serial: mctrl_gpio: add a new API to enable / disable wake_irq

Add a new API to enable / disable wake_irq in order to enable gpio irqs as
wakeup irqs for the uart port.

Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
Link: https://lore.kernel.org/r/20220203171644.12231-2-erwan.leray@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Erwan Le Ray 2022-02-03 18:16:43 +01:00 committed by Greg Kroah-Hartman
parent 186ab09930
commit 9978c2f14f
2 changed files with 56 additions and 0 deletions

View File

@ -299,4 +299,42 @@ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios)
} }
EXPORT_SYMBOL_GPL(mctrl_gpio_disable_ms); EXPORT_SYMBOL_GPL(mctrl_gpio_disable_ms);
void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios)
{
enum mctrl_gpio_idx i;
if (!gpios)
return;
if (!gpios->mctrl_on)
return;
for (i = 0; i < UART_GPIO_MAX; ++i) {
if (!gpios->irq[i])
continue;
enable_irq_wake(gpios->irq[i]);
}
}
EXPORT_SYMBOL_GPL(mctrl_gpio_enable_irq_wake);
void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios)
{
enum mctrl_gpio_idx i;
if (!gpios)
return;
if (!gpios->mctrl_on)
return;
for (i = 0; i < UART_GPIO_MAX; ++i) {
if (!gpios->irq[i])
continue;
disable_irq_wake(gpios->irq[i]);
}
}
EXPORT_SYMBOL_GPL(mctrl_gpio_disable_irq_wake);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");

View File

@ -91,6 +91,16 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios);
*/ */
void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios); void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios);
/*
* Enable gpio wakeup interrupts to enable wake up source.
*/
void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios);
/*
* Disable gpio wakeup interrupts to enable wake up source.
*/
void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios);
#else /* GPIOLIB */ #else /* GPIOLIB */
static inline static inline
@ -142,6 +152,14 @@ static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios)
{ {
} }
static inline void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios)
{
}
static inline void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios)
{
}
#endif /* GPIOLIB */ #endif /* GPIOLIB */
#endif #endif