freebsd-dev/sys/dev/gpio
Ian Lepore e1275c6805 Add gpio methods to read/write/configure up to 32 pins simultaneously.
Sometimes it is necessary to combine several gpio pins into an ad-hoc bus
and manipulate the pins as a group. In such cases manipulating the pins
individualy is not an option, because the value on the "bus" assumes
potentially-invalid intermediate values as each pin is changed in turn. Note
that the "bus" may be something as simple as a bi-color LED where changing
colors requires changing both gpio pins at once, or something as complex as
a bitbanged multiplexed address/data bus connected to a microcontroller.

In addition to the absolute requirement of simultaneously changing the
output values of driven pins, a desirable feature of these new methods is to
provide a higher-performance mechanism for reading and writing multiple
pins, especially from userland where pin-at-a-time access incurs a noticible
syscall time penalty.

These new interfaces are NOT intended to abstract away all the ugly details
of how gpio is implemented on any given platform. In fact, to use these
properly you absolutely must know something about how the gpio hardware is
organized. Typically there are "banks" of gpio pins controlled by registers
which group several pins together. A bank may be as small as 2 pins or as
big as "all the pins on the device, hundreds of them." In the latter case, a
driver might support this interface by allowing access to any 32 adjacent
pins within the overall collection. Or, more likely, any 32 adjacent pins
starting at any multiple of 32. Whatever the hardware restrictions may be,
you would need to understand them to use this interface.

In additional to defining the interfaces, two example implementations are
included here, for imx5/6, and allwinner. These represent the two primary
types of gpio hardware drivers. imx6 has multiple gpio devices, each
implementing a single bank of 32 pins. Allwinner implements a single large
gpio number space from 1-n pins, and the driver internally translates that
linear number space to a bank+pin scheme based on how the pins are grouped
into control registers. The allwinner implementation imposes the restriction
that the first_pin argument to the new functions must always be pin 0 of a
bank.

Differential Revision:	https://reviews.freebsd.org/D11810
2017-09-10 18:08:25 +00:00
..
bytgpio.c [bytgpio] prepare bytgpio(4) for modularization 2016-11-21 19:43:01 +00:00
gpio_if.m Add gpio methods to read/write/configure up to 32 pins simultaneously. 2017-09-10 18:08:25 +00:00
gpiobacklight.c
gpiobus_if.m
gpiobus.c Remove a too strict test and instead, just filter the passed flags with the 2016-12-13 03:36:41 +00:00
gpiobusvar.h Stop including a possibly GPLd header from the GPIO code. Add the only 2016-10-26 12:41:44 +00:00
gpioc.c Add gpio methods to read/write/configure up to 32 pins simultaneously. 2017-09-10 18:08:25 +00:00
gpioiic.c
gpiokeys_codes.c
gpiokeys.c
gpiokeys.h
gpioled_fdt.c Refactor FDT part of gpioled driver 2016-11-07 21:15:39 +00:00
gpioled.c Refactor FDT part of gpioled driver 2016-11-07 21:15:39 +00:00
gpiopower.c Add a GPIO poweroff and reset driver. 2016-11-16 02:14:07 +00:00
gpiopps.c
gpioregulator.c
gpiospi.c [gpiospi] add clock delay to avoid smashing of bits 2016-12-13 10:03:29 +00:00
gpioths.c [gpioths] new driver for temperature/humidity sensor DHT11 2017-01-16 15:36:36 +00:00
ofw_gpiobus.c Only write to *active once, even when GPIO_ACTIVE_LOW is set. 2017-01-07 22:55:23 +00:00