[PATCH v5 08/11] leds: pca995x: Initialize MODE2 register on probe
From: Nora Schiffer
Date: Mon Oct 05 2026 - 10:00:54 EST
Ensure that the LED driver is in a known state.
Not all of the bits in the MODE2 register have a function - some are just
reserved bits that always read 1 - so the values given in the PCA9952/
PCA9955B/PCA9956B datasheets are simply specified as hex values.
Signed-off-by: Nora Schiffer <nora.schiffer@xxxxxxxxxxxxxxx>
---
drivers/leds/leds-pca995x.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/leds/leds-pca995x.c b/drivers/leds/leds-pca995x.c
index df3f7ab2e1f87..3d6053625b1c9 100644
--- a/drivers/leds/leds-pca995x.c
+++ b/drivers/leds/leds-pca995x.c
@@ -43,24 +43,31 @@ struct pca995x_chipdef {
unsigned int num_leds;
u8 pwm_base;
u8 irefall;
+ u8 mode2_cfg;
};
static const struct pca995x_chipdef pca9952_chipdef = {
.num_leds = 16,
.pwm_base = 0x0a,
.irefall = 0x43,
+ /* Reset default */
+ .mode2_cfg = 0x05,
};
static const struct pca995x_chipdef pca9955b_chipdef = {
.num_leds = 16,
.pwm_base = 0x08,
.irefall = 0x45,
+ /* Reset default */
+ .mode2_cfg = 0x01,
};
static const struct pca995x_chipdef pca9956b_chipdef = {
.num_leds = 24,
.pwm_base = 0x0a,
.irefall = 0x40,
+ /* Reset default */
+ .mode2_cfg = 0x05,
};
struct pca995x_led {
@@ -185,6 +192,11 @@ static int pca995x_probe(struct i2c_client *client)
if (ret)
goto err_put_nodes;
+ /* Clear errors on probe */
+ ret = regmap_write(chip->regmap, PCA995X_MODE2, chipdef->mode2_cfg);
+ if (ret)
+ goto err_put_nodes;
+
/* IREF Output current value for all LEDn outputs */
ret = regmap_write(chip->regmap, chipdef->irefall, iref);
if (ret)
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/