diff mbox series

[v2,4/4] HID: gamecube-adapter: restore input after suspend

Message ID 20200512084616.32158-4-fx.carton91@gmail.com
State Superseded
Headers show
Series [v2,1/4] HID: gamecube-adapter: add nintendo gamecube adapter | expand

Commit Message

François-Xavier Carton May 12, 2020, 8:46 a.m. UTC
Send the init command after suspend, so that we get input reports again.

Signed-off-by: François-Xavier Carton <fx.carton91@gmail.com>
---
 drivers/hid/hid-gamecube-adapter.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/drivers/hid/hid-gamecube-adapter.c b/drivers/hid/hid-gamecube-adapter.c
index efcbd8f27b67..11d3e483f0c1 100644
--- a/drivers/hid/hid-gamecube-adapter.c
+++ b/drivers/hid/hid-gamecube-adapter.c
@@ -441,6 +441,14 @@  static int gamecube_hid_probe(struct hid_device *hdev,
 	return ret;
 }
 
+#ifdef CONFIG_PM
+static int gamecube_resume(struct hid_device *hdev)
+{
+	gamecube_send_cmd_init(hdev);
+	return 0;
+}
+#endif
+
 static void gamecube_hid_remove(struct hid_device *hdev)
 {
 	struct gamecube_adapter *adpt = hid_get_drvdata(hdev);
@@ -462,6 +470,9 @@  static struct hid_driver gamecube_hid_driver = {
 	.probe		= gamecube_hid_probe,
 	.remove		= gamecube_hid_remove,
 	.raw_event	= gamecube_hid_event,
+#ifdef CONFIG_PM
+	.reset_resume	= gamecube_resume,
+#endif
 };
 module_hid_driver(gamecube_hid_driver);