|
@@ -1054,21 +1054,29 @@ static int i2c_hid_remove(struct i2c_client *client)
|
|
static int i2c_hid_suspend(struct device *dev)
|
|
static int i2c_hid_suspend(struct device *dev)
|
|
{
|
|
{
|
|
struct i2c_client *client = to_i2c_client(dev);
|
|
struct i2c_client *client = to_i2c_client(dev);
|
|
|
|
+ struct i2c_hid *ihid = i2c_get_clientdata(client);
|
|
|
|
+ struct hid_device *hid = ihid->hid;
|
|
|
|
+ int ret = 0;
|
|
|
|
|
|
disable_irq(client->irq);
|
|
disable_irq(client->irq);
|
|
if (device_may_wakeup(&client->dev))
|
|
if (device_may_wakeup(&client->dev))
|
|
enable_irq_wake(client->irq);
|
|
enable_irq_wake(client->irq);
|
|
|
|
|
|
|
|
+ if (hid->driver && hid->driver->suspend)
|
|
|
|
+ ret = hid->driver->suspend(hid, PMSG_SUSPEND);
|
|
|
|
+
|
|
/* Save some power */
|
|
/* Save some power */
|
|
i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
|
|
i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static int i2c_hid_resume(struct device *dev)
|
|
static int i2c_hid_resume(struct device *dev)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
struct i2c_client *client = to_i2c_client(dev);
|
|
struct i2c_client *client = to_i2c_client(dev);
|
|
|
|
+ struct i2c_hid *ihid = i2c_get_clientdata(client);
|
|
|
|
+ struct hid_device *hid = ihid->hid;
|
|
|
|
|
|
enable_irq(client->irq);
|
|
enable_irq(client->irq);
|
|
ret = i2c_hid_hwreset(client);
|
|
ret = i2c_hid_hwreset(client);
|
|
@@ -1078,6 +1086,11 @@ static int i2c_hid_resume(struct device *dev)
|
|
if (device_may_wakeup(&client->dev))
|
|
if (device_may_wakeup(&client->dev))
|
|
disable_irq_wake(client->irq);
|
|
disable_irq_wake(client->irq);
|
|
|
|
|
|
|
|
+ if (hid->driver && hid->driver->reset_resume) {
|
|
|
|
+ ret = hid->driver->reset_resume(hid);
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|