mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Heidelberg <david@ixit.cz>
To: "Konrad Dybcio" <konrad.dybcio@oss.qualcomm.com>,
	"Lee Jones" <lee@kernel.org>,
	"Daniel Thompson" <danielt@kernel.org>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Helge Deller" <deller@gmx.de>,
	"Kiran Gunda" <quic_kgunda@quicinc.com>,
	"Marco Mattiolo" <marco.mattiolo@hotmail.it>,
	"Barnabás Czémán" <barnabas.czeman@mainlining.org>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	phone-devel@vger.kernel.org,
	Joel Selvaraj <foss@joelselvaraj.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v4 2/4] backlight: qcom-wled: Fix WLED3 brightness register stride
Date: Mon, 21 Sep 2026 13:11:18 +0200	[thread overview]
Message-ID: <426b6aeb-578f-43ee-865d-30e69b7bb2f2@ixit.cz> (raw)
In-Reply-To: <22355625-a2ea-4b6e-99b3-65cf93ac8034@oss.qualcomm.com>

On 21/09/2026 13:08, Konrad Dybcio wrote:
> On 9/21/26 12:46 PM, David Heidelberg via B4 Relay wrote:
>> From: David Heidelberg <david@ixit.cz>
>>
>> WLED3 has a 16-bit brightness register pair per string, at 0x40 + 2*n,
>> which is what the pm8941-wled driver wrote to:
>>
>> 	rc = regmap_bulk_write(wled->regmap,
>> 			wled->addr + WLED3_CTRL_REG_VAL_BASE + 2 * i,
>> 			v, 2);
>>
>> The restructuring for WLED3 turned that into WLED3_SINK_REG_BRIGHT(n),
>> defined as 0x40 + n, so the two byte writes for consecutive strings
>> overlap: string 1 overwrites the MSB of string 0 with its own LSB, and
>> with the default three strings only string 1 ends up with the requested
>> value.
>>
>> Use the 2 byte stride.
>>
>> Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
>> Cc: stable@vger.kernel.org
>> Assisted-by: LLM
>> Signed-off-by: David Heidelberg <david@ixit.cz>
>> ---
>>   drivers/video/backlight/qcom-wled.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
>> index 2281007bdd459..f452d328997ad 100644
>> --- a/drivers/video/backlight/qcom-wled.c
>> +++ b/drivers/video/backlight/qcom-wled.c
>> @@ -54,17 +54,17 @@
>>   #define WLED3_SINK_REG_SYNC				0x47
>>   #define  WLED3_SINK_REG_SYNC_CLEAR			0x00
>>   
>>   #define WLED3_SINK_REG_CURR_SINK			0x4f
>>   #define  WLED3_SINK_REG_CURR_SINK_MASK			GENMASK(7, 5)
>>   #define  WLED3_SINK_REG_CURR_SINK_SHFT			5
>>   
>>   /* WLED3 specific per-'string' registers below */
>> -#define WLED3_SINK_REG_BRIGHT(n)			(0x40 + n)
>> +#define WLED3_SINK_REG_BRIGHT(n)			(0x40 + (n * 0x2))
> 
> Ideally n would be wrapped in its own parentheses (doesn't
> checkpatch warn against that?)

Yeah it does, thou not sure it make sense here.
If needed, I'll send another version with it... :)

Thanks
David

> 
> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> 
> Konrad


  reply	other threads:[~2026-09-21 11:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 10:46 [PATCH v4 0/4] backlight: qcom-wled: Fix OVP IRQ imbalance and start from the hardware state David Heidelberg via B4 Relay
2026-09-21 10:46 ` [PATCH v4 1/4] backlight: qcom-wled: Fix NULL pointer dereference in wled_remove() David Heidelberg via B4 Relay
2026-09-21 11:06   ` Konrad Dybcio
2026-09-21 10:46 ` [PATCH v4 2/4] backlight: qcom-wled: Fix WLED3 brightness register stride David Heidelberg via B4 Relay
2026-09-21 11:08   ` Konrad Dybcio
2026-09-21 11:11     ` David Heidelberg [this message]
2026-09-21 10:46 ` [PATCH v4 3/4] backlight: qcom-wled: Fix unbalanced OVP IRQ enable at probe David Heidelberg via B4 Relay
2026-09-21 10:46 ` [PATCH v4 4/4] backlight: qcom-wled: Read back the programmed brightness " David Heidelberg via B4 Relay

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=426b6aeb-578f-43ee-865d-30e69b7bb2f2@ixit.cz \
    --to=david@ixit.cz \
    --cc=barnabas.czeman@mainlining.org \
    --cc=danielt@kernel.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=foss@joelselvaraj.com \
    --cc=jingoohan1@gmail.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=lee@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco.mattiolo@hotmail.it \
    --cc=phone-devel@vger.kernel.org \
    --cc=quic_kgunda@quicinc.com \
    --cc=stable@vger.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®