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:
parent
186ab09930
commit
9978c2f14f
@ -299,4 +299,42 @@ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios)
|
||||
}
|
||||
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");
|
||||
|
@ -91,6 +91,16 @@ void mctrl_gpio_enable_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 */
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user