All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: corsair-psu: fix suspend behavior
@ 2021-06-03  5:23 Wilken Gottwalt
  2021-06-03 10:41 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Wilken Gottwalt @ 2021-06-03  5:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jean Delvare, Guenter Roeck, Jonathan Corbet, linux-hwmon

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

Fixes: 726c945ab2eb ("hwmon: (corsair-psu) Remove unneeded semicolons")
Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
---
 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);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: corsair-psu: fix suspend behavior
  2021-06-03  5:23 [PATCH] hwmon: corsair-psu: fix suspend behavior Wilken Gottwalt
@ 2021-06-03 10:41 ` Guenter Roeck
  2021-06-03 11:37   ` Wilken Gottwalt
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2021-06-03 10:41 UTC (permalink / raw)
  To: Wilken Gottwalt; +Cc: linux-kernel, Jean Delvare, Jonathan Corbet, linux-hwmon

On Thu, Jun 03, 2021 at 05:23:38AM +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: 726c945ab2eb ("hwmon: (corsair-psu) Remove unneeded semicolons")

That seems wrong. Removing semicolons doesn't typically introduce resume bugs.
This should fix the patch introducing the driver.

Guenter

> Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
> ---
>  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);
>  
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: corsair-psu: fix suspend behavior
  2021-06-03 10:41 ` Guenter Roeck
@ 2021-06-03 11:37   ` Wilken Gottwalt
  0 siblings, 0 replies; 3+ messages in thread
From: Wilken Gottwalt @ 2021-06-03 11:37 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, Jean Delvare, Jonathan Corbet, linux-hwmon

On Thu, 3 Jun 2021 03:41:56 -0700
Guenter Roeck <linux@roeck-us.net> wrote:

> On Thu, Jun 03, 2021 at 05:23:38AM +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: 726c945ab2eb ("hwmon: (corsair-psu) Remove unneeded semicolons")
> 
> That seems wrong. Removing semicolons doesn't typically introduce resume bugs.
> This should fix the patch introducing the driver.

Oh yes, you are right. Wasn't really thinking about it. I will send a proper
patch.

greetings,
Will

> Guenter
> 
> > Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
> > ---
> >  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);
> >  
> > -- 
> > 2.31.1
> > 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-03 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03  5:23 [PATCH] hwmon: corsair-psu: fix suspend behavior Wilken Gottwalt
2021-06-03 10:41 ` Guenter Roeck
2021-06-03 11:37   ` Wilken Gottwalt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.