[PATCH 3/3] Input: snvs_pwrkey - report press event in interrupt handler

Joy Zou
2026-03-26T10:38:23Z

On some boards such as i.MX8MQ-EVK, the PCIe driver may take up to
200ms to restore the PCIe link during the no_irq resume phase. This
causes key press events to be lost because the key may be released
before the timer starts running, as interrupts are disabled during
this 200ms window.

Report key press events directly in interrupt handler to prevent event
loss during system suspend.

Signed-off-by: Joy Zou <joy.zou@nxp.com>
---
drivers/input/keyboard/snvs_pwrkey.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index bab3ab57fdac77256be75a080773ea99372ec9c7..b557c1618d7369e872c6ce708a7b3017264ee385 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -78,6 +78,16 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)

pm_wakeup_event(input->dev.parent, 0);

+ /*
+ * Report key press events directly in interrupt handler to prevent event
+ * loss during system suspend.
+ */
+ if (pdev->dev.power.is_suspended) {
+ pdata->keystate = 1;
+ input_report_key(input, pdata->keycode, 1);
+ input_sync(input);
+ }
+
regmap_read(pdata->snvs, SNVS_LPSR_REG, &lp_status);
if (lp_status & SNVS_LPSR_SPO) {
if (pdata->minor_rev == 0) {

--
2.37.1