mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
tty/serial: Add GPIOLIB helpers for controlling modem lines
This patch add some helpers to control modem lines (CTS/RTS/DSR...) via GPIO. This will be useful for many boards which have a serial controller that only handle CTS/RTS pins (or even just RX/TX). Signed-off-by: Richard Genoud <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Tested-by: Yegor Yefremov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
fa3909320c
commit
84130aace8
5 changed files with 284 additions and 0 deletions
|
|
@ -429,3 +429,28 @@ thus:
|
|||
struct uart_port port;
|
||||
int my_stuff;
|
||||
};
|
||||
|
||||
Modem control lines via GPIO
|
||||
----------------------------
|
||||
|
||||
Some helpers are provided in order to set/get modem control lines via GPIO.
|
||||
|
||||
mctrl_gpio_init(dev, idx):
|
||||
This will get the {cts,rts,...}-gpios from device tree if they are
|
||||
present and request them, set direction etc, and return an
|
||||
allocated structure. devm_* functions are used, so there's no need
|
||||
to call mctrl_gpio_free().
|
||||
|
||||
mctrl_gpio_free(dev, gpios):
|
||||
This will free the requested gpios in mctrl_gpio_init().
|
||||
As devm_* function are used, there's generally no need to call
|
||||
this function.
|
||||
|
||||
mctrl_gpio_to_gpiod(gpios, gidx)
|
||||
This returns the gpio structure associated to the modem line index.
|
||||
|
||||
mctrl_gpio_set(gpios, mctrl):
|
||||
This will sets the gpios according to the mctrl state.
|
||||
|
||||
mctrl_gpio_get(gpios, mctrl):
|
||||
This will update mctrl with the gpios values.
|
||||
|
|
|
|||
Loading…
Reference in a new issue