diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-09-24 13:31:21 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-01-08 10:29:58 +0000 |
commit | ccf4f611d138527b0d18b617ab27d7d821014890 (patch) | |
tree | b93f03891404175e756d27211a1e7dee5cc092fd | |
parent | eb7b603be1d0df4a797fb98df6c7b44020ab7ec9 (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 e51ca593ab86..52e680769acb 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -385,4 +385,23 @@ void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios) } EXPORT_SYMBOL_GPL(mctrl_gpio_disable_irq_wake); +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 fc76910fb105..07bec3aa2786 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.h +++ b/drivers/tty/serial/serial_mctrl_gpio.h @@ -101,6 +101,17 @@ void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios); */ void mctrl_gpio_disable_irq_wake(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 @@ -160,6 +171,17 @@ static inline void mctrl_gpio_disable_irq_wake(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 |