Skip to contentSkip to conversation

gpio-hog names

DISCUSSION Frank Wunderlich 2 participants 4 messages Sep 6 – Sep 30 GPIO

lore
Share & tools
lore
#0 lore raw

Hi,

Until v7.0, GPIO hogs inherited the DT node name when no line-name property was specified. This was implemented as a fallback in of_parse_own_gpio().

Commit d1d564ec4992 ("gpio: move hogs into GPIO core") moved hog parsing into the GPIO core and removed this fallback.

Consequently, GPIO hogs without a line-name property are now displayed with a ? in /sys/kernel/debug/gpio.

Is this an intentional change, or should the fallback to the DT node name be retained?

regards Frank

maintainer
#1 lore raw
Quoted 1 line · Frank Wunderlich

Until v7.0, GPIO hogs inherited the DT node name

Where? In debugfs? /sys/kernel/debug/gpio?

Quoted 9 lines

when no line-name
property was specified. This was implemented as a fallback in of_parse_own_gpio().

Commit d1d564ec4992 ("gpio: move hogs into GPIO core") moved hog parsing into the GPIO core and removed this fallback.

Consequently, GPIO hogs without a line-name property are now displayed with a ? in /sys/kernel/debug/gpio.

It seems like so...

Quoted 2 lines

Is this an intentional change, or should the fallback to the DT node name be retained?

No reason to since debugfs is not ABI.

But if you think that *looks better* then by all means send a patch!

Yours,
Linus Walleij

#2 lore raw

Hi

Thanks Linux for your answer.

Am 16. September 2026 um 15:32 schrieb "Linus Walleij" <[email protected]>:

Quoted 8 lines
Quoted 3 lines · Frank Wunderlich

Until v7.0, GPIO hogs inherited the DT node name

Where? In debugfs? /sys/kernel/debug/gpio?

yes, for me it is the preferred way to verify gpio-states...is there another way to see the names (unit-name from dt) except dtc decompile (where i had to search the gpio-number in hex)?

I only know gpioinfo, but here all gpio are "unnamed", also when line-name is set in the hog.

and for 63/79 i see only this with gpioinfo (without line-name):

        line  63:       unnamed                 output consumer=?
        line  79:       unnamed                 output consumer=?

with line-name it looks like this:

        line  63:       unnamed                 output consumer=pcie3-cn14-hog
        line  79:       unnamed                 output consumer=pcie2-cn15-hog

It looks like this shows only the line-names property on gpio-controller itself (have done this on the pca9555 i2c-gpio) where it looks like this:

gpiochip1 - 16 lines:

        line   0:       "BKEY-A-PDN"            input
        line   1:       "BKEY-A-Vset"           input
        line   2:       "BKEY-B-PDN"            input
        line   3:       "BKEY-B-Vset"           input
        line   4:       "BKEY-C-PDN"            input

...

Quoted 5 lines
Quoted 5 lines

when no line-name
property was specified. This was implemented as a fallback in of_parse_own_gpio().

Quoted 7 lines
Quoted 6 lines

Commit d1d564ec4992 ("gpio: move hogs into GPIO core") moved hog parsing into the GPIO core and removed this fallback.

Consequently, GPIO hogs without a line-name property are now displayed with a ? in /sys/kernel/debug/gpio.

It seems like so...

just an example on my r4pro (8x) with pcie2/3-hog

defined like this (mix with overlay - basedt only defines hog+gpio, overlay output+name) [1]

	/* 1L0 0=key-b (CN15), 1=key-m (CN13) */
	pcie-2-hog {
		gpio-hog;
		gpios = <79 GPIO_ACTIVE_HIGH>;
		//defined in my local overlay
		output-low;
		line-name = "pcie2-cn15-hog";
	};

	/* 1L1 0=key-b (CN18), 1=key-m (CN14) */
	pcie-3-hog {
		gpio-hog;
		gpios = <63 GPIO_ACTIVE_HIGH>;
		//defined in my local overlay
		output-high;
		line-name = "pcie3-cn14-hog";
	};
root@bpi-r4:~# uname -a
Linux bpi-r4 7.0.0-bpi-r4-main #1 SMP PREEMPT Wed Apr 29 19:40:09 CEST 2026 aarch64 GNU/Linux
root@bpi-r4:~# cat /sys/kernel/debug/gpio 
gpiochip0: 84 GPIOs, parent: platform/1001f000.pinctrl, pinctrl_moore:
 gpio-0   (                    |tx-disable          ) in  lo 
 gpio-1   (                    |mod-def0            ) in  hi IRQ ACTIVE LOW
 gpio-2   (                    |los                 ) in  hi IRQ 
 gpio-12  (                    |cd                  ) in  lo IRQ ACTIVE LOW
 gpio-13  (                    |reset               ) in  hi IRQ ACTIVE LOW
 gpio-14  (                    |WPS                 ) in  hi IRQ ACTIVE LOW
 gpio-21  (                    |tx-disable          ) in  lo 
 gpio-63  (                    |pcie-3-hog          ) out hi 
 gpio-69  (                    |mod-def0            ) in  hi IRQ ACTIVE LOW
 gpio-70  (                    |los                 ) in  hi IRQ 
 gpio-79  (                    |pcie-2-hog          ) out lo 
 gpio-82  (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-83  (                    |PHY reset           ) out hi ACTIVE LOW
root@bpi-r4:~# uname -a
Linux bpi-r4 7.1.0-bpi-r4-main #4 SMP PREEMPT Sun Aug  2 23:22:35 CEST 2026 aarch64 GNU/Linux
root@bpi-r4:~# cat /sys/kernel/debug/gpio 
gpiochip0: 84 GPIOs, parent: platform/1001f000.pinctrl, pinctrl_moore:
 gpio-0   (                    |tx-disable          ) in  lo 
 gpio-1   (                    |mod-def0            ) in  hi IRQ ACTIVE LOW
 gpio-2   (                    |los                 ) in  hi IRQ 
 gpio-3   (                    |?                   ) out lo 
 gpio-12  (                    |cd                  ) in  lo IRQ ACTIVE LOW
 gpio-13  (                    |reset               ) in  hi IRQ ACTIVE LOW
 gpio-14  (                    |WPS                 ) in  hi IRQ ACTIVE LOW
 gpio-21  (                    |tx-disable          ) in  lo 
 gpio-54  (                    |?                   ) out hi 
 gpio-63  (                    |?                   ) out hi 
 gpio-69  (                    |mod-def0            ) in  hi IRQ ACTIVE LOW
 gpio-70  (                    |los                 ) in  hi IRQ 
 gpio-79  (                    |?                   ) out lo 
 gpio-82  (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-83  (                    |PHY reset           ) out hi ACTIVE LOW
Quoted 5 lines
Quoted 4 lines

Is this an intentional change, or should the fallback to the DT node name
be retained?

No reason to since debugfs is not ABI.

Imho it makes things easier without looking in schematics or dts to find the right gpio :) And it does not require changing dts to see the name again.

in my current codebase i have added the line-name property to all hogs, so here it looks like this:

Linux bpi-r4 7.3.0-rc1-bpi-r4 #1 SMP PREEMPT Wed Sep 16 20:45:17 CEST 2026 aarch64 GNU/Linux

root@bpi-r4:~# cat /sys/kernel/debug/gpio 
gpiochip0: 84 GPIOs, parent: platform/1001f000.pinctrl, pinctrl_moore:
 gpio-0   (                    |tx-disable          ) in  lo 
 gpio-1   (                    |mod-def0            ) in  hi IRQ ACTIVE LOW
 gpio-2   (                    |los                 ) in  hi IRQ 
 gpio-3   (                    |wan-phy-hog         ) out lo 
 gpio-12  (                    |cd                  ) in  lo IRQ ACTIVE LOW
 gpio-13  (                    |reset               ) in  hi IRQ ACTIVE LOW
 gpio-14  (                    |WPS                 ) in  hi IRQ ACTIVE LOW
 gpio-21  (                    |tx-disable          ) in  lo 
 gpio-54  (                    |lan-phy-hog         ) out hi 
 gpio-63  (                    |pcie3-cn14-hog      ) out hi 
 gpio-69  (                    |mod-def0            ) in  hi IRQ ACTIVE LOW
 gpio-70  (                    |los                 ) in  hi IRQ 
 gpio-79  (                    |pcie2-cn15-hog      ) out lo 
 gpio-82  (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-83  (                    |PHY reset           ) out hi ACTIVE LOW
Quoted 1 line

But if you think that *looks better* then by all means send a patch!

I have not yet looked how to get the previous fallback back, but if this is the preferred way i can do it.
Just wanted to point to it and get opinion what's the best way to handle.

From my PoV i would send DTS patch adding the line-name properties as fix (for backporting), but i guess this behavour will affect other users/boards too where imho a driver/framework patch makes more sense (will not "fix" gpioinfo).
So better patch both?

Quoted 3 lines

Yours,
Linus Walleij

regards Frank

[1]
https://github.com/frank-w/BPI-Router-Linux/blob/7.3-rc/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-pro.dtsi#L589
https://github.com/frank-w/BPI-Router-Linux/blob/7.3-rc/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-pro-cn14.dtso
https://github.com/frank-w/BPI-Router-Linux/blob/7.3-rc/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-pro-cn15.dtso

maintainer
#3 lore raw
Quoted 10 lines · Frank Wunderlich
Quoted 1 line

But if you think that *looks better* then by all means send a patch!

I have not yet looked how to get the previous fallback back, but if this is the preferred way i can do it.
Just wanted to point to it and get opinion what's the best way to handle.

From my PoV i would send DTS patch adding the line-name properties as fix (for backporting), but i guess this behavour will affect other users/boards too where imho a driver/framework patch makes more sense (will not "fix" gpioinfo).
So better patch both?

I don't know, can only judge from seeing the patches.

Fix it so it looks like you want it and people will review it.

Yours,
Linus Walleij