Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	mfd@lists.linux.dev, robh@kernel.org, conor+dt@kernel.org,
	lee@kernel.org
Subject: Re: [PATCH v2 1/8] backlight: qcom-wled: fix string detection brightness on WLED5
Date: Mon, 19 Oct 2026 11:32:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-177041@kernel.org> (raw)
In-Reply-To: <20261019-sm8150-display-card-v2-1-86c05068efc5@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] backlight: qcom-wled: wled5_set_brightness() clamps 0 to low_limit on restore
--

commit 1866e6688066844d34f7f3f1d2a0c521bb917107
Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

backlight: qcom-wled: fix string detection brightness on WLED5

This commit updates wled_auto_string_detection() to use the per-version
wled_set_brightness() callback instead of hardcoding wled4_set_brightness(),
and moves the WLED5 module sync toggle into wled5_set_brightness().

> diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
> index ca350f320e177..c5243a6d547e5 100644
> --- a/drivers/video/backlight/qcom-wled.c
> +++ b/drivers/video/backlight/qcom-wled.c

[ ... ]

> @@ -791,7 +783,7 @@ static void wled_auto_string_detection(struct wled *wled)
>  	}
>  
>  	/* Restore brightness */
> -	rc = wled4_set_brightness(wled, wled->brightness);
> +	rc = wled->wled_set_brightness(wled, wled->brightness);
>  	if (rc < 0) {
>  		dev_err(wled->dev, "Failed to set brightness after auto detection rc=%d\n",
>  			rc);

[Severity: Medium]
When wled_auto_string_detection() runs during probe via
wled_probe() -> wled5_setup() -> wled_auto_detection_at_init(),
wled_read_brightness() has not run yet, so wled->brightness is still 0.

Previously, wled4_set_brightness() only clamped non-zero brightness values:

	/* WLED4's lower limit of operation is 0.4% */
	if (brightness > 0 && brightness < low_limit)
		brightness = low_limit;

However, wled5_set_brightness() unconditionally clamps brightness == 0 up to
low_limit (0.1% of max_brightness):

	/* WLED5's lower limit is 0.1% */
	if (brightness < low_limit)
		brightness = low_limit;

With this change, restoring wled->brightness (0) at the end of
wled_auto_string_detection() on WLED5 writes and latches low_limit into the
modulator brightness register before enabling WLED3_CTRL_REG_MOD_EN.

When wled_probe() subsequently calls wled_read_brightness():

	rc = wled_read_brightness(wled);
	if (rc < 0)
		return rc;

	wled->brightness = rc;
	...
	props.brightness = wled->brightness ?: val;

will it read back low_limit instead of 0, leaving ovp_irq enabled in
wled_configure_ovp_irq() and initializing props.brightness to low_limit
instead of default-brightness?

Should wled5_set_brightness() check brightness > 0 && brightness < low_limit
like wled4_set_brightness() does?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019-sm8150-display-card-v2-0-86c05068efc5@oss.qualcomm.com?part=1

  reply	other threads:[~2026-10-19 11:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 11:25 [PATCH v2 0/8] arm64: qcom: enable display card support on SM8150 HDK Dmitry Baryshkov
2026-10-19 11:25 ` [PATCH v2 1/8] backlight: qcom-wled: fix string detection brightness on WLED5 Dmitry Baryshkov
2026-10-19 11:32   ` sashiko-bot [this message]
2026-10-19 11:25 ` [PATCH v2 2/8] regulator: dt-bindings: add Qualcomm LCDB regulator Dmitry Baryshkov
2026-10-19 11:25 ` [PATCH v2 3/8] dt-bindings: mfd: qcom,spmi-pmic: add LCDB Dmitry Baryshkov
2026-10-20  7:57   ` Krzysztof Kozlowski
2026-10-19 11:25 ` [PATCH v2 4/8] regulator: add Qualcomm LCDB driver Dmitry Baryshkov
2026-10-19 11:39   ` sashiko-bot
2026-10-19 11:59   ` Konrad Dybcio
2026-10-19 11:25 ` [PATCH v2 5/8] arm64: dts: qcom: pm8150l: add LCDB regulators Dmitry Baryshkov
2026-10-19 11:47   ` Abel Vesa
2026-10-19 11:48   ` Konrad Dybcio
2026-10-19 11:25 ` [PATCH v2 6/8] arm64: dts: qcom: sm8150: add MDSS reset Dmitry Baryshkov
2026-10-19 11:46   ` Abel Vesa
2026-10-19 11:25 ` [PATCH v2 7/8] arm64: dts: qcom: sm8150-hdk: fix FSA4480 address Dmitry Baryshkov
2026-10-19 11:46   ` Abel Vesa
2026-10-19 11:25 ` [PATCH v2 8/8] arm64: dts: qcom: sm8150-hdk: add display card overlay Dmitry Baryshkov
2026-10-19 11:47   ` Konrad Dybcio
2026-10-19 11:47   ` Abel Vesa
2026-10-19 11:32 ` [PATCH v2 0/8] arm64: qcom: enable display card support on SM8150 HDK Konrad Dybcio

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=sashiko-outbox-177041@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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