mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: fenglin.wu@oss.qualcomm.com, kernel@oss.qualcomm.com,
	Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>
Cc: Subbaraman Narayanamurthy
	<subbaraman.narayanamurthy@oss.qualcomm.com>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] leds: flash: leds-qcom-flash: update torch current clamp setting
Date: Tue, 29 Jul 2025 13:01:31 +0200	[thread overview]
Message-ID: <f3c004a9-dba9-48b5-9930-979053d0a32c@oss.qualcomm.com> (raw)
In-Reply-To: <20250729-fix-torch-clamp-issue-v2-1-9b83816437a3@oss.qualcomm.com>

On 7/29/25 6:51 AM, Fenglin Wu via B4 Relay wrote:
> From: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
> 
> There is a register to clamp the flash current per LED channel when
> safety timer is disabled. It needs to be updated according to the
> maximum torch LED current setting to ensure the torch current won't
> be clamped unexpectedly.
> 
> Fixes: 96a2e242a5dc ("leds: flash: Add driver to support flash LED module in QCOM PMICs")
> Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
> ---

I'd prefer the regfield change was done in a separate commit,
but it's not groundbreaking so I don't mind that much

[...]

>  struct qcom_flash_led {
> @@ -702,6 +706,7 @@ static int qcom_flash_register_led_device(struct device *dev,
>  	u32 current_ua, timeout_us;
>  	u32 channels[4];
>  	int i, rc, count;
> +	u8 torch_clamp;
>  
>  	count = fwnode_property_count_u32(node, "led-sources");
>  	if (count <= 0) {
> @@ -751,6 +756,12 @@ static int qcom_flash_register_led_device(struct device *dev,
>  	current_ua = min_t(u32, current_ua, TORCH_CURRENT_MAX_UA * led->chan_count);
>  	led->max_torch_current_ma = current_ua / UA_PER_MA;
>  
> +	torch_clamp = (current_ua / led->chan_count) / TORCH_IRES_UA;
> +	if (torch_clamp != 0)
> +		torch_clamp--;
> +
> +	flash_data->torch_clamp = max_t(u8, flash_data->torch_clamp, torch_clamp);

Please confirm if I understand correctly, we may have N flash LEDs 
connected, and this additional safety hardware can only compare any
individual LED's current draw against a single maximum value, which
we're setting here

Konrad

  reply	other threads:[~2025-07-29 11:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29  4:51 [PATCH v2 0/2] " Fenglin Wu via B4 Relay
2025-07-29  4:51 ` [PATCH v2 1/2] " Fenglin Wu via B4 Relay
2025-07-29 11:01   ` Konrad Dybcio [this message]
2025-07-31  1:43     ` Fenglin Wu
2025-07-31  9:33       ` Konrad Dybcio
2025-07-29  4:51 ` [PATCH v2 2/2] leds: flash: leds-qcom-flash: add a separate register map for PMI8998 Fenglin Wu via B4 Relay
2025-07-29 11:01   ` Konrad Dybcio
2025-07-31 13:53 ` [PATCH v2 0/2] leds: flash: leds-qcom-flash: update torch current clamp setting 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=f3c004a9-dba9-48b5-9930-979053d0a32c@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=fenglin.wu@oss.qualcomm.com \
    --cc=kernel@oss.qualcomm.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=subbaraman.narayanamurthy@oss.qualcomm.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®