]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
HID: multitouch: Set to high latency mode on suspend.
authorBlaž Hrastnik <blaz@mxxn.io>
Sat, 19 Dec 2020 04:47:41 +0000 (13:47 +0900)
committerJiri Kosina <jkosina@suse.cz>
Tue, 26 Jan 2021 10:09:06 +0000 (11:09 +0100)
Per Windows Precision Touchpad guidelines:

> The latency mode feature report is sent by the host to a Windows
> Precision Touchpad to indicate when high latency is desirable for
> power savings and, conversely, when normal latency is desired for
> operation.
>
> For USB-connected Windows Precision Touchpads, this enables the device
> to disambiguate between being suspended for inactivity (runtime IDLE)
> and being suspended because the system is entering S3 or Connected
> Standby.

The current implementation would set the latency to normal on device initialization,
but we didn't set the device to high latency on suspend.

Signed-off-by: Blaž Hrastnik <blaz@mxxn.io>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-multitouch.c

index 0743ef51d3b246ab2086ca3dda387a842b79e19e..39e802eeff247fbaf98270e04d2129d3fdb064c2 100644 (file)
@@ -1746,6 +1746,13 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 }
 
 #ifdef CONFIG_PM
+static int mt_suspend(struct hid_device *hdev, pm_message_t state)
+{
+       /* High latency is desirable for power savings during S3/S0ix */
+       mt_set_modes(hdev, HID_LATENCY_HIGH, true, true);
+       return 0;
+}
+
 static int mt_reset_resume(struct hid_device *hdev)
 {
        mt_release_contacts(hdev);
@@ -1761,6 +1768,8 @@ static int mt_resume(struct hid_device *hdev)
 
        hid_hw_idle(hdev, 0, 0, HID_REQ_SET_IDLE);
 
+       mt_set_modes(hdev, HID_LATENCY_NORMAL, true, true);
+
        return 0;
 }
 #endif
@@ -2154,6 +2163,7 @@ static struct hid_driver mt_driver = {
        .event = mt_event,
        .report = mt_report,
 #ifdef CONFIG_PM
+       .suspend = mt_suspend,
        .reset_resume = mt_reset_resume,
        .resume = mt_resume,
 #endif