diff options
Diffstat (limited to 'Documentation/gpio.txt')
-rw-r--r-- | Documentation/gpio.txt | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index c2c6e9b39bbe..d96a6dba5748 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -158,10 +158,11 @@ and configure pullups/pulldowns appropriately.) | |||
158 | Spinlock-Safe GPIO access | 158 | Spinlock-Safe GPIO access |
159 | ------------------------- | 159 | ------------------------- |
160 | Most GPIO controllers can be accessed with memory read/write instructions. | 160 | Most GPIO controllers can be accessed with memory read/write instructions. |
161 | That doesn't need to sleep, and can safely be done from inside IRQ handlers. | 161 | Those don't need to sleep, and can safely be done from inside hard |
162 | (That includes hardirq contexts on RT kernels.) | 162 | (nonthreaded) IRQ handlers and similar contexts. |
163 | 163 | ||
164 | Use these calls to access such GPIOs: | 164 | Use the following calls to access such GPIOs, |
165 | for which gpio_cansleep() will always return false (see below): | ||
165 | 166 | ||
166 | /* GPIO INPUT: return zero or nonzero */ | 167 | /* GPIO INPUT: return zero or nonzero */ |
167 | int gpio_get_value(unsigned gpio); | 168 | int gpio_get_value(unsigned gpio); |
@@ -210,9 +211,31 @@ To access such GPIOs, a different set of accessors is defined: | |||
210 | /* GPIO OUTPUT, might sleep */ | 211 | /* GPIO OUTPUT, might sleep */ |
211 | void gpio_set_value_cansleep(unsigned gpio, int value); | 212 | void gpio_set_value_cansleep(unsigned gpio, int value); |
212 | 213 | ||
213 | Other than the fact that these calls might sleep, and will not be ignored | 214 | |
214 | for GPIOs that can't be accessed from IRQ handlers, these calls act the | 215 | Accessing such GPIOs requires a context which may sleep, for example |
215 | same as the spinlock-safe calls. | 216 | a threaded IRQ handler, and those accessors must be used instead of |
217 | spinlock-safe accessors without the cansleep() name suffix. | ||
218 | |||
219 | Other than the fact that these accessors might sleep, and will work | ||
220 | on GPIOs that can't be accessed from hardIRQ handlers, these calls act | ||
221 | the same as the spinlock-safe calls. | ||
222 | |||
223 | ** IN ADDITION ** calls to setup and configure such GPIOs must be made | ||
224 | from contexts which may sleep, since they may need to access the GPIO | ||
225 | controller chip too: (These setup calls are usually made from board | ||
226 | setup or driver probe/teardown code, so this is an easy constraint.) | ||
227 | |||
228 | gpio_direction_input() | ||
229 | gpio_direction_output() | ||
230 | gpio_request() | ||
231 | |||
232 | ## gpio_request_one() | ||
233 | ## gpio_request_array() | ||
234 | ## gpio_free_array() | ||
235 | |||
236 | gpio_free() | ||
237 | gpio_set_debounce() | ||
238 | |||
216 | 239 | ||
217 | 240 | ||
218 | Claiming and Releasing GPIOs | 241 | Claiming and Releasing GPIOs |