mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* gpio-hog names
@ 2026-09-06 19:05 Frank Wunderlich
  2026-09-16 13:32 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Wunderlich @ 2026-09-06 19:05 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gpio-hog names
  2026-09-06 19:05 gpio-hog names Frank Wunderlich
@ 2026-09-16 13:32 ` Linus Walleij
  2026-09-17  9:26   ` Frank Wunderlich
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2026-09-16 13:32 UTC (permalink / raw)
  To: Frank Wunderlich; +Cc: Bartosz Golaszewski, linux-gpio, linux-kernel

On Sun, Sep 6, 2026 at 9:05 PM Frank Wunderlich
<frank.wunderlich@linux.dev> wrote:

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

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

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

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gpio-hog names
  2026-09-16 13:32 ` Linus Walleij
@ 2026-09-17  9:26   ` Frank Wunderlich
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Wunderlich @ 2026-09-17  9:26 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Bartosz Golaszewski, linux-gpio, linux-kernel

Hi

Thanks Linux for your answer.

Am 16. September 2026 um 15:32 schrieb "Linus Walleij" <linusw@kernel.org>:

> 
> On Sun, Sep 6, 2026 at 9:05 PM Frank Wunderlich
> <frank.wunderlich@linux.dev> wrote:
> 
> > 
> > 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
...

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

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

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

> 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?

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-17  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-06 19:05 gpio-hog names Frank Wunderlich
2026-09-16 13:32 ` Linus Walleij
2026-09-17  9:26   ` Frank Wunderlich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®