Commit 30cf821e authored by Linus Walleij's avatar Linus Walleij

pinctrl: update GPIO range doc

This updates the GPIO range documentation with the API changes
for sparse/random/arbitrary pin-to-GPIO mappings.
Reviewed-by: default avatarChristian Ruppert <christian.ruppert@abilis.com>
Acked-by: default avatarRob Landley <rob@landley.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ff73ceed
...@@ -350,6 +350,23 @@ chip b: ...@@ -350,6 +350,23 @@ chip b:
- GPIO range : [48 .. 55] - GPIO range : [48 .. 55]
- pin range : [64 .. 71] - pin range : [64 .. 71]
The above examples assume the mapping between the GPIOs and pins is
linear. If the mapping is sparse or haphazard, an array of arbitrary pin
numbers can be encoded in the range like this:
static const unsigned range_pins[] = { 14, 1, 22, 17, 10, 8, 6, 2 };
static struct pinctrl_gpio_range gpio_range = {
.name = "chip",
.id = 0,
.base = 32,
.pins = &range_pins,
.npins = ARRAY_SIZE(range_pins),
.gc = &chip;
};
In this case the pin_base property will be ignored.
When GPIO-specific functions in the pin control subsystem are called, these When GPIO-specific functions in the pin control subsystem are called, these
ranges will be used to look up the appropriate pin controller by inspecting ranges will be used to look up the appropriate pin controller by inspecting
and matching the pin to the pin ranges across all controllers. When a and matching the pin to the pin ranges across all controllers. When a
...@@ -357,9 +374,9 @@ pin controller handling the matching range is found, GPIO-specific functions ...@@ -357,9 +374,9 @@ pin controller handling the matching range is found, GPIO-specific functions
will be called on that specific pin controller. will be called on that specific pin controller.
For all functionalities dealing with pin biasing, pin muxing etc, the pin For all functionalities dealing with pin biasing, pin muxing etc, the pin
controller subsystem will subtract the range's .base offset from the passed controller subsystem will look up the corresponding pin number from the passed
in gpio number, and add the ranges's .pin_base offset to retrive a pin number. in gpio number, and use the range's internals to retrive a pin number. After
After that, the subsystem passes it on to the pin control driver, so the driver that, the subsystem passes it on to the pin control driver, so the driver
will get an pin number into its handled number range. Further it is also passed will get an pin number into its handled number range. Further it is also passed
the range ID value, so that the pin controller knows which range it should the range ID value, so that the pin controller knows which range it should
deal with. deal with.
...@@ -368,6 +385,7 @@ Calling pinctrl_add_gpio_range from pinctrl driver is DEPRECATED. Please see ...@@ -368,6 +385,7 @@ Calling pinctrl_add_gpio_range from pinctrl driver is DEPRECATED. Please see
section 2.1 of Documentation/devicetree/bindings/gpio/gpio.txt on how to bind section 2.1 of Documentation/devicetree/bindings/gpio/gpio.txt on how to bind
pinctrl and gpio drivers. pinctrl and gpio drivers.
PINMUX interfaces PINMUX interfaces
================= =================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment