From: Lee Jones <lee@kernel.org>
To: Ruslan Koreev <koreev.r@gmail.com>
Cc: pavel@kernel.org, rillian.grant@gmail.com,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] leds: flash: lm3643: Return to standby when the last output is switched off
Date: Wed, 14 Oct 2026 16:21:51 +0100 [thread overview]
Message-ID: <179198511712.839288.17752967041610699661@kernel.org> (raw)
In-Reply-To: <20260924172040.1185688-2-koreev.r@gmail.com>
--- checkpatch.pl: clean (0 issues) ---
On Thu, 24 Sep 2026, Ruslan Koreev wrote:
> Setting the torch brightness of an output to 0 only cleared its enable
> bit and left the mode bits at torch (or flash), so the chip kept its
> boost converter running with no output enabled. Likewise switching the
> strobe off returned early when the output's enable bit had already been
> cleared, leaving the mode bits at flash. Both were flagged by the
> Sashiko review of the RFC, which Lee Jones asked to have addressed.
>
> Clear the mode bits together with the enable bit whenever the sibling
> output is not active, so that the chip goes back to standby when its
> last output is switched off.
>
> Signed-off-by: Ruslan Koreev <koreev.r@gmail.com>
Given that the base series hasn't been merged yet, please coordinate with
Rillian to fold these fixes directly into the next version of the original
series rather than sending fix-up patches on top of an unapplied RFC.
> ---
> drivers/leds/flash/leds-lm3643.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/leds/flash/leds-lm3643.c b/drivers/leds/flash/leds-lm3643.c
> index 48e164261..bbe9358c9 100644
> --- a/drivers/leds/flash/leds-lm3643.c
> +++ b/drivers/leds/flash/leds-lm3643.c
> @@ -271,9 +271,15 @@ static int lm3643_torch_set_brightness(struct led_classdev *led_cdev,
> mode != LM3643_MODE_TORCH)
> return -EBUSY;
>
> - if (brightness == 0)
> - return regmap_update_bits(led->regmap, LM3643_REG_ENABLE,
> - chan->enable_bit, 0);
> + if (brightness == 0) {
> + unsigned int mask = chan->enable_bit;
> +
> + /* Last active output: leave torch mode, back to standby */
> + if (!(enable & sibling_bit))
> + mask |= LM3643_MODE_MASK;
> +
> + return regmap_update_bits(led->regmap, LM3643_REG_ENABLE, mask, 0);
> + }
>
> ret = regmap_update_bits(led->regmap, chan->torch_br_reg, LM3643_TORCH_BR_MASK,
> LM3643_TORCH_BR_CDEV_TO_CODE(brightness));
> @@ -365,11 +371,16 @@ static int lm3643_flash_strobe_set(struct led_classdev_flash *fled_cdev, bool st
> mode = enable_reg & LM3643_MODE_MASK;
>
> if (!state) {
> - if (mode != LM3643_MODE_FLASH || !(enable_reg & chan->enable_bit))
> + unsigned int mask = chan->enable_bit;
> +
> + if (mode != LM3643_MODE_FLASH)
> return 0;
>
> - return regmap_update_bits(led->regmap, LM3643_REG_ENABLE,
> - LM3643_MODE_MASK, LM3643_MODE_STANDBY);
> + /* Leave flash mode once no other output is strobing */
> + if (!(enable_reg & sibling_bit))
> + mask |= LM3643_MODE_MASK;
> +
> + return regmap_update_bits(led->regmap, LM3643_REG_ENABLE, mask, 0);
> }
> if ((enable_reg & sibling_bit) && mode != LM3643_MODE_STANDBY)
> return -EBUSY;
> --
> 2.55.0
>
--
Lee Jones
next prev parent reply other threads:[~2026-10-14 15:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260821083620.68324-1-rillian.grant@gmail.com>
2026-08-21 8:36 ` [RFC PATCH 1/2] dt-bindings: leds: Document TI LM3643 dual LED flash driver Rillian Grant
2026-08-21 8:36 ` [RFC PATCH 2/2] leds: flash: Add support for the " Rillian Grant
2026-09-24 17:20 ` [PATCH 0/2] leds: flash: lm3643: standby fix and ACPI LED description Ruslan Koreev
2026-09-24 17:20 ` [PATCH 1/2] leds: flash: lm3643: Return to standby when the last output is switched off Ruslan Koreev
2026-10-14 15:21 ` Lee Jones [this message]
2026-09-24 17:20 ` [PATCH 2/2] leds: flash: lm3643: Describe the LED of ACPI boards without LED nodes Ruslan Koreev
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=179198511712.839288.17752967041610699661@kernel.org \
--to=lee@kernel.org \
--cc=koreev.r@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rillian.grant@gmail.com \
/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®