Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1474430imm; Wed, 26 Sep 2018 19:30:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Yj9DVAG864jpr/TSYpKU2uRu6YswO0YTV9jUNz1e3VuzshjMVdlMMfkk+e4cN5xm7DcgS X-Received: by 2002:a62:c008:: with SMTP id x8-v6mr8898409pff.149.1538015402286; Wed, 26 Sep 2018 19:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538015402; cv=none; d=google.com; s=arc-20160816; b=gToS/3LjkDzhKmFX+n9q8YI34r+8IToEsXFPIWz7TbEkIdcoDhaF9ItL79ak6XG8Aa SwfwLWLYmOfr8wD8GkO+17dqxYCiDIzRWc4sFQGbSBbhj+n9sVFFmx7RRITaZKXCSZlR HDIoTgU8rmM40Goers8WX3O/M+xNOoyjtczzOnE/UhohjXzTd5FPEYpJtxroxfqdF3t0 Tr467RfQX60Xap/hvu4hZvfD/b6O86+/OF2GGWXIGdl/ijrvOpD2lXFbQl68rwa8vBZ7 uMaNRxFIbQFuoTTjpQ2lVkWM56gtFr2p4RfdjcdRbygQJonsxgUz65wNFb4ZLALWQCqA ZYUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=TRg/gR6l2tuAbxlhJsShpMf8V+hKH/kPn5K7VX6uQW8=; b=gylSg1oOaNrELkYy9OlezQilKcbykvEnJdF469eTp9QCoE1y2zkMZ3iNNYZvmXaqR/ o/u5Ax9pDsjgcC2UpBXOSWL+mJk4JT7enrY4O7WC/TyR5WxY3C6DuCLODAyMOSbXLeI+ skeFyhwqcAitWwBC8E/TWAce2Wu6FtwR3nSt4qt6uGcGAEZqDeISAmTzMBZrz9HHbyvj a0TlJ1i6siKb/67C8PYOSq22FuPq5Xtj7A0NSxyxIMYSuq2xKILBIen+eoUvlmzbbAM3 pp3QxyNif0SncVIRK8cfcn4EFVkL3WrM2jc15OBvvo9WbLSpUBrgf26zbhdEg5eCOMuG Jqjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2-v6si742923pgg.108.2018.09.26.19.29.01; Wed, 26 Sep 2018 19:30:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727197AbeI0Ior convert rfc822-to-8bit (ORCPT + 99 others); Thu, 27 Sep 2018 04:44:47 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58960 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727010AbeI0Ior (ORCPT ); Thu, 27 Sep 2018 04:44:47 -0400 Received: from mail-wm1-f71.google.com ([209.85.128.71]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1g5M2s-0004wH-79 for linux-kernel@vger.kernel.org; Thu, 27 Sep 2018 02:28:50 +0000 Received: by mail-wm1-f71.google.com with SMTP id a69-v6so3993266wma.7 for ; Wed, 26 Sep 2018 19:28:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=MOHsVTItP7K4W+cz+BT1+YHPuQ3I7f97g5h1bFF7Fdo=; b=tgHvcYIQqOfUrEn9fwD1AxX6UErnV/WG7Z7f/do2eD5sze9Za+f0W/8f6OX/ijexn3 PGxInUZHznyjqGpSC6q4c7rrpsZQWlinaUgiEhKSMdi56ust4LtR/hnATngcugzK0fqJ OwFHmTbysAJKmOb2ZD860N0sArSNRMO/73Fo503eOEKhDF2BD0P4/E9qnDTFNV8qqJD9 SxruyIK6bIoCXcGEpEuupnrM52dUTa+fiH0xLs/c2bFCKCdiXS16TFuOi7TH+SVeIQzZ CHEY9+3gKKPVoG3V/RYeMY8z8wSvUPFVGrKkhkmUf3SZpkscg0/DkBPhByqv5vOp5mv5 /tOg== X-Gm-Message-State: ABuFfojvzTzGJUwvL2DMsqH/OuHMFeo9StaJ6sgmpVYuBbC8Kt6Od2da zKyhtXTsCb/kD6F4TIIwK4RJ7zrhqk5PN+HM2xyU8vUY/mDE/9Yr6pJCSuPKC42kzN6kqTT7DPk PJ3KeiZQKJu80U6TkkJMohOaOo1KDgQhVjocxLr3365bSCnjNUr06M3EJTA== X-Received: by 2002:adf:f7c8:: with SMTP id a8-v6mr7350234wrq.86.1538015329788; Wed, 26 Sep 2018 19:28:49 -0700 (PDT) X-Received: by 2002:adf:f7c8:: with SMTP id a8-v6mr7350220wrq.86.1538015329421; Wed, 26 Sep 2018 19:28:49 -0700 (PDT) MIME-Version: 1.0 References: <20180920070940.14773-1-acelan.kao@canonical.com> In-Reply-To: From: AceLan Kao Date: Thu, 27 Sep 2018 10:28:37 +0800 Message-ID: Subject: Re: [PATCH] usb: core: disable USB2 LPM when suspending To: stern@rowland.harvard.edu Cc: felipe.balbi@linux.intel.com, Daniel Drake , joe@perches.com, mathias.nyman@linux.intel.com, linux-usb@vger.kernel.org, "Linux-Kernel@Vger. Kernel. Org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Alan Stern 於 2018年9月20日 週四 下午10:43寫道: > > On Thu, 20 Sep 2018, AceLan Kao wrote: > > > 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. > > But usb_suspend() -> usb_suspend_both() -> usb_suspend_device() -> > generic_suspend() -> usb_port_suspend() -> > usb_set_usb2_hardware_lpm(udev, 0). So why does USB2 LPM stay enabled? Right, after checking the normal case, it calls usb_set_usb2_hardware_lpm(udev, 0) eventually. In the buggy machine, it doesn't reach that part and stops somewhere after resume. But unfortunately, I can't duplicate the issue after doing some experiments anymore, so I can't get more info about that. I'll dig further and get back to you when I have any progress. > > > 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 > > --- > > 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); > > At this point the device may still be in runtime suspend. Is that > really okay? > > Alan Stern > > > + > > unbind_no_pm_drivers_interfaces(udev); > > > > /* From now on we are sure all drivers support suspend/resume > > >