From: Markus Pargmann <mpa@pengutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>,
Michael Welling <mwelling@ieee.org>,
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>,
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: Sun, 21 Feb 2016 14:13:29 +0100 [thread overview]
Message-ID: <4414113.xrDgcf7gfo@galactica> (raw)
In-Reply-To: <CACRpkdb2+MDhTiUy9bS-dVORyQpCo-MNvtKpU3TSpq=5JkXDWw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3801 bytes --]
Hi,
On Friday 19 February 2016 12:51:48 Linus Walleij wrote:
> On Fri, Feb 19, 2016 at 12:35 PM, <jic23@jic23.retrosnub.co.uk> wrote:
> > [Me]
> >> Here I lean toward the IIO event interface, that if you want to
> >> monitor a GPIO line you should ask for an event file
> >> descriptor and select() it waiting for events in userspace,
> >> i.e. every such request comes with obtaining a new fd
> >> and watching it.
> >>
> > On events, it might be worth doing it a bit more input evdev
> > like and allowing mor than one consumer.
>
> Hm. I'm not familiar with how that works... I guess I just
> have to go and read the code.
>
> > Do we need to describe to userspace what GPIOs are available?
> > Right now I don't have a board to hand to see what info is
> > already available on that front. Strikes me as that side of
> > things may be more complex than the interface to actually get hole
> > of them. It's this side of things that makes IOCTLs on highly
> > varied devices a pain (any why we ended up with the split interface
> > in IIO which is sort of an input / hwmon hybrid).
>
> So the usecase that has been around the recent months is
> basically Arduino-type usecases, where you want a Linux
> SoC+board to be used for clever electronics prototyping
> (Internet of Things-yada yada thingofabobs).
>
> Those are by definition one-off kind of things, and people
> want to go around having to implement kernelspace stuff
> for their one-offs.
>
> Another typical example is industrial
> automation, PLCs. Those currently mmap() their GPIO
> address range to userspace and hammers them from
> there, because they think Linux GPIO suck and they
> rather break down the kernelspace/userspace barrier
> than try to fix it. (Whether this stance come from
> laziness, ignorance or plain "not my problem" attitude,
> I don't know.)
>
> Industrial automation with relays and shutter and
> valves and whatnot are probably better off in userspace
> than in kernelspace, a bunch of GPIO onebit reading
> and writing drivers in the kernel is not gonna be helpful.
> If it's something more complex like a sensor they should
> use IIO, if it's a LED then they should use that
> subsystem etc. But for all these binary things that
> are really dumb analog components, like relays doing
> something misc.
>
> A typical case is a PLC or lab board such as
> BeagleBone or 96board, where there is a number of
> GPIO lines, that all come out on the same identical
> header on the board (96board has this). Then you want
> to put an accessory on this header and access it from
> userspace. But you want it to work the same no matter
> whether it is SoC A or SoC B.
>
> So in order to satisfy that usecase, you need to look up
> the GPIO by name. And that mechanism is now in
> place, just that we need some DT bindings or board
> data to name the lines (it can currently be done using
> the char *names[] array in struct gpio_chip).
The gpio-hogging DT bindings still seem perfectly fine for me:
qe_pio_a: gpio-controller@1400 {
compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank";
reg = <0x1400 0x18>;
gpio-controller;
#gpio-cells = <2>;
line_b {
gpio-hog;
gpios = <6 0>;
output-low;
line-name = "foo-bar-gpio";
};
};
This could be something like this without hogging:
...
line_b {
gpios = <6 0>;
line-name = "foo-bar-gpio";
};
Best Regards,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-02-21 17:23 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
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 [this message]
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=4414113.xrDgcf7gfo@galactica \
--to=mpa@pengutronix.de \
--cc=acourbot@nvidia.com \
--cc=amit.kucheria@linaro.org \
--cc=bamvor.zhangjian@linaro.org \
--cc=grant.likely@linaro.org \
--cc=jic23@jic23.retrosnub.co.uk \
--cc=jic23@kernel.org \
--cc=johan@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mwelling@ieee.org \
/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