summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilken Gottwalt <wilken.gottwalt@posteo.net>2021-06-03 11:51:02 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-16 12:05:13 +0200
commite3b478db63dc64f40f231e862c68a0418a2378d6 (patch)
tree91eb5f962bbd3f585f93624b5ab728bd12427e30
parent0c010eae2febe81d7d25d554471cc015b950e0a1 (diff)
downloadlinux-e3b478db63dc64f40f231e862c68a0418a2378d6.tar.gz
linux-e3b478db63dc64f40f231e862c68a0418a2378d6.tar.bz2
linux-e3b478db63dc64f40f231e862c68a0418a2378d6.zip
hwmon: (corsair-psu) fix suspend behavior
commit 7656cd2177612aa7c299b083ecff30a4d3e9a587 upstream. During standby some PSUs turn off the microcontroller. A re-init is required during resume or the microcontroller stays unresponsive. Fixes: d115b51e0e56 ("hwmon: add Corsair PSU HID controller driver") Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net> Link: https://lore.kernel.org/r/YLjCJiVtu5zgTabI@monster.powergraphx.local Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/hwmon/corsair-psu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
index 99494056f4bd..7c462726382d 100644
--- a/drivers/hwmon/corsair-psu.c
+++ b/drivers/hwmon/corsair-psu.c
@@ -570,6 +570,16 @@ static int corsairpsu_raw_event(struct hid_device *hdev, struct hid_report *repo
return 0;
}
+#ifdef CONFIG_PM
+static int corsairpsu_resume(struct hid_device *hdev)
+{
+ struct corsairpsu_data *priv = hid_get_drvdata(hdev);
+
+ /* some PSUs turn off the microcontroller during standby, so a reinit is required */
+ return corsairpsu_init(priv);
+}
+#endif
+
static const struct hid_device_id corsairpsu_idtable[] = {
{ HID_USB_DEVICE(0x1b1c, 0x1c03) }, /* Corsair HX550i */
{ HID_USB_DEVICE(0x1b1c, 0x1c04) }, /* Corsair HX650i */
@@ -592,6 +602,10 @@ static struct hid_driver corsairpsu_driver = {
.probe = corsairpsu_probe,
.remove = corsairpsu_remove,
.raw_event = corsairpsu_raw_event,
+#ifdef CONFIG_PM
+ .resume = corsairpsu_resume,
+ .reset_resume = corsairpsu_resume,
+#endif
};
module_hid_driver(corsairpsu_driver);