From ab0c52a53b37cd572e5b8d68c74d71360a33ecc7 Mon Sep 17 00:00:00 2001 From: "Justin M. Forbes" Date: Mon, 18 Sep 2017 14:14:22 -0500 Subject: Linux v4.14-rc1 --- ...e-sure-the-HID-device-is-opened-on-resume.patch | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 HID-rmi-Make-sure-the-HID-device-is-opened-on-resume.patch (limited to 'HID-rmi-Make-sure-the-HID-device-is-opened-on-resume.patch') diff --git a/HID-rmi-Make-sure-the-HID-device-is-opened-on-resume.patch b/HID-rmi-Make-sure-the-HID-device-is-opened-on-resume.patch new file mode 100644 index 000000000..d7d626972 --- /dev/null +++ b/HID-rmi-Make-sure-the-HID-device-is-opened-on-resume.patch @@ -0,0 +1,74 @@ +From patchwork Sun Jul 23 01:15:09 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: HID: rmi: Make sure the HID device is opened on resume +From: Lyude +X-Patchwork-Id: 9858267 +Message-Id: <20170723011509.23651-1-lyude@redhat.com> +To: linux-input@vger.kernel.org +Cc: Lyude , Andrew Duggan , + stable@vger.kernel.org, Jiri Kosina , + Benjamin Tissoires , + linux-kernel@vger.kernel.org +Date: Sat, 22 Jul 2017 21:15:09 -0400 + +So it looks like that suspend/resume has actually always been broken on +hid-rmi. The fact it worked was a rather silly coincidence that was +relying on the HID device to already be opened upon resume. This means +that so long as anything was reading the /dev/input/eventX node for for +an RMI device, it would suspend and resume correctly. As well, if +nothing happened to be keeping the HID device away it would shut off, +then the RMI driver would get confused on resume when it stopped +responding and explode. + +So, call hid_hw_open() in rmi_post_resume() so we make sure that the +device is alive before we try talking to it. + +This fixes RMI device suspend/resume over HID. + +Signed-off-by: Lyude +Cc: Andrew Duggan +Cc: stable@vger.kernel.org +--- + drivers/hid/hid-rmi.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c +index 5b40c2614599..e7d124f9a27f 100644 +--- a/drivers/hid/hid-rmi.c ++++ b/drivers/hid/hid-rmi.c +@@ -431,22 +431,29 @@ static int rmi_post_resume(struct hid_device *hdev) + { + struct rmi_data *data = hid_get_drvdata(hdev); + struct rmi_device *rmi_dev = data->xport.rmi_dev; +- int ret; ++ int ret = 0; + + if (!(data->device_flags & RMI_DEVICE)) + return 0; + +- ret = rmi_reset_attn_mode(hdev); ++ /* Make sure the HID device is ready to receive events */ ++ ret = hid_hw_open(hdev); + if (ret) + return ret; + ++ ret = rmi_reset_attn_mode(hdev); ++ if (ret) ++ goto out; ++ + ret = rmi_driver_resume(rmi_dev, false); + if (ret) { + hid_warn(hdev, "Failed to resume device: %d\n", ret); +- return ret; ++ goto out; + } + +- return 0; ++out: ++ hid_hw_close(hdev); ++ return ret; + } + #endif /* CONFIG_PM */ + -- cgit