LF-389: input: keyboard: snvs_pwrkey: fix no event report from suspend

In case long latency spent on some board such as i.mx8mq-evk where pcie
driver may take 200ms timing window to restore pcie link in no_irq phase,
press event will be ignored since key maybe already released before timer
start to run because of the above large 200ms window with irq disabled.
Directly report press event in interrupt handler after suspend to ensure
no press event miss in this case.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
This commit is contained in:
Robin Gong 2019-12-11 01:07:25 +08:00
parent 7ae82f64e9
commit 010acdd743
1 changed files with 7 additions and 0 deletions

View File

@ -85,6 +85,7 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
{
struct platform_device *pdev = dev_id;
struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
struct input_dev *input = pdata->input;
u32 lp_status;
pm_wakeup_event(pdata->input->dev.parent, 0);
@ -92,6 +93,12 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
if (pdata->clk)
clk_enable(pdata->clk);
if (pdata->suspended) {
pdata->keystate = 1;
input_event(input, EV_KEY, pdata->keycode, 1);
input_sync(input);
}
regmap_read(pdata->snvs, SNVS_LPSR_REG, &lp_status);
if (lp_status & SNVS_LPSR_SPO)
mod_timer(&pdata->check_timer, jiffies + msecs_to_jiffies(DEBOUNCE_TIME));