Re: [PATCH v5 1/1] leds: st1202: Add hardware-accelerated blink support

Lee Jones <[email protected]> Thu, 6 Aug 2026 15:17:21 +0100
Newsgroups org.kernel.vger.linux-leds,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, 04 Aug 2026, Manuel Fombuena wrote:

> Implement blink_set() to enable hardware-accelerated blinking via the
> timer trigger. The LED1202 pattern engine is used to produce a two-step
> sequence: full brightness for delay_on, off for delay_off, repeating
> indefinitely.
> 
> Requested delays are clamped to the hardware range [22ms, 5610ms] then
> rounded up to the nearest 22ms step. Clamping before rounding prevents
> integer overflow in roundup() for extreme input values; since
> ST1202_MILLIS_PATTERN_DUR_MAX is an exact multiple of
> ST1202_MILLIS_PATTERN_DUR_MIN, rounding a clamped value cannot exceed
> the maximum. A zero delay is replaced with the default of 500ms
> independently for each of delay_on and delay_off.
> 
> The LED1202 pattern sequencer is global and its timing registers are
> shared across all channels, so only one blink configuration can be
> active at a time. Other active channels have their PWM slots zeroed for
> both pattern steps so they remain dark rather than outputting unintended
> values when the sequencer runs. The target channel's ILED register is
> set to full brightness and the channel is enabled, since the timer
> trigger deactivates the current trigger before calling blink_set which
> would otherwise leave the channel disabled.
> 
> Signed-off-by: Manuel Fombuena <[email protected]>
> ---
>  drivers/leds/leds-st1202.c | 80 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 80 insertions(+)

Sorry, I've just reviewed v3.

I think the points are still valid though.

-- 
Lee Jones