build/patch/kernel/archive/sunxi-6.4/patches.megous/leds-sgm3140-Add-missing-timer-cleanup-and-flash-gpio-control.patch

34 lines
1.1 KiB
Diff
Raw Permalink Normal View History

From 55aec698dd528967601d7dbab273e21741aac8a2 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Fri, 27 May 2022 03:10:07 +0200
Subject: [PATCH 371/469] leds: sgm3140: Add missing timer cleanup and flash
gpio control
strobe = 1 + brightness = 0 before the timeout may mess up the
driver state.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/leds/flash/leds-sgm3140.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/leds/flash/leds-sgm3140.c b/drivers/leds/flash/leds-sgm3140.c
index d3a30ad94ac4..dd5d327c52a1 100644
--- a/drivers/leds/flash/leds-sgm3140.c
+++ b/drivers/leds/flash/leds-sgm3140.c
@@ -114,8 +114,11 @@ static int sgm3140_brightness_set(struct led_classdev *led_cdev,
"failed to enable regulator: %d\n", ret);
return ret;
}
+ gpiod_set_value_cansleep(priv->flash_gpio, 0);
gpiod_set_value_cansleep(priv->enable_gpio, 1);
} else {
+ del_timer_sync(&priv->powerdown_timer);
+ gpiod_set_value_cansleep(priv->flash_gpio, 0);
gpiod_set_value_cansleep(priv->enable_gpio, 0);
ret = regulator_disable(priv->vin_regulator);
if (ret) {
--
2.34.1