mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Acked-by: Stephen Warren <[email protected]> Reviewed-by: Thomas Abraham <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
75d6642a3e
commit
542e704f3f
3 changed files with 108 additions and 9 deletions
|
|
@ -645,6 +645,17 @@ All the above functions are mandatory to implement for a pinmux driver.
|
|||
Pinmux interaction with the GPIO subsystem
|
||||
==========================================
|
||||
|
||||
The public pinmux API contains two functions named pinmux_request_gpio()
|
||||
and pinmux_free_gpio(). These two functions shall *ONLY* be called from
|
||||
gpiolib-based drivers as part of their gpio_request() and
|
||||
gpio_free() semantics. Likewise the pinmux_gpio_direction_[input|output]
|
||||
shall only be called from within respective gpio_direction_[input|output]
|
||||
gpiolib implementation.
|
||||
|
||||
NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be
|
||||
muxed in. Instead, implement a proper gpiolib driver and have that driver
|
||||
request proper muxing for its pins.
|
||||
|
||||
The function list could become long, especially if you can convert every
|
||||
individual pin into a GPIO pin independent of any other pins, and then try
|
||||
the approach to define every pin as a function.
|
||||
|
|
@ -652,19 +663,24 @@ the approach to define every pin as a function.
|
|||
In this case, the function array would become 64 entries for each GPIO
|
||||
setting and then the device functions.
|
||||
|
||||
For this reason there is an additional function a pinmux driver can implement
|
||||
to enable only GPIO on an individual pin: .gpio_request_enable(). The same
|
||||
.free() function as for other functions is assumed to be usable also for
|
||||
GPIO pins.
|
||||
For this reason there are two functions a pinmux driver can implement
|
||||
to enable only GPIO on an individual pin: .gpio_request_enable() and
|
||||
.gpio_disable_free().
|
||||
|
||||
This function will pass in the affected GPIO range identified by the pin
|
||||
controller core, so you know which GPIO pins are being affected by the request
|
||||
operation.
|
||||
|
||||
Alternatively it is fully allowed to use named functions for each GPIO
|
||||
pin, the pinmux_request_gpio() will attempt to obtain the function "gpioN"
|
||||
where "N" is the global GPIO pin number if no special GPIO-handler is
|
||||
registered.
|
||||
If your driver needs to have an indication from the framework of whether the
|
||||
GPIO pin shall be used for input or output you can implement the
|
||||
.gpio_set_direction() function. As described this shall be called from the
|
||||
gpiolib driver and the affected GPIO range, pin offset and desired direction
|
||||
will be passed along to this function.
|
||||
|
||||
Alternatively to using these special functions, it is fully allowed to use
|
||||
named functions for each GPIO pin, the pinmux_request_gpio() will attempt to
|
||||
obtain the function "gpioN" where "N" is the global GPIO pin number if no
|
||||
special GPIO-handler is registered.
|
||||
|
||||
|
||||
Pinmux board/machine configuration
|
||||
|
|
|
|||
Loading…
Reference in a new issue