Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6052148imu; Wed, 30 Jan 2019 08:02:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN4EIWarR5BN41OR/socb/VwihHhbug6Sr/hN5XU8wzhEjcMnfoREKjzfrM1ApJWkqdUb6dP X-Received: by 2002:a17:902:aa82:: with SMTP id d2mr31011954plr.153.1548864123866; Wed, 30 Jan 2019 08:02:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548864123; cv=none; d=google.com; s=arc-20160816; b=Ibob5Mfk8jyQvhXAgboC3SXrzCEyUnA28DtUYcHmfjHeVQpm7uBEyfu45+/hLxe+Fj t+oqPdENtUcXjNZLOZYm9Fpr1iZFspTykveN6x7CVIpLlQkL6HpYiUBkyYA/TrH05ONZ aHhLME6hZRnKNE2HUobn8kyPXIJh+3AyXL+A7VZ9/eamkfLtz3IEpo1u71/fCkc8O5V9 TW0bVl1inDE2ooHLzQV/2ikjOY4q9sfYOZL05STh3wJibBGPFafw5SiwQSMgAZ9YfYhi jxbNNBMvUs/Y3AENbTHliu72uqBrdAcXzFYOaNkByq2ZAftwASxBa3/TyShzWSJ1iQ39 JHpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=si3pEiVFxRfO6/xDalFo6LFZzHjXHv+w4FfyYadcRmU=; b=kQIYtoP81pOv+F/yekIg8FOTZUQgk1+Fgj4ZHpQCRuBT3VXGY9i7ytObDzMQq+f/4i BM7XAmmxfvtx65B3elH8zFuKmgR5voxzQAKcmdevOK+O7XVAmKo1ARDSV/nWmLhhafN7 Ds7h4IQFWKFUuBOxh5s19HOQpxeUZ3yFTbZPVLPImxdzlRBA+UW1z5lBKcSTcedGxGTU yHjVDt0ouxC0N4xkd92WSOCgBC3k/kvpDInUc2CE0MP/ZUNHo+T8Ha4Fzr5Ej8aFcQEz RAiH4Ye+z6KKEvM+8ul5MN51a1fbRJZrduwuFFKVbH7SgibRZWWzUHV6Pjsj2NL+dGCp eZ8Q== 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 o5si1757874plk.360.2019.01.30.08.01.44; Wed, 30 Jan 2019 08:02:03 -0800 (PST) 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 S1731604AbfA3QBY convert rfc822-to-8bit (ORCPT + 99 others); Wed, 30 Jan 2019 11:01:24 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:53529 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729904AbfA3QBX (ORCPT ); Wed, 30 Jan 2019 11:01:23 -0500 Received: from mail-pg1-f198.google.com ([209.85.215.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gosIk-0008K9-4o for linux-kernel@vger.kernel.org; Wed, 30 Jan 2019 16:01:22 +0000 Received: by mail-pg1-f198.google.com with SMTP id r16so6747pgr.15 for ; Wed, 30 Jan 2019 08:01:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ZTipoSoB8ykd1NY00WZypDMOTW9gdmBfncfdp+2JvVE=; b=rJatSpxB3nW8Fk0w1MD6/ujSFdO7vOWSa0/FXyIsl4EfrXk2GUtllaMiCf+4aYSCRT HS2VEBX9mjQLERdgZ4ielZMFkk8zRijjJq7oF3n+3U4tOvslCq4sBwRmzx7cG8csXY/x d/sC/UBGwV+WHGHr5ANgqwZE86L4zUJTMV+4Tj76SakPYE4R3OVJNv4BLqbRMlNWvnzS 3J7Ar8RfAHobqSZ/8ouYxzYZ2q/mOPaeDkwpznHMb7Fbgr3nmv0aEJaqe0Gk/zhCna0U TUHz7xH4kvLFzOflby11UEgHDahK6w6fBcFVHoe/tk1bYXoEuA99fQII+f9MwjuNljP0 iMVQ== X-Gm-Message-State: AJcUukePcRoBhQvLGNspzWEk2U1KB/sORe73SDANdaCC+mBB5IXolUkm evY138MCuoIA6wAYW8RdFgc+n5QWfAsjetTjXpAJ4Okpe9fJgaSGfsAxMklBFtcn6/vFyIYALU+ fCa1t2D1wmxA+0+MTgK3hvhT6BagNOowgUrRZCggc+g== X-Received: by 2002:a62:2fc3:: with SMTP id v186mr31253937pfv.82.1548864080762; Wed, 30 Jan 2019 08:01:20 -0800 (PST) X-Received: by 2002:a62:2fc3:: with SMTP id v186mr31253894pfv.82.1548864080124; Wed, 30 Jan 2019 08:01:20 -0800 (PST) Received: from [192.168.1.215] (220-133-187-190.HINET-IP.hinet.net. [220.133.187.190]) by smtp.gmail.com with ESMTPSA id 84sm2891490pfk.134.2019.01.30.08.01.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 08:01:19 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: [PATCH v2] USB: Disable USB2 LPM at shutdown From: Kai-Heng Feng In-Reply-To: <20190130082133.GA32660@kroah.com> Date: Thu, 31 Jan 2019 00:01:13 +0800 Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: <20190124061643.11663-1-kai.heng.feng@canonical.com> <20190130082133.GA32660@kroah.com> To: Greg KH X-Mailer: Apple Mail (2.3445.102.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jan 30, 2019, at 16:21, Greg KH wrote: > > 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 >> --- >> 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. Yes I think this should be universally applied. I don’t think the bug only happens to one device. Users won’t find this unless they connect their laptop to a power meter. Platform may not completely cut off USB bus power during shutdown, so the device transits to L1 after system shutdown. Now xHC is disabled so nothing can bring it back to L0 or L2. Kai-Heng > > thanks, > > greg k-h