diff options
author | Bartosz Golaszewski <brgl@bgdev.pl> | 2018-04-10 23:30:28 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-05-16 15:35:24 +0300 |
commit | a411e81e61df24023f40255145d8f023402002c9 (patch) | |
tree | 9fce75978e1553b206fea79511034453a174b5b7 /Documentation/driver-api/gpio/board.rst | |
parent | 192a35b1348275c8decf42452d382be21add938c (diff) | |
download | linux-a411e81e61df24023f40255145d8f023402002c9.tar.xz |
gpiolib: add hogs support for machine code
Board files constitute a significant part of the users of the legacy
GPIO framework. In many cases they only export a line and set its
desired value. We could use GPIO hogs for that like we do for DT and
ACPI but there's no support for that in machine code.
This patch proposes to extend the machine.h API with support for
registering hog tables in board files.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'Documentation/driver-api/gpio/board.rst')
-rw-r--r-- | Documentation/driver-api/gpio/board.rst | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Documentation/driver-api/gpio/board.rst b/Documentation/driver-api/gpio/board.rst index 25d62b2e9fd0..2c112553df84 100644 --- a/Documentation/driver-api/gpio/board.rst +++ b/Documentation/driver-api/gpio/board.rst @@ -177,3 +177,19 @@ mapping and is thus transparent to GPIO consumers. A set of functions such as gpiod_set_value() is available to work with the new descriptor-oriented interface. + +Boards using platform data can also hog GPIO lines by defining GPIO hog tables. + +.. code-block:: c + + struct gpiod_hog gpio_hog_table[] = { + GPIO_HOG("gpio.0", 10, "foo", GPIO_ACTIVE_LOW, GPIOD_OUT_HIGH), + { } + }; + +And the table can be added to the board code as follows:: + + gpiod_add_hogs(gpio_hog_table); + +The line will be hogged as soon as the gpiochip is created or - in case the +chip was created earlier - when the hog table is registered. |