@@ -109,17 +109,19 @@ use numbers 2000-2063 to identify GPIOs in a bank of I2C GPIO expanders.
109109
110110If you want to initialize a structure with an invalid GPIO number, use
111111some 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:
113114
114115 int gpio_is_valid(int number);
115116
116117A number that's not valid will be rejected by calls which may request
117118or 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-
120- Whether a platform supports multiple GPIO controllers is currently a
121- platform-specific implementation issue.
119+ example, a number might be valid but temporarily unused on a given board.
122120
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.
123125
124126Using GPIOs
125127-----------
@@ -480,12 +482,16 @@ To support this framework, a platform's Kconfig will "select" either
480482ARCH_REQUIRE_GPIOLIB or ARCH_WANT_OPTIONAL_GPIOLIB
481483and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines
482484three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep().
483- They may also want to provide a custom value for ARCH_NR_GPIOS.
484485
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
486492into the kernel on that architecture.
487493
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
489495can enable it and build it into the kernel optionally.
490496
491497If neither of these options are selected, the platform does not support
0 commit comments