Skip to contentSkip to conversation

i2c_hid: enable i2c-hid devices to suspend/resume asynchronously

PATCH Applied Fu, Zhonghui 4 participants 6 messages May 19, 2016 – Jun 6, 2016 1 message not in the archive HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c_hid: enable i2c-hid devices to suspend/resume asynchronously

i2c-hid devices' suspend/resume are usually time-consuming process. For example, the touch controller(i2c-ATML1000:00) on ASUS T100 tablet takes about 160ms for suspending and 120ms for resuming. This patch enables i2c-hid devices to suspend/resume asynchronously. This will take advantage of multicore and speed up system suspend/resume process.

---
 drivers/hid/i2c-hid/i2c-hid.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/hid/i2c-hid/i2c-hid.c +1 -0
index 2e021ba..cc41e1e 100644
@@ -1020,6 +1020,7 @@ static int i2c_hid_probe(struct i2c_client *client,
 	pm_runtime_get_noresume(&client->dev);
 	pm_runtime_set_active(&client->dev);
 	pm_runtime_enable(&client->dev);
+	device_enable_async_suspend(&client->dev);
 
 	ret = i2c_hid_fetch_hid_descriptor(ihid);
 	if (ret < 0)

-- 1.7.1

Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Zhonghui

i2c-hid devices' suspend/resume are usually time-consuming process. For example, the touch controller(i2c-ATML1000:00) on ASUS T100 tablet takes about 160ms for suspending and 120ms for resuming. This patch enables i2c-hid devices to suspend/resume asynchronously. This will take advantage of multicore and speed up system suspend/resume process.

Looks reasonable to me,

maintainer
#2 lore raw
In reply to Fu, Zhonghui
Quoted 5 lines · Zhonghui

i2c-hid devices' suspend/resume are usually time-consuming process. For example, the touch controller(i2c-ATML1000:00) on ASUS T100 tablet takes about 160ms for suspending and 120ms for resuming. This patch enables i2c-hid devices to suspend/resume asynchronously. This will take advantage of multicore and speed up system suspend/resume process.

Umm, why do we need this in the first place, given the fact that we are enabling async suspend for each and every HID device allocated via hid_allocate_device() already?

Signature · 2 lines
Jiri Kosina
SUSE Labs

A message that is not in the archive (sent off-list or not yet received): CAE_wzQ-Rwpf3Cb8cpw11s=rcRTMZ5kpod7jLAhF84A82CLaVcA@mail.gmail.com

#4 lore raw
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · Jiri Kosina
Quoted 5 lines · Zhonghui

i2c-hid devices' suspend/resume are usually time-consuming process. For example, the touch controller(i2c-ATML1000:00) on ASUS T100 tablet takes about 160ms for suspending and 120ms for resuming. This patch enables i2c-hid devices to suspend/resume asynchronously. This will take advantage of multicore and speed up system suspend/resume process.

Quoted 7 lines
Quoted 4 lines

Umm, why do we need this in the first place, given the fact that we are enabling async suspend for each and every HID device allocated via hid_allocate_device() already?

i2c-hid is not a HID but I2C device on I2C bus and is currently resumed synchronously, in-line. Since it tries to reset device as part of resume it may take a while for the device to respond.

Sorry for late reply.
Yes, the devices driven by i2c-hid driver are I2C devices, not HID devices.

Quoted 6 lines

BTW, I am not quite sure what async suspend enabled
in hid_allocate_device() does for us, given that I do not see HID bus implementing the suspend/resume support for its devices (as far as I remember we rely on underlying transports - USB or I2C - to resume the devices properly).

Even if HID bus does not implement the suspend/resume support for its devices, the power domain, device type, device class or device driver subsystem related to HID devices can still implement the suspend/resume support for HID devices.

Thanks,
Zhonghui

Quoted 4 lines

Thanks,
Dmitry

Acked-by on v1 1/1
#5 lore raw
In reply to Fu, Zhonghui
Quoted 8 lines · Zhonghui

i2c-hid devices' suspend/resume are usually time-consuming process. For example, the touch controller(i2c-ATML1000:00) on ASUS T100 tablet takes about 160ms for suspending and 120ms for resuming. This patch enables i2c-hid devices to suspend/resume asynchronously. This will take advantage of multicore and speed up system suspend/resume process.

---

In regard with the discussion:

Quoted 17 lines
 drivers/hid/i2c-hid/i2c-hid.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/hid/i2c-hid/i2c-hid.c +1 -1
index 2e021ba..cc41e1e 100644
@@ -1020,6 +1020,7 @@ static int i2c_hid_probe(struct i2c_client *client,
 	pm_runtime_get_noresume(&client->dev);
 	pm_runtime_set_active(&client->dev);
 	pm_runtime_enable(&client->dev);
+	device_enable_async_suspend(&client->dev);
 
 	ret = i2c_hid_fetch_hid_descriptor(ihid);
 	if (ret < 0)
-- 1.7.1
maintainer Applied
#6 lore raw
In reply to Fu, Zhonghui
Quoted 16 lines · Zhonghui

i2c-hid devices' suspend/resume are usually time-consuming process. For example, the touch controller(i2c-ATML1000:00) on ASUS T100 tablet takes about 160ms for suspending and 120ms for resuming. This patch enables i2c-hid devices to suspend/resume asynchronously. This will take advantage of multicore and speed up system suspend/resume process.

---
 drivers/hid/i2c-hid/i2c-hid.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/hid/i2c-hid/i2c-hid.c +0 -0
index 2e021ba..cc41e1e 100644

drivers/hid/i2c-hid/i2c-hid.c static int i2c_hid_probe(struct i2c_client *client, · line 1026

Quoted 7 lines
drivers/hid/i2c-hid/i2c-hid.c +1 -0
@@ -1020,6 +1020,7 @@ static int i2c_hid_probe(struct i2c_client *client,
 	pm_runtime_get_noresume(&client->dev);
 	pm_runtime_set_active(&client->dev);
 	pm_runtime_enable(&client->dev);
+	device_enable_async_suspend(&client->dev);
 
 	ret = i2c_hid_fetch_hid_descriptor(ihid);
 	if (ret < 0)

Applied to hid.git#for-4.8/i2c-hid.

Signature · 2 lines
Jiri Kosina
SUSE Labs