Re: [PATCH v2] gpio: add userspace ABI for GPIO line information

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

 



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@xxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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