Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5261523pxb; Sun, 7 Nov 2021 08:30:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJycBYEJ28dy5K64MhiGnr7kJ5kRPbhZYnqZjb29FB4acQJI6sqLDsNGdsOa84Z6pT4ram7F X-Received: by 2002:a05:6638:dd5:: with SMTP id m21mr20229845jaj.51.1636302643312; Sun, 07 Nov 2021 08:30:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636302643; cv=none; d=google.com; s=arc-20160816; b=xz5ngek/CiIOD0GwsqD8Y+1H6dPvVVF1fQ5b9/CAqONV9tRnZMHs6ou+D3DL7ExYOo TkSMx8UxMzKxT+MZmgsQoTyEleB3wAOPd6Vb+zukIEUO5WWDN5NYvnucBkW9PCRDuKw7 DAu+Q56mkRTDzuD4WgGy7vOHRUm3NNwekBf5tkz6HuAt9M3tUxOwLoK264reJy7bV4Oc X8zafjEP05KfxEjm1u34ntiVrHckd98PcK5gf8KTfY3+e/31hT1Sk9frl+7KZ3p0VTnX r6PI0/qRnXVfLd+9u2jcppwp32eBtYagFXzOBi5awGoTpSQcupeGJDnWHLGhLkD7owSa KBMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ORSNg1OE7Xa9FY3VD739gMdkxzjzNUSkqLsY6vJ/zaI=; b=Cce+sb3fBsjcv2Fx39olRqx1L2047NBeh43se0x1srCRRJP6uiK726PTpwN9wMFwzm BXF1vNnBfXXKmerVlHFlNu+CMis+yYNXtcf6N1glHscVzO/ix2fJocS4/p1uzwBJKncE LgqTQFJULqi1WwoqzvVtdhJNRfjOHwH4am06UTfOhEIsnnveIr+z5PNWQPTKPvKbBXl+ UhQbxRLG9DGd6kO7s7dzaWj2x0DBSIsxVSgn+r3nKz8Rqd3DGRDvJR1jp+UqDkc2OXUd btEdihrD/WDQd552teiVDdJHjT8iSOQGdtJtCFx78XvL90pg17m4IyLCKM8YROSr9lPW 0TpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lD5gxEgl; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si29532061iov.5.2021.11.07.08.30.15; Sun, 07 Nov 2021 08:30:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lD5gxEgl; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235237AbhKGIiD (ORCPT + 99 others); Sun, 7 Nov 2021 03:38:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:45988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235231AbhKGIiD (ORCPT ); Sun, 7 Nov 2021 03:38:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1934561352; Sun, 7 Nov 2021 08:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1636274120; bh=93wEXkMa2gI4FVSMhi+EYZcrkjhsHTaqExcUt64gxNQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lD5gxEglNP7ubqget5OMWC9I8Ypki6Zj3XiivMuP7pymeXpU2eOi8r3dWYqarzbCq 4267kzklVM00dEj3zqRIdaqGAvqL89IZBfLhSYO31j44KY27I5Xpqsgxtqp9rbHtDI wahrZG/6XmPNL4FU7kgcdDObhq0fVjCBn84BUxi0= Date: Sun, 7 Nov 2021 09:35:15 +0100 From: Greg KH To: Aditya Garg Cc: Luiz Augusto von Dentz , Orlando Chamberlain , Daniel Winkler , Johan Hedberg , "linux-bluetooth@vger.kernel.org" , Linux Kernel Mailing List , Marcel Holtmann , "regressions@lists.linux.dev" , Sonny Sasaka Subject: Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power Message-ID: References: <4970a940-211b-25d6-edab-21a815313954@protonmail.com> <20210930063106.19881-1-redecorating@protonmail.com> <20210930141256.19943-1-redecorating@protonmail.com> <275acce4-9eab-9cba-7145-5a75a69ca530@protonmail.com> <20211001083412.3078-1-redecorating@protonmail.com> <972034A8-4B22-4FEE-9B37-C0A7C7ADD60C@live.com> <829A2DF8-818E-4AF1-84F9-49B5822F9146@live.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <829A2DF8-818E-4AF1-84F9-49B5822F9146@live.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Sat, Nov 06, 2021 at 05:27:27PM +0000, Aditya Garg wrote: > > > > On 06-Nov-2021, at 5:19 PM, Greg KH wrote: > > > > On Sat, Nov 06, 2021 at 09:41:28AM +0000, Aditya Garg wrote: > >> > >> > >>> On 06-Nov-2021, at 3:17 AM, Luiz Augusto von Dentz wrote: > >>> > >>> Hi Orlando, > >>> > >>> On Fri, Oct 1, 2021 at 1:56 AM Orlando Chamberlain > >>> wrote: > >>>> > >>>> The LE Read Transmit Power command is Advertised on some Broadcom > >>>> controlers, but not supported. Using this command breaks Bluetooth > >>>> on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read > >>>> Transmit Power for these devices, based off their common chip id 150. > >>>> > >>>> Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.com > >>>> Signed-off-by: Orlando Chamberlain > >>>> --- > >>>> v1->v2: Clarified quirk description > >>>> > >>>> drivers/bluetooth/btbcm.c | 4 ++++ > >>>> include/net/bluetooth/hci.h | 11 +++++++++++ > >>>> net/bluetooth/hci_core.c | 3 ++- > >>>> 3 files changed, 17 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c > >>>> index e4182acee488..4ecc50d93107 100644 > >>>> --- a/drivers/bluetooth/btbcm.c > >>>> +++ b/drivers/bluetooth/btbcm.c > >>>> @@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev) > >>>> return PTR_ERR(skb); > >>>> > >>>> bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]); > >>>> + > >>>> + if (skb->data[1] == 150) > >>>> + set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks); > >>>> + > >>>> kfree_skb(skb); > >>>> > >>>> /* Read Controller Features */ > >>>> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h > >>>> index b80415011dcd..6da9bd6b7259 100644 > >>>> --- a/include/net/bluetooth/hci.h > >>>> +++ b/include/net/bluetooth/hci.h > >>>> @@ -246,6 +246,17 @@ enum { > >>>> * HCI after resume. > >>>> */ > >>>> HCI_QUIRK_NO_SUSPEND_NOTIFIER, > >>>> + > >>>> + /* When this quirk is set, LE Read Transmit Power is disabled. > >>>> + * This is mainly due to the fact that the HCI LE Read Transmit > >>>> + * Power command is advertised, but not supported; these > >>>> + * controllers often reply with unknown command and need a hard > >>>> + * reset. > >>>> + * > >>>> + * This quirk can be set before hci_register_dev is called or > >>>> + * during the hdev->setup vendor callback. > >>>> + */ > >>>> + HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, > >>>> }; > >>>> > >>>> /* HCI device flags */ > >>>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c > >>>> index 8a47a3017d61..9a23fe7c8d67 100644 > >>>> --- a/net/bluetooth/hci_core.c > >>>> +++ b/net/bluetooth/hci_core.c > >>>> @@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt) > >>>> hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL); > >>>> } > >>>> > >>>> - if (hdev->commands[38] & 0x80) { > >>>> + if (hdev->commands[38] & 0x80 && > >>>> + !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) { > >>>> /* Read LE Min/Max Tx Power*/ > >>>> hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER, > >>>> 0, NULL); > >>>> -- > >>>> 2.33.0 > >>> > >>> Nowadays it is possible to treat errors such like this on a per > >>> command basis (assuming it is not essential for the init sequence): > >>> > >>> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h > >>> index 979da5179ff4..f244f42cc609 100644 > >>> --- a/include/net/bluetooth/hci.h > >>> +++ b/include/net/bluetooth/hci.h > >>> @@ -551,6 +551,7 @@ enum { > >>> #define HCI_LK_AUTH_COMBINATION_P256 0x08 > >>> > >>> /* ---- HCI Error Codes ---- */ > >>> +#define HCI_ERROR_UNKNOWN_CMD 0x01 > >>> #define HCI_ERROR_UNKNOWN_CONN_ID 0x02 > >>> #define HCI_ERROR_AUTH_FAILURE 0x05 > >>> #define HCI_ERROR_PIN_OR_KEY_MISSING 0x06 > >>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > >> This diff cannot be applied to stable 5.15. Could you provide a patch capable of being applied to stable. > > > > That is not needed until a patch is in Linus's tree. Why do you need it > > earlier? > > > Well not an emergency, but the issue of Bluetooth not working on some Apple Macs has been there for a long time. BTW, will this patch be there in Linus’s tree in the coming days? That is up to the bluetooth maintainers, they have to accept it first. thanks, greg k-h