Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3648871imu; Mon, 7 Jan 2019 07:07:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Z0A3BvNruTteEjy5n1KYF2PqvNGhLMoorLWR3SxzjlT+38QTlHNcjTTXhu4xgtt0SQ+h/ X-Received: by 2002:a63:101:: with SMTP id 1mr11246980pgb.152.1546873664658; Mon, 07 Jan 2019 07:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546873664; cv=none; d=google.com; s=arc-20160816; b=TBfy48dGZWfvtD9OlyAonquDOCDR+W6SbAFXe65tyc0EA8xkMhuzKVAKAivKx4rv8F 03AupXl0oxfxajZbO7HO0eX4eiNv7dM0yIThbAkB6+vWCJweQTvTRHr+4OpMwzYrsuy1 mwMKup7cve4pFv9moZ8LQGFl3ADC/F7YQWPJragQF0AHhk3mpxi2rg3lGgv4OttQVIAv rsyVz2DUvIaZ2hilvplqFloF+oWsYM39TwEBdL/mt4FdlK0Q9N138uy8NG64SigvoXUo xN9z01/p+hDsCiMk+F+v91YqzvAVloDHOmQB/myg2fpohcBJQjjjevydr0mCtBIwxjrT HRCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=nX9NbsOdRpCl57t0Dip1mAMld8kLohmlbv6imkFrpw4=; b=C2HdGwbPUUK9piTuHwwWJ2sQ++apQnbK/FO3rJt2g1ub+nWl/+YYg5e+s360sYaBQP foUehBypMGHn8lzPy1VSgcI1xnAur91arIOJhzAuw0lfg4cigVd7IX/rTbQUYq3xBb/A mHnXUyKK+CjLIGxNdpbKLmbzpBVRK4MIej2wj9YyhTrbeMOJKEX1LiGq0aGLCZq22ugz YgFUoZrYYxLJw8BQnbIgJWTM9eAsyLkkag0Y+FRRrYOZq+62XGveaQfPpxgFktfENaoU QdJgPDI3ScTivmCK4cmN8BT25uc1yDLPDU7U2io9Lro+5CKKBJ7s8pIFw3dhP9zqVeJX 4T2g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37si4644137pgs.447.2019.01.07.07.07.27; Mon, 07 Jan 2019 07:07:44 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729406AbfAGPGA (ORCPT + 99 others); Mon, 7 Jan 2019 10:06:00 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:57352 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1729090AbfAGPF7 (ORCPT ); Mon, 7 Jan 2019 10:05:59 -0500 Received: (qmail 2171 invoked by uid 2102); 7 Jan 2019 10:05:58 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 7 Jan 2019 10:05:58 -0500 Date: Mon, 7 Jan 2019 10:05:58 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Kai Heng Feng cc: Greg Kroah-Hartman , Linux USB List , lkml , Mathias Nyman Subject: Re: [PATCH v4] USB: Don't enable LPM if it's already enabled In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 7 Jan 2019, Kai Heng Feng wrote: > Hi, > > > On Dec 3, 2018, at 18:26, Kai-Heng Feng wrote: > > > > 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. > > > > Also consolidate USB2 LPM functions to usb_enable_usb2_hardware_lpm() > > and usb_disable_usb2_hardware_lpm(). > > Please review my new approach, hopefully this can be included in Linux v5.0. > > > > > Signed-off-by: Kai-Heng Feng > > --- > > v4: > > - Use usb_enable_usb2_hardware_lpm() and > > usb_disable_usb2_hardware_lpm() to control USB2 LPM. > > v3: > > - Consolidate udev->usb2_hw_lpm_capable and udev->usb2_hw_lpm_enabled > > check to usb_set_usb2_hardware_lpm(). > > v2: > > - Check udev->usb2_hw_lpm_enabled before calling usb_port_resume(). > > > > drivers/usb/core/driver.c | 23 +++++++++++++++++++---- > > drivers/usb/core/hub.c | 16 ++++++---------- > > drivers/usb/core/message.c | 3 +-- > > drivers/usb/core/sysfs.c | 5 ++++- > > drivers/usb/core/usb.h | 10 ++++++++-- > > 5 files changed, 38 insertions(+), 19 deletions(-) Reviewed-by: Alan Stern