Skip to content

Commit 57e0d7b

Browse files
Linus WalleijLee Jones
authored andcommitted
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>
1 parent 4a98e5e commit 57e0d7b

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

drivers/video/backlight/ktd253-backlight.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,16 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
137137
brightness = max_brightness;
138138
}
139139

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);
149141
if (IS_ERR(ktd253->gpiod)) {
150142
ret = PTR_ERR(ktd253->gpiod);
151143
if (ret != -EPROBE_DEFER)
152144
dev_err(dev, "gpio line missing or invalid.\n");
153145
return ret;
154146
}
155147
gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev));
148+
/* Bring backlight to a known off state */
149+
msleep(KTD253_T_OFF_MS);
156150

157151
bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253,
158152
&ktd253_backlight_ops, NULL);

0 commit comments

Comments
 (0)