Lines Matching refs:GPIO

2 Legacy GPIO Interfaces
5 This provides an overview of GPIO access conventions on Linux.
11 What is a GPIO?
13 A "General Purpose Input/Output" (GPIO) is a flexible software-controlled
15 to Linux developers working with embedded and custom hardware. Each GPIO
22 non-dedicated pin can be configured as a GPIO; and most chips have at least
26 also "GPIO Expander" chips that connect using the I2C or SPI serial busses.
27 Most PC southbridges have a few dozen GPIO-capable pins (with only the BIOS
39 cases (to support bidirectional signaling). GPIO controllers may have
46 - Usually a GPIO will be configurable as either input or output, as needed
52 On a given board each GPIO is used for one specific purpose like monitoring
58 GPIO conventions
71 used for several very different kinds of GPIO controller. (There is some
73 in this document, but drivers acting as clients to the GPIO interface must
77 use it when possible. Platforms must select GPIOLIB if GPIO functionality
79 standard GPIO calls should have Kconfig entries which depend on GPIOLIB. The
80 GPIO calls are available, either as "real code" or as optimized-away stubs,
100 for the GPIO lines so that board-specific setup code directly corresponds
101 to the relevant schematics. In contrast, drivers should only use GPIO
107 uses numbers 0..63 with one set of GPIO controllers, 64-79 with another
108 type of GPIO controller, and on one particular board 80-95 with an FPGA.
110 use numbers 2000-2063 to identify GPIOs in a bank of I2C GPIO expanders.
112 If you want to initialize a structure with an invalid GPIO number, use
114 test if such number from such a structure could reference a GPIO, you
123 Whether a platform supports multiple GPIO controllers is a platform-specific
125 of GPIO numbers, and whether new controllers can be added at runtime. Such issues
126 can affect things including whether adjacent GPIO numbers are both valid.
130 The first thing a system should do with a GPIO is allocate it, using
133 One of the next things to do with a GPIO, often in board setup code when
134 setting up a platform_device using the GPIO, is mark its direction::
150 of a GPIO implicitly requests that GPIO (see below) if it has not been
154 Setting the direction can fail if the GPIO number is invalid, or when
155 that particular GPIO can't be used in that mode. It's generally a bad
158 that board setup code probably needs to multiplex that pin as a GPIO,
162 Spinlock-Safe GPIO access
164 Most GPIO controllers can be accessed with memory read/write instructions.
170 /* GPIO INPUT: return zero or nonzero */
173 /* GPIO OUTPUT */
181 The get/set calls have no error returns because "invalid GPIO" should have
188 calls to access the GPIO value in cases where the GPIO number (and for
196 GPIO access that may sleep
198 Some GPIO controllers must be accessed using message based busses like I2C
199 or SPI. Commands to read or write those GPIO values require waiting to
204 /* GPIO INPUT: return zero or nonzero, might sleep */
207 /* GPIO OUTPUT, might sleep */
219 from contexts which may sleep, since they may need to access the GPIO
238 /* request GPIO, returning 0 or negative errno.
243 /* release previously-claimed GPIO */
246 Passing invalid GPIO numbers to gpio_request() will fail, as will requesting
259 GPIO can serve as a kind of lock.
273 GPIO signal to the appropriate pin should occur within a GPIO driver's
275 setup of an output GPIO's value. This allows a glitch-free migration from a
276 pin's special function to GPIO. This is sometimes required when using a GPIO
277 to implement a workaround on signals typically driven by a non-GPIO HW block.
279 Some platforms allow some or all GPIO signals to be routed to different pins.
280 Similarly, other aspects of the GPIO or pin may need to be configured, such as
283 the pinctrl subsystem's mapping table, so that GPIO users need not be aware
286 Also note that it's your responsibility to have stopped using a GPIO
292 /* request a single GPIO, with initial configuration specified by
353 GPIO numbers are unsigned integers; so are IRQ numbers. These make up
354 two logically distinct namespaces (GPIO 0 need not use IRQ 0). You can
357 /* map GPIO numbers to IRQ numbers */
362 some GPIOs can't be used as IRQs.) It is an unchecked error to use a GPIO
387 Some GPIO controllers directly support open drain outputs; many don't. When
389 there's a common idiom you can use to emulate it with any GPIO pin that can
406 GPIO controllers and the pinctrl subsystem
409 A GPIO controller on a SOC might be tightly coupled with the pinctrl
412 case where e.g. a GPIO controller need to reserve a pin or set the
420 But how does the pin control subsystem cross-correlate the GPIO
454 to route a given GPIO to any one of several pins. (Yes, those examples all
476 a side effect of configuring an add-on board with some GPIO expanders.
479 GPIO implementor's framework (OPTIONAL)
482 easier for platforms to support different kinds of GPIO controller using
492 In this framework each GPIO controller is packaged as a "struct gpio_chip"
495 - methods to establish GPIO direction
496 - methods used to access GPIO values
502 the number of its first GPIO, and how many GPIOs it exposes.
506 gpio_chip and issue gpiochip_add(). Removing a GPIO controller should be
510 not exposed by the GPIO interfaces, such as addressing, power management,
511 and more. Chips such as codecs will have complex non-GPIO state.
515 either NULL or the label associated with that GPIO when it was requested.
521 else it is up to the user to configure support for GPIO.
524 GPIOs through GPIO-lib and the code cannot be enabled by the user.
534 referenced GPIO is the constant "12", getting or setting its value could
550 For external GPIO controllers -- such as I2C or SPI expanders, ASICs, multi
552 registering controller devices and ensures that their drivers know what GPIO
557 of GPIOs that chip will expose, and passes them to each GPIO expander chip
562 an I2C-based GPIO, its probe() routine should only be called after that GPIO
564 calls for that GPIO can work. One way to address such dependencies is for
568 the GPIO controller device becomes unavailable.
575 debugfs interface, since it provides control over GPIO direction and
580 know for example that GPIO #23 controls the write protect line used to
582 may need to temporarily remove that protection, first importing a GPIO,
584 the write protection. In normal use, GPIO #23 would never be touched,
588 userspace GPIO can be used to determine system configuration data that
590 GPIO drivers could be all that the system really needs.
593 GPIO tasks: "leds-gpio" and "gpio_keys", respectively. Use those
606 - GPIO controllers ("gpio_chip" instances).
615 a GPIO to userspace by writing its number to this file.
618 for GPIO #19, if that's not requested by kernel code.
625 GPIO signals have paths like /sys/class/gpio/gpio42/ (for GPIO #42)
634 configure the GPIO as an output with that initial value.
637 doesn't support changing the direction of a GPIO, or
639 allow userspace to reconfigure this GPIO's direction.
641 "value" ... reads as either 0 (low) or 1 (high). If the GPIO
668 GPIO controllers have paths like /sys/class/gpio/gpiochip42/ (for the
674 "base" ... same as N, the first GPIO managed by this chip
685 the correct GPIO number to use for a given signal.
691 The functions listed in this section are deprecated. The GPIO descriptor based