All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frank Wunderlich" <frank.wunderlich@linux.dev>
To: "Linus Walleij" <linusw@kernel.org>
Cc: "Bartosz Golaszewski" <brgl@kernel.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: gpio-hog names
Date: Thu, 17 Sep 2026 09:26:52 +0000	[thread overview]
Message-ID: <e4a859da5ab7f40d9de53dfe605d29f510d1f1f2@linux.dev> (raw)
In-Reply-To: <CAD++jL=KoKd4gLcyxuTTT904oR=EFeVkqQF-iD6qcc-GwQ39ug@mail.gmail.com>

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

  reply	other threads:[~2026-09-17  9:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2026-09-30 13:13     ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4a859da5ab7f40d9de53dfe605d29f510d1f1f2@linux.dev \
    --to=frank.wunderlich@linux.dev \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.