Thread (37 messages) 37 messages, 8 authors, 2020-01-08

Re: [PATCH v2 05/11] pinctrl: mediatek: avoid virtual gpio trying to set reg

From: Linus Walleij <hidden>
Date: 2020-01-07 10:20:25
Also in: linux-clk, linux-mediatek, lkml

On Mon, Dec 23, 2019 at 4:11 AM Hanks Chen [off-list ref] wrote:
On Fri, 2019-08-23 at 10:57 +0200, Linus Walleij wrote:
quoted
On Mon, Aug 19, 2019 at 11:22 AM Mars Cheng [off-list ref] wrote:
quoted
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.

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?
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.
quoted
quoted
+       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.

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help