Received: by 10.223.185.116 with SMTP id b49csp2350807wrg; Thu, 15 Feb 2018 10:13:44 -0800 (PST) X-Google-Smtp-Source: AH8x225HraqfpWt1A4vyx6KPOhiK88TuHi1XNd2sOMP6gxOGmij6LZrt+KBM2T6BuLooXZxXP/EK X-Received: by 10.98.251.5 with SMTP id x5mr3480721pfm.18.1518718424710; Thu, 15 Feb 2018 10:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518718424; cv=none; d=google.com; s=arc-20160816; b=Ds2yRd6b6U+mD5T88Wwoa6kjgGk5lLFfDfgxtse29RunP9JsIpxfYU/VAgToNLTRPX U9ez0yaL1nhOD1722HG3c+JWF7ByYb8GJ7RjNQjI5Mq+DdumgLuklE2+m8DkrD7grbZl o3r9rpvNFzu6NDjizbf6amP3P2JYA1r9B3xDVHPNPNuhKql9/8CkbzorY62sQw1+hYob nr9p1+3u7Nq9BI4mxqKxRUd1fHi7z9A6IIPkkVJJBW4GmNHz9mkoTECe3V2vmAySFOu4 gbCoQAH91wu8p5Fc4wG9rD+dBleiCZpAkXNtiMqk5VHPBIbTS9qQC67YBlIHKu4aX/A8 l3Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=LOZCkKNexxJEGlQ+oRoX9+mY1j/oOtegxjB8DY2Bisk=; b=M1D8RlBX3uAf8ZxWTLx5ZdcYo5QYvPLlIqLLYJhFBYqIFdfKLSa4vj3pOt5FjLtsDS 0IwSc0ZMqKZ2NeJctosioC+2snz1pDAO6xCYilvCUPW4WQDFcfq6P7YQzXCfPFBSTBQ2 Gr+VgZiGxeUdnq8s49v81BXkj+w+3W9yFmPNyxzKP3gD07b8+9rViPPXqGHxSr1gikki nPVF87RJTwtthXNfwJdJ/ogtGwaOqaLtPDpGmdqyQotBa4OOa8RHVyq4qkWeoqOI0UWT BOR1trAJnIqNNxwegGzHggWX+2mzdF2AEcqEKDh7zcla+J0LaE/We+Zy/CCfbsx9IfOG CP/w== 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 1-v6si3369951ply.348.2018.02.15.10.13.29; Thu, 15 Feb 2018 10:13: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 S1164064AbeBOSLx (ORCPT + 99 others); Thu, 15 Feb 2018 13:11:53 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53830 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163804AbeBOP23 (ORCPT ); Thu, 15 Feb 2018 10:28:29 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2CB4FBD1; Thu, 15 Feb 2018 15:28:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leif Liddy , Matthias Kaehlcke , Brian Norris , Daniel Drake , Kai-Heng Feng , Hans de Goede , Marcel Holtmann Subject: [PATCH 4.9 69/88] Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version Date: Thu, 15 Feb 2018 16:17:36 +0100 Message-Id: <20180215151232.076118027@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.437136975@linuxfoundation.org> References: <20180215151222.437136975@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans de Goede commit 61f5acea8737d9b717fcc22bb6679924f3c82b98 upstream. 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. 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: Leif Liddy Cc: Matthias Kaehlcke Cc: Brian Norris Cc: Daniel Drake Cc: Kai-Heng Feng Signed-off-by: Hans de Goede Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/btusb.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -369,8 +370,8 @@ static const struct usb_device_id blackl #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_DIAG_RUNNING 10 +#define BTUSB_OOB_WAKE_ENABLED 11 struct btusb_data { struct hci_dev *hdev; @@ -2925,6 +2926,12 @@ static int btusb_probe(struct usb_interf 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 @@ -2935,7 +2942,7 @@ static int btusb_probe(struct usb_interf * 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 @@ -3092,14 +3099,6 @@ static int btusb_suspend(struct usb_inte btusb_stop_traffic(data); usb_kill_anchored_urbs(&data->tx_anchor); - /* 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; }