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

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: cef8ec8cbd21 ("leds: add sgm3140 driver")
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Link: https://lore.kernel.org/r/20240217191133.1757553-1-megi@xff.cz
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Ondrej Jirman and committed by
Lee Jones
205c2988 2cd0d1db

+3
+3
drivers/leds/flash/leds-sgm3140.c
··· 114 114 "failed to enable regulator: %d\n", ret); 115 115 return ret; 116 116 } 117 + gpiod_set_value_cansleep(priv->flash_gpio, 0); 117 118 gpiod_set_value_cansleep(priv->enable_gpio, 1); 118 119 } else { 120 + del_timer_sync(&priv->powerdown_timer); 121 + gpiod_set_value_cansleep(priv->flash_gpio, 0); 119 122 gpiod_set_value_cansleep(priv->enable_gpio, 0); 120 123 ret = regulator_disable(priv->vin_regulator); 121 124 if (ret) {