lkml.org 
[lkml]   [2022]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mfd: stmpe: switch to using gpiod API
On Tue, Sep 06, 2022 at 01:29:21PM +0200, Linus Walleij wrote:
> On Tue, Sep 6, 2022 at 12:11 PM Francesco Dolcini
> <francesco.dolcini@toradex.com> wrote:
> > On Mon, Sep 05, 2022 at 10:01:47PM -0700, Dmitry Torokhov wrote:
> > > This patch switches the driver away from legacy gpio/of_gpio API to
> > > gpiod API, and removes use of of_get_named_gpio_flags() which I want to
> > > make private to gpiolib.
> > >
> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > ---
> > > drivers/mfd/stmpe.c | 36 +++++++++++++-----------------------
> > > 1 file changed, 13 insertions(+), 23 deletions(-)
> > >
> > > diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> > > index 987e251d90ae..0c4f74197d3e 100644
> > > --- a/drivers/mfd/stmpe.c
> > > +++ b/drivers/mfd/stmpe.c
> > > @@ -8,14 +8,13 @@
> > > */
> > >
> >
> > <snip>
> >
> > > - pdata->irq_gpio = of_get_named_gpio_flags(np, "irq-gpio", 0,
> > <snip>
> > > + irq_gpio = devm_gpiod_get_optional(ci->dev, "irq", GPIOD_ASIS);
> > isn't this changing from irq-gpio to irq-gpios property name?
>
> The gpiolib core will automatically append and test the strings
> *-gpios and *-gpio (in that order)
>
> > in the DTS files we do have something like that:
> >
> > irq-gpio = <&gpio TEGRA_GPIO(V, 0) IRQ_TYPE_LEVEL_LOW>;
>
> This seems to be an orthogonal bug.
>
> That flag in the last cell is invalid for a GPIO, the DT schema should
> scream at you if you have one. GPIO flags are
> GPIO_ACTIVE_LOW, GPIO_OPEN_DRAIN etc. That looks more
> like an IRQ, and then the property should be irqs = <...>.

Francesco is right though in the sense that we need to update DTS
together with the patch, or we will break the driver... The original
code relied on the fact that flags returned by of_get_named_gpio_flags()
could contain anything, not necessarily valid GPIO flags.

Thanks.

--
Dmitry

\
 
 \ /
  Last update: 2022-09-06 20:18    [W:0.359 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site