Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Manuel Fombuena" <fombuena@outlook.com>
Cc: linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH v1 02/11] leds: st1202: Spell out the phase-shift configuration bit
Date: Sat, 12 Sep 2026 22:50:30 +0000	[thread overview]
Message-ID: <20260912225030.E2BBD1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <GV1PR08MB8497C0EF1F3979EEC073AAAEC5BD2@GV1PR08MB8497.eurprd08.prod.outlook.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Blinking an LED destructively zeroes out the PWM values for all other channels, permanently breaking steady-ON LEDs.
- [High] Hardware state clobbering: per-LED pattern operations corrupt global sequencer configuration and step durations.
--

commit 2c776e6568e7de2682a8142a57768cace68e6086
Author: Manuel Fombuena <fombuena@outlook.com>

leds: st1202: Spell out the phase-shift configuration bit

This commit renames ST1202_CONFIG_REG_SHFT to ST1202_CONFIG_REG_PHASE_SHIFT
to improve readability and properly document the phase-shift delay feature.
It also adjusts line wrapping in the register writes to adhere to column
limits without introducing functional changes.

> diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c
> index 5a2202fb4c223..d8a04e96fb46c 100644
> --- a/drivers/leds/leds-st1202.c
> +++ b/drivers/leds/leds-st1202.c
[ ... ]
> @@ -210,7 +211,7 @@ static int st1202_led_pattern_clear(struct led_classdev *ldev)
>  
>  	guard(mutex)(&chip->lock);
>  
> -	ret = st1202_write_reg(chip, ST1202_CONFIG_REG, ST1202_CONFIG_REG_SHFT);
> +	ret = st1202_write_reg(chip, ST1202_CONFIG_REG, ST1202_CONFIG_REG_PHASE_SHIFT);

[Severity: High]
This is a pre-existing issue, but by writing only the phase-shift bit to the
global ST1202_CONFIG_REG, doesn't this unconditionally clear the PATS and
PATSR bits? 

Since the ST1202 chip appears to use a single global sequencer, clearing
these bits would instantly halt the sequencer for all other active LEDs on
the chip. Additionally, when setting patterns in st1202_led_pattern_set(),
the shared global ST1202_PATTERN_DUR step durations are unconditionally
overwritten. 

Does the driver need a way to coordinate or reject conflicting requests for
the global sequencer instead of silently clobbering the state of other LEDs?

[ ... ]
> @@ -299,7 +301,7 @@ static int st1202_blink_set(struct led_classdev *led_cdev,
>  
>  	guard(mutex)(&chip->lock);
>  
> -	ret = st1202_write_reg(chip, ST1202_CONFIG_REG, ST1202_CONFIG_REG_SHFT);
> +	ret = st1202_write_reg(chip, ST1202_CONFIG_REG, ST1202_CONFIG_REG_PHASE_SHIFT);

[Severity: High]
This isn't a bug introduced by this patch, but does st1202_blink_set()
inadvertently break steady-ON LEDs? 

When a given LED starts blinking, the function iterates over all other active
channels and unconditionally zero-fills their PWM slots to prevent them from
blinking:

st1202_pwm_pattern_write(chip, chan, 0, LED_OFF);
st1202_pwm_pattern_write(chip, chan, 1, LED_OFF);

If those other channels were previously configured to be steady ON, this zero
fill causes them to turn completely off during patterns 0 and 1. When the
blinking LED is later disabled, the original full PWM slots for the other
channels are never restored, which seems to leave them permanently disabled.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/GV1PR08MB8497422B7A44424C4968AEC1C5BD2@GV1PR08MB8497.eurprd08.prod.outlook.com?part=2

  reply	other threads:[~2026-09-12 22:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 22:27 [PATCH v1 00/11] leds: st1202: Naming cleanups and pre-existing fixes Manuel Fombuena
2026-09-12 22:29 ` [PATCH v1 01/11] leds: st1202: Correct the name of the prescaler conversion helper Manuel Fombuena
2026-09-12 22:51   ` sashiko-bot
2026-09-12 22:30 ` [PATCH v1 02/11] leds: st1202: Spell out the phase-shift configuration bit Manuel Fombuena
2026-09-12 22:50   ` sashiko-bot [this message]
2026-09-12 22:31 ` [PATCH v1 03/11] leds: st1202: Name pattern index variables consistently Manuel Fombuena
2026-09-12 22:51   ` sashiko-bot
2026-09-12 22:32 ` [PATCH v1 04/11] leds: st1202: Use u8 consistently for 8-bit values Manuel Fombuena
2026-09-12 22:46   ` sashiko-bot
2026-09-12 22:34 ` [PATCH v1 05/11] leds: st1202: Clear unused pattern slots in pattern_set() Manuel Fombuena
2026-09-12 22:52   ` sashiko-bot
2026-09-12 22:35 ` [PATCH v1 06/11] leds: st1202: Scale pattern brightness to the 12-bit PWM range Manuel Fombuena
2026-09-12 22:51   ` sashiko-bot
2026-09-12 22:36 ` [PATCH v1 07/11] leds: st1202: Program the channel current for hardware patterns Manuel Fombuena
2026-09-12 22:49   ` sashiko-bot
2026-09-12 22:37 ` [PATCH v1 08/11] leds: st1202: Take a reference on the LED firmware node Manuel Fombuena
2026-09-12 22:47   ` sashiko-bot
2026-09-12 22:38 ` [PATCH v1 09/11] leds: st1202: Do not set brightness from atomic context Manuel Fombuena
2026-09-12 22:46   ` sashiko-bot
2026-09-12 22:39 ` [PATCH v1 10/11] leds: st1202: Clear unused pattern slots in blink_set() Manuel Fombuena
2026-09-12 22:51   ` sashiko-bot
2026-09-12 22:40 ` [PATCH v1 11/11] leds: st1202: Honour max_brightness when blinking Manuel Fombuena
2026-09-12 22:55   ` sashiko-bot

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=20260912225030.E2BBD1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=fombuena@outlook.com \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.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