leds: flash: leds-qcom-flash: Turn off LED before setting flash current
authorFenglin Wu <quic_fenglinw@quicinc.com>
Tue, 25 Jul 2023 09:57:20 +0000 (17:57 +0800)
committerLee Jones <lee@kernel.org>
Fri, 28 Jul 2023 11:17:32 +0000 (12:17 +0100)
Strobe off the LED before setting flash current to avoid it's being
enabled with an incorrect current if it has been working in torch
mode.

Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
Link: https://lore.kernel.org/r/20230725-leds-qcom-flash-driver-tiny-fixes-v2-2-0f5cbce5fed0@quicinc.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/flash/leds-qcom-flash.c

index b089ca1..29cf094 100644 (file)
@@ -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;