Skip to content

Commit

Permalink
HID: i2c-hid: set power sleep before shutdown
Browse files Browse the repository at this point in the history
Add i2c_hid_shutdown for i2c-hid driver to send suspend cmd & free
irq before device shutdown.

Some HW design (i.e. Umaro, a chromebook model) is that the power to
i2c hid device won't down after device shutdown. Also the i2c-hid driver
do not send suspend cmd to the hid i2c device and free its irq before
shutdown.So if We touch the touchscreen or some other i2c hid device,
the power consumtion will be go up even when the device is in shutdown
state.

Though the root cause maybe a HW issue. But it seems that it is a
good pratice to set power sleep for i2c-hid device before shutdown.

Signed-off-by: Guohua Zhong <ghzhong@yifangdigital.com>
Acked-By: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Guohua Zhong authored and Jiri Kosina committed Jun 21, 2016
1 parent 982e42d commit d9f448e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/hid/i2c-hid/i2c-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,14 @@ static int i2c_hid_remove(struct i2c_client *client)
return 0;
}

static void i2c_hid_shutdown(struct i2c_client *client)
{
struct i2c_hid *ihid = i2c_get_clientdata(client);

i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
free_irq(client->irq, ihid);
}

#ifdef CONFIG_PM_SLEEP
static int i2c_hid_suspend(struct device *dev)
{
Expand Down Expand Up @@ -1231,7 +1239,7 @@ static struct i2c_driver i2c_hid_driver = {

.probe = i2c_hid_probe,
.remove = i2c_hid_remove,

.shutdown = i2c_hid_shutdown,
.id_table = i2c_hid_id_table,
};

Expand Down

0 comments on commit d9f448e

Please sign in to comment.