lkml.org 
[lkml]   [2021]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] gpio: mt7621: support gpio-line-names property
On Sun, Jun 27, 2021 at 1:56 PM Sergio Paracuellos
<sergio.paracuellos@gmail.com> wrote:
> On Sun, Jun 27, 2021 at 12:51 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Sun, Jun 27, 2021 at 12:47 PM Sergio Paracuellos
> > <sergio.paracuellos@gmail.com> wrote:
> > > On Sun, Jun 27, 2021 at 11:33 AM Andy Shevchenko
> > > <andy.shevchenko@gmail.com> wrote:
> > > > On Sat, Jun 26, 2021 at 7:18 PM Sergio Paracuellos
> > > > <sergio.paracuellos@gmail.com> wrote:
> > > > >
> > > > > The default handling of the gpio-line-names property by the
> > > > > gpiolib-of implementation does not work with the multiple
> > > > > gpiochip banks per device structure used by the gpio-mt7621
> > > > > driver.
> > > > >
> > > > > This commit adds driver level support for the device tree
> > > > > property so that GPIO lines can be assigned friendly names.
> >
> > > > > This driver has three gpiochips with 32 gpios each. Core implementation
> > > >
> > > > implementation
> > > >
> > > >
> > > > > got gpio's repeated along each gpio chip if chip.names is not assigned.
> > > > > To avoid this behaviour driver will set this names as empty or
> > > >
> > > > the driver
> > > > these names
> > > >
> > > > > with desired friendly line names. Consider the following sample with
> > > > > minimal entries for the first chip with this patch changes applied:
> > > >
> > > > The same comment as per v1:
> > > >
> > > > Any idea why it's not a duplicate of
> > > > https://elixir.bootlin.com/linux/v5.13-rc7/C/ident/devprop_gpiochip_set_names,
> > > > and why the latter is not called in your case?
> > >
> > > The core properly calls this function but not in the way expected.
> > > This driver implements three banks of 32 gpios each internally using
> > > one gpiochip per bank, all of them in the same device. So the core
> > > code you are pointing out here duplicates the same names along the
> > > three gpiochips which is not the expected behaviour. So implementing
> > > in this way and setting names at least reserved avoids the core code
> > > to be run and also avoids the duplication getting expected behaviour
> > > for all the banks and each line friendly name.
> >
> > Isn't it the problem of how we supply fwnode in that case?
> > Another possibility is to fix DT (although I'm not sure it's now possible).
>
> Since the fwnode is the same for all banks of the same device, each bank
> repeats the first MTK_BANK_WIDTH label names in each bank.

Can you point out the DT in question?

> This commit populates the gc.names member of each bank from the
> device-tree node within the driver. This overrides the default behavior
> since devprop_gpiochip_set_names() will only be called if names is NULL.

I believe this commit is not needed in the proposed (i.e. duplication) shape.
The fwnode supports primary and secondary ones. Thus, we may create a
pair of fwnodes when they will unify properties per device with
properties per child together (child is primary and device, i.e.
parent, is secondary).

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-06-27 15:01    [W:0.052 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site