From: Matthias Fend <matthias.fend@emfend.at>
To: jiegu <jie.gu@leica-geosystems.com>, Lee Jones <lee@kernel.org>,
Pavel Machek <pavel@kernel.org>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
gujie <jie.gu@leica-geosystems.com.cn>
Subject: Re: [PATCH 2/2] leds: tps6131x: clear torch brightness cache on flash takeover
Date: Thu, 19 Nov 2026 09:10:25 +0100 [thread overview]
Message-ID: <bd02afca-4136-4639-b6c3-40765cdada73@emfend.at> (raw)
In-Reply-To: <20261117064328.4096518-3-jie.gu@leica-geosystems.com>
Hi Jie,
Am 17.11.2026 um 07:43 schrieb jiegu:
> From: gujie <jie.gu@leica-geosystems.com.cn>
>
> When the device switches from torch mode to flash or external strobe
> mode, the hardware torch output is disabled, but the LED class
> brightness cache may still keep the previous non-zero torch value.
>
> This leaves sysfs brightness reporting an enabled torch state even
> though the light is already off.
>
> Update the cached LED brightness to LED_OFF when flash control takes
> over so userspace state matches the actual hardware state.
>
> Signed-off-by: gujie <jie.gu@leica-geosystems.com.cn>
> ---
> drivers/leds/flash/leds-tps6131x.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/flash/leds-tps6131x.c b/drivers/leds/flash/leds-tps6131x.c
> index 823e0462939c..4f708cf56178 100644
> --- a/drivers/leds/flash/leds-tps6131x.c
> +++ b/drivers/leds/flash/leds-tps6131x.c
> @@ -294,6 +294,11 @@ static int tps6131x_set_mode(struct tps6131x *tps6131x, enum tps6131x_mode mode,
> NULL, false, force);
> }
>
> +static void tps6131x_sync_torch_brightness_off(struct tps6131x *tps6131x)
> +{
> + tps6131x->fled_cdev.led_cdev.brightness = LED_OFF;
> +}
Nit: I don't think that we need a helper for this one-liner. But also
okay for me.
Tested with i.MX8MP-EVK and TPS61310EVM.
Reviewed-by: Matthias Fend <matthias.fend@emfend.at>
Tested-by: Matthias Fend <matthias.fend@emfend.at>
Best regards
~Matthias
next prev parent reply other threads:[~2026-11-19 8:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 6:43 [PATCH 0/2] leds: tps6131x: Fix torch-to-flash transitions jiegu
2026-11-17 6:43 ` [PATCH 1/2] leds: tps6131x: cancel torch refresh on flash mode switch jiegu
2026-11-19 8:10 ` Matthias Fend
2026-11-17 6:43 ` [PATCH 2/2] leds: tps6131x: clear torch brightness cache on flash takeover jiegu
2026-11-19 8:10 ` Matthias Fend [this message]
2026-11-19 9:10 ` 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=bd02afca-4136-4639-b6c3-40765cdada73@emfend.at \
--to=matthias.fend@emfend.at \
--cc=jie.gu@leica-geosystems.com \
--cc=jie.gu@leica-geosystems.com.cn \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
/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®