armbian_build/patch/kernel/archive/sunxi-6.2/patches.megous/leds-sgm3140-Add-missing-timer-cleanup-and-flash-gpio-control.patch
The-going 77674a2b76
Sunxi 6.2 (#4883)
* sunxi-6.2: add megous patches

* sunxi-6.2: add series.conf

* sunxi-6.2: add armbian patches

* sunxi-6.2: mfd: sunxi-ac200: fix error initialization

* sunxi-6.2: Extract patches again after rebasing

---------

Co-authored-by: Igor Pečovnik <igor@armbian.com>
2023-03-03 19:09:22 +01:00

34 lines
1.1 KiB
Diff

From ae32395dbd768f87d7417532f93ea89c20f69920 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Fri, 27 May 2022 03:10:07 +0200
Subject: [PATCH 353/391] 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 d3a30ad94..dd5d327c5 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.35.3