aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/pinctrl.txt
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-11-14 04:06:22 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-01-03 03:10:01 -0500
commit542e704f3ffee1dc4539c9e8191e4dc215220f5e (patch)
treeda2f8aae8bedb6e3216b4808dc743eb94c3270e3 /Documentation/pinctrl.txt
parent75d6642a3ee1dfe2552028997cdcc2c4207bec8f (diff)
pinctrl: GPIO direction support for muxing
When requesting a single GPIO pin to be muxed in, some controllers will need to poke a different value into the control register depending on whether the pin will be used for GPIO output or GPIO input. So create pinmux counterparts to gpio_direction_[input|output] in the pinctrl framework. ChangeLog v1->v2: - This also amends the documentation to make it clear the this function and associated machinery is *ONLY* intended as a backend to gpiolib machinery, not for everyone and his dog to start playing around with pins. ChangeLog v2->v3: - Don't pass an argument to the common request function, instead provide pinmux_* counterparts to the gpio_direction_[input|output] calls, simpler and anyone can understand it. ChangeLog v3->v4: - Fix numerous spelling mistakes and dangling text in documentation. Add Ack and Rewewed-by. Cc: Igor Grinberg <grinberg@compulab.co.il> Acked-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'Documentation/pinctrl.txt')
-rw-r--r--Documentation/pinctrl.txt32
1 files changed, 24 insertions, 8 deletions
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
index 43ba411d1571..3846264c5973 100644
--- a/Documentation/pinctrl.txt
+++ b/Documentation/pinctrl.txt
@@ -645,6 +645,17 @@ All the above functions are mandatory to implement for a pinmux driver.
645Pinmux interaction with the GPIO subsystem 645Pinmux interaction with the GPIO subsystem
646========================================== 646==========================================
647 647
648The public pinmux API contains two functions named pinmux_request_gpio()
649and pinmux_free_gpio(). These two functions shall *ONLY* be called from
650gpiolib-based drivers as part of their gpio_request() and
651gpio_free() semantics. Likewise the pinmux_gpio_direction_[input|output]
652shall only be called from within respective gpio_direction_[input|output]
653gpiolib implementation.
654
655NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be
656muxed in. Instead, implement a proper gpiolib driver and have that driver
657request proper muxing for its pins.
658
648The function list could become long, especially if you can convert every 659The function list could become long, especially if you can convert every
649individual pin into a GPIO pin independent of any other pins, and then try 660individual pin into a GPIO pin independent of any other pins, and then try
650the approach to define every pin as a function. 661the approach to define every pin as a function.
@@ -652,19 +663,24 @@ the approach to define every pin as a function.
652In this case, the function array would become 64 entries for each GPIO 663In this case, the function array would become 64 entries for each GPIO
653setting and then the device functions. 664setting and then the device functions.
654 665
655For this reason there is an additional function a pinmux driver can implement 666For this reason there are two functions a pinmux driver can implement
656to enable only GPIO on an individual pin: .gpio_request_enable(). The same 667to enable only GPIO on an individual pin: .gpio_request_enable() and
657.free() function as for other functions is assumed to be usable also for 668.gpio_disable_free().
658GPIO pins.
659 669
660This function will pass in the affected GPIO range identified by the pin 670This function will pass in the affected GPIO range identified by the pin
661controller core, so you know which GPIO pins are being affected by the request 671controller core, so you know which GPIO pins are being affected by the request
662operation. 672operation.
663 673
664Alternatively it is fully allowed to use named functions for each GPIO 674If your driver needs to have an indication from the framework of whether the
665pin, the pinmux_request_gpio() will attempt to obtain the function "gpioN" 675GPIO pin shall be used for input or output you can implement the
666where "N" is the global GPIO pin number if no special GPIO-handler is 676.gpio_set_direction() function. As described this shall be called from the
667registered. 677gpiolib driver and the affected GPIO range, pin offset and desired direction
678will be passed along to this function.
679
680Alternatively to using these special functions, it is fully allowed to use
681named functions for each GPIO pin, the pinmux_request_gpio() will attempt to
682obtain the function "gpioN" where "N" is the global GPIO pin number if no
683special GPIO-handler is registered.
668 684
669 685
670Pinmux board/machine configuration 686Pinmux board/machine configuration