From: Manuel Fombuena <fombuena@outlook.com>
To: lee@kernel.org, pavel@kernel.org,
vicentiu.galanopulo@remote-tech.co.uk,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 04/10] leds: st1202: fix pattern_clear to explicitly mark unused slots as skip
Date: Sat, 16 May 2026 15:34:06 +0100 [thread overview]
Message-ID: <WA0P291MB0385C7F36F3D6D7C0477DEC0C5052@WA0P291MB0385.POLP291.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <WA0P291MB03850F4E9B4EC7389FE89779C5052@WA0P291MB0385.POLP291.PROD.OUTLOOK.COM>
pattern_clear used st1202_duration_pattern_write() with the minimum
duration (22 ms) to reset the eight pattern slots. With the old buggy
formula (value / 22 - 1) this accidentally wrote register value 0,
which the hardware interprets as skip. The corrected formula
(value / 22) maps 22 ms to register 1, a valid 22 ms duration.
As a result, any pattern_set() call with fewer than eight steps left
the remaining slots with 22 ms valid durations and zero PWM, making
the LED appear off for 7 x 22 ms out of every cycle.
Write 0 directly to the duration registers so that unused slots are
always explicitly marked as skip, independently of the conversion
formula.
Fixes: 259230378c65 ("leds: Add LED1202 I2C driver")
Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
Assisted-by: Claude:claude-sonnet-4-6
---
drivers/leds/leds-st1202.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c
index 02db1006fb53..1ca77fbe4ec9 100644
--- a/drivers/leds/leds-st1202.c
+++ b/drivers/leds/leds-st1202.c
@@ -209,7 +209,7 @@ static int st1202_led_pattern_clear(struct led_classdev *ldev)
if (ret != 0)
return ret;
- ret = st1202_duration_pattern_write(chip, patt, ST1202_MILLIS_PATTERN_DUR_MIN);
+ ret = st1202_write_reg(chip, ST1202_PATTERN_DUR + patt, 0);
if (ret != 0)
return ret;
}
--
2.54.0
next prev parent reply other threads:[~2026-05-16 14:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-16 14:25 [PATCH 00/10] leds: st1202: fix multiple bugs in pattern engine and brightness handling Manuel Fombuena
2026-05-16 14:30 ` [PATCH 01/10] leds: st1202: stop pattern sequence before reprogramming Manuel Fombuena
2026-05-16 14:32 ` [PATCH 02/10] leds: st1202: validate pattern input before stopping the sequence Manuel Fombuena
2026-05-16 14:33 ` [PATCH 03/10] leds: st1202: fix pattern duration register calculation Manuel Fombuena
2026-05-16 14:34 ` Manuel Fombuena [this message]
2026-05-16 14:34 ` [PATCH 05/10] leds: st1202: reset PAT_REP to POR default in pattern_clear Manuel Fombuena
2026-05-16 14:35 ` [PATCH 06/10] leds: st1202: restore Pattern0 PWM to full on after clearing pattern Manuel Fombuena
2026-05-16 14:36 ` [PATCH 07/10] leds: st1202: fix spurious pattern sequence start in setup Manuel Fombuena
2026-05-16 14:39 ` [PATCH 08/10] leds: st1202: fix brightness having no effect while pattern mode is active Manuel Fombuena
2026-05-16 14:40 ` [PATCH 09/10] leds: st1202: disable channel when brightness is set to zero Manuel Fombuena
2026-05-16 14:42 ` [PATCH 10/10] leds: st1202: correct and extend hw_pattern documentation Manuel Fombuena
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=WA0P291MB0385C7F36F3D6D7C0477DEC0C5052@WA0P291MB0385.POLP291.PROD.OUTLOOK.COM \
--to=fombuena@outlook.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=vicentiu.galanopulo@remote-tech.co.uk \
/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®