From: AceLan Kao <acelan.kao@canonical.com> To: Alan Stern <stern@rowland.harvard.edu>, Felipe Balbi <felipe.balbi@linux.intel.com>, Daniel Drake <drake@endlessm.com>, Joe Perches <joe@perches.com>, Mathias Nyman <mathias.nyman@linux.intel.com>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: core: disable USB2 LPM when suspending Date: Thu, 20 Sep 2018 15:09:40 +0800 [thread overview] Message-ID: <20180920070940.14773-1-acelan.kao@canonical.com> (raw) We found a S5 current leakage issue on Dell DW1820 WiFi/BT combo card which uses Qualcomm QCA6174 SoC. It also comes with WiFi and BT failure when encountered current leakage issue. 1. Power on, both WiFi and BT work. 2. Power off and found a current leakage issue(consumes ~0.5W) 3. Power on, no WiFi and BT devices can be found in lspci and lsusb. 4. Power off, there is no current leakage issue at S5. 5. continue to 1. From Qualcomm's report: Based on the USB sniffer log, the difference between Linux and Windows is USB LPM setting(no LPM transaction on Windows) which may leads to the voltage leakage on Linux S5 state. After checked the LPM related code and found, when system is going to enter S5, it resumes the USB devices from runtime suspend and enables USB2 LPM, and then it calls usb_dev_poweroff() -> usb_suspend(), and leave USB2 LPM stays enabled. Disable USB2 LPM in usb_suspend() fixes the issue mentioned above, and try 30 times of s2idle, S3 and S5, the USB devices keep working well. Disable USB2 LPM seems do no harm to the system. Signed-off-by: AceLan Kao <acelan.kao@canonical.com> --- drivers/usb/core/driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index e76e95f62f76..ac5e60d7104f 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1463,6 +1463,9 @@ int usb_suspend(struct device *dev, pm_message_t msg) struct usb_device *udev = to_usb_device(dev); int r; + if (udev->usb2_hw_lpm_enabled == 1) + usb_set_usb2_hardware_lpm(udev, 0); + unbind_no_pm_drivers_interfaces(udev); /* From now on we are sure all drivers support suspend/resume -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: AceLan Kao <acelan.kao@canonical.com> To: Alan Stern <stern@rowland.harvard.edu>, Felipe Balbi <felipe.balbi@linux.intel.com>, Daniel Drake <drake@endlessm.com>, Joe Perches <joe@perches.com>, Mathias Nyman <mathias.nyman@linux.intel.com>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: usb: core: disable USB2 LPM when suspending Date: Thu, 20 Sep 2018 15:09:40 +0800 [thread overview] Message-ID: <20180920070940.14773-1-acelan.kao@canonical.com> (raw) We found a S5 current leakage issue on Dell DW1820 WiFi/BT combo card which uses Qualcomm QCA6174 SoC. It also comes with WiFi and BT failure when encountered current leakage issue. 1. Power on, both WiFi and BT work. 2. Power off and found a current leakage issue(consumes ~0.5W) 3. Power on, no WiFi and BT devices can be found in lspci and lsusb. 4. Power off, there is no current leakage issue at S5. 5. continue to 1. From Qualcomm's report: Based on the USB sniffer log, the difference between Linux and Windows is USB LPM setting(no LPM transaction on Windows) which may leads to the voltage leakage on Linux S5 state. After checked the LPM related code and found, when system is going to enter S5, it resumes the USB devices from runtime suspend and enables USB2 LPM, and then it calls usb_dev_poweroff() -> usb_suspend(), and leave USB2 LPM stays enabled. Disable USB2 LPM in usb_suspend() fixes the issue mentioned above, and try 30 times of s2idle, S3 and S5, the USB devices keep working well. Disable USB2 LPM seems do no harm to the system. Signed-off-by: AceLan Kao <acelan.kao@canonical.com> --- drivers/usb/core/driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index e76e95f62f76..ac5e60d7104f 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1463,6 +1463,9 @@ int usb_suspend(struct device *dev, pm_message_t msg) struct usb_device *udev = to_usb_device(dev); int r; + if (udev->usb2_hw_lpm_enabled == 1) + usb_set_usb2_hardware_lpm(udev, 0); + unbind_no_pm_drivers_interfaces(udev); /* From now on we are sure all drivers support suspend/resume
next reply other threads:[~2018-09-20 7:09 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-09-20 7:09 AceLan Kao [this message] 2018-09-20 7:09 ` usb: core: disable USB2 LPM when suspending AceLan Kao 2018-09-20 14:43 ` [PATCH] " Alan Stern 2018-09-20 14:43 ` Alan Stern 2018-09-27 2:28 ` [PATCH] " AceLan Kao 2018-09-27 2:28 ` AceLan Kao
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=20180920070940.14773-1-acelan.kao@canonical.com \ --to=acelan.kao@canonical.com \ --cc=drake@endlessm.com \ --cc=felipe.balbi@linux.intel.com \ --cc=joe@perches.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=mathias.nyman@linux.intel.com \ --cc=stern@rowland.harvard.edu \ /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: linkBe 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.