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
43 for the GPIO. Values can be:
45 * GPIOD_ASIS or 0 to not initialize the GPIO at all. The direction must be set
47 * GPIOD_IN to initialize the GPIO as input.
48 * GPIOD_OUT_LOW to initialize the GPIO as output with a value of 0.
49 * GPIOD_OUT_HIGH to initialize the GPIO as output with a value of 1.
51 Both functions return either a valid GPIO descriptor, or an error code checkable
53 if and only if no GPIO has been assigned to the device/function/index triplet,
54 other error codes are used for cases where a GPIO has been assigned but an error
56 errors and an absence of GPIO for optional GPIO parameters. For the common
57 pattern where a GPIO is optional, the gpiod_get_optional() and
59 instead of -ENOENT if no GPIO has been assigned to the requested function:
118 A GPIO descriptor can be disposed of using the gpiod_put() function:
142 The first thing a driver must do with a GPIO is setting its direction. If no
158 A driver can also query the current direction of a GPIO:
164 Be aware that there is no default direction for GPIOs. Therefore, **using a GPIO
169 Spinlock-Safe GPIO Access
171 Most GPIO controllers can be accessed with memory read/write instructions. Those
185 The get/set calls do not return errors because "invalid GPIO" should have been
192 GPIO Access That May Sleep
194 Some GPIO controllers must be accessed using message based buses like I2C or
195 SPI. Commands to read or write those GPIO values require waiting to get to the
199 Platforms that support this type of GPIO distinguish them from other GPIOs by
218 Active-low State and Raw GPIO Values
220 Device drivers like to manage the logical state of a GPIO, i.e. the value their
221 device will actually receive, no matter what lies between it and the GPIO line.
222 In some cases, it might make sense to control the actual GPIO line value. The
223 following set of calls ignore the active-low property of a GPIO and work on the
232 The active-low state of a GPIO can also be queried using the following call:
240 Set multiple GPIO outputs with a single function call
265 * desc_array - an array of GPIO descriptors
288 GPIO lines can quite often be used as IRQs. You can get the IRQ number
289 corresponding to a given GPIO using the following call:
294 done (most likely because that particular GPIO cannot be used as IRQ). It is an
295 unchecked error to use a GPIO that wasn't set up as an input using
317 case, it will be handled by the GPIO subsystem automatically. However, if the
318 _DSD is not present, the mappings between GpioIo()/GpioInt() resources and GPIO
324 Interacting With the Legacy GPIO Subsystem
328 descriptor-based API, the following two functions allow you to convert a GPIO
329 descriptor into the GPIO integer namespace and vice-versa:
334 The GPIO number returned by desc_to_gpio() can be safely used as long as the
335 GPIO descriptor has not been freed. All the same, a GPIO number passed to
336 gpio_to_desc() must have been properly acquired, and usage of the returned GPIO
337 descriptor is only possible after the GPIO number has been released.
339 Freeing a GPIO obtained by one API with the other API is forbidden and an