summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2021-01-26 22:32:00 +0100
committerLee Jones <lee.jones@linaro.org>2021-02-09 14:09:21 +0000
commit57e0d7b7f8663d0a3a5facc83c445ffc9802ad65 (patch)
tree37ede321cad8c626960dacfee1c0598923c4dcf2 /drivers/video
parent4a98e5ef88f8a7a9fd42e71b018d3070662f8a2a (diff)
backlight: ktd253: Bring up in a known state
The KTD253 backlight might already be on when the driver is probed: then we don't really know what the current ratio is and all light intensity settings will be off relative to what it was at boot. To fix this, bring up the backlight OFF then move it to the default backlight from there so we know the state. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/ktd253-backlight.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/video/backlight/ktd253-backlight.c b/drivers/video/backlight/ktd253-backlight.c
index e3fee3f1f582..d7b287cffd5c 100644
--- a/drivers/video/backlight/ktd253-backlight.c
+++ b/drivers/video/backlight/ktd253-backlight.c
@@ -137,15 +137,7 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
brightness = max_brightness;
}
- if (brightness)
- /* This will be the default ratio when the KTD253 is enabled */
- ktd253->ratio = KTD253_MAX_RATIO;
- else
- ktd253->ratio = 0;
-
- ktd253->gpiod = devm_gpiod_get(dev, "enable",
- brightness ? GPIOD_OUT_HIGH :
- GPIOD_OUT_LOW);
+ ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
if (IS_ERR(ktd253->gpiod)) {
ret = PTR_ERR(ktd253->gpiod);
if (ret != -EPROBE_DEFER)
@@ -153,6 +145,8 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
return ret;
}
gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev));
+ /* Bring backlight to a known off state */
+ msleep(KTD253_T_OFF_MS);
bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253,
&ktd253_backlight_ops, NULL);