Received: by 10.223.185.116 with SMTP id b49csp2955562wrg; Mon, 12 Feb 2018 18:27:15 -0800 (PST) X-Google-Smtp-Source: AH8x227GyZi8b4brd7ZLtDi+tDHG/TUabJzrJrJqcphFUWhsh/I0H6YXo/QaaxCWk/d5wyiLS8vC X-Received: by 2002:a17:902:7e43:: with SMTP id a3-v6mr12720012pln.138.1518488835778; Mon, 12 Feb 2018 18:27:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518488835; cv=none; d=google.com; s=arc-20160816; b=Kmw9PSK/r4mnSt/GxyO37wkDu8Iq3eHxoP15X6bpB9ymnangfRtvol7QvLPgEtu/oR nzTPpydqlXDcjVv5rwjaYDeic9SEOWOF58yf3qd0L4F4w8OLd+FmE02nRbcFtJImCzhY PruVz3utUUDmSkols848W+vd4iPVnMhqWpNWE384ypm2NN16tz6Y60b9bgkDXLNOjBEL ej4jSguX0ODevpMedS15pWHBwCGGGcCGq5Kn4bwRNmaTkEEkY8eVuxJtQi7ZHzeKuZjL iHljDsIvaU7ViQglXjcZXXwilvhaly6NhIzDVhW6/hIyIcQuLH7pGuUpRVtMsahul2Hj SjIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=XHTerq8NsLAcRPICfTjhDHrg1t3iV8nT+vXFPMppo/8=; b=IeMVw0MgU6i8+YDsVTIRg+UwI4cSnjehZpvJuMppa80d61gT3lOc+CKezlJeuVMa2r taTAp3HszbauCSi+xla5jJE2dg7AMuG3s88p5jY/ItQ3LhPAexHLzRVU7oORM8o340Q1 ZPzzvJvR2rw+p+ganJYs7CNB/sCNauszScfhDQCYq9sxu+vFl0pz61yMg6PRMfvADYM3 85yF/PsM1vYcGVHYIiqtw3ZTFQu+cp6juxdJyg7H1YUrDS8oSdfdd+eOnAmned5jkyH7 VcxB6MC528M9qvk6OYXJ6k2EzXddFzzEpAvaW9/fffWB4SJQuI6hSi3kKIHx2+oXZOow GFMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AgLEYwgA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si876957pfi.305.2018.02.12.18.27.01; Mon, 12 Feb 2018 18:27:15 -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; dkim=pass header.i=@chromium.org header.s=google header.b=AgLEYwgA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933349AbeBMCZD (ORCPT + 99 others); Mon, 12 Feb 2018 21:25:03 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:38280 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933313AbeBMCZA (ORCPT ); Mon, 12 Feb 2018 21:25:00 -0500 Received: by mail-pl0-f65.google.com with SMTP id m19so1025091pls.5 for ; Mon, 12 Feb 2018 18:24:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XHTerq8NsLAcRPICfTjhDHrg1t3iV8nT+vXFPMppo/8=; b=AgLEYwgAA4KuMY4MfbVilH+MF/Sw2dN/whSQRebCCD1/atdrprRzGBL5NOO2w1vRGR 1yA9ra1ml+9kJ7GOWBKAAVKvlFW6TTJij/kfF2Q8E3dFmQ/+PhmsBVC3Yt5jUHHZmYv7 1A1Q9YN4dsA658HUt74qZCVoj91ZPO48j6Ilc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XHTerq8NsLAcRPICfTjhDHrg1t3iV8nT+vXFPMppo/8=; b=NnVux/MwWwVXpQwz8JQvXqVMzMyUIUeUinyXfTEzxKnVr3nffhEeuP+/IP+oEsolok Qec6N40oxluNvbw1jKJ1kJgY8bGeD8zTge4o3BNKI4Nss9dJspfiLC8UPAoMrITtyQrg ZS2ngDIwAmhU2XNjoW440h8ycN6piGrm5W5BsZwXWo2nKnvz1SRPQlbcvURl/791UQel 5XSYxbut1rEieCZ3AqLLyQ4fo+KF89FPOx31Er9Dw3JWer91WpFLOLRGAtiCmC5ttH8/ Dg6DcGSCH5a5Sbr0wfTCgDfh/BNl7YAro0lpV9S95pCbbPNVIf3D+xYh1E39thFVM9vs qqCQ== X-Gm-Message-State: APf1xPAjsXt6OFiGZ89w1DTKX4KzS/wOdVIrXIdEffDalujJLtRQX2ZL 1U+rFceQelPttQiEcGxu1o0T/A== X-Received: by 2002:a17:902:8a97:: with SMTP id p23-v6mr12472151plo.74.1518488699451; Mon, 12 Feb 2018 18:24:59 -0800 (PST) Received: from rodete-desktop-imager.corp.google.com ([2620:0:1000:1501:da1a:a5c1:68e:d948]) by smtp.gmail.com with ESMTPSA id r29sm28862079pfb.40.2018.02.12.18.24.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 18:24:58 -0800 (PST) Date: Mon, 12 Feb 2018 18:24:56 -0800 From: Brian Norris To: Hans de Goede Cc: Marcel Holtmann , Gustavo Padovan , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org, linux-acpi@vger.kernel.org, stable@vger.kernel.org, Leif Liddy , Matthias Kaehlcke , Daniel Drake , Kai-Heng Feng , matadeen@qti.qualcomm.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version Message-ID: <20180213022455.GA151190@rodete-desktop-imager.corp.google.com> References: <20180108094416.4789-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180108094416.4789-1-hdegoede@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, Jan 08, 2018 at 10:44:16AM +0100, Hans de Goede wrote: > Commit 7d06d5895c15 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"") > removed the setting of the BTUSB_RESET_RESUME quirk for QCA Rome devices, > instead favoring adding USB_QUIRK_RESET_RESUME quirks in usb/core/quirks.c. > > This was done because the DIY BTUSB_RESET_RESUME reset-resume handling > has several issues (see the original commit message). An added advantage > of moving over to the USB-core reset-resume handling is that it also > disables autosuspend for these devices, which is similarly broken on these. Wait, is autosuspend actually broken for all QCA Rome chipsets? I don't think so -- I'm using one now. Thus, this is a poor solution, which negatively affects my systems. However, I see that this patch was applied regardless... What justifications was found for this anyway? AIUI, this is a platform bug, and not entirely a chipset bug. Why should all users of this chipset be penalized? Brian > But there are 2 issues with this approach: > 1) It leaves the broken DIY BTUSB_RESET_RESUME code in place for Realtek > devices. > 2) Sofar only 2 of the 10 QCA devices known to the btusb code have been > added to usb/core/quirks.c and if we fix the Realtek case the same way > we need to add an additional 14 entries. So in essence we need to > duplicate a large part of the usb_device_id table in btusb.c in > usb/core/quirks.c and manually keep them in sync. > > This commit instead restores setting a reset-resume quirk for QCA devices > in the btusb.c code, avoiding the duplicate usb_device_id table problem. > > This commit avoids the problems with the original DIY BTUSB_RESET_RESUME > code by simply setting the USB_QUIRK_RESET_RESUME quirk directly on the > usb_device. > > This commit also moves the BTUSB_REALTEK case over to directly setting the > USB_QUIRK_RESET_RESUME on the usb_device and removes the now unused > BTUSB_RESET_RESUME code. > > BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514836 > Fixes: 7d06d5895c15 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"") > Cc: stable@vger.kernel.org > Cc: Leif Liddy > Cc: Matthias Kaehlcke > Cc: Brian Norris > Cc: Daniel Drake > Cc: Kai-Heng Feng > Signed-off-by: Hans de Goede > --- > Note: > 1) Once this has been merged, the 2 commits adding QCA device entries to > drivers/usb/core/quirks.c should be reverted or dropped from bluetooth-next. > 2) I don't have any of the affected devices, please test > --- > drivers/bluetooth/btusb.c | 22 ++++++++++------------ > 1 file changed, 10 insertions(+), 12 deletions(-) > > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c > index 4764100a5888..c4689f03220f 100644 > --- a/drivers/bluetooth/btusb.c > +++ b/drivers/bluetooth/btusb.c > @@ -23,6 +23,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -388,9 +389,8 @@ static const struct usb_device_id blacklist_table[] = { > #define BTUSB_FIRMWARE_LOADED 7 > #define BTUSB_FIRMWARE_FAILED 8 > #define BTUSB_BOOTING 9 > -#define BTUSB_RESET_RESUME 10 > -#define BTUSB_DIAG_RUNNING 11 > -#define BTUSB_OOB_WAKE_ENABLED 12 > +#define BTUSB_DIAG_RUNNING 10 > +#define BTUSB_OOB_WAKE_ENABLED 11 > > struct btusb_data { > struct hci_dev *hdev; > @@ -3118,6 +3118,12 @@ static int btusb_probe(struct usb_interface *intf, > if (id->driver_info & BTUSB_QCA_ROME) { > data->setup_on_usb = btusb_setup_qca; > hdev->set_bdaddr = btusb_set_bdaddr_ath3012; > + > + /* QCA Rome devices lose their updated firmware over suspend, > + * but the USB hub doesn't notice any status change. > + * explicitly request a device reset on resume. > + */ > + interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME; > } > > #ifdef CONFIG_BT_HCIBTUSB_RTL > @@ -3128,7 +3134,7 @@ static int btusb_probe(struct usb_interface *intf, > * but the USB hub doesn't notice any status change. > * Explicitly request a device reset on resume. > */ > - set_bit(BTUSB_RESET_RESUME, &data->flags); > + interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME; > } > #endif > > @@ -3297,14 +3303,6 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) > enable_irq(data->oob_wake_irq); > } > > - /* Optionally request a device reset on resume, but only when > - * wakeups are disabled. If wakeups are enabled we assume the > - * device will stay powered up throughout suspend. > - */ > - if (test_bit(BTUSB_RESET_RESUME, &data->flags) && > - !device_may_wakeup(&data->udev->dev)) > - data->udev->reset_resume = 1; > - > return 0; > } > > -- > 2.14.3 >