Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp4304169imd; Mon, 29 Oct 2018 22:55:43 -0700 (PDT) X-Google-Smtp-Source: AJdET5dXQjh5ynDLPDWQEn6nJSyvOpnnXKQyFgz/iGzTaamQb8Rkt0AVcGhTdE8UTSY6VfAWPGur X-Received: by 2002:a63:e20a:: with SMTP id q10mr15697575pgh.206.1540878943786; Mon, 29 Oct 2018 22:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540878943; cv=none; d=google.com; s=arc-20160816; b=LPeS8NQx/TO/GMnv76P3vOCvzs4R2clE3OczmGRw9Ui3i9Khtqgyl0g7UxkYpIU9hk IfNBmDc4viL977zxIEYTmVtqVOur+GauC4sEmCS/arjb5EIPM28JdDJW96spb6R/d/W6 QLNCzFY54Yo05pK5yUFVyWh/SDnqOMCOGIOmf6ye+8sf+MRmq5GKu1L3BQuu5pflwmFk uiCnnja9VIHA1kiAZPhrVY1cQEJ/JhdOE17tB6JT1Cwx7Z4NP7Cp+jA7JJRm3Jghc8KR lmWRnhzYEiGYHPmwIeDFNtskCKde9TJDYXLcJGI0LO/QONQadpfdlRoQePCq1qEFUJNO EL0A== 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:mime-version :message-id:date:subject:cc:to:from; bh=S7g12hqwuVrg4NdmDDGCYHocy5pb8l+O1FzI+0kKowA=; b=J3S1IK6Zk9ow6HlKUbgRG0QDwSzvHHg24tZX4ibw94p38bEMZ8ltaWYv1/oqoIwRxu C0v7wc4ABYmw6bc+pRzvudRPbpDUI6x9BkXKXnpD46KhOfmTMhTLea0mNh+oWhahdwgH 7hfWu674u39ftT5JtvQbCbTmYIf86wcCT/xPlWBD7ph34DWMwZRLFk1+wbkOL6t4KJnJ cl1A4ZklTPJrR/Guf12YOCVuAR8puw9b3SXAw4Ma5qQPTYRrVxWw9oT/h+W+O0h/Lch7 uTwWAmS/C6dqSuO3TSpe8ZGES4E1pOALgccjDAyBsfKa9j7eYI+3936zPA2Ea6t4ZVSD SBgw== 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 l30-v6si23575415plg.179.2018.10.29.22.55.28; Mon, 29 Oct 2018 22:55:43 -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 S1726203AbeJ3OrC (ORCPT + 99 others); Tue, 30 Oct 2018 10:47:02 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:43899 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbeJ3OrC (ORCPT ); Tue, 30 Oct 2018 10:47:02 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gHMzQ-00031a-QQ; Tue, 30 Oct 2018 05:54:57 +0000 From: Kai-Heng Feng To: gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kai-Heng Feng Subject: [PATCH] USB: Don't enable LPM if it's already enabled Date: Tue, 30 Oct 2018 13:54:52 +0800 Message-Id: <20181030055452.25969-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org USB Bluetooth controller QCA ROME (0cf3:e007) sometimes stops working after S3: [ 165.110742] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000302.bin [ 168.432065] Bluetooth: hci0: Failed to send body at 4 of 1953 (-110) After some experiments, I found that disabling LPM can workaround the issue. On some platforms, the USB power is cut during S3, so the driver uses reset-resume to resume the device. During port resume, LPM gets enabled twice, by usb_reset_and_verify_device() and usb_port_resume(). So let's enable LPM for just once, as this solves the issue for the device in question. Signed-off-by: Kai-Heng Feng --- drivers/usb/core/driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 53564386ed57..e11d2eac76b6 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1901,7 +1901,8 @@ int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) struct usb_hcd *hcd = bus_to_hcd(udev->bus); int ret = -EPERM; - if (enable && !udev->usb2_hw_lpm_allowed) + if (enable && !udev->usb2_hw_lpm_allowed || + udev->usb2_hw_lpm_enabled == enable) return 0; if (hcd->driver->set_usb2_hw_lpm) { -- 2.19.1