From 445f77d01d9a895dbab8a6fbf4dce3f1d7dc9876 Mon Sep 17 00:00:00 2001 From: Pavankumar Vijapur Date: Mon, 1 Feb 2021 12:35:52 +0530 Subject: [PATCH] drivers: qcom: sdx_ext_ipc: keep wakeup irq always on When suspend is in progress on local processor, if remote processor toggles GPIO to indicate a resume event to local processor, this event may get lost. This commit addresses this situation. 1. Add IRQF_NO_SUSPEND flag so that wakeup_irq is not disabled during suspend on local processor. 2. Install primary handler that inform pm core that a system wakeup event has happened. The pm core can then abort a suspend in progress. Change-Id: I8d84f15a118c4630bde7b9db35ffadddeb937cb9 Signed-off-by: Pavankumar Vijapur Signed-off-by: Yogesh Lal --- drivers/soc/qcom/sdx_ext_ipc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/sdx_ext_ipc.c b/drivers/soc/qcom/sdx_ext_ipc.c index 89dfa7928563..9ea708c2838d 100644 --- a/drivers/soc/qcom/sdx_ext_ipc.c +++ b/drivers/soc/qcom/sdx_ext_ipc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #define STATUS_UP 1 @@ -304,6 +305,12 @@ static int sdx_ext_ipc_panic(struct notifier_block *this, return NOTIFY_DONE; } +static irqreturn_t hw_irq_handler(int irq, void *p) +{ + pm_system_wakeup(); + return IRQ_WAKE_THREAD; +} + static int sdx_ext_ipc_probe(struct platform_device *pdev) { int ret; @@ -371,9 +378,9 @@ static int sdx_ext_ipc_probe(struct platform_device *pdev) if (mdm->gpios[WAKEUP_IN] >= 0) { ret = devm_request_threaded_irq(mdm->dev, mdm->wakeup_irq, - sdx_ext_ipc_wakeup_irq, NULL, - IRQF_TRIGGER_FALLING, "sdx_ext_ipc_wakeup", - mdm); + hw_irq_handler, sdx_ext_ipc_wakeup_irq, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT | + IRQF_NO_SUSPEND, "sdx_ext_ipc_wakeup", mdm); if (ret < 0) { dev_err(mdm->dev, "%s: WAKEUP_IN IRQ#%d request failed,\n",