linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: pavel@ucw.cz, dmurphy@ti.com, linux-leds@vger.kernel.org,
	Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Subject: Re: Leds-gpio discarding the entries in /sys/class/leds : Linux 5.4.38
Date: Sat, 20 Jun 2020 22:55:46 +0530	[thread overview]
Message-ID: <6644A4B6-E6DA-413B-97CA-1E4D199D52CE@linux.vnet.ibm.com> (raw)
In-Reply-To: <124c90ad-e239-d5e8-4c86-be96e7aa7c26@gmail.com>

Hi Jacek,

Thank you very much for the quick response. Greatly appreciate that.

> On 20-Jun-2020, at 3:27 AM, Jacek Anaszewski <jacek.anaszewski@gmail.com> wrote:
> 
> Hi Vishwanatha,
> 
> Please refer to Documentation/devicetree/bindings/leds/leds-pca955x.txt.
> 
> At first glance I don't get why you have gpio-leds node, which is for
> leds-gpio driver.

Not sure I understood it right.. But if you are asking me why I have "leds {"  and “gpio-leds” in there, then it is to get the entries in /sys/class/leds.
The GPIOs from PCA9552 are connected to LED. Also, that is how we have had in the past, and that worked.

Example: https://github.com/openbmc/linux/blob/dev-5.4/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts#L115

The problem I am running into is for : https://github.com/openbmc/linux/blob/dev-5.4/arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts

> 
> On 6/19/20 3:34 PM, Vishwanatha Subbanna wrote:
>> Hello,
>> I am Vishwanath, working with IBM and looking for your help on one of the issues that I am running into. Would really appreciate help on this. I run Linux 5.4.38
>> I have 2 number of PCA9552 chips, one on the Planar and other on the card that is optionally pluggable. The optional card must be plugged prior to booting and is not hot pluggable. In my experiment, I am running *without* the optional card plugged in.
>> In the device tree, I have a "leds {" section that looks like below for the PCA9552 that is on the planar and everything works fine and I can see /sys/class/leds/fan0
>>  leds {
>>         compatible = "gpio-leds”;
>>         fan0 {
>>             retain-state-shutdown;
>>             default-state = "keep";
>>             gpios = <&pca0 0 GPIO_ACTIVE_LOW>;
>>         };
>> };
>> &i2c7 {
>>     status = "okay”;
>>     pca0: pca9552@61 {
>>        compatible = "nxp,pca9552";
>>         reg = <0x61>;
>>         #address-cells = <1>;
>>         #size-cells = <0>;
>>         gpio-controller;
>>         #gpio-cells = <2>;
>>         gpio@0 {
>>             reg = <0>;
>>             type = <PCA955X_TYPE_GPIO>;
>>      	};
>>     };
>> };
>> Similarly, if I update the device tree entry for PCA9552 for the card that is optionally pluggable, then I don’t see any leds entries in /sys/class/leds.
> 
> Please share your DT node after the update.
> 

Pasting the GPIO_0 entry only here for brevity.

leds {
        compatible = "gpio-leds”;

        fan0 {
            retain-state-shutdown;
            default-state = "keep";
            gpios = <&pca0 0 GPIO_ACTIVE_LOW>;
        };

        nvmeslot0 {
            retain-state-shutdown;
            default-state = "keep";
            gpios = <&pca1 0 GPIO_ACTIVE_LOW>;
        };
};

&i2c7 {
    status = "okay”;
    pca0: pca9552@61 {
       compatible = "nxp,pca9552";
        reg = <0x61>;
        #address-cells = <1>;
        #size-cells = <0>;
        gpio-controller;
        #gpio-cells = <2>;

        gpio@0 {
            reg = <0>;
            type = <PCA955X_TYPE_GPIO>;
     	};
    };
};

&i2c13
{
    pca1: pca9552@60 {
       compatible = "nxp,pca9552";
       reg = <0x60>;
       #address-cells = <1>;
       #size-cells = <0>;

       gpio-controller;
       #gpio-cells = <2>;

       gpio@0 {
           reg = <0>;
           type = <PCA955X_TYPE_GPIO>;
       };
    };
};

Thanks
!! Vishwa !!

>> I don’t even see “fan0” that is on the PCA9552 on planar also. I was expecting that I should see “/sys/class/leds/fan0”.
>> However, I could see all the entries in “/proc/device-tree/leds”.
>> Data from the failure.
>> [    7.895757] leds-pca955x 7-0061: leds-pca955x: Using pca9552 16-bit LED driver at slave address 0x61
>> [    7.907659] leds-pca955x 7-0061: gpios 168...183
>> [    7.913012] leds-pca955x 13-0060: leds-pca955x: Using pca9552 16-bit LED driver at slave address 0x60
>> [    7.923486] leds-pca955x 13-0060: pca955x_write_pwm: reg 0x0, val 0x80, err -6
>> [    7.931695] leds-pca955x 14-0060: leds-pca955x: Using pca9552 16-bit LED driver at slave address 0x60
>> [    7.942138] leds-pca955x 14-0060: pca955x_write_pwm: reg 0x0, val 0x80, err -6
>> [    7.950320] leds-pca955x 15-0060: leds-pca955x: Using pca9552 16-bit LED driver at slave address 0x60
>> root@bmc:/sys/class/gpio/# ls -l
>> lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip168 -> ../../devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-7/7-0061/gpio/gpiochip168
>> root@bmc:/sys/class/gpio/gpiochip168/device# ls -l
>> lrwxrwxrwx    1 root     root             0 Jun  3 22:03 driver -> ../../../../../../../../bus/i2c/drivers/leds-pca955x
>> drwxr-xr-x    3 root     root             0 Jan  1  1970 gpio
>> drwxr-xr-x    3 root     root             0 Jan  1  1970 gpiochip3
>> -r--r--r--    1 root     root          4096 Jun  3 22:03 modalias
>> -r--r--r--    1 root     root          4096 Jan  1  1970 name
>> lrwxrwxrwx    1 root     root             0 Jun  3 22:03 of_node -> ../../../../../../../../firmware/devicetree/base/ahb/apb/bus@1e78a000/i2c-bus@400/pca9552@61
>> drwxr-xr-x    2 root     root             0 Jun  3 22:03 power
>> lrwxrwxrwx    1 root     root             0 Jan  1  1970 subsystem -> ../../../../../../../../bus/i2c
>> -rw-r--r--    1 root     root          4096 Jan  1  1970 uevent
>> root@bmc:/sys/class/gpio/gpiochip168/device# ls -l gpio
>> Thank you,
>> !! Vishwa !!
> 
> -- 
> Best regards,
> Jacek Anaszewski


  reply	other threads:[~2020-06-20 17:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 13:34 Leds-gpio discarding the entries in /sys/class/leds : Linux 5.4.38 Vishwanatha Subbanna
2020-06-19 21:57 ` Jacek Anaszewski
2020-06-20 17:25   ` Vishwanatha Subbanna [this message]
2020-06-21 21:42     ` Jacek Anaszewski
2020-06-22  6:58       ` Vishwanatha Subbanna
2020-06-22 10:54         ` Jacek Anaszewski
2020-06-22 11:01           ` Jacek Anaszewski
2020-06-26 13:04             ` Vishwanatha Subbanna
2020-06-22 11:07           ` Vishwanatha Subbanna
2020-06-22 11:36             ` Jacek Anaszewski
     [not found]               ` <F6E7B2CD-3871-4C41-A7F0-8A77E824D155@linux.vnet.ibm.com>
2020-06-22 18:13                 ` Vishwanatha Subbanna
2020-06-22 20:08                 ` Jacek Anaszewski

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=6644A4B6-E6DA-413B-97CA-1E4D199D52CE@linux.vnet.ibm.com \
    --to=vishwa@linux.vnet.ibm.com \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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).