diff mbox series

[v2] hwmon: corsair-psu: fix suspend behavior

Message ID YLjCJiVtu5zgTabI@monster.powergraphx.local (mailing list archive)
State Accepted
Headers show
Series [v2] hwmon: corsair-psu: fix suspend behavior | expand

Commit Message

Wilken Gottwalt June 3, 2021, 11:51 a.m. UTC
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>
---
Changes in v2:
  - corrected fixes commit
---
 drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Guenter Roeck June 3, 2021, 4:05 p.m. UTC | #1
On Thu, Jun 03, 2021 at 11:51:02AM +0000, Wilken Gottwalt wrote:
> 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>

Applied.

Thanks,
Guenter

> ---
> Changes in v2:
>   - corrected fixes commit
> ---
>  drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
> index 02298b86b57b..731d5117f9f1 100644
> --- a/drivers/hwmon/corsair-psu.c
> +++ b/drivers/hwmon/corsair-psu.c
> @@ -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);
>
Wilken Gottwalt June 4, 2021, 5:17 a.m. UTC | #2
On Thu, 3 Jun 2021 09:05:33 -0700
Guenter Roeck <linux@roeck-us.net> wrote:

> On Thu, Jun 03, 2021 at 11:51:02AM +0000, Wilken Gottwalt wrote:
> > 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>
> 
> 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

> Thanks,
> Guenter
> 
> > ---
> > Changes in v2:
> >   - corrected fixes commit
> > ---
> >  drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
> > index 02298b86b57b..731d5117f9f1 100644
> > --- a/drivers/hwmon/corsair-psu.c
> > +++ b/drivers/hwmon/corsair-psu.c
> > @@ -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);
> >
Guenter Roeck June 4, 2021, 11:05 a.m. UTC | #3
On Fri, Jun 04, 2021 at 05:17:11AM +0000, Wilken Gottwalt wrote:
> On Thu, 3 Jun 2021 09:05:33 -0700
> Guenter Roeck <linux@roeck-us.net> wrote:
> 
> > On Thu, Jun 03, 2021 at 11:51:02AM +0000, Wilken Gottwalt wrote:
> > > 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>
> > 
> > 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
<wanjiabing@vivo.com>, Jack Doan <me@jackdoan.com>, and Colin Ian King
<colin.king@canonical.com>. I would suggest to ask them first if the license
change is ok with them.

Guenter

> 
> greetings,
> Will
> 
> > Thanks,
> > Guenter
> > 
> > > ---
> > > Changes in v2:
> > >   - corrected fixes commit
> > > ---
> > >  drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
> > >  1 file changed, 14 insertions(+)
> > > 
> > > diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
> > > index 02298b86b57b..731d5117f9f1 100644
> > > --- a/drivers/hwmon/corsair-psu.c
> > > +++ b/drivers/hwmon/corsair-psu.c
> > > @@ -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);
> > >  
>
Wilken Gottwalt June 13, 2021, 2:06 p.m. UTC | #4
On Fri, 4 Jun 2021 04:05:14 -0700
Guenter Roeck <linux@roeck-us.net> wrote:

> On Fri, Jun 04, 2021 at 05:17:11AM +0000, Wilken Gottwalt wrote:
> > On Thu, 3 Jun 2021 09:05:33 -0700
> > Guenter Roeck <linux@roeck-us.net> wrote:
> > 
> > > On Thu, Jun 03, 2021 at 11:51:02AM +0000, Wilken Gottwalt wrote:
> > > > 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>
> > > 
> > > 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
> <wanjiabing@vivo.com>, Jack Doan <me@jackdoan.com>, and Colin Ian King
> <colin.king@canonical.com>. 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?

> Guenter
> 
> > 
> > greetings,
> > Will
> > 
> > > Thanks,
> > > Guenter
> > > 
> > > > ---
> > > > Changes in v2:
> > > >   - corrected fixes commit
> > > > ---
> > > >  drivers/hwmon/corsair-psu.c | 14 ++++++++++++++
> > > >  1 file changed, 14 insertions(+)
> > > > 
> > > > diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
> > > > index 02298b86b57b..731d5117f9f1 100644
> > > > --- a/drivers/hwmon/corsair-psu.c
> > > > +++ b/drivers/hwmon/corsair-psu.c
> > > > @@ -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);
> > > >  
> >
Guenter Roeck June 13, 2021, 5:42 p.m. UTC | #5
On Sun, Jun 13, 2021 at 02:06:34PM +0000, Wilken Gottwalt wrote:
> On Fri, 4 Jun 2021 04:05:14 -0700
> Guenter Roeck <linux@roeck-us.net> wrote:
> 
> > On Fri, Jun 04, 2021 at 05:17:11AM +0000, Wilken Gottwalt wrote:
> > > On Thu, 3 Jun 2021 09:05:33 -0700
> > > Guenter Roeck <linux@roeck-us.net> wrote:
> > > 
> > > > On Thu, Jun 03, 2021 at 11:51:02AM +0000, Wilken Gottwalt wrote:
> > > > > 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>
> > > > 
> > > > 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
> > <wanjiabing@vivo.com>, Jack Doan <me@jackdoan.com>, and Colin Ian King
> > <colin.king@canonical.com>. 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
diff mbox series

Patch

diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
index 02298b86b57b..731d5117f9f1 100644
--- a/drivers/hwmon/corsair-psu.c
+++ b/drivers/hwmon/corsair-psu.c
@@ -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);