Leds-gpio discarding the entries in /sys/class/leds : Linux 5.4.38

Vishwanatha Subbanna
2020-06-19T13:36:45Z

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.
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 !!