All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: Disable USB2 LPM at shutdown
@ 2018-11-06 17:34 ` Kai-Heng Feng
  0 siblings, 0 replies; 6+ messages in thread
From: Kai-Heng Feng @ 2018-11-06 17:34 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, Kai-Heng Feng

The QCA Rome USB Bluetooth controller has several issues once LPM gets
enabled:
- Fails to get enumerated in coldboot. [1]
- Drains more power (~ 0.2W) when the system is in S5. [2]
- Disappears after a warmboot. [2]

The issue happens because the device lingers at LPM L1 in S5, so device
can't get enumerated even after a reboot.

Disalbe LPM at shutdown can solve the issue.

[1] https://bugs.launchpad.net/bugs/1757218
[2] https://patchwork.kernel.org/patch/10607097/

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/core/port.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 1a06a4b5fbb1..15f6924a4d84 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -285,6 +285,15 @@ static int usb_port_runtime_suspend(struct device *dev)
 }
 #endif
 
+static void usb_port_shutdown(struct device *dev)
+{
+	struct usb_port *port_dev = to_usb_port(dev);
+
+	if (port_dev->child)
+		usb_set_usb2_hardware_lpm(port_dev->child, 0);
+
+}
+
 static const struct dev_pm_ops usb_port_pm_ops = {
 #ifdef CONFIG_PM
 	.runtime_suspend =	usb_port_runtime_suspend,
@@ -301,6 +310,7 @@ struct device_type usb_port_device_type = {
 static struct device_driver usb_port_driver = {
 	.name = "usb",
 	.owner = THIS_MODULE,
+	.shutdown = usb_port_shutdown,
 };
 
 static int link_peers(struct usb_port *left, struct usb_port *right)
-- 
2.19.1


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

* USB: Disable USB2 LPM at shutdown
@ 2018-11-06 17:34 ` Kai-Heng Feng
  0 siblings, 0 replies; 6+ messages in thread
From: Kai-Heng Feng @ 2018-11-06 17:34 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, Kai-Heng Feng

The QCA Rome USB Bluetooth controller has several issues once LPM gets
enabled:
- Fails to get enumerated in coldboot. [1]
- Drains more power (~ 0.2W) when the system is in S5. [2]
- Disappears after a warmboot. [2]

The issue happens because the device lingers at LPM L1 in S5, so device
can't get enumerated even after a reboot.

Disalbe LPM at shutdown can solve the issue.

[1] https://bugs.launchpad.net/bugs/1757218
[2] https://patchwork.kernel.org/patch/10607097/

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/core/port.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 1a06a4b5fbb1..15f6924a4d84 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -285,6 +285,15 @@ static int usb_port_runtime_suspend(struct device *dev)
 }
 #endif
 
+static void usb_port_shutdown(struct device *dev)
+{
+	struct usb_port *port_dev = to_usb_port(dev);
+
+	if (port_dev->child)
+		usb_set_usb2_hardware_lpm(port_dev->child, 0);
+
+}
+
 static const struct dev_pm_ops usb_port_pm_ops = {
 #ifdef CONFIG_PM
 	.runtime_suspend =	usb_port_runtime_suspend,
@@ -301,6 +310,7 @@ struct device_type usb_port_device_type = {
 static struct device_driver usb_port_driver = {
 	.name = "usb",
 	.owner = THIS_MODULE,
+	.shutdown = usb_port_shutdown,
 };
 
 static int link_peers(struct usb_port *left, struct usb_port *right)

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

* Re: [PATCH] USB: Disable USB2 LPM at shutdown
@ 2018-11-23  6:04   ` Kai-Heng Feng
  0 siblings, 0 replies; 6+ messages in thread
From: Kai Heng Feng @ 2018-11-23  6:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Linux USB List, linux-kernel

Hi,

> On Nov 7, 2018, at 1:34 AM, Kai-Heng Feng <kai.heng.feng@canonical.com> wrote:
> 
> The QCA Rome USB Bluetooth controller has several issues once LPM gets
> enabled:
> - Fails to get enumerated in coldboot. [1]
> - Drains more power (~ 0.2W) when the system is in S5. [2]
> - Disappears after a warmboot. [2]
> 
> The issue happens because the device lingers at LPM L1 in S5, so device
> can't get enumerated even after a reboot.
> 
> Disalbe LPM at shutdown can solve the issue.
> 
> [1] https://bugs.launchpad.net/bugs/1757218
> [2] https://patchwork.kernel.org/patch/10607097/
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Would it be possible to merge this patch?

Kai-Heng

> ---
> drivers/usb/core/port.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
> index 1a06a4b5fbb1..15f6924a4d84 100644
> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c
> @@ -285,6 +285,15 @@ static int usb_port_runtime_suspend(struct device *dev)
> }
> #endif
> 
> +static void usb_port_shutdown(struct device *dev)
> +{
> +	struct usb_port *port_dev = to_usb_port(dev);
> +
> +	if (port_dev->child)
> +		usb_set_usb2_hardware_lpm(port_dev->child, 0);
> +
> +}
> +
> static const struct dev_pm_ops usb_port_pm_ops = {
> #ifdef CONFIG_PM
> 	.runtime_suspend =	usb_port_runtime_suspend,
> @@ -301,6 +310,7 @@ struct device_type usb_port_device_type = {
> static struct device_driver usb_port_driver = {
> 	.name = "usb",
> 	.owner = THIS_MODULE,
> +	.shutdown = usb_port_shutdown,
> };
> 
> static int link_peers(struct usb_port *left, struct usb_port *right)
> -- 
> 2.19.1
> 


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

* USB: Disable USB2 LPM at shutdown
@ 2018-11-23  6:04   ` Kai-Heng Feng
  0 siblings, 0 replies; 6+ messages in thread
From: Kai-Heng Feng @ 2018-11-23  6:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Linux USB List, linux-kernel

Hi,

> On Nov 7, 2018, at 1:34 AM, Kai-Heng Feng <kai.heng.feng@canonical.com> wrote:
> 
> The QCA Rome USB Bluetooth controller has several issues once LPM gets
> enabled:
> - Fails to get enumerated in coldboot. [1]
> - Drains more power (~ 0.2W) when the system is in S5. [2]
> - Disappears after a warmboot. [2]
> 
> The issue happens because the device lingers at LPM L1 in S5, so device
> can't get enumerated even after a reboot.
> 
> Disalbe LPM at shutdown can solve the issue.
> 
> [1] https://bugs.launchpad.net/bugs/1757218
> [2] https://patchwork.kernel.org/patch/10607097/
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Would it be possible to merge this patch?

Kai-Heng

> ---
> drivers/usb/core/port.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
> index 1a06a4b5fbb1..15f6924a4d84 100644
> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c
> @@ -285,6 +285,15 @@ static int usb_port_runtime_suspend(struct device *dev)
> }
> #endif
> 
> +static void usb_port_shutdown(struct device *dev)
> +{
> +	struct usb_port *port_dev = to_usb_port(dev);
> +
> +	if (port_dev->child)
> +		usb_set_usb2_hardware_lpm(port_dev->child, 0);
> +
> +}
> +
> static const struct dev_pm_ops usb_port_pm_ops = {
> #ifdef CONFIG_PM
> 	.runtime_suspend =	usb_port_runtime_suspend,
> @@ -301,6 +310,7 @@ struct device_type usb_port_device_type = {
> static struct device_driver usb_port_driver = {
> 	.name = "usb",
> 	.owner = THIS_MODULE,
> +	.shutdown = usb_port_shutdown,
> };
> 
> static int link_peers(struct usb_port *left, struct usb_port *right)
> -- 
> 2.19.1
>

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

* Re: [PATCH] USB: Disable USB2 LPM at shutdown
@ 2018-11-23 15:06   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2018-11-23 15:06 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: linux-usb, linux-kernel

On Wed, Nov 07, 2018 at 01:34:01AM +0800, Kai-Heng Feng wrote:
> The QCA Rome USB Bluetooth controller has several issues once LPM gets
> enabled:
> - Fails to get enumerated in coldboot. [1]
> - Drains more power (~ 0.2W) when the system is in S5. [2]
> - Disappears after a warmboot. [2]
> 
> The issue happens because the device lingers at LPM L1 in S5, so device
> can't get enumerated even after a reboot.
> 
> Disalbe LPM at shutdown can solve the issue.
> 
> [1] https://bugs.launchpad.net/bugs/1757218
> [2] https://patchwork.kernel.org/patch/10607097/
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/usb/core/port.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
> index 1a06a4b5fbb1..15f6924a4d84 100644
> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c
> @@ -285,6 +285,15 @@ static int usb_port_runtime_suspend(struct device *dev)
>  }
>  #endif
>  
> +static void usb_port_shutdown(struct device *dev)
> +{
> +	struct usb_port *port_dev = to_usb_port(dev);
> +
> +	if (port_dev->child)
> +		usb_set_usb2_hardware_lpm(port_dev->child, 0);

Shouldn't you also test if child->usb2_hw_lpm_enabled before calling
this?

Or at the least usb2_hw_lpm_capable?

You did test this on a bunch of USB 1 and USB 3 devices, right?

thanks,

greg k-h

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

* USB: Disable USB2 LPM at shutdown
@ 2018-11-23 15:06   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2018-11-23 15:06 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: linux-usb, linux-kernel

On Wed, Nov 07, 2018 at 01:34:01AM +0800, Kai-Heng Feng wrote:
> The QCA Rome USB Bluetooth controller has several issues once LPM gets
> enabled:
> - Fails to get enumerated in coldboot. [1]
> - Drains more power (~ 0.2W) when the system is in S5. [2]
> - Disappears after a warmboot. [2]
> 
> The issue happens because the device lingers at LPM L1 in S5, so device
> can't get enumerated even after a reboot.
> 
> Disalbe LPM at shutdown can solve the issue.
> 
> [1] https://bugs.launchpad.net/bugs/1757218
> [2] https://patchwork.kernel.org/patch/10607097/
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/usb/core/port.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
> index 1a06a4b5fbb1..15f6924a4d84 100644
> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c
> @@ -285,6 +285,15 @@ static int usb_port_runtime_suspend(struct device *dev)
>  }
>  #endif
>  
> +static void usb_port_shutdown(struct device *dev)
> +{
> +	struct usb_port *port_dev = to_usb_port(dev);
> +
> +	if (port_dev->child)
> +		usb_set_usb2_hardware_lpm(port_dev->child, 0);

Shouldn't you also test if child->usb2_hw_lpm_enabled before calling
this?

Or at the least usb2_hw_lpm_capable?

You did test this on a bunch of USB 1 and USB 3 devices, right?

thanks,

greg k-h

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

end of thread, other threads:[~2018-11-23 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06 17:34 [PATCH] USB: Disable USB2 LPM at shutdown Kai-Heng Feng
2018-11-06 17:34 ` Kai-Heng Feng
2018-11-23  6:04 ` [PATCH] " Kai Heng Feng
2018-11-23  6:04   ` Kai-Heng Feng
2018-11-23 15:06 ` [PATCH] " Greg KH
2018-11-23 15:06   ` Greg Kroah-Hartman

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.