Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1915211imc; Tue, 12 Mar 2019 03:23:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlXv9p+K6ruwwe64TvEM8/nujDG5sKXktFXxdJV9G3yz/KX6BqViCCeZHB57b8PK4BlP1/ X-Received: by 2002:a62:3990:: with SMTP id u16mr37783196pfj.80.1552386197528; Tue, 12 Mar 2019 03:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552386197; cv=none; d=google.com; s=arc-20160816; b=TmyYNAyAMYTaiF+t/4AYJU73SblqWVMLh8kjf/0y7Sf4lO1hxrq5UbXZIgMEeajGu9 px5z6hjA6VIPFSrakVyMCKv4IVN+tH0gdtEsM+jTpT8CFlV2RysKG12tK3oPoQxK5QtH VExFucEQn48rkA1CLWQoiKyhnru8QumllQHffl/8uekqNMQRnB0jABe72A9PLMetJg9Q uvwSKyVkRqz7DPElRsOQchAI4igOnI9wXmScE7bTIqi7qOjZ4/cGO5fV/cTdhrE6qW2+ eHV89amfndJ6yc2FdRjGvb54yvcfPn0CRmxQB7vPie0T8AnIjG0xFd+oWJYOl/1yXlkd 2WGg== 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=TgRA/hciwBHAWJoy1gIBJETUZTizs8mL/bXn/5C0jfM=; b=SEWlYjdC7tLquZNp0XLUOFkvnn9Th3ewIvF8PQJJ3nRgW8AqoLQItXHZG1IyXH9wK8 7eN8qc3Lichv4XeSrA1XniwrzMfeVg6BRpa+ZtJmx7R154UD5sORCCgB6sgBrGSXonl8 rtbKRip4GCPijdnT4U29698+3Uc922rIqnvTWsR1MR0YptywGu+Js+MGBRVs2vMyPZmi tUnjY1BIldt0jjZJ0WaWvp68L4+Bztm6h7liUC00r17nLf9/mCfRZwjXMGjk6Ng3UZaW 4eVq7rraWKxDyOp0VJhtZxnrcoSJWUDqR2F3P91H6Dp1YeESRWgm5D5G077uqagzJorC dWog== 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 k16si7556242pfj.174.2019.03.12.03.23.01; Tue, 12 Mar 2019 03:23:17 -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 S1726692AbfCLKWS (ORCPT + 99 others); Tue, 12 Mar 2019 06:22:18 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:36604 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbfCLKWR (ORCPT ); Tue, 12 Mar 2019 06:22:17 -0400 Received: from mail-pf1-f199.google.com ([209.85.210.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1h3eY4-0005EQ-3P for linux-kernel@vger.kernel.org; Tue, 12 Mar 2019 10:22:16 +0000 Received: by mail-pf1-f199.google.com with SMTP id v2so2025893pfn.14 for ; Tue, 12 Mar 2019 03:22:16 -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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=TgRA/hciwBHAWJoy1gIBJETUZTizs8mL/bXn/5C0jfM=; b=dapY9S1hVBOM1pTdOv3tnbYPPlIsC0uapMBsxtK+Ca6ZZx8SzEspMZDS12DVYGiNvZ niay/dr83b2QnFGBtP5f+mY2L90YZ3CfqtooUUdrbRcZL6ZRwPk9c71NG715fpUajvz7 BXTHSwoTM63TK0vGVG6U9kSZkEyx2OYU77KCeHDuE/ePM0qd+WyamVEKGTZu3Jx8+EJB GexeOUP5qzM/WBEOxxmS3EKHetlpGXc3nvyblQYrRVNOl9Yt5zLAG8lAmQKjSTvdiqJv qNnfkERvBlvSZo+NSZ1rxyUICZ71wwrWgFFencmq+fXudit+wUX+eUCOr+8NPQZODy8T BzsQ== X-Gm-Message-State: APjAAAXx7JMH/eMPFxl7+TwsI1U/iYYVGCjYdPacFiHPOUjKx57TMnkp olMTFDPQ0ynKNCW08OO0jDPPR7X4Nv+N4jwG97Nq9Or66yw/tORzO6QHOXSt2uwuE7Tt43XSw/4 IMyVRGhYy+KlW2rcHTEfhUKIhgMm8jCmHy8+nJYNZPA== X-Received: by 2002:a65:6559:: with SMTP id a25mr23885800pgw.99.1552386134762; Tue, 12 Mar 2019 03:22:14 -0700 (PDT) X-Received: by 2002:a65:6559:: with SMTP id a25mr23885780pgw.99.1552386134373; Tue, 12 Mar 2019 03:22:14 -0700 (PDT) Received: from 2001-b011-380f-14b9-4175-e032-a704-9b27.dynamic-ip6.hinet.net (2001-b011-380f-14b9-4175-e032-a704-9b27.dynamic-ip6.hinet.net. [2001:b011:380f:14b9:4175:e032:a704:9b27]) by smtp.gmail.com with ESMTPSA id l79sm18719822pfb.102.2019.03.12.03.22.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 03:22:13 -0700 (PDT) Content-Type: text/plain; charset=utf-8; delsp=yes; format=flowed 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: Date: Tue, 12 Mar 2019 18:22:11 +0800 Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit Message-Id: <9EC6DA7E-2503-40F8-AB5A-25A2424B6346@canonical.com> 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 at 00:01, Kai-Heng Feng wrote: > > >> 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. It would be great if someone can come up with better ideas. We can also use other approaches, but currently this is the only way I can think of. Kai-Heng > > Kai-Heng > >> thanks, >> >> greg k-h