From: Drew Fustini <drew@beagleboard.org>
To: Tony Lindgren <tony@atomide.com>,
Haojian Zhuang <haojian.zhuang@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org
Cc: Jason Kridner <jkridner@beagleboard.org>,
Robert Nelson <robertcnelson@gmail.com>
Subject: AM335x: how to mux a pin for libgpiod to use?
Date: Fri, 26 Jun 2020 01:22:07 +0200 [thread overview]
Message-ID: <20200625231633.GA9012@x1> (raw)
I am trying to determine an upstream method to be able to mux an AM3358
pin to gpio and then allow that line to be used from the gpiod userspace
ABI. A "pinctrl-single,pins" device tree property can easily define a
gpio mux for a given pin. For example, the P9_14 pin on the BeagleBone
[0] can be set to gpio (mode 7) with this node:
P9_14_gpio_pin: pinmux_P9_14_gpio_pin {
pinctrl-single,pins = <
AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_INPUT_PULLDOWN, MUX_MODE7)
>;
};
GPMC_A2 is gpio1_18 per the AM3358 datasheet [1]. Normally, a node for
a driver, like gpio-keys, would have a gpio property that cause the
driver to claim the gpio line. But, in that case, the line will not be
available to be used through the gpiod userspace ABI.
If no driver claims the gpio line, then I find that the pin mux in
"pinctrl-single,pins" does not get applied by the pinctrl-single driver.
Thus, I can't figure out how to mux a pin to gpio and then use that gpio
line from userspace. The natural question is why try access a gpio line
from userspace. BeagleBone users do want this capability for prototyping
and I believe that is an accepted use case based on what Linus Walleij
wrote in "Using GPIO Lines in Linux" [2].
The kernel used in our BeagleBoard.org Debian images has an out-of-tree
driver [3] named gpio-of-helper will claim the gpio line but a hack [4]
allows the line to still be controlled through the gpiod userspace ABI.
This does not seem to be an acceptable upstream solution, so I am trying
to figure out what an upstream solution would look like.
Maybe one soltion would be to make pinctrl-single set the mux for any
"pinctrl-single,pins" properties regardless of whether a driver
references it or not. Thus, the pin would be muxed to gpio by
pinctrl-single and libgpiod would be able to use the line as it was not
claimed by any driver.
I would very much appreciate any feedback.
Thanks,
Drew
[0] https://git.io/JfjYH
[1] http://www.ti.com/lit/ds/symlink/am3358.pdf
[2] Documentation/driver-api/gpio/using-gpio.rst
[3] https://git.io/JfjYf
[4] https://git.io/JfjYJ
next reply other threads:[~2020-06-25 23:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 23:22 Drew Fustini [this message]
2020-06-26 10:36 ` AM335x: how to mux a pin for libgpiod to use? Grygorii Strashko
2020-06-26 15:57 ` Drew Fustini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200625231633.GA9012@x1 \
--to=drew@beagleboard.org \
--cc=haojian.zhuang@linaro.org \
--cc=jkridner@beagleboard.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=robertcnelson@gmail.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).