linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-leds@vger.kernel.org,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH RESEND 0/2] leds: gpio: Add devlink between the leds-gpio device and the gpio used.
Date: Tue, 20 Feb 2024 15:53:47 +0100	[thread overview]
Message-ID: <20240220155347.693e46e1@bootlin.com> (raw)
In-Reply-To: <CAMRc=MfWPEOHeNvAwra-JxHZBFMrQbP+273zbFLDZfxi7fx8Yg@mail.gmail.com>

On Tue, 20 Feb 2024 15:19:57 +0100
Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> On Tue, Feb 20, 2024 at 2:39 PM Herve Codina <herve.codina@bootlin.com> wrote:
> >
> > Hi,
> >
> > Note: Resent this series with Saravana added in Cc.
> >
> > When a gpio used by the leds-gpio device is removed, the leds-gpio
> > device continues to use this gpio. Also, when the gpio is back, the
> > leds-gpio still uses the old removed gpio.
> >
> > A consumer/supplier relationship is missing between the leds-gpio device
> > (consumer) and the gpio used (supplier).
> >
> > This series adds an addionnal devlink between this two device.
> > With this link when the gpio is removed, the leds-gpio device is also
> > removed.
> >
> > Best regards,
> > Hervé Codina
> >
> > Herve Codina (2):
> >   gpiolib: Introduce gpiod_device_add_link()
> >   leds: gpio: Add devlinks between the gpio consumed and the gpio leds
> >     device
> >
> >  drivers/gpio/gpiolib.c        | 32 ++++++++++++++++++++++++++++++++
> >  drivers/leds/leds-gpio.c      | 15 +++++++++++++++
> >  include/linux/gpio/consumer.h |  5 +++++
> >  3 files changed, 52 insertions(+)
> >
> > --
> > 2.43.0
> >  
> 
> Can you add some more context here in the form of DT snippets that
> lead to this being needed?

/ {
	leds-dock {
		compatible = "gpio-leds";

		led-5 {
			label = "dock:alarm:red";
			gpios = <&tca6424_dock_2 12 GPIO_ACTIVE_HIGH>;
		};

		led-6 {
			label = "dock:alarm:yellow";
			gpios = <&tca6424_dock_2 13 GPIO_ACTIVE_HIGH>;
		};

		led-7 {
			label = "dock:alarm:blue";
			gpios = <&tca6424_dock_2 14 GPIO_ACTIVE_HIGH>;
		};
	};

	...
	i2c5 {
		...
		tca6424_dock_2: gpio@23 {
			compatible = "ti,tca6424";
			reg = <0x23>;
			gpio-controller;
			#gpio-cells = <2>;
			interrupt-parent = <&tca6424_dock_1>;
			interrupts = <23 IRQ_TYPE_EDGE_FALLING>;
			interrupt-controller;
			#interrupt-cells = <2>;
			vcc-supply = <&reg_dock_ctrl_3v3>;
		};
		tca6424_dock_1: gpio@22 {
			compatible = "ti,tca6424";
			reg = <0x22>;
			gpio-controller;
			#gpio-cells = <2>;
			interrupt-parent = <&gpio4>;
			interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
			interrupt-controller;
			#interrupt-cells = <2>;
			vcc-supply = <&reg_dock_ctrl_3v3>;
		};
	};
};

Also, had the exact same issue if I use a SoC gpio chip instead of an
i2c gpio expander.

Best regards,
Hervé

  reply	other threads:[~2024-02-20 14:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 13:39 [PATCH RESEND 0/2] leds: gpio: Add devlink between the leds-gpio device and the gpio used Herve Codina
2024-02-20 13:39 ` [PATCH RESEND 1/2] gpiolib: Introduce gpiod_device_add_link() Herve Codina
2024-02-20 13:39 ` [PATCH RESEND 2/2] leds: gpio: Add devlinks between the gpio consumed and the gpio leds device Herve Codina
2024-02-20 14:19 ` [PATCH RESEND 0/2] leds: gpio: Add devlink between the leds-gpio device and the gpio used Bartosz Golaszewski
2024-02-20 14:53   ` Herve Codina [this message]
2024-02-20 15:30     ` Bartosz Golaszewski
2024-02-20 15:47       ` Herve Codina
2024-02-21  3:28         ` Saravana Kannan
2024-02-27 12:06           ` Herve Codina
2024-04-08 13:44           ` Herve Codina

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=20240220155347.693e46e1@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=brgl@bgdev.pl \
    --cc=lee@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=pavel@ucw.cz \
    --cc=saravanak@google.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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;
as well as URLs for NNTP newsgroup(s).