Skip to content

Commit 205c298

Browse files
Ondrej Jirmanlag-linaro
authored andcommitted
leds: sgm3140: Add missing timer cleanup and flash gpio control
Enabling strobe and then setting brightness to 0 causes the driver to enter invalid state after strobe end timer fires. We should cancel strobe mode resources when changing brightness (aka torch mode). Fixes: cef8ec8 ("leds: add sgm3140 driver") Signed-off-by: Ondrej Jirman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 2cd0d1d commit 205c298

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/leds/flash/leds-sgm3140.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ static int sgm3140_brightness_set(struct led_classdev *led_cdev,
114114
"failed to enable regulator: %d\n", ret);
115115
return ret;
116116
}
117+
gpiod_set_value_cansleep(priv->flash_gpio, 0);
117118
gpiod_set_value_cansleep(priv->enable_gpio, 1);
118119
} else {
120+
del_timer_sync(&priv->powerdown_timer);
121+
gpiod_set_value_cansleep(priv->flash_gpio, 0);
119122
gpiod_set_value_cansleep(priv->enable_gpio, 0);
120123
ret = regulator_disable(priv->vin_regulator);
121124
if (ret) {

0 commit comments

Comments
 (0)