Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Linus Walleij and committed by
Lee Jones
57e0d7b7 4a98e5ef

+3 -9
+3 -9
drivers/video/backlight/ktd253-backlight.c
··· 137 137 brightness = max_brightness; 138 138 } 139 139 140 - if (brightness) 141 - /* This will be the default ratio when the KTD253 is enabled */ 142 - ktd253->ratio = KTD253_MAX_RATIO; 143 - else 144 - ktd253->ratio = 0; 145 - 146 - ktd253->gpiod = devm_gpiod_get(dev, "enable", 147 - brightness ? GPIOD_OUT_HIGH : 148 - GPIOD_OUT_LOW); 140 + ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); 149 141 if (IS_ERR(ktd253->gpiod)) { 150 142 ret = PTR_ERR(ktd253->gpiod); 151 143 if (ret != -EPROBE_DEFER) ··· 145 153 return ret; 146 154 } 147 155 gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev)); 156 + /* Bring backlight to a known off state */ 157 + msleep(KTD253_T_OFF_MS); 148 158 149 159 bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253, 150 160 &ktd253_backlight_ops, NULL);