From: Michael Welling <mwelling@ieee.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>,
Johan Hovold <johan@kernel.org>,
Markus Pargmann <mpa@pengutronix.de>,
Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>,
Grant Likely <grant.likely@linaro.org>,
Amit Kucheria <amit.kucheria@linaro.org>
Subject: Re: [PATCH v2] gpio: add userspace ABI for GPIO line information
Date: Fri, 19 Feb 2016 04:26:14 -0600 [thread overview]
Message-ID: <20160219102614.GA31335@deathstar> (raw)
In-Reply-To: <CACRpkdairn2nnpWz48gakwdwcbPUiv3mVOzcdhdW9Yy8W=XZog@mail.gmail.com>
On Fri, Feb 19, 2016 at 10:47:45AM +0100, Linus Walleij wrote:
> On Fri, Feb 19, 2016 at 10:46 AM, Michael Welling <mwelling@ieee.org> wrote:
>
> > I am looking forward to see how the GPIOs will be modified from userspace.
> > The fact that single controllers can host hundreds of GPIOs is going to
> > make it an interesting problem.
> >
> > Do you have a sketch of how the accesses with be performed?
> > ioctl, read, write.
>
> No. Suggestions welcome. Looking at drivers/iio for inspiration.
>
Well one thing I never liked about the iio userspace is the mixed API.
You have to use sysfs to setup buffered reads and character device for
the reads.
I suppose individual GPIOs could be configured by simply calling
specific ioctls passing the (offset, value) as the argument.
GPIO_EXPORT_LINE_IOCTL - Allocate the GPIO to userspace.
GPIO_SET_DIRECTION_IOCTL - Set GPIO direction.
GPIO_SET_VALUE_IOCTL - Set GPIO value.
GPIO_GET_VALUE_IOCTL - Get GPIO value.
GPIO_SET_ACTIVE_IOCTL - Set GPIO active high/low.
GPIO_SET_OPEN_DRAIN_IOCTL - Set GPIO open drain.
GPIO_SET_OPEN_SOURCE_IOCTL - Set GPIO open source.
Then all exported GPIOs could be accessible using read and write callbacks.
Handling interrupts may prove a little trickier.
The poll could be used on the character device but then there would have to
be a way to resolve which GPIO triggered the interrupt.
What do you think?
> Yours,
> Linus Walleij
next prev parent reply other threads:[~2016-02-19 10:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 13:20 [PATCH v2] gpio: add userspace ABI for GPIO line information Linus Walleij
2016-02-16 18:28 ` Michael Welling
2016-02-17 20:54 ` Michael Welling
2016-02-19 8:55 ` Linus Walleij
2016-02-19 9:46 ` Michael Welling
2016-02-19 9:47 ` Linus Walleij
2016-02-19 10:26 ` Michael Welling [this message]
2016-02-19 11:25 ` Linus Walleij
2016-02-19 11:29 ` Grant Likely
2016-02-19 11:54 ` Linus Walleij
2016-02-19 11:35 ` jic23
2016-02-19 11:51 ` Linus Walleij
2016-02-21 13:13 ` Markus Pargmann
2016-02-21 19:04 ` Linus Walleij
2016-02-22 12:05 ` Markus Pargmann
2016-02-22 12:25 ` Linus Walleij
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=20160219102614.GA31335@deathstar \
--to=mwelling@ieee.org \
--cc=acourbot@nvidia.com \
--cc=amit.kucheria@linaro.org \
--cc=bamvor.zhangjian@linaro.org \
--cc=grant.likely@linaro.org \
--cc=jic23@kernel.org \
--cc=johan@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mpa@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.