All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [v2] USB: Disable USB2 LPM at shutdown
Date: Wed, 30 Jan 2019 09:21:33 +0100	[thread overview]
Message-ID: <20190130082133.GA32660@kroah.com> (raw)

On Thu, Jan 24, 2019 at 02:16:43PM +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.
> 
> Disable LPM at shutdown to 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>
> ---
> v2: Use new LPM helpers.
> 
>  drivers/usb/core/port.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
> index 1a06a4b5fbb1..bbbb35fa639f 100644
> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c
> @@ -285,6 +285,14 @@ 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_disable_usb2_hardware_lpm(port_dev->child);
> +}
> +
>  static const struct dev_pm_ops usb_port_pm_ops = {
>  #ifdef CONFIG_PM
>  	.runtime_suspend =	usb_port_runtime_suspend,
> @@ -301,6 +309,7 @@ struct device_type usb_port_device_type = {
>  static struct device_driver usb_port_driver = {
>  	.name = "usb",
>  	.owner = THIS_MODULE,
> +	.shutdown = usb_port_shutdown,
>  };

So you now do this for all ports in the system, no matter what is
plugged in or not.  Are you _SURE_ you want to do that?  It seems like a
big hammer to solve just one single device's problems.

thanks,

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <gregkh@linuxfoundation.org>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] USB: Disable USB2 LPM at shutdown
Date: Wed, 30 Jan 2019 09:21:33 +0100	[thread overview]
Message-ID: <20190130082133.GA32660@kroah.com> (raw)
In-Reply-To: <20190124061643.11663-1-kai.heng.feng@canonical.com>

On Thu, Jan 24, 2019 at 02:16:43PM +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.
> 
> Disable LPM at shutdown to 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>
> ---
> v2: Use new LPM helpers.
> 
>  drivers/usb/core/port.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
> index 1a06a4b5fbb1..bbbb35fa639f 100644
> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c
> @@ -285,6 +285,14 @@ 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_disable_usb2_hardware_lpm(port_dev->child);
> +}
> +
>  static const struct dev_pm_ops usb_port_pm_ops = {
>  #ifdef CONFIG_PM
>  	.runtime_suspend =	usb_port_runtime_suspend,
> @@ -301,6 +309,7 @@ struct device_type usb_port_device_type = {
>  static struct device_driver usb_port_driver = {
>  	.name = "usb",
>  	.owner = THIS_MODULE,
> +	.shutdown = usb_port_shutdown,
>  };

So you now do this for all ports in the system, no matter what is
plugged in or not.  Are you _SURE_ you want to do that?  It seems like a
big hammer to solve just one single device's problems.

thanks,

greg k-h

         reply	other threads:[~2019-01-30  8:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24  6:16 [v2] USB: Disable USB2 LPM at shutdown Kai-Heng Feng
2019-01-24  6:16 ` [PATCH v2] " Kai-Heng Feng
2019-01-30  8:21 ` Greg Kroah-Hartman [this message]
2019-01-30  8:21   ` Greg KH
2019-01-30 16:01   ` [v2] " Kai-Heng Feng
2019-01-30 16:01     ` [PATCH v2] " Kai-Heng Feng
2019-03-12 10:22     ` [v2] " Kai-Heng Feng
2019-03-12 10:22       ` [PATCH v2] " Kai-Heng Feng
2019-04-11  7:55       ` [v2] " Kai-Heng Feng
2019-04-11  7:55         ` [PATCH v2] " Kai-Heng Feng
2019-06-06  8:06         ` Kai-Heng Feng
2019-06-06 14:17           ` Alan Stern
2019-06-08  9:22             ` Kai-Heng Feng
2019-08-05 12:58               ` Kai-Heng Feng
2019-08-05 13:06                 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190130082133.GA32660@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.