aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/gpio.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/gpio.txt')
-rw-r--r--Documentation/gpio.txt17
1 files changed, 10 insertions, 7 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
index 09dd510c4a5f..576ce463cf44 100644
--- a/Documentation/gpio.txt
+++ b/Documentation/gpio.txt
@@ -78,7 +78,8 @@ Identifying GPIOs
78----------------- 78-----------------
79GPIOs are identified by unsigned integers in the range 0..MAX_INT. That 79GPIOs are identified by unsigned integers in the range 0..MAX_INT. That
80reserves "negative" numbers for other purposes like marking signals as 80reserves "negative" numbers for other purposes like marking signals as
81"not available on this board", or indicating faults. 81"not available on this board", or indicating faults. Code that doesn't
82touch the underlying hardware treats these integers as opaque cookies.
82 83
83Platforms define how they use those integers, and usually #define symbols 84Platforms define how they use those integers, and usually #define symbols
84for the GPIO lines so that board-specific setup code directly corresponds 85for the GPIO lines so that board-specific setup code directly corresponds
@@ -139,10 +140,10 @@ issues including wire-OR and output latencies.
139The get/set calls have no error returns because "invalid GPIO" should have 140The get/set calls have no error returns because "invalid GPIO" should have
140been reported earlier in gpio_set_direction(). However, note that not all 141been reported earlier in gpio_set_direction(). However, note that not all
141platforms can read the value of output pins; those that can't should always 142platforms can read the value of output pins; those that can't should always
142return zero. Also, these calls will be ignored for GPIOs that can't safely 143return zero. Also, using these calls for GPIOs that can't safely be accessed
143be accessed wihtout sleeping (see below). 144without sleeping (see below) is an error.
144 145
145Platform-specific implementations are encouraged to optimise the two 146Platform-specific implementations are encouraged to optimize the two
146calls to access the GPIO value in cases where the GPIO number (and for 147calls to access the GPIO value in cases where the GPIO number (and for
147output, value) are constant. It's normal for them to need only a couple 148output, value) are constant. It's normal for them to need only a couple
148of instructions in such cases (reading or writing a hardware register), 149of instructions in such cases (reading or writing a hardware register),
@@ -239,7 +240,8 @@ options are part of the IRQ interface, e.g. IRQF_TRIGGER_FALLING, as are
239system wakeup capabilities. 240system wakeup capabilities.
240 241
241Non-error values returned from irq_to_gpio() would most commonly be used 242Non-error values returned from irq_to_gpio() would most commonly be used
242with gpio_get_value(). 243with gpio_get_value(), for example to initialize or update driver state
244when the IRQ is edge-triggered.
243 245
244 246
245 247
@@ -260,9 +262,10 @@ pullups (or pulldowns) so that the on-chip ones should not be used.
260There are other system-specific mechanisms that are not specified here, 262There are other system-specific mechanisms that are not specified here,
261like the aforementioned options for input de-glitching and wire-OR output. 263like the aforementioned options for input de-glitching and wire-OR output.
262Hardware may support reading or writing GPIOs in gangs, but that's usually 264Hardware may support reading or writing GPIOs in gangs, but that's usually
263configuration dependednt: for GPIOs sharing the same bank. (GPIOs are 265configuration dependent: for GPIOs sharing the same bank. (GPIOs are
264commonly grouped in banks of 16 or 32, with a given SOC having several such 266commonly grouped in banks of 16 or 32, with a given SOC having several such
265banks.) Code relying on such mechanisms will necessarily be nonportable. 267banks.) Some systems can trigger IRQs from output GPIOs. Code relying on
268such mechanisms will necessarily be nonportable.
266 269
267Dynamic definition of GPIOs is not currently supported; for example, as 270Dynamic definition of GPIOs is not currently supported; for example, as
268a side effect of configuring an add-on board with some GPIO expanders. 271a side effect of configuring an add-on board with some GPIO expanders.