diff options
Diffstat (limited to 'Documentation/pinctrl.txt')
-rw-r--r-- | Documentation/pinctrl.txt | 32 |
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. | |||
645 | Pinmux interaction with the GPIO subsystem | 645 | Pinmux interaction with the GPIO subsystem |
646 | ========================================== | 646 | ========================================== |
647 | 647 | ||
648 | The public pinmux API contains two functions named pinmux_request_gpio() | ||
649 | and pinmux_free_gpio(). These two functions shall *ONLY* be called from | ||
650 | gpiolib-based drivers as part of their gpio_request() and | ||
651 | gpio_free() semantics. Likewise the pinmux_gpio_direction_[input|output] | ||
652 | shall only be called from within respective gpio_direction_[input|output] | ||
653 | gpiolib implementation. | ||
654 | |||
655 | NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be | ||
656 | muxed in. Instead, implement a proper gpiolib driver and have that driver | ||
657 | request proper muxing for its pins. | ||
658 | |||
648 | The function list could become long, especially if you can convert every | 659 | The function list could become long, especially if you can convert every |
649 | individual pin into a GPIO pin independent of any other pins, and then try | 660 | individual pin into a GPIO pin independent of any other pins, and then try |
650 | the approach to define every pin as a function. | 661 | the approach to define every pin as a function. |
@@ -652,19 +663,24 @@ the approach to define every pin as a function. | |||
652 | In this case, the function array would become 64 entries for each GPIO | 663 | In this case, the function array would become 64 entries for each GPIO |
653 | setting and then the device functions. | 664 | setting and then the device functions. |
654 | 665 | ||
655 | For this reason there is an additional function a pinmux driver can implement | 666 | For this reason there are two functions a pinmux driver can implement |
656 | to enable only GPIO on an individual pin: .gpio_request_enable(). The same | 667 | to 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(). |
658 | GPIO pins. | ||
659 | 669 | ||
660 | This function will pass in the affected GPIO range identified by the pin | 670 | This function will pass in the affected GPIO range identified by the pin |
661 | controller core, so you know which GPIO pins are being affected by the request | 671 | controller core, so you know which GPIO pins are being affected by the request |
662 | operation. | 672 | operation. |
663 | 673 | ||
664 | Alternatively it is fully allowed to use named functions for each GPIO | 674 | If your driver needs to have an indication from the framework of whether the |
665 | pin, the pinmux_request_gpio() will attempt to obtain the function "gpioN" | 675 | GPIO pin shall be used for input or output you can implement the |
666 | where "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 |
667 | registered. | 677 | gpiolib driver and the affected GPIO range, pin offset and desired direction |
678 | will be passed along to this function. | ||
679 | |||
680 | Alternatively to using these special functions, it is fully allowed to use | ||
681 | named functions for each GPIO pin, the pinmux_request_gpio() will attempt to | ||
682 | obtain the function "gpioN" where "N" is the global GPIO pin number if no | ||
683 | special GPIO-handler is registered. | ||
668 | 684 | ||
669 | 685 | ||
670 | Pinmux board/machine configuration | 686 | Pinmux board/machine configuration |