[PATCH 3/7] leds: pca995x: add support for reset GPIO

From: Nora Schiffer

Date: Wed Sep 02 2026 - 08:26:57 EST


The PCA995x has a reset pin. Use it to reset the LED driver if provided
in the Device Tree.

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 fee6216cd1bd0..8eb9847b9709f 100644
--- a/drivers/leds/leds-pca995x.c
+++ b/drivers/leds/leds-pca995x.c
@@ -8,6 +8,7 @@
* Copyright 2023 Marek Vasut
*/

+#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/leds.h>
#include <linux/module.h>
@@ -121,6 +122,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 +132,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) {
+ usleep_range(3, 4);
+ 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/