mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dylan Van Assche <me@dylanvanassche.be>
To: pavel@ucw.cz, quic_fenglinw@quicinc.com, lee@kernel.org
Cc: trix@redhat.com, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org,
	Dylan Van Assche <me@dylanvanassche.be>
Subject: [PATCH 2/2] leds: flash: leds-qcom-flash: disable LED when changing brightness
Date: Sun,  7 May 2023 19:29:41 +0200	[thread overview]
Message-ID: <20230507172941.364852-3-me@dylanvanassche.be> (raw)
In-Reply-To: <20230507172941.364852-1-me@dylanvanassche.be>

The Qualcomm PMI8998 PMIC requires the LED to be disabled when configuring
the brightness. Always disable the LED when setting the brightness and
re-enable it afterwards.

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
---
 drivers/leds/flash/leds-qcom-flash.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c
index 16045b5d89b1..c8d41a3caf38 100644
--- a/drivers/leds/flash/leds-qcom-flash.c
+++ b/drivers/leds/flash/leds-qcom-flash.c
@@ -417,6 +417,14 @@ static int qcom_flash_led_brightness_set(struct led_classdev *led_cdev,
 	bool enable = !!brightness;
 	int rc;
 
+	rc = set_flash_strobe(led, SW_STROBE, false);
+	if (rc)
+		return rc;
+
+	rc = set_flash_module_en(led, false);
+	if (rc)
+		return rc;
+
 	rc = set_flash_current(led, current_ma, TORCH_MODE);
 	if (rc)
 		return rc;
-- 
2.40.1


  parent reply	other threads:[~2023-05-07 17:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-07 17:29 [PATCH 0/2] leds: flash: leds-qcom-flash: add PMI8998 support Dylan Van Assche
2023-05-07 17:29 ` [PATCH 1/2] " Dylan Van Assche
2023-05-15 16:18   ` Lee Jones
2023-05-07 17:29 ` Dylan Van Assche [this message]
2023-05-15 16:19   ` [PATCH 2/2] leds: flash: leds-qcom-flash: disable LED when changing brightness Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230507172941.364852-3-me@dylanvanassche.be \
    --to=me@dylanvanassche.be \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=phone-devel@vger.kernel.org \
    --cc=quic_fenglinw@quicinc.com \
    --cc=trix@redhat.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®