mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nora Schiffer <nora.schiffer@ew.tq-group.com>
To: Lee Jones <lee@kernel.org>
Cc: Pavel Machek <pavel@kernel.org>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Isai Gaspar <isaiezequiel.gaspar@nxp.com>,
	Marek Vasut <marex@denx.de>,
	Pieterjan Camerlynck <pieterjanca@gmail.com>,
	Javier Carrasco <javier.carrasco.cruz@gmail.com>,
	 linux@ew.tq-group.com, linux-leds@vger.kernel.org,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 06/10] leds: pca995x: Add support for reset GPIO
Date: Tue, 29 Sep 2026 11:25:23 +0200	[thread overview]
Message-ID: <f90d0a7853d5e2489ea491e7c87bad3ce77aeeb1.camel@ew.tq-group.com> (raw)
In-Reply-To: <20260929091428.GE2112133@google.com>

On Tue, 2026-09-29 at 10:14 +0100, Lee Jones wrote:
> On Tue, 22 Sep 2026, Nora Schiffer wrote:
> 
> > 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@ew.tq-group.com>
> > ---
> >  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 e6122b33451ed..b528b2b4990a7 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, 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);
> 
> It's strange to see delays _before_ actions.

devm_gpiod_get*() with GPIOD_OUT_HIGH asserts the reset GPIO if it was in a
different state before. We keep the chip in reset for 3us, de-assert the reset,
and then wait for ~1.5ms until the chip is back up. This is a common pattern
seen in various drivers.

> 
> What are you delaying for exactly?
> 
> > +		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/
> > 
> 

-- 
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/

  reply	other threads:[~2026-09-29  9:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 14:47 [PATCH v3 00/10] leds: pca995x: Minor fixes; reset, output-gain, error reporting and group brightness support Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 01/10] dt-bindings: leds: pca995x: Describe reset-gpios property Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 02/10] dt-bindings: leds: pca995x: Describe nxp,output-gain property Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 03/10] leds: pca995x: Fix maximum LED index for 16-channel variants Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 04/10] leds: pca995x: Fix fwnode handle leaks in error paths Nora Schiffer
2026-09-29  9:20   ` Lee Jones
2026-09-29  9:27     ` Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 05/10] leds: pca995x: Write global registers before creating LED devices Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 06/10] leds: pca995x: Add support for reset GPIO Nora Schiffer
2026-09-29  9:14   ` Lee Jones
2026-09-29  9:25     ` Nora Schiffer [this message]
2026-09-22 14:47 ` [PATCH v3 07/10] leds: pca995x: Make output gain configurable Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 08/10] leds: pca995x: Add sysfs files for error reporting Nora Schiffer
2026-09-29 10:12   ` Lee Jones
2026-09-29 11:04     ` Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 09/10] leds: pca995x: Do not use full on LED mode Nora Schiffer
2026-09-22 14:47 ` [PATCH v3 10/10] leds: pca995x: Add support for group brightness control Nora Schiffer
2026-09-29 10:13   ` Lee Jones
2026-09-29 11:06     ` Nora Schiffer

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=f90d0a7853d5e2489ea491e7c87bad3ce77aeeb1.camel@ew.tq-group.com \
    --to=nora.schiffer@ew.tq-group.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=isaiezequiel.gaspar@nxp.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@ew.tq-group.com \
    --cc=marex@denx.de \
    --cc=pavel@kernel.org \
    --cc=pieterjanca@gmail.com \
    --cc=robh@kernel.org \
    /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®