Lines Matching refs:GPIO

1 GPIO Descriptor Driver Interface
4 This document serves as a guide for GPIO chip drivers writers. Note that it
6 deprecated integer-based GPIO interface please refer to gpio-legacy.txt.
8 Each GPIO controller driver needs to include the following header, which defines
9 the structures used to define a GPIO driver:
17 Inside a GPIO driver, individual GPIOs are identified by their hardware number,
20 GPIO descriptor is never made visible outside of the driver.
22 On top of this internal number, each GPIO also need to have a global number in
23 the integer GPIO namespace so that it can be used with the legacy GPIO
25 assigned), and for each GPIO the global number will be (base + hardware number).
31 numbers 0..63 with one set of GPIO controllers, 64-79 with another type of GPIO
34 identify GPIOs in a bank of I2C GPIO expanders.
40 In the gpiolib framework each GPIO controller is packaged as a "struct
44 - methods to establish GPIO direction
45 - methods used to access GPIO values
46 - method to return the IRQ number associated to a given GPIO
54 gpio_chip and issue gpiochip_add(). Removing a GPIO controller should be rare;
58 exposed by the GPIO interfaces, such as addressing, power management, and more.
59 Chips such as codecs will have complex non-GPIO state.
63 NULL or the label associated with that GPIO when it was requested.
65 RT_FULL: GPIO driver should not use spinlock_t or any sleepable APIs
67 control callbacks) if it is expected to call GPIO APIs from atomic context
71 GPIO drivers providing IRQs
73 It is custom that GPIO drivers (GPIO chips) are also providing interrupts,
75 cases the GPIO logic is melded with a SoC's primary interrupt controller.
77 The IRQ portions of the GPIO block are implemented using an irqchip, using
81 RT_FULL: GPIO driver should not use spinlock_t or any sleepable APIs
88 GPIO irqchips usually fall in one of two categories:
90 * CHAINED GPIO irqchips: these are usually the type that is embedded on
93 system interrupt controller. This means the GPIO irqchip is registered
95 gpiochip_set_chained_irqchip() helper function, and the GPIO irqchip
97 holding the IRQs disabled. The GPIO irqchip will then end up calling
105 Chained GPIO irqchips typically can NOT set the .can_sleep flag on
111 if required (and if it can't be converted to the nested threaded GPIO irqchip)
126 * GENERIC CHAINED GPIO irqchips: these are the same as "CHAINED GPIO irqchips",
127 but chained IRQ handlers are not used. Instead GPIO IRQs dispatching is
129 The GPIO irqchip will then end up calling something like this sequence in
133 for each detected GPIO IRQ
138 the same W/A as for "CHAINED GPIO irqchips" can be applied.
140 * NESTED THREADED GPIO irqchips: these are off-chip GPIO expanders and any
141 other GPIO irqchip residing on the other side of a sleeping bus. Of course
153 The hallmark of threaded GPIO irqchips is that they set the .can_sleep
157 To help out in handling the set-up and management of GPIO irqchips and the
182 expected for GPIO driver that irqchip .set_type() callback have to be called
183 before using/enabling GPIO IRQ. Then set the handler to handle_level_irq()
188 if that is a combined GPIO+IRQ driver. The basic premise is that gpio_chip and
193 certain GPIO line and should not be relied upon to have been called before
197 callbacks from the GPIO and irqchip APIs. Do not rely on gpiod_to_irq() having
202 GPIO line and register for example) it needs to deny certain operations and
210 to mark the GPIO as being used as an IRQ:
214 This will prevent the use of non-irq related GPIO APIs until the GPIO IRQ lock
219 When implementing an irqchip inside a GPIO driver, these two functions should
223 Real-Time compliance for GPIO IRQ chips
227 preemption. It is desireable that all irqchips in the GPIO subsystem keep this
237 - Chained GPIO irqchips: ensure spinlock_t or any sleepable APIs are not used
239 - Generic chained GPIO irqchips: take care about generic_handle_irq() calls and
241 - Chained GPIO irqchips: get rid of chained IRQ handler and use generic irq
244 GPIO IRQ chip implementation;
249 Requesting self-owned GPIO pins
252 Sometimes it is useful to allow a GPIO chip driver to request its own GPIO
255 try_module_get()). A GPIO driver can use the following functions instead