diff mbox series

[6/6] ARM: dts: aspeed: rainier: Add leds that are on optional PCI cable cards

Message ID 1605247168-1028-6-git-send-email-vishwa@linux.vnet.ibm.com
State Changes Requested, archived
Headers show
Series [1/6] ARM: dts: aspeed: rainier: Add Operator Panel LEDs | expand

Commit Message

vishwanatha subbanna Nov. 13, 2020, 5:59 a.m. UTC
These are LEDs on the cable cards that plug into PCIE slots.
The LEDs are controlled by PCA9552 I2C expander

Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
---
 arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 288 +++++++++++++++++++++++++++
 1 file changed, 288 insertions(+)

Comments

Joel Stanley Nov. 16, 2020, 6:13 a.m. UTC | #1
On Fri, 13 Nov 2020 at 05:59, Vishwanatha Subbanna
<vishwa@linux.vnet.ibm.com> wrote:
>
> These are LEDs on the cable cards that plug into PCIE slots.
> The LEDs are controlled by PCA9552 I2C expander
>
> Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
> ---
>  arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 288 +++++++++++++++++++++++++++
>  1 file changed, 288 insertions(+)
>
> diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> index 67c8c40..7de5f76 100644
> --- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> +++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> @@ -696,6 +696,70 @@
>                         gpios = <&pca4 7 GPIO_ACTIVE_LOW>;
>                 };
>         };
> +
> +       leds-optional-cablecard0 {

Is it necessary to have separate nodes for each of the different GPIO devices?

Would it make sense to combine them, or is it better to be separate?

Andrew, Eddie, Brad: please review this one before I merge it.

> +               compatible = "gpio-leds";
> +
> +               cablecard0-cxp-top {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca5 0 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               cablecard0-cxp-bot {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca5 1 GPIO_ACTIVE_LOW>;
> +               };
> +       };
> +
> +       leds-optional-cablecard3 {
> +               compatible = "gpio-leds";
> +
> +               cablecard3-cxp-top {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca6 0 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               cablecard3-cxp-bot {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca6 1 GPIO_ACTIVE_LOW>;
> +               };
> +       };
> +
> +       leds-optional-cablecard4 {
> +               compatible = "gpio-leds";
> +
> +               cablecard4-cxp-top {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca7 0 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               cablecard4-cxp-bot {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca7 1 GPIO_ACTIVE_LOW>;
> +               };
> +       };
> +
> +       leds-optional-cablecard10 {
> +               compatible = "gpio-leds";
> +
> +               cablecard10-cxp-top {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca8 0 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               cablecard10-cxp-bot {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca8 1 GPIO_ACTIVE_LOW>;
> +               };
> +       };
>  };
>
>  &ehci1 {
> @@ -1212,6 +1276,180 @@
>                 compatible = "atmel,24c64";
>                 reg = <0x52>;
>         };
> +
> +       pca5: pca9551@60 {
> +               compatible = "nxp,pca9551";
> +               reg = <0x60>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +
> +               gpio@0 {
> +                       reg = <0>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@1 {
> +                       reg = <1>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@2 {
> +                       reg = <2>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@3 {
> +                       reg = <3>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@4 {
> +                       reg = <4>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@5 {
> +                       reg = <5>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@6 {
> +                       reg = <6>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@7 {
> +                       reg = <7>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +       };
> +};
> +
> +&i2c5 {
> +       status = "okay";
> +
> +       tmp275@48 {
> +               compatible = "ti,tmp275";
> +               reg = <0x48>;
> +       };
> +
> +       tmp275@49 {
> +               compatible = "ti,tmp275";
> +               reg = <0x49>;
> +       };
> +
> +       eeprom@50 {
> +               compatible = "atmel,24c64";
> +               reg = <0x50>;
> +       };
> +
> +       eeprom@51 {
> +               compatible = "atmel,24c64";
> +               reg = <0x51>;
> +       };
> +
> +       pca6: pca9551@60 {
> +               compatible = "nxp,pca9551";
> +               reg = <0x60>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +
> +               gpio@0 {
> +                       reg = <0>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@1 {
> +                       reg = <1>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@2 {
> +                       reg = <2>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@3 {
> +                       reg = <3>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@4 {
> +                       reg = <4>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@5 {
> +                       reg = <5>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@6 {
> +                       reg = <6>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@7 {
> +                       reg = <7>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +       };
> +
> +       pca7: pca9551@61 {
> +               compatible = "nxp,pca9551";
> +               reg = <0x61>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +
> +               gpio@0 {
> +                       reg = <0>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@1 {
> +                       reg = <1>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@2 {
> +                       reg = <2>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@3 {
> +                       reg = <3>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@4 {
> +                       reg = <4>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@5 {
> +                       reg = <5>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@6 {
> +                       reg = <6>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@7 {
> +                       reg = <7>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +       };
>  };
>
>  &i2c5 {
> @@ -2028,6 +2266,56 @@
>                 compatible = "atmel,24c64";
>                 reg = <0x51>;
>         };
> +
> +       pca8: pca9551@60 {
> +               compatible = "nxp,pca9551";
> +               reg = <0x60>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +
> +               gpio@0 {
> +                       reg = <0>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@1 {
> +                       reg = <1>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@2 {
> +                       reg = <2>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@3 {
> +                       reg = <3>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@4 {
> +                       reg = <4>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@5 {
> +                       reg = <5>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@6 {
> +                       reg = <6>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@7 {
> +                       reg = <7>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +       };
>  };
>
>  &i2c12 {
> --
> 1.8.3.1
>
Andrew Jeffery Nov. 30, 2020, 6:08 a.m. UTC | #2
On Mon, 16 Nov 2020, at 16:43, Joel Stanley wrote:
> On Fri, 13 Nov 2020 at 05:59, Vishwanatha Subbanna
> <vishwa@linux.vnet.ibm.com> wrote:
> >
> > These are LEDs on the cable cards that plug into PCIE slots.
> > The LEDs are controlled by PCA9552 I2C expander
> >
> > Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
> > ---
> >  arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 288 +++++++++++++++++++++++++++
> >  1 file changed, 288 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> > index 67c8c40..7de5f76 100644
> > --- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> > +++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> > @@ -696,6 +696,70 @@
> >                         gpios = <&pca4 7 GPIO_ACTIVE_LOW>;
> >                 };
> >         };
> > +
> > +       leds-optional-cablecard0 {
> 
> Is it necessary to have separate nodes for each of the different GPIO devices?

Good question. Vishwa, what's the advantage either way here?

> 
> Would it make sense to combine them, or is it better to be separate?
> 
> Andrew, Eddie, Brad: please review this one before I merge it.
> 
> > +               compatible = "gpio-leds";
> > +
> > +               cablecard0-cxp-top {
> > +                       retain-state-shutdown;
> > +                       default-state = "keep";
> > +                       gpios = <&pca5 0 GPIO_ACTIVE_LOW>;
> > +               };
> > +
> > +               cablecard0-cxp-bot {
> > +                       retain-state-shutdown;
> > +                       default-state = "keep";
> > +                       gpios = <&pca5 1 GPIO_ACTIVE_LOW>;
> > +               };
> > +       };
> > +
> > +       leds-optional-cablecard3 {
> > +               compatible = "gpio-leds";
> > +
> > +               cablecard3-cxp-top {
> > +                       retain-state-shutdown;
> > +                       default-state = "keep";
> > +                       gpios = <&pca6 0 GPIO_ACTIVE_LOW>;
> > +               };
> > +
> > +               cablecard3-cxp-bot {
> > +                       retain-state-shutdown;
> > +                       default-state = "keep";
> > +                       gpios = <&pca6 1 GPIO_ACTIVE_LOW>;
> > +               };
> > +       };
> > +
> > +       leds-optional-cablecard4 {
> > +               compatible = "gpio-leds";
> > +
> > +               cablecard4-cxp-top {
> > +                       retain-state-shutdown;
> > +                       default-state = "keep";
> > +                       gpios = <&pca7 0 GPIO_ACTIVE_LOW>;
> > +               };
> > +
> > +               cablecard4-cxp-bot {
> > +                       retain-state-shutdown;
> > +                       default-state = "keep";
> > +                       gpios = <&pca7 1 GPIO_ACTIVE_LOW>;
> > +               };
> > +       };
> > +
> > +       leds-optional-cablecard10 {
> > +               compatible = "gpio-leds";
> > +
> > +               cablecard10-cxp-top {
> > +                       retain-state-shutdown;
> > +                       default-state = "keep";
> > +                       gpios = <&pca8 0 GPIO_ACTIVE_LOW>;
> > +               };
> > +
> > +               cablecard10-cxp-bot {
> > +                       retain-state-shutdown;
> > +                       default-state = "keep";
> > +                       gpios = <&pca8 1 GPIO_ACTIVE_LOW>;
> > +               };
> > +       };
> >  };
> >
> >  &ehci1 {
> > @@ -1212,6 +1276,180 @@
> >                 compatible = "atmel,24c64";
> >                 reg = <0x52>;
> >         };
> > +
> > +       pca5: pca9551@60 {
> > +               compatible = "nxp,pca9551";
> > +               reg = <0x60>;
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +
> > +               gpio-controller;
> > +               #gpio-cells = <2>;
> > +
> > +               gpio@0 {
> > +                       reg = <0>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@1 {
> > +                       reg = <1>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@2 {
> > +                       reg = <2>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@3 {
> > +                       reg = <3>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@4 {
> > +                       reg = <4>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@5 {
> > +                       reg = <5>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@6 {
> > +                       reg = <6>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@7 {
> > +                       reg = <7>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +       };
> > +};
> > +
> > +&i2c5 {
> > +       status = "okay";
> > +
> > +       tmp275@48 {
> > +               compatible = "ti,tmp275";
> > +               reg = <0x48>;
> > +       };
> > +
> > +       tmp275@49 {
> > +               compatible = "ti,tmp275";
> > +               reg = <0x49>;
> > +       };

These aren't LED devices.

> > +
> > +       eeprom@50 {
> > +               compatible = "atmel,24c64";
> > +               reg = <0x50>;
> > +       };
> > +
> > +       eeprom@51 {
> > +               compatible = "atmel,24c64";
> > +               reg = <0x51>;
> > +       };

Neither are these.

> > +
> > +       pca6: pca9551@60 {
> > +               compatible = "nxp,pca9551";
> > +               reg = <0x60>;
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +
> > +               gpio-controller;
> > +               #gpio-cells = <2>;
> > +
> > +               gpio@0 {
> > +                       reg = <0>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@1 {
> > +                       reg = <1>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@2 {
> > +                       reg = <2>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@3 {
> > +                       reg = <3>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@4 {
> > +                       reg = <4>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@5 {
> > +                       reg = <5>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@6 {
> > +                       reg = <6>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@7 {
> > +                       reg = <7>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +       };
> > +
> > +       pca7: pca9551@61 {
> > +               compatible = "nxp,pca9551";
> > +               reg = <0x61>;
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +
> > +               gpio-controller;
> > +               #gpio-cells = <2>;
> > +
> > +               gpio@0 {
> > +                       reg = <0>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@1 {
> > +                       reg = <1>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@2 {
> > +                       reg = <2>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@3 {
> > +                       reg = <3>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@4 {
> > +                       reg = <4>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@5 {
> > +                       reg = <5>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@6 {
> > +                       reg = <6>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@7 {
> > +                       reg = <7>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +       };
> >  };
> >
> >  &i2c5 {
> > @@ -2028,6 +2266,56 @@
> >                 compatible = "atmel,24c64";
> >                 reg = <0x51>;
> >         };
> > +
> > +       pca8: pca9551@60 {
> > +               compatible = "nxp,pca9551";
> > +               reg = <0x60>;
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +
> > +               gpio-controller;
> > +               #gpio-cells = <2>;
> > +
> > +               gpio@0 {
> > +                       reg = <0>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@1 {
> > +                       reg = <1>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@2 {
> > +                       reg = <2>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@3 {
> > +                       reg = <3>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@4 {
> > +                       reg = <4>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@5 {
> > +                       reg = <5>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@6 {
> > +                       reg = <6>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +
> > +               gpio@7 {
> > +                       reg = <7>;
> > +                       type = <PCA955X_TYPE_GPIO>;
> > +               };
> > +       };
> >  };

If we're adding LEDs, why aren't we using PCA955X_TYPE_LED? Why the indirection through the leds-gpio driver?

Andrew
vishwanatha subbanna Feb. 10, 2021, 11:14 a.m. UTC | #3
> On 30-Nov-2020, at 11:38 AM, Andrew Jeffery <andrew@aj.id.au> wrote:
> 
> 
> 
> On Mon, 16 Nov 2020, at 16:43, Joel Stanley wrote:
>> On Fri, 13 Nov 2020 at 05:59, Vishwanatha Subbanna
>> <vishwa@linux.vnet.ibm.com> wrote:
>>> 
>>> These are LEDs on the cable cards that plug into PCIE slots.
>>> The LEDs are controlled by PCA9552 I2C expander
>>> 
>>> Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
>>> ---
>>> arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 288 +++++++++++++++++++++++++++
>>> 1 file changed, 288 insertions(+)
>>> 
>>> diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
>>> index 67c8c40..7de5f76 100644
>>> --- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
>>> +++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
>>> @@ -696,6 +696,70 @@
>>>                        gpios = <&pca4 7 GPIO_ACTIVE_LOW>;
>>>                };
>>>        };
>>> +
>>> +       leds-optional-cablecard0 {
>> 
>> Is it necessary to have separate nodes for each of the different GPIO devices?
> 
> Good question. Vishwa, what's the advantage either way here?



If I express ‘em all in one node that is “leds {", then if any of the GPIO is not seen because of not having the card, then the current leds-gpio driver knocks off all the ones on which it successfully acquired the GPIOs also, leaving nothing. I did speak to the maintainer and it looked like the behaviour was existing since long time and changing it would break old code.



> 
>> 
>> Would it make sense to combine them, or is it better to be separate?
>> 
>> Andrew, Eddie, Brad: please review this one before I merge it.
>> 
>>> +               compatible = "gpio-leds";
>>> +
>>> +               cablecard0-cxp-top {
>>> +                       retain-state-shutdown;
>>> +                       default-state = "keep";
>>> +                       gpios = <&pca5 0 GPIO_ACTIVE_LOW>;
>>> +               };
>>> +
>>> +               cablecard0-cxp-bot {
>>> +                       retain-state-shutdown;
>>> +                       default-state = "keep";
>>> +                       gpios = <&pca5 1 GPIO_ACTIVE_LOW>;
>>> +               };
>>> +       };
>>> +
>>> +       leds-optional-cablecard3 {
>>> +               compatible = "gpio-leds";
>>> +
>>> +               cablecard3-cxp-top {
>>> +                       retain-state-shutdown;
>>> +                       default-state = "keep";
>>> +                       gpios = <&pca6 0 GPIO_ACTIVE_LOW>;
>>> +               };
>>> +
>>> +               cablecard3-cxp-bot {
>>> +                       retain-state-shutdown;
>>> +                       default-state = "keep";
>>> +                       gpios = <&pca6 1 GPIO_ACTIVE_LOW>;
>>> +               };
>>> +       };
>>> +
>>> +       leds-optional-cablecard4 {
>>> +               compatible = "gpio-leds";
>>> +
>>> +               cablecard4-cxp-top {
>>> +                       retain-state-shutdown;
>>> +                       default-state = "keep";
>>> +                       gpios = <&pca7 0 GPIO_ACTIVE_LOW>;
>>> +               };
>>> +
>>> +               cablecard4-cxp-bot {
>>> +                       retain-state-shutdown;
>>> +                       default-state = "keep";
>>> +                       gpios = <&pca7 1 GPIO_ACTIVE_LOW>;
>>> +               };
>>> +       };
>>> +
>>> +       leds-optional-cablecard10 {
>>> +               compatible = "gpio-leds";
>>> +
>>> +               cablecard10-cxp-top {
>>> +                       retain-state-shutdown;
>>> +                       default-state = "keep";
>>> +                       gpios = <&pca8 0 GPIO_ACTIVE_LOW>;
>>> +               };
>>> +
>>> +               cablecard10-cxp-bot {
>>> +                       retain-state-shutdown;
>>> +                       default-state = "keep";
>>> +                       gpios = <&pca8 1 GPIO_ACTIVE_LOW>;
>>> +               };
>>> +       };
>>> };
>>> 
>>> &ehci1 {
>>> @@ -1212,6 +1276,180 @@
>>>                compatible = "atmel,24c64";
>>>                reg = <0x52>;
>>>        };
>>> +
>>> +       pca5: pca9551@60 {
>>> +               compatible = "nxp,pca9551";
>>> +               reg = <0x60>;
>>> +               #address-cells = <1>;
>>> +               #size-cells = <0>;
>>> +
>>> +               gpio-controller;
>>> +               #gpio-cells = <2>;
>>> +
>>> +               gpio@0 {
>>> +                       reg = <0>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@1 {
>>> +                       reg = <1>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@2 {
>>> +                       reg = <2>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@3 {
>>> +                       reg = <3>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@4 {
>>> +                       reg = <4>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@5 {
>>> +                       reg = <5>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@6 {
>>> +                       reg = <6>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@7 {
>>> +                       reg = <7>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +       };
>>> +};
>>> +
>>> +&i2c5 {
>>> +       status = "okay";
>>> +
>>> +       tmp275@48 {
>>> +               compatible = "ti,tmp275";
>>> +               reg = <0x48>;
>>> +       };
>>> +
>>> +       tmp275@49 {
>>> +               compatible = "ti,tmp275";
>>> +               reg = <0x49>;
>>> +       };
> 
> These aren't LED devices.
> 
>>> +
>>> +       eeprom@50 {
>>> +               compatible = "atmel,24c64";
>>> +               reg = <0x50>;
>>> +       };
>>> +
>>> +       eeprom@51 {
>>> +               compatible = "atmel,24c64";
>>> +               reg = <0x51>;
>>> +       };
> 
> Neither are these.
> 
>>> +
>>> +       pca6: pca9551@60 {
>>> +               compatible = "nxp,pca9551";
>>> +               reg = <0x60>;
>>> +               #address-cells = <1>;
>>> +               #size-cells = <0>;
>>> +
>>> +               gpio-controller;
>>> +               #gpio-cells = <2>;
>>> +
>>> +               gpio@0 {
>>> +                       reg = <0>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@1 {
>>> +                       reg = <1>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@2 {
>>> +                       reg = <2>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@3 {
>>> +                       reg = <3>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@4 {
>>> +                       reg = <4>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@5 {
>>> +                       reg = <5>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@6 {
>>> +                       reg = <6>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@7 {
>>> +                       reg = <7>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +       };
>>> +
>>> +       pca7: pca9551@61 {
>>> +               compatible = "nxp,pca9551";
>>> +               reg = <0x61>;
>>> +               #address-cells = <1>;
>>> +               #size-cells = <0>;
>>> +
>>> +               gpio-controller;
>>> +               #gpio-cells = <2>;
>>> +
>>> +               gpio@0 {
>>> +                       reg = <0>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@1 {
>>> +                       reg = <1>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@2 {
>>> +                       reg = <2>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@3 {
>>> +                       reg = <3>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@4 {
>>> +                       reg = <4>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@5 {
>>> +                       reg = <5>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@6 {
>>> +                       reg = <6>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@7 {
>>> +                       reg = <7>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +       };
>>> };
>>> 
>>> &i2c5 {
>>> @@ -2028,6 +2266,56 @@
>>>                compatible = "atmel,24c64";
>>>                reg = <0x51>;
>>>        };
>>> +
>>> +       pca8: pca9551@60 {
>>> +               compatible = "nxp,pca9551";
>>> +               reg = <0x60>;
>>> +               #address-cells = <1>;
>>> +               #size-cells = <0>;
>>> +
>>> +               gpio-controller;
>>> +               #gpio-cells = <2>;
>>> +
>>> +               gpio@0 {
>>> +                       reg = <0>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@1 {
>>> +                       reg = <1>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@2 {
>>> +                       reg = <2>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@3 {
>>> +                       reg = <3>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@4 {
>>> +                       reg = <4>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@5 {
>>> +                       reg = <5>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@6 {
>>> +                       reg = <6>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +
>>> +               gpio@7 {
>>> +                       reg = <7>;
>>> +                       type = <PCA955X_TYPE_GPIO>;
>>> +               };
>>> +       };
>>> };
> 
> If we're adding LEDs, why aren't we using PCA955X_TYPE_LED? Why the indirection through the leds-gpio driver?


Yes.. we could.. I kind of continued what we had for Witherspoon DTS. But then it does not solve the leds-gpio driver knocking off devices. So, I would say
We still need the leds-gpio driver sections


> 
> Andrew
vishwanatha subbanna Feb. 10, 2021, 11:16 a.m. UTC | #4
> On 16-Nov-2020, at 11:43 AM, Joel Stanley <joel@jms.id.au> wrote:
> 
> On Fri, 13 Nov 2020 at 05:59, Vishwanatha Subbanna
> <vishwa@linux.vnet.ibm.com> wrote:
>> 
>> These are LEDs on the cable cards that plug into PCIE slots.
>> The LEDs are controlled by PCA9552 I2C expander
>> 
>> Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
>> ---
>> arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 288 +++++++++++++++++++++++++++
>> 1 file changed, 288 insertions(+)
>> 
>> diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
>> index 67c8c40..7de5f76 100644
>> --- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
>> +++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
>> @@ -696,6 +696,70 @@
>>                        gpios = <&pca4 7 GPIO_ACTIVE_LOW>;
>>                };
>>        };
>> +
>> +       leds-optional-cablecard0 {
> 
> Is it necessary to have separate nodes for each of the different GPIO devices?
> 
> Would it make sense to combine them, or is it better to be separate?
> 
> Andrew, Eddie, Brad: please review this one before I merge it.

I answered this in previous patch set.  If I express ‘em all in one node that is “leds {", then if any of the GPIO is not seen because of not having the card, then the current leds-gpio driver knocks off all the ones on which it successfully acquired the GPIOs also, leaving nothing. I did speak to the maintainer and it looked like the behaviour was existing since long time and changing it would break old code.


> 
>> +               compatible = "gpio-leds";
>> +
>> +               cablecard0-cxp-top {
>> +                       retain-state-shutdown;
>> +                       default-state = "keep";
>> +                       gpios = <&pca5 0 GPIO_ACTIVE_LOW>;
>> +               };
>> +
>> +               cablecard0-cxp-bot {
>> +                       retain-state-shutdown;
>> +                       default-state = "keep";
>> +                       gpios = <&pca5 1 GPIO_ACTIVE_LOW>;
>> +               };
>> +       };
>> +
>> +       leds-optional-cablecard3 {
>> +               compatible = "gpio-leds";
>> +
>> +               cablecard3-cxp-top {
>> +                       retain-state-shutdown;
>> +                       default-state = "keep";
>> +                       gpios = <&pca6 0 GPIO_ACTIVE_LOW>;
>> +               };
>> +
>> +               cablecard3-cxp-bot {
>> +                       retain-state-shutdown;
>> +                       default-state = "keep";
>> +                       gpios = <&pca6 1 GPIO_ACTIVE_LOW>;
>> +               };
>> +       };
>> +
>> +       leds-optional-cablecard4 {
>> +               compatible = "gpio-leds";
>> +
>> +               cablecard4-cxp-top {
>> +                       retain-state-shutdown;
>> +                       default-state = "keep";
>> +                       gpios = <&pca7 0 GPIO_ACTIVE_LOW>;
>> +               };
>> +
>> +               cablecard4-cxp-bot {
>> +                       retain-state-shutdown;
>> +                       default-state = "keep";
>> +                       gpios = <&pca7 1 GPIO_ACTIVE_LOW>;
>> +               };
>> +       };
>> +
>> +       leds-optional-cablecard10 {
>> +               compatible = "gpio-leds";
>> +
>> +               cablecard10-cxp-top {
>> +                       retain-state-shutdown;
>> +                       default-state = "keep";
>> +                       gpios = <&pca8 0 GPIO_ACTIVE_LOW>;
>> +               };
>> +
>> +               cablecard10-cxp-bot {
>> +                       retain-state-shutdown;
>> +                       default-state = "keep";
>> +                       gpios = <&pca8 1 GPIO_ACTIVE_LOW>;
>> +               };
>> +       };
>> };
>> 
>> &ehci1 {
>> @@ -1212,6 +1276,180 @@
>>                compatible = "atmel,24c64";
>>                reg = <0x52>;
>>        };
>> +
>> +       pca5: pca9551@60 {
>> +               compatible = "nxp,pca9551";
>> +               reg = <0x60>;
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +
>> +               gpio-controller;
>> +               #gpio-cells = <2>;
>> +
>> +               gpio@0 {
>> +                       reg = <0>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@1 {
>> +                       reg = <1>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@2 {
>> +                       reg = <2>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@3 {
>> +                       reg = <3>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@4 {
>> +                       reg = <4>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@5 {
>> +                       reg = <5>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@6 {
>> +                       reg = <6>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@7 {
>> +                       reg = <7>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +       };
>> +};
>> +
>> +&i2c5 {
>> +       status = "okay";
>> +
>> +       tmp275@48 {
>> +               compatible = "ti,tmp275";
>> +               reg = <0x48>;
>> +       };
>> +
>> +       tmp275@49 {
>> +               compatible = "ti,tmp275";
>> +               reg = <0x49>;
>> +       };
>> +
>> +       eeprom@50 {
>> +               compatible = "atmel,24c64";
>> +               reg = <0x50>;
>> +       };
>> +
>> +       eeprom@51 {
>> +               compatible = "atmel,24c64";
>> +               reg = <0x51>;
>> +       };
>> +
>> +       pca6: pca9551@60 {
>> +               compatible = "nxp,pca9551";
>> +               reg = <0x60>;
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +
>> +               gpio-controller;
>> +               #gpio-cells = <2>;
>> +
>> +               gpio@0 {
>> +                       reg = <0>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@1 {
>> +                       reg = <1>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@2 {
>> +                       reg = <2>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@3 {
>> +                       reg = <3>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@4 {
>> +                       reg = <4>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@5 {
>> +                       reg = <5>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@6 {
>> +                       reg = <6>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@7 {
>> +                       reg = <7>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +       };
>> +
>> +       pca7: pca9551@61 {
>> +               compatible = "nxp,pca9551";
>> +               reg = <0x61>;
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +
>> +               gpio-controller;
>> +               #gpio-cells = <2>;
>> +
>> +               gpio@0 {
>> +                       reg = <0>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@1 {
>> +                       reg = <1>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@2 {
>> +                       reg = <2>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@3 {
>> +                       reg = <3>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@4 {
>> +                       reg = <4>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@5 {
>> +                       reg = <5>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@6 {
>> +                       reg = <6>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@7 {
>> +                       reg = <7>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +       };
>> };
>> 
>> &i2c5 {
>> @@ -2028,6 +2266,56 @@
>>                compatible = "atmel,24c64";
>>                reg = <0x51>;
>>        };
>> +
>> +       pca8: pca9551@60 {
>> +               compatible = "nxp,pca9551";
>> +               reg = <0x60>;
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +
>> +               gpio-controller;
>> +               #gpio-cells = <2>;
>> +
>> +               gpio@0 {
>> +                       reg = <0>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@1 {
>> +                       reg = <1>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@2 {
>> +                       reg = <2>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@3 {
>> +                       reg = <3>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@4 {
>> +                       reg = <4>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@5 {
>> +                       reg = <5>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@6 {
>> +                       reg = <6>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +
>> +               gpio@7 {
>> +                       reg = <7>;
>> +                       type = <PCA955X_TYPE_GPIO>;
>> +               };
>> +       };
>> };
>> 
>> &i2c12 {
>> --
>> 1.8.3.1
>>
Andrew Jeffery Feb. 14, 2021, 11:08 p.m. UTC | #5
On Wed, 10 Feb 2021, at 21:46, vishwanatha subbanna wrote:
> 
> 
> > On 16-Nov-2020, at 11:43 AM, Joel Stanley <joel@jms.id.au> wrote:
> > 
> > On Fri, 13 Nov 2020 at 05:59, Vishwanatha Subbanna
> > <vishwa@linux.vnet.ibm.com> wrote:
> >> 
> >> These are LEDs on the cable cards that plug into PCIE slots.
> >> The LEDs are controlled by PCA9552 I2C expander
> >> 
> >> Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
> >> ---
> >> arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 288 +++++++++++++++++++++++++++
> >> 1 file changed, 288 insertions(+)
> >> 
> >> diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> >> index 67c8c40..7de5f76 100644
> >> --- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> >> +++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> >> @@ -696,6 +696,70 @@
> >>                        gpios = <&pca4 7 GPIO_ACTIVE_LOW>;
> >>                };
> >>        };
> >> +
> >> +       leds-optional-cablecard0 {
> > 
> > Is it necessary to have separate nodes for each of the different GPIO devices?
> > 
> > Would it make sense to combine them, or is it better to be separate?
> > 
> > Andrew, Eddie, Brad: please review this one before I merge it.
> 
> I answered this in previous patch set.  If I express ‘em all in one 
> node that is “leds {", then if any of the GPIO is not seen because of 
> not having the card, then the current leds-gpio driver knocks off all 
> the ones on which it successfully acquired the GPIOs also, leaving 
> nothing.

I'm struggling to follow this sentence. Can you please explain what you're 
trying to say in a less colloquial way?

> I did speak to the maintainer and it looked like the behaviour 
> was existing since long time and changing it would break old code.
> 

Break how?

Andrew
Andrew Jeffery Feb. 18, 2021, 10:45 p.m. UTC | #6
On Mon, 15 Feb 2021, at 17:14, vishwanatha subbanna wrote:
> 
> 
> > On 15-Feb-2021, at 4:38 AM, Andrew Jeffery <andrew@aj.id.au> wrote:
> > 
> > 
> > 
> > On Wed, 10 Feb 2021, at 21:46, vishwanatha subbanna wrote:
> >> 
> >> 
> >>> On 16-Nov-2020, at 11:43 AM, Joel Stanley <joel@jms.id.au> wrote:
> >>> 
> >>> On Fri, 13 Nov 2020 at 05:59, Vishwanatha Subbanna
> >>> <vishwa@linux.vnet.ibm.com> wrote:
> >>>> 
> >>>> These are LEDs on the cable cards that plug into PCIE slots.
> >>>> The LEDs are controlled by PCA9552 I2C expander
> >>>> 
> >>>> Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
> >>>> ---
> >>>> arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 288 +++++++++++++++++++++++++++
> >>>> 1 file changed, 288 insertions(+)
> >>>> 
> >>>> diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> >>>> index 67c8c40..7de5f76 100644
> >>>> --- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> >>>> +++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
> >>>> @@ -696,6 +696,70 @@
> >>>>                      gpios = <&pca4 7 GPIO_ACTIVE_LOW>;
> >>>>              };
> >>>>      };
> >>>> +
> >>>> +       leds-optional-cablecard0 {
> >>> 
> >>> Is it necessary to have separate nodes for each of the different GPIO devices?
> >>> 
> >>> Would it make sense to combine them, or is it better to be separate?
> >>> 
> >>> Andrew, Eddie, Brad: please review this one before I merge it.
> >> 
> >> I answered this in previous patch set.  If I express ‘em all in one 
> >> node that is “leds {", then if any of the GPIO is not seen because of 
> >> not having the card, then the current leds-gpio driver knocks off all 
> >> the ones on which it successfully acquired the GPIOs also, leaving 
> >> nothing.
> > 
> > I'm struggling to follow this sentence. Can you please explain what you're 
> > trying to say in a less colloquial way?
> 
> 
> Okay.. So, let me give a bit of background. We have some cards that are 
> optional. What that means is, if the cards are to be inserted, then the 
> system needs to be brought down to put ‘em. Now, there can be N such 
> cards in our system and any of ‘em can be populated or none of ‘em can 
> be populated depending on what user wants.
> 
> Now, let us assume I put global “leds { , compatible = "gpio-leds"; ” 
> section and I describe LEDs of all these N cards along with all the 
> other LEDs on the planar, then leds-gpio driver would populate all the 
> entries in /sys/class/leds/ __if__ all of the N cards that I mentioned 
> are plugged in and their GPIOs can be detected.
> 
> However, take for instance where 1 or more of those cards are not 
> plugged in, then, because there is a failure in detecting those GPIOs, 
> leds-gpio driver will
> discard all other LEDs on which it could successfully acquire the 
> GPIOs. So, there will not be anything in “/sys/class/leds”. So, the way 
> it works is : either -all- or -none-.

Right.

So what's happening is we're using the static description of the hardware in 
the devicetree to describe non-static data. That makes the patch a bit of a 
hack. I'm not terribly enthused about it. Reliance on a specific probe 
behaviour of the leds-gpio driver is not ideal.

The alternative is runtime device creation and driver binding, but then we have 
issues describing the device configuration to the kernel. For LED configuration 
I don't think that's a solved problem, but I'm keen for others to weigh in with 
ideas here.

I think where I land is the devicetree approach is quite distasteful, but 
pragmatic?

I'm torn so I'm going to punt to the maintainer.

Andrew
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
index 67c8c40..7de5f76 100644
--- a/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
@@ -696,6 +696,70 @@ 
 			gpios = <&pca4 7 GPIO_ACTIVE_LOW>;
 		};
 	};
+
+	leds-optional-cablecard0 {
+		compatible = "gpio-leds";
+
+		cablecard0-cxp-top {
+			retain-state-shutdown;
+			default-state = "keep";
+			gpios = <&pca5 0 GPIO_ACTIVE_LOW>;
+		};
+
+		cablecard0-cxp-bot {
+			retain-state-shutdown;
+			default-state = "keep";
+			gpios = <&pca5 1 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	leds-optional-cablecard3 {
+		compatible = "gpio-leds";
+
+		cablecard3-cxp-top {
+			retain-state-shutdown;
+			default-state = "keep";
+			gpios = <&pca6 0 GPIO_ACTIVE_LOW>;
+		};
+
+		cablecard3-cxp-bot {
+			retain-state-shutdown;
+			default-state = "keep";
+			gpios = <&pca6 1 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	leds-optional-cablecard4 {
+		compatible = "gpio-leds";
+
+		cablecard4-cxp-top {
+			retain-state-shutdown;
+			default-state = "keep";
+			gpios = <&pca7 0 GPIO_ACTIVE_LOW>;
+		};
+
+		cablecard4-cxp-bot {
+			retain-state-shutdown;
+			default-state = "keep";
+			gpios = <&pca7 1 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	leds-optional-cablecard10 {
+		compatible = "gpio-leds";
+
+		cablecard10-cxp-top {
+			retain-state-shutdown;
+			default-state = "keep";
+			gpios = <&pca8 0 GPIO_ACTIVE_LOW>;
+		};
+
+		cablecard10-cxp-bot {
+			retain-state-shutdown;
+			default-state = "keep";
+			gpios = <&pca8 1 GPIO_ACTIVE_LOW>;
+		};
+	};
 };
 
 &ehci1 {
@@ -1212,6 +1276,180 @@ 
 		compatible = "atmel,24c64";
 		reg = <0x52>;
 	};
+
+	pca5: pca9551@60 {
+		compatible = "nxp,pca9551";
+		reg = <0x60>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		gpio@0 {
+			reg = <0>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@1 {
+			reg = <1>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@2 {
+			reg = <2>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@3 {
+			reg = <3>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@4 {
+			reg = <4>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@5 {
+			reg = <5>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@6 {
+			reg = <6>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@7 {
+			reg = <7>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+	};
+};
+
+&i2c5 {
+	status = "okay";
+
+	tmp275@48 {
+		compatible = "ti,tmp275";
+		reg = <0x48>;
+	};
+
+	tmp275@49 {
+		compatible = "ti,tmp275";
+		reg = <0x49>;
+	};
+
+	eeprom@50 {
+		compatible = "atmel,24c64";
+		reg = <0x50>;
+	};
+
+	eeprom@51 {
+		compatible = "atmel,24c64";
+		reg = <0x51>;
+	};
+
+	pca6: pca9551@60 {
+		compatible = "nxp,pca9551";
+		reg = <0x60>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		gpio@0 {
+			reg = <0>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@1 {
+			reg = <1>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@2 {
+			reg = <2>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@3 {
+			reg = <3>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@4 {
+			reg = <4>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@5 {
+			reg = <5>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@6 {
+			reg = <6>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@7 {
+			reg = <7>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+	};
+
+	pca7: pca9551@61 {
+		compatible = "nxp,pca9551";
+		reg = <0x61>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		gpio@0 {
+			reg = <0>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@1 {
+			reg = <1>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@2 {
+			reg = <2>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@3 {
+			reg = <3>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@4 {
+			reg = <4>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@5 {
+			reg = <5>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@6 {
+			reg = <6>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@7 {
+			reg = <7>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+	};
 };
 
 &i2c5 {
@@ -2028,6 +2266,56 @@ 
 		compatible = "atmel,24c64";
 		reg = <0x51>;
 	};
+
+	pca8: pca9551@60 {
+		compatible = "nxp,pca9551";
+		reg = <0x60>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		gpio@0 {
+			reg = <0>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@1 {
+			reg = <1>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@2 {
+			reg = <2>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@3 {
+			reg = <3>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@4 {
+			reg = <4>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@5 {
+			reg = <5>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@6 {
+			reg = <6>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+
+		gpio@7 {
+			reg = <7>;
+			type = <PCA955X_TYPE_GPIO>;
+		};
+	};
 };
 
 &i2c12 {