[PATCH v2 4/8] leds: pca995x: Add support for reset GPIO
From: Nora Schiffer
Date: Tue Sep 15 2026 - 12:43:51 EST
The PCA9952/9955B/9956B have a reset pin. Use it to reset the LED driver
if provided in the Device Tree.
Signed-off-by: Nora Schiffer <nora.schiffer@xxxxxxxxxxxxxxx>
---
v2:
- Use correct #includes
- Use udelay for small delay
- Use full hardware model names in commit description
drivers/leds/leds-pca995x.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/leds/leds-pca995x.c b/drivers/leds/leds-pca995x.c
index 8b05b3f12cf38..0c0ea57f3225a 100644
--- a/drivers/leds/leds-pca995x.c
+++ b/drivers/leds/leds-pca995x.c
@@ -8,6 +8,8 @@
* Copyright 2023 Marek Vasut
*/
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/leds.h>
#include <linux/module.h>
@@ -121,6 +123,7 @@ static int pca995x_probe(struct i2c_client *client)
struct fwnode_handle *led_fwnodes[PCA995X_MAX_OUTPUTS] = { 0 };
struct device *dev = &client->dev;
const struct pca995x_chipdef *chipdef;
+ struct gpio_desc *reset_gpio;
struct pca995x_chip *chip;
struct pca995x_led *led;
int i, j, reg, ret;
@@ -130,6 +133,16 @@ static int pca995x_probe(struct i2c_client *client)
if (!dev_fwnode(dev))
return -ENODEV;
+ reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(reset_gpio),
+ "failed to request reset GPIO\n");
+ if (reset_gpio) {
+ udelay(3);
+ gpiod_set_value_cansleep(reset_gpio, 0);
+ usleep_range(1500, 1600);
+ }
+
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
--
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/