Re: [PATCH RESEND 0/2] leds: gpio: Add devlink between the leds-gpio device and the gpio used.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> On Tue, Feb 20, 2024 at 2:39 PM Herve Codina <herve.codina@xxxxxxxxxxx> 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é




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux