Lines Matching refs:GPIO
1 GPIO Descriptor Consumer Interface
4 This document describes the consumer interface of the GPIO framework. Note that
6 deprecated integer-based GPIO interface please refer to gpio-legacy.txt.
12 Drivers that can't work without standard GPIO calls should have Kconfig entries
18 All the functions that work with the descriptor-based GPIO interface are
29 device that will use the GPIO and the function the requested GPIO is supposed to
46 for the GPIO. Values can be:
48 * GPIOD_ASIS or 0 to not initialize the GPIO at all. The direction must be set
50 * GPIOD_IN to initialize the GPIO as input.
51 * GPIOD_OUT_LOW to initialize the GPIO as output with a value of 0.
52 * GPIOD_OUT_HIGH to initialize the GPIO as output with a value of 1.
54 Both functions return either a valid GPIO descriptor, or an error code checkable
56 if and only if no GPIO has been assigned to the device/function/index triplet,
57 other error codes are used for cases where a GPIO has been assigned but an error
59 errors and an absence of GPIO for optional GPIO parameters. For the common
60 pattern where a GPIO is optional, the gpiod_get_optional() and
62 instead of -ENOENT if no GPIO has been assigned to the requested function:
121 A GPIO descriptor can be disposed of using the gpiod_put() function:
145 The first thing a driver must do with a GPIO is setting its direction. If no
161 A driver can also query the current direction of a GPIO:
167 Be aware that there is no default direction for GPIOs. Therefore, **using a GPIO
172 Spinlock-Safe GPIO Access
174 Most GPIO controllers can be accessed with memory read/write instructions. Those
188 The get/set calls do not return errors because "invalid GPIO" should have been
195 GPIO Access That May Sleep
197 Some GPIO controllers must be accessed using message based buses like I2C or
198 SPI. Commands to read or write those GPIO values require waiting to get to the
202 Platforms that support this type of GPIO distinguish them from other GPIOs by
221 Active-low State and Raw GPIO Values
223 Device drivers like to manage the logical state of a GPIO, i.e. the value their
224 device will actually receive, no matter what lies between it and the GPIO line.
225 In some cases, it might make sense to control the actual GPIO line value. The
226 following set of calls ignore the active-low property of a GPIO and work on the
235 The active-low state of a GPIO can also be queried using the following call:
249 This means that they check whether the GPIO is configured to be active-low,
257 As an example, if the active-low property for a dedicated GPIO is set, and the
276 Set multiple GPIO outputs with a single function call
301 * desc_array - an array of GPIO descriptors
324 GPIO lines can quite often be used as IRQs. You can get the IRQ number
325 corresponding to a given GPIO using the following call:
330 done (most likely because that particular GPIO cannot be used as IRQ). It is an
331 unchecked error to use a GPIO that wasn't set up as an input using
353 case, it will be handled by the GPIO subsystem automatically. However, if the
354 _DSD is not present, the mappings between GpioIo()/GpioInt() resources and GPIO
360 Interacting With the Legacy GPIO Subsystem
364 descriptor-based API, the following two functions allow you to convert a GPIO
365 descriptor into the GPIO integer namespace and vice-versa:
370 The GPIO number returned by desc_to_gpio() can be safely used as long as the
371 GPIO descriptor has not been freed. All the same, a GPIO number passed to
372 gpio_to_desc() must have been properly acquired, and usage of the returned GPIO
373 descriptor is only possible after the GPIO number has been released.
375 Freeing a GPIO obtained by one API with the other API is forbidden and an