Re: [PATCH v2] gpio: mt7621: support gpio-line-names property

From: Sergio Paracuellos
Date: Fri Jul 02 2021 - 07:31:13 EST


Hi Linus,

On Fri, Jul 2, 2021 at 12:18 PM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
>
> On Fri, Jul 2, 2021 at 11:40 AM Sergio Paracuellos
> <sergio.paracuellos@xxxxxxxxx> wrote:
> > On Fri, Jul 2, 2021 at 11:27 AM Andy Shevchenko
> > <andy.shevchenko@xxxxxxxxx> wrote:
>
> > > > There are no child nodes, all the stuff is in the same parent node
> > > > and, as I said, belongs to the same device but internally uses three
> > > > gpiochips.
> > >
> > > And it can't be split into three children in the overlay?
> >
> > Original code before this being mainlined was using three children and
> > I was told in the review that three children were not allowed:
> >
> > See https://patchwork.ozlabs.org/project/linux-gpio/patch/1527924610-13135-3-git-send-email-sergio.paracuellos@xxxxxxxxx/#1932827
>
> Yeah this is one of those unfortunate cases where the DT representation
> (or ACPI for that matter) of the device and the Linux internal representation
> differs.
>
> > > Let's assume it can't, then the GPIO library function should be
> > > refactored in a way that it takes parameters like base index for the
> > > names and tries to satisfy the caller.
> >
> > Bartosz, Linus, any thoughts on this?
>
> This would be ideal, is there a reasonably simple way to get to this helper?
>
> In gpiolib.c devprop_gpiochip_set_names() need to be refactored to
> take a base number, devprop_gpiochip_set_names_base() that
> function exposed in <linux/gpio/driver.h> and then the old function
> devprop_gpiochip_set_names() wrapped in the new
> one so all old users continue to work without modification.
> Sprinkle some kerneldoc on top so we do not make mistakes
> in the future.
>
> This should work I think.
>
> Any similar drivers (several gpio_chip per FW node) that want to
> set line names need to do the same thing.

Thanks for the advices. I'll try to make a bit of time to try to
handle this in the way you are pointing out here.

Best regards,
Sergio Paracuellos

>
> Sorry that you ran into this, I hate it when I'm first at hairy stuff
> like this.
>
> Yours,
> Linus Walleij