Skip to contentSkip to conversation

leds-gpio: no GPIO labels (in debugfs)

DISCUSSION Alexander Stein 3 participants 3 messages Nov 30, 2016 – Dec 2, 2016 LED

lore
Share & tools
lore
#0 lore raw

Hi,

I jut noticed that the used GPIOs for leds-gpio do not have an actual label which is visible in debugfs (/sys/kernel/debug/gpio):

Quoted 7 lines

gpiochip4: GPIOs 368-383, parent: spi/spi0.2, mcp23s17, can sleep:

 gpio-369 P0.1 (?           ) out hi
 gpio-370 P0.2 (?           ) out lo
 gpio-371 P0.3 (?           ) out lo
 gpio-372 P0.4 (?           ) out lo
 gpio-373 P0.5 (?           ) out lo
 gpio-374 P0.6 (?           ) out lo

The reason is that the call to devm_get_gpiod_from_child() in gpio_leds_create() eventually calls "gpiod_request(desc, NULL);" in fwnode_get_named_gpiod. So no label attached to GPIO, hence "?" output.

As we have already a gpiod in create_gpio_led(), devm_gpio_request_one() with the proper label is not called.
I don't know much of that code, so what would be needed to have a proper GPIO label? And how?

Best regards,
Alexander Stein

Signature · 17 lines
Dipl.-Inf. Alexander Stein
SYS TEC electronic GmbH
[email protected]

Legal and Commercial Address:
Am Windrad 2
08468 Heinsdorfergrund
Germany

Office: +49 (0) 3765 38600-0
Fax:    +49 (0) 3765 38600-4100
 
Managing Directors:
	Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt;
	Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp
Commercial Registry:
	Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010
#1 lore raw

Hi Alexander,

Quoted 12 lines · Alexander Stein

Hi,

I jut noticed that the used GPIOs for leds-gpio do not have an actual label which is visible in debugfs (/sys/kernel/debug/gpio):

Quoted 7 lines

gpiochip4: GPIOs 368-383, parent: spi/spi0.2, mcp23s17, can sleep:

 gpio-369 P0.1 (?           ) out hi
 gpio-370 P0.2 (?           ) out lo
 gpio-371 P0.3 (?           ) out lo
 gpio-372 P0.4 (?           ) out lo
 gpio-373 P0.5 (?           ) out lo
 gpio-374 P0.6 (?           ) out lo
Quoted 8 lines

The reason is that the call to devm_get_gpiod_from_child() in gpio_leds_create() eventually calls "gpiod_request(desc, NULL);" in fwnode_get_named_gpiod. So no label attached to GPIO, hence "?" output.

As we have already a gpiod in create_gpio_led(), devm_gpio_request_one() with the proper label is not called.
I don't know much of that code, so what would be needed to have a proper GPIO label? And how?

From the LED subsystem perspective everything looks OK both in the case when label is defined and without it (node name is used for the LED class device name then).

Since this seems to be an issue within GPIOLIB internals, I'm adding Linus Walleij.

Signature · 2 lines
Best regards,
Jacek Anaszewski
#2 lore raw
Quoted 25 lines · Jacek Anaszewski
Quoted 16 lines · Alexander Stein

I jut noticed that the used GPIOs for leds-gpio do not have an actual label
which is visible in debugfs (/sys/kernel/debug/gpio):

Quoted 8 lines

gpiochip4: GPIOs 368-383, parent: spi/spi0.2, mcp23s17, can sleep:

 gpio-369 P0.1 (?           ) out hi
 gpio-370 P0.2 (?           ) out lo
 gpio-371 P0.3 (?           ) out lo
 gpio-372 P0.4 (?           ) out lo
 gpio-373 P0.5 (?           ) out lo
 gpio-374 P0.6 (?           ) out lo

The reason is that the call to devm_get_gpiod_from_child() in gpio_leds_create() eventually calls "gpiod_request(desc, NULL);" in fwnode_get_named_gpiod. So no label attached to GPIO, hence "?" output.

Quoted 6 lines

As we have already a gpiod in create_gpio_led(), devm_gpio_request_one() with
the proper label is not called.
I don't know much of that code, so what would be needed to have a proper GPIO
label? And how?

Quoted 6 lines

From the LED subsystem perspective everything looks OK both in the case when label is defined and without it (node name is used for the LED class device name then).

Since this seems to be an issue within GPIOLIB internals, I'm adding Linus Walleij.

The consumer label is entirely optional, it's just a very nice thing to get right for debugging and feeling you have everything in check on the system.

So it's not a bug, it is an optional feature.

If you want to fix it better looking I guess dig into the code :)

Yours,
Linus Walleij