[PATCH v3 2/2] backlight: pwm_bl: Check the pwm state for initial backlight power state

From: Peter Ujfalusi
Date: Tue Nov 01 2016 - 09:00:43 EST


If the pwm is not enabled the backlight initially should not be enabled
either if we have booted with DT and there is a phandle pointing to the
backlight node.

The patch extends the checks to decide if we should keep the backlight off
initially.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
---
drivers/video/backlight/pwm_bl.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 4b07da278b4f..f680f7b033b2 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -215,6 +215,10 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)
if (!regulator_is_enabled(pb->power_supply))
return FB_BLANK_POWERDOWN;

+ /* The pwm is disabled, keep it like this */
+ if (!pwm_is_enabled(pb->pwm))
+ return FB_BLANK_POWERDOWN;
+
return FB_BLANK_UNBLANK;
}

--
2.10.2