diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-09-24 13:31:21 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2020-10-12 21:55:34 +0100 |
commit | d8a82543fd2c951ec17f980f7c1c259090ddfde3 (patch) | |
tree | 0f9f3dc72b00e4b8018974c0ac7c66b20a34341a | |
parent | dfaeb24d717abd2a9398ac89f88b59ac9f91441d (diff) |
tty: serial_mctrl_gpio: add wakeup support for serial control gpios
Allow serial control GPIOs to be used as a wakeup source for the system.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/tty/serial/serial_mctrl_gpio.c | 19 | ||||
-rw-r--r-- | drivers/tty/serial/serial_mctrl_gpio.h | 22 |
2 files changed, 41 insertions, 0 deletions
diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index fb4781292d40..3e3e05d5daee 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -299,4 +299,23 @@ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) } EXPORT_SYMBOL_GPL(mctrl_gpio_disable_ms); +int mctrl_gpio_enable_wake(struct mctrl_gpios *gpios, enum mctrl_gpio_idx gidx) +{ + int ret = -EINVAL; + + if (gidx < UART_GPIO_MAX && gpios->irq[gidx]) + ret = enable_irq_wake(gpios->irq[gidx]); + + return ret; +} +EXPORT_SYMBOL_GPL(mctrl_gpio_enable_wake); + +void mctrl_gpio_disable_wake(struct mctrl_gpios *gpios, + enum mctrl_gpio_idx gidx) +{ + if (gidx < UART_GPIO_MAX && gpios->irq[gidx]) + disable_irq_wake(gpios->irq[gidx]); +} +EXPORT_SYMBOL_GPL(mctrl_gpio_disable_wake); + MODULE_LICENSE("GPL"); diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h index b134a0ffc894..e2c1fb48207d 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.h +++ b/drivers/tty/serial/serial_mctrl_gpio.h @@ -91,6 +91,17 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios); */ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios); +/* + * Enable wakeup due to state change on the gpio + */ +int mctrl_gpio_enable_wake(struct mctrl_gpios *gpios, enum mctrl_gpio_idx gidx); + +/* + * Disable wakeup due to state change on the gpio + */ +void mctrl_gpio_disable_wake(struct mctrl_gpios *gpios, + enum mctrl_gpio_idx gidx); + #else /* GPIOLIB */ static inline @@ -142,6 +153,17 @@ static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) { } +static inline int mctrl_gpio_enable_wake(struct mctrl_gpios *gpios, + enum mctrl_gpio_idx gidx) +{ + return 0; +} + +static inline void mctrl_gpio_disable_wake(struct mctrl_gpios *gpios, + enum mctrl_gpio_idx gidx) +{ +} + #endif /* GPIOLIB */ #endif |