Skip to contentSkip to conversation

hwmon: corsair-psu: fix suspend behavior

PATCH Applied Wilken Gottwalt 2 participants 6 messages Jun 3, 2021 – Jun 13, 2021

Subsystems (2)
lore
Share & tools
lore

Wilken Gottwalt

author maintainer
#0 lore raw

PATCH v2 1/1 hwmon: corsair-psu: fix suspend behavior

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")

---
Changes in v2:
- corrected fixes commit

---
 drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/hwmon/corsair-psu.c +14 -0
index 02298b86b57b..731d5117f9f1 100644
@@ -771,6 +771,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 */
@@ -793,6 +803,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);
 
Signature · 1 line
2.31.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Wilken Gottwalt

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")

Applied.

Thanks,
Guenter

Quoted 39 lines

---
Changes in v2:
- corrected fixes commit

---
 drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/hwmon/corsair-psu.c +14 -0
index 02298b86b57b..731d5117f9f1 100644
@@ -771,6 +771,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 */
@@ -793,6 +803,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);
 
author maintainer
#2 lore raw
Quoted 8 lines · On Thu, 3 Jun 2021 09:05:33 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 5 lines · Wilken Gottwalt

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")

Applied.

Thank you. Though I have an odd question. I would like to change the licensing to a dual license (GPL/MPL) to support the LibreHardwareMonitor project. They want to use my code but use a MPL license. What would be the best way to do this?

greetings,
Will

Quoted 42 lines

Thanks,
Guenter

Quoted 39 lines

---
Changes in v2:
- corrected fixes commit

---
 drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/hwmon/corsair-psu.c +14 -0
index 02298b86b57b..731d5117f9f1 100644
@@ -771,6 +771,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 */
@@ -793,6 +803,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);
 
maintainer
#3 lore raw
Quoted 7 lines · Wilken Gottwalt
Quoted 4 lines · On Thu, 3 Jun 2021 09:05:33 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 3 lines · Wilken Gottwalt

During standby some PSUs turn off the microcontroller. A re-init is required during resume or the microcontroller stays unresponsive.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes d115b51e0e56 ("hwmon: add Corsair PSU HID controller driver")

Applied.

Thank you. Though I have an odd question. I would like to change the licensing to a dual license (GPL/MPL) to support the LibreHardwareMonitor project. They want to use my code but use a MPL license. What would be the best way to do this?

Submit a patch which would need an Acked-by: from everyone who contributed to the driver. As far as I can see, that would be Wan Jiabing <[email protected]>, Jack Doan <[email protected]>, and Colin Ian King <[email protected]>. I would suggest to ask them first if the license change is ok with them.

Guenter

Quoted 47 lines

greetings,
Will

Quoted 42 lines

Thanks,
Guenter

Quoted 39 lines

---
Changes in v2:
- corrected fixes commit

---
 drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/hwmon/corsair-psu.c +14 -0
index 02298b86b57b..731d5117f9f1 100644
@@ -771,6 +771,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 */
@@ -793,6 +803,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);
 
author maintainer
#4 lore raw
Quoted 17 lines · On Fri, 4 Jun 2021 04:05:14 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 7 lines · Wilken Gottwalt
Quoted 4 lines · On Thu, 3 Jun 2021 09:05:33 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 3 lines · Wilken Gottwalt

During standby some PSUs turn off the microcontroller. A re-init is required during resume or the microcontroller stays unresponsive.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes d115b51e0e56 ("hwmon: add Corsair PSU HID controller driver")

Applied.

Thank you. Though I have an odd question. I would like to change the licensing to a dual license (GPL/MPL) to support the LibreHardwareMonitor project. They want to use my code but use a MPL license. What would be the best way to do this?

Quoted 5 lines

Submit a patch which would need an Acked-by: from everyone who contributed to the driver. As far as I can see, that would be Wan Jiabing <[email protected]>, Jack Doan <[email protected]>, and Colin Ian King <[email protected]>. I would suggest to ask them first if the license change is ok with them.

I got the okay from Jack who had the idea for the precision patch. But the other two, who did the semicolon and long cast patches do not reply. So what now?

Quoted 50 lines

Guenter

Quoted 48 lines

greetings,
Will

Quoted 43 lines

Thanks,
Guenter

Quoted 40 lines

---
Changes in v2:
- corrected fixes commit

---
 drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/hwmon/corsair-psu.c +10 -0
index 02298b86b57b..731d5117f9f1 100644
@@ -771,6 +771,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 */
drivers/hwmon/corsair-psu.c +4 -0
 	{ HID_USB_DEVICE(0x1b1c, 0x1c04) }, /* Corsair HX650i */
@@ -793,6 +803,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);
 
maintainer
#5 lore raw
Quoted 20 lines · Wilken Gottwalt
Quoted 17 lines · On Fri, 4 Jun 2021 04:05:14 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 15 lines · Wilken Gottwalt
Quoted 8 lines · On Thu, 3 Jun 2021 09:05:33 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 5 lines · Wilken Gottwalt

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")

Applied.

Thank you. Though I have an odd question. I would like to change the licensing to a dual license (GPL/MPL) to support the LibreHardwareMonitor project. They want to use my code but use a MPL license. What would be the best way to do this?

Quoted 9 lines
Quoted 5 lines

Submit a patch which would need an Acked-by: from everyone who contributed to the driver. As far as I can see, that would be Wan Jiabing <[email protected]>, Jack Doan <[email protected]>, and Colin Ian King <[email protected]>. I would suggest to ask them first if the license change is ok with them.

I got the okay from Jack who had the idea for the precision patch. But the other two, who did the semicolon and long cast patches do not reply. So what now?

I see two options:
- Publish your original code (not including the semicolon and long cast patches) as an out-of-tree driver at github or some other open source repository site, with whatever license you want, and ask LibreHardwareMonitor pull it from there.
- Submit the driver yourself into LibreHardwareMonitor, again not including the problematic changes, with whatever license you want.

Disclaimer: I am not an attorney, and this is not legal advice.

Guenter