Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH v1] led: flash: various minor fixes for leds-qcom-flash driver
@ 2023-07-18  9:24 Fenglin Wu
  2023-07-18  9:32 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 5+ messages in thread
From: Fenglin Wu @ 2023-07-18  9:24 UTC (permalink / raw)
  To: linux-arm-msm, linux-kernel, lee, pavel, krzysztof.kozlowski,
	Fenglin Wu, ChiaEn Wu, Alice Chen, ChiYuan Huang,
	Dylan Van Assche, Jiapeng Chong, Tom Rix, linux-leds
  Cc: quic_collinsd, quic_subbaram

Update the driver to address following minor issues:
 - Add a sentence in Kconfig to explain the driver can be compiled
   as a module
 - strobe off the LED channel before setting flash current to prevent
   the flash LED being lit with an incorrect brightness if it was
   already active in torch mode
 - put the child node if register any flash LED device failed.

Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
---
 drivers/leds/flash/Kconfig           | 2 ++
 drivers/leds/flash/leds-qcom-flash.c | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/leds/flash/Kconfig b/drivers/leds/flash/Kconfig
index 4ed2efc65434..4e08dbc05709 100644
--- a/drivers/leds/flash/Kconfig
+++ b/drivers/leds/flash/Kconfig
@@ -89,6 +89,8 @@ config LEDS_QCOM_FLASH
 	  the total LED current will be split symmetrically on each channel and
 	  they will be enabled/disabled at the same time.
 
+	  This driver can be built as a module, it will be called "leds-qcom-flash".
+
 config LEDS_RT4505
 	tristate "LED support for RT4505 flashlight controller"
 	depends on I2C && OF
diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c
index b089ca1a1901..a73d3ea5c97a 100644
--- a/drivers/leds/flash/leds-qcom-flash.c
+++ b/drivers/leds/flash/leds-qcom-flash.c
@@ -309,6 +309,10 @@ static int qcom_flash_strobe_set(struct led_classdev_flash *fled_cdev, bool stat
 	struct qcom_flash_led *led = flcdev_to_qcom_fled(fled_cdev);
 	int rc;
 
+	rc = set_flash_strobe(led, SW_STROBE, false);
+	if (rc)
+		return rc;
+
 	rc = set_flash_current(led, led->flash_current_ma, FLASH_MODE);
 	if (rc)
 		return rc;
@@ -745,6 +749,7 @@ static int qcom_flash_led_probe(struct platform_device *pdev)
 	return 0;
 
 release:
+	fwnode_handle_put(child);
 	while (flash_data->v4l2_flash[flash_data->leds_count] && flash_data->leds_count)
 		v4l2_flash_release(flash_data->v4l2_flash[flash_data->leds_count--]);
 	return rc;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-19  8:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-18  9:24 [PATCH v1] led: flash: various minor fixes for leds-qcom-flash driver Fenglin Wu
2023-07-18  9:32 ` Krzysztof Kozlowski
2023-07-18  9:52   ` Fenglin Wu
2023-07-19  8:50     ` Lee Jones
2023-07-19  8:52       ` Fenglin Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox