From aa99a90650b276047986e3ef398e5078d34264c9 Mon Sep 17 00:00:00 2001 From: Ajay Dudani Date: Wed, 26 Sep 2012 13:43:40 +0530 Subject: [PATCH] input: pm8xxx-pwrkey: Update key press status during probe Power key could be in pressed state during boot. Set the flag to track the press status properly by reading press irq status. CRs-fixed: 404018 Change-Id: I93a8584420002d9cb399484b3ac77fa2ed954690 Signed-off-by: Mohan Pallaka --- drivers/input/misc/pmic8xxx-pwrkey.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c index 4f21adceac05..1b937dc764a1 100644 --- a/drivers/input/misc/pmic8xxx-pwrkey.c +++ b/drivers/input/misc/pmic8xxx-pwrkey.c @@ -178,10 +178,22 @@ static int __devinit pmic8xxx_pwrkey_probe(struct platform_device *pdev) pwrkey->key_press_irq = key_press_irq; pwrkey->key_release_irq = key_release_irq; pwrkey->pwr = pwr; - pwrkey->press = false; platform_set_drvdata(pdev, pwrkey); + /* check power key status during boot */ + err = pm8xxx_read_irq_stat(pdev->dev.parent, key_press_irq); + if (err < 0) { + dev_err(&pdev->dev, "reading irq status failed\n"); + goto unreg_input_dev; + } + pwrkey->press = !!err; + + if (pwrkey->press) { + input_report_key(pwrkey->pwr, KEY_POWER, 1); + input_sync(pwrkey->pwr); + } + err = request_any_context_irq(key_press_irq, pwrkey_press_irq, IRQF_TRIGGER_RISING, "pmic8xxx_pwrkey_press", pwrkey); if (err < 0) {