How to find the GPIO ID of the leds in a DTS

Hi
I am trying to make a new DTS
For the "leds" part, how to determine which led is which gpio ID ?

For instance, in the following:

               lan {
                       label = "lan";
                       function = LED_FUNCTION_LAN;
                       color = <LED_COLOR_ID_GREEN>;
                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
               };

where to find that 14 is the GPIO of the LAN led ?

Thank you

You can export gpios in devfs by writing numbers into sys/class/gpio/export
Then look at gpiochip0-13 and the gpio14 character device should be there.
Or /sys/class/leds have only led controls
Or Lucy/System/Leds for more high level config.

Don't understant.
What do you mean by "writing numbers to xx" ?
What is gpiochip0-13 ?

If you're trying to make a DTS for unsupported device, start from running
cat /sys/kernel/debug/gpio on the device running OEM firmware.
If you want to test or detect the LEDs - refer to this wiki article.
In either case it will be good to know details about the device, why "make a new DTS", etc.

1 Like

cat /sys/kernel/debug/gpio return the values I set in the DTS
But how to find the actual values ?
(yes, a dts for an unsupported device)

If you mean running a command on the original firmware, it is indeed impossible (as there is no open root access)