diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2010-09-09 19:38:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-09 21:57:24 -0400 |
commit | c956126c137d97acb6f4d56fa9572d0bcc84e4ed (patch) | |
tree | aad2bdd087f9b5ea2abbf633b7f61ebd326ce562 /Documentation/gpio.txt | |
parent | 5affb607720d734ca572b8a77c5c7d62d3042b6f (diff) |
gpio: doc updates
There's been some recent confusion about error checking GPIO numbers.
briefly, it should be handled mostly during setup, when gpio_request() is
called, and NEVER by expectig gpio_is_valid to report more than
never-usable GPIO numbers.
[akpm@linux-foundation.org: terminate unterminated comment]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Eric Miao" <eric.y.miao@gmail.com>
Cc: "Ryan Mallon" <ryan@bluewatersys.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/gpio.txt')
-rw-r--r-- | Documentation/gpio.txt | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index d96a6dba5748..9633da01ff46 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -109,17 +109,19 @@ use numbers 2000-2063 to identify GPIOs in a bank of I2C GPIO expanders. | |||
109 | 109 | ||
110 | If you want to initialize a structure with an invalid GPIO number, use | 110 | If you want to initialize a structure with an invalid GPIO number, use |
111 | some negative number (perhaps "-EINVAL"); that will never be valid. To | 111 | some negative number (perhaps "-EINVAL"); that will never be valid. To |
112 | test if a number could reference a GPIO, you may use this predicate: | 112 | test if such number from such a structure could reference a GPIO, you |
113 | may use this predicate: | ||
113 | 114 | ||
114 | int gpio_is_valid(int number); | 115 | int gpio_is_valid(int number); |
115 | 116 | ||
116 | A number that's not valid will be rejected by calls which may request | 117 | A number that's not valid will be rejected by calls which may request |
117 | or free GPIOs (see below). Other numbers may also be rejected; for | 118 | or free GPIOs (see below). Other numbers may also be rejected; for |
118 | example, a number might be valid but unused on a given board. | 119 | example, a number might be valid but temporarily unused on a given board. |
119 | |||
120 | Whether a platform supports multiple GPIO controllers is currently a | ||
121 | platform-specific implementation issue. | ||
122 | 120 | ||
121 | Whether a platform supports multiple GPIO controllers is a platform-specific | ||
122 | implementation issue, as are whether that support can leave "holes" in the space | ||
123 | of GPIO numbers, and whether new controllers can be added at runtime. Such issues | ||
124 | can affect things including whether adjacent GPIO numbers are both valid. | ||
123 | 125 | ||
124 | Using GPIOs | 126 | Using GPIOs |
125 | ----------- | 127 | ----------- |
@@ -480,12 +482,16 @@ To support this framework, a platform's Kconfig will "select" either | |||
480 | ARCH_REQUIRE_GPIOLIB or ARCH_WANT_OPTIONAL_GPIOLIB | 482 | ARCH_REQUIRE_GPIOLIB or ARCH_WANT_OPTIONAL_GPIOLIB |
481 | and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines | 483 | and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines |
482 | three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep(). | 484 | three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep(). |
483 | They may also want to provide a custom value for ARCH_NR_GPIOS. | ||
484 | 485 | ||
485 | ARCH_REQUIRE_GPIOLIB means that the gpio-lib code will always get compiled | 486 | It may also provide a custom value for ARCH_NR_GPIOS, so that it better |
487 | reflects the number of GPIOs in actual use on that platform, without | ||
488 | wasting static table space. (It should count both built-in/SoC GPIOs and | ||
489 | also ones on GPIO expanders. | ||
490 | |||
491 | ARCH_REQUIRE_GPIOLIB means that the gpiolib code will always get compiled | ||
486 | into the kernel on that architecture. | 492 | into the kernel on that architecture. |
487 | 493 | ||
488 | ARCH_WANT_OPTIONAL_GPIOLIB means the gpio-lib code defaults to off and the user | 494 | ARCH_WANT_OPTIONAL_GPIOLIB means the gpiolib code defaults to off and the user |
489 | can enable it and build it into the kernel optionally. | 495 | can enable it and build it into the kernel optionally. |
490 | 496 | ||
491 | If neither of these options are selected, the platform does not support | 497 | If neither of these options are selected, the platform does not support |