Re: [PATCH v3 3/6] gpio: max77620: Don't set of_node

From: Andy Shevchenko
Date: Thu Jul 09 2020 - 05:08:02 EST


On Thu, Jul 9, 2020 at 12:44 AM Dmitry Osipenko <digetx@xxxxxxxxx> wrote:
> 08.07.2020 23:57, Andy Shevchenko ÐÐÑÐÑ:
> > On Wednesday, July 8, 2020, Dmitry Osipenko <digetx@xxxxxxxxx
> > <mailto:digetx@xxxxxxxxx>> wrote:

...

> > I gave a second look and I think my suggestion is wrong. Here is an
> > interesting propagation of the parent device node to its grand son,
> > leaving sonâs one untouched. Original code has intentions to do that way.
>
> The [1] says that gpio_chip.parent should point at the "device providing
> the GPIOs".

Yes, physical device I believe.

> That's the pdev->dev.parent in the case of this driver.
> MAX77620 is an MFD PMIC device that has virtual sub-devices like GPIO
> controller, PINCTRL and RTC. The MFD is the parent device that provides
> the GPIOs [2].
>
> [1]
> https://elixir.bootlin.com/linux/v5.8-rc3/source/include/linux/gpio/driver.h#L276
>
> [2]
> https://elixir.bootlin.com/linux/v5.8-rc3/source/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi#L48
>
> I think the old code was wrong and this patch is correct, please correct
> me if I'm missing something.

Hmm... I have checked through GPIO drivers I have knowledge of / care
about and PMIC ones do like you suggested in this patch, the rest
(which are instantiated from MFD) take a virtual platform device.

Looking at DT excerpt I think you're rather right than wrong, so I
leave it to you and maintainers.
Thanks!

--
With Best Regards,
Andy Shevchenko