Re: [PATCH v2 05/11] pinctrl: mediatek: avoid virtual gpio trying to set reg
From: Hanks Chen
Date: Wed Jan 08 2020 - 06:27:42 EST
On Tue, 2020-01-07 at 11:20 +0100, Linus Walleij wrote:
> On Mon, Dec 23, 2019 at 4:11 AM Hanks Chen <hanks.chen@xxxxxxxxxxxx> wrote:
> > On Fri, 2019-08-23 at 10:57 +0200, Linus Walleij wrote:
> > > On Mon, Aug 19, 2019 at 11:22 AM Mars Cheng <mars.cheng@xxxxxxxxxxxx> wrote:
>
> > > This does not explain what a "virtual GPIO" is in this
> > > context, so please elaborate. What is this? Why does
> > > it exist? What is it used for?
> > >
> > > GPIO is "general purpose input/output" and it is a
> > > pretty rubbery category already as it is, so we need
> > > to define our terms pretty strictly.
> > >
> > Virtual GPIO only used inside SOC and not being exported to outside SOC
> > in MTK platform. Some modules use virtual GPIO as eint (e.g. pmic or
> > usb).
>
> I would call that internal GPIOs, those are very real rails inside
> the chip made with polysilicone so there is nothing "virtual"
> about them. If the documentation for the chip calls them virtual
> then explain in the driver that these are SoC-internal
> lines so that everyone will get it.
>
Got it, I will add the info into the driver in v3
> Is the PMIC inside the SoC? I thought that was usually outside of it
> in its own chip.
>
> But I suppose there could be some interface to it in the SoC and
> then that interface has this EINT?
>
That's right. I use incorrect word.
e.g. pmic interface inside the SOC (PMIF), not pmic...
> > In MTK platform, external interrupt (EINT) and GPIO is 1-1 mapping and
> > we can set GPIO as eint.
> > But some modules use specific eint which doesn't have real GPIO pin.
> > So we use virtual GPIO to map it.
>
> OK I get it I think... just put these comments into the code as well
> so we understand when reading the code what is going on.
Got it, will add the comments in v3. Thanks for reviewing.
>
> > > > + if (mtk_is_virt_gpio(hw, gpio))
> > > > + return 1;
> > >
> > > Why are "virtual GPIOs" always inputs?
> >
> > We set virtual GPIO as eint.
> > It mean virtual GPIO only used inside SOC and not being exported to
> > outside SOC.
>
> Are you saying that:
> - "Virtual" GPIOs are always and only used for interrupts
> - Since they are only used for interrupts, they are always inputs
>
> Then write that in a comment to the above change so we know
> this context.
>
Yes, virtual GPIOs are always and only used for interrupts in mtk
platform. I'll add the comments in v3. Thanks for reviewing
> Yours,
> Linus Walleij
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-mediatek