[PATCH] gpiolib: fix gpio-hog functionality

Marco Felsch m.felsch at pengutronix.de
Thu Jun 1 10:13:15 PDT 2023

On 23-06-01, Jules Maselbas wrote:
> On Thu, Jun 01, 2023 at 04:32:09PM +0200, Sascha Hauer wrote:
> > On Thu, Jun 01, 2023 at 04:25:06PM +0200, Marco Felsch wrote:
> > > This reverts commit 3641d381e63321016e3bf09504852a6b2a2f879b.
> > > 
> > > Since the of_xlate support the gpio-hog support is broken because the
> > > 'gpio' property used to specify the gpio-hog pin does not contain any
> > > phandle. Due to the fact that of_xlate was never implemented the easiest
> > > way to fix the gpio-hog functionality is to revert the commit.
> > 
> > 3641d381e63321016e3bf09504852a6b2a2f879b was introduced for sunxi. As
> > Jules is currently working on sunxi support this is likely needed soon,
> > so what's the second easiest way?
> I am not very familiar with the gpio-hog concept, what I understand is:
> "gpio-hog" are a description of gpios config to be initialized early on.
> The main difference with classic gpio is the omission of the phandle of
> the gpio controller (since gpio-hog are expected to be a child node of
> gpio controller). Correct me if I am wrong.

Correct hogs are used if you have a static gpio e.g. a power-switch
which is never turned off.

> In this case the current version of of_hog_gpio fails since it calls
> of_parse_phandle_with_args which expect the gpio to start with the controller
> phandle.


> My best guess would be to rework of_hog_gpio to not use of_parse_phandle_with_args
> and probably not gpio_of_xlate

This would be a partly revert of your commit.

> This sounds easier than a sync of barebox gpio code with linux.

You don't need to sync the complete code, let me check if I can prepare
a patch which adds the of_xlate support and is a bit more in sync with
the kernel. If this is not possible I go with the partly revert.


More information about the barebox mailing list