HID: i2c-hid: do not reset hid if device support wakeup when resume
authorZhou weixin <zwx@rock-chips.com>
Wed, 28 Dec 2016 06:28:54 +0000 (14:28 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 29 Dec 2016 02:35:19 +0000 (10:35 +0800)
The host will trigger the hid interrupt to after reset hid, then send
wakeup key to light up screen,so any wakeupirq source will light up
screen due to reset hid in resume, and hid hwreset is not necessary.

Change-Id: I920239eeb4b57b0f594cc67cb8f4c1649c5125bd
Signed-off-by: Zhou weixin <zwx@rock-chips.com>
drivers/hid/i2c-hid/i2c-hid.c

index 6c37c4a039f081a35948bdbf61d43453add16324..ba096a4d1060b6e30e79acc0bc03fc2503dc0978 100644 (file)
@@ -462,7 +462,7 @@ static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
 
        i2c_hid_get_input(ihid);
 
-       if (ihid->is_suspend == 1)
+       if (device_may_wakeup(&ihid->client->dev) && ihid->is_suspend == 1)
                rk_send_wakeup_key();
 
        return IRQ_HANDLED;
@@ -1176,9 +1176,11 @@ static int i2c_hid_resume(struct device *dev)
        int wake_status;
 
        enable_irq(ihid->irq);
-       ret = i2c_hid_hwreset(client);
-       if (ret)
-               return ret;
+       if (!device_may_wakeup(&client->dev)) {
+               ret = i2c_hid_hwreset(client);
+               if (ret)
+                       return ret;
+       }
 
        if (device_may_wakeup(&client->dev) && ihid->irq_wake_enabled) {
                wake_status = disable_irq_wake(ihid->irq);