Re: [PATCH V4 2/2] gpio: inverter: document the inverter bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stephen,

On Fri, Oct 04, 2019 at 01:07:23PM -0600, Stephen Warren wrote:

[..]

> I think the DT should represent the device that's attached to the GPIOs.
> That way, there's already a clear way to represent the GPIO polarity, as
> described in the document linked by Eugenui in [2] below.
> 
> If for some reason that's not possible, then I think keeping track of the
> GPIO polarity in user-space is entirely reasonable, and is the correct
> approach. To claim that tracking GPIO polarity in user-space is too much
> burden, yet to also allow user-space to control GPIOs at all, and hence to
> know exactly which GPIOs must be controlled, is an inconsistent assertion.
> 
> Put another way: If a piece of user-space SW controls GPIOs, it must know
> which GPIO number to use for each logical purpose. This information
> presumably varies on different platforms, so the SW must have a list of GPIO
> numbers and GPIO controller IDs per platform. Additionally storing a
> polarity bit along with that information seems entirely trivial to me.
> 
> Is there some other issue that I'm overlooking?

Based on the discussions so far, the user who requested this feature
intends to (in fact already does) "mark" the userspace-relevant gpio
lines via the "gpio-line-names" [5] DT property, implemented by Linus
in v4.7 commit [6]. By keeping track of "gpio line name" both in DT and
in user-space, apparently the user is able to accurately map the
"line name" (visible in userspace) to the corresponding gpio chip/name
and gpio line offset in a "platform/board-independent" way.

Do you think this is unorthodox?

> If the list of GPIO IDs is retrieved from DT by the user-space SW, I could
> see an argument for storing the polarity information in DT along with that
> list of GPIO IDs. However, I don't believe there's any standard way of
> representing "a list of GPIO IDs for user space use" in DT.
> 
> > If we hog a GPIO pin in DTS (which allows specifying its polarity),
> > userspace no longer has access to that pin. There isn't a way to define
> > GPIO polarity by means of DTS without affecting userspace access
> > (can anybody contradict this statement?).
> 
> GPIO hog doesn't seem like the right approach; its intent is to actively
> configure the GPIO in a fixed state, which is logically incompatible with
> user-space control of the GPIO.

Agreed. Thanks for strengthening the idea behind hogging the gpios.

[..]

> > [1] https://marc.info/?l=linux-gpio&m=139204273132477&w=4 ("Correct meaning of the GPIO active low flag")
> > [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=51e8afc1c43c75 ("gpio: document polarity flag best practices")
> > [3] https://marc.info/?l=linux-gpio&m=155721267517644&w=2 ("[PATCH V1 1/2] gpio: make it possible to set active-state on GPIO lines")
> > [4] https://marc.info/?l=linux-gpio&m=155713157122847&w=2 ("[PATCH V1 1/2] gpio: make it possible to set active-state on GPIO lines")
[5] https://marc.info/?l=linux-gpio&m=155712945922102&w=2
[6] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fd9c55315db9
    ("gpio: of: make it possible to name GPIO lines")

-- 
Best Regards,
Eugeniu



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux