Lines Matching +full:a +full:- +full:gpio
6 GPIO Interfaces
10 GPIOs in drivers, and how to write a driver for a device that provides GPIOs
13 Due to the history of GPIO interfaces in the kernel, there are two different
16 - The descriptor-based interface is the preferred way to manipulate GPIOs,
18 - The legacy integer-based interface which is considered deprecated (but still
21 The remainder of this document applies to the new descriptor-based interface.
23 integer-based interface.
26 What is a GPIO?
29 A "General Purpose Input/Output" (GPIO) is a flexible software-controlled
31 to Linux developers working with embedded and custom hardware. Each GPIO
32 represents a bit connected to a particular pin, or "ball" on Ball Grid Array
37 System-on-Chip (SOC) processors heavily rely on GPIOs. In some cases, every
38 non-dedicated pin can be configured as a GPIO; and most chips have at least
41 often have a few such pins to help with pin scarcity on SOCs; and there are
42 also "GPIO Expander" chips that connect using the I2C or SPI serial buses.
43 Most PC southbridges have a few dozen GPIO-capable pins (with only the BIOS
48 - Output values are writable (high=1, low=0). Some chips also have
50 value might be driven, supporting "wire-OR" and similar schemes for the
53 - Input values are likewise readable (1, 0). Some chips support readback
54 of pins configured as "output", which is very useful in such "wire-OR"
55 cases (to support bidirectional signaling). GPIO controllers may have
56 input de-glitch/debounce logic, sometimes with software controls.
58 - Inputs can often be used as IRQ signals, often edge triggered but
60 wakeup events, to wake the system from a low power state.
62 - Usually a GPIO will be configurable as either input or output, as needed
65 - Most GPIOs can be accessed while holding spinlocks, but those accessed
66 through a serial bus normally can't. Some systems support both types.
68 On a given board each GPIO is used for one specific purpose like monitoring
69 MMC/SD card insertion/removal, detecting card write-protect status, driving
70 a LED, configuring a transceiver, bit-banging a serial bus, poking a hardware
71 watchdog, sensing a switch, and so on.
74 Common GPIO Properties
77 These properties are met through all the other documents of the GPIO interface
78 and it is useful to understand them, especially if you need to define GPIO
81 Active-High and Active-Low
82 --------------------------
83 It is natural to assume that a GPIO is "active" when its output signal is 1
84 ("high"), and inactive when it is 0 ("low"). However in practice the signal of a
85 GPIO may be inverted before is reaches its destination, or a device could decide
87 be transparent to device drivers, therefore it is possible to define a GPIO as
88 being either active-high ("1" means "active", the default) or active-low ("0"
93 --------------------------
97 used for TTL. A pullup or pulldown resistor causes the high or low signal level.
98 This is sometimes called a "wire-AND"; or more practically, from the negative
99 logic (low=true) perspective this is a "wire-OR".
101 One common example of an open drain signal is a shared active-low IRQ line.
104 Some GPIO controllers directly support open drain and open source outputs; many
106 support it, there's a common idiom you can use to emulate it with any GPIO pin
109 **LOW**: ``gpiod_direction_output(gpio, 0)`` ... this drives the signal and
112 **HIGH**: ``gpiod_direction_input(gpio)`` ... this turns off the output, so
116 high signal and configuring the GPIO as input for low. This open drain/open
117 source emulation can be handled transparently by the GPIO framework.
119 If you are "driving" the signal high but gpiod_get_value(gpio) reports a low
122 example, that's how I2C clocks are stretched: a slave that needs a slower clock