Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp867903pxm; Thu, 3 Mar 2022 06:11:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOL41moxxpus5zMJZouUd7Ccd0Q0PcqYSCwJtKDzCxb+kxZxQMPnJmRXf9PfdCRB0dc4pz X-Received: by 2002:a17:903:24f:b0:14f:73fa:2b30 with SMTP id j15-20020a170903024f00b0014f73fa2b30mr36500501plh.174.1646316684113; Thu, 03 Mar 2022 06:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646316684; cv=none; d=google.com; s=arc-20160816; b=OYFTkyX/3RQ06vqHjKdJA5JmaOrCvnUhomjWSqB02uMr7L2iyCowtCP6Xk8YyopX2Q jbwF5v4PGRmYmjP+enimJRC8H8VaU/Yok8JGMBCMrM9uGySQUQm87NCCoFCTih8oOz8g 6bu+X9d0UtBapF/y13RoLeJq69AkaRyVf2RV9wF2VX2ry+rRWrTcM9RPuQca+zsdx4H9 boiJK2hYgQJuQ0pXr33CSZM2bwygTW+iyNbfvEpN7XzTlNZ57PgBHpQxHkvAweyE9vLq QJh5myNaApXEL1MBSFnIKl/IKwTSqt4YCOMC2e6k/gzYRsJ6FGsXPhXPAQ1+0ADvJW9y 0M9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=7H94ywqMsbX87NJlMMM+UjE13stcAHzqVo6ukO13tVU=; b=cbyvYRgz3IKYGBb2tzw4EFyxpmN7a8qW/UBtMAoEZKw7ek90/fsYhAw8oJrvdNYEpC Xs/DhsN3pksQI5MZs15TAo7GcttFAPR8zclCjFMv8n8B2GIHlwBFSsYS5uThkS4ES1rU +gBLh3Y3PKChh8xcrU60zvwwja4F7Umx4/+GpErVrQQr+JDPJu8TcQP3Ke9VfoWaSS6H CU5B4lrli8vHGSIbRphppclHDOdMcDnmEwWDyfj+Z+SDbKk5Uxxb2meoQZdTCMsHxlsK OXxor596ektlG0vcMCq8Gtj/kvDVk1Zqp5ae5euqN9tcg8AvoaS9E3rJBQ+E7u8gFObm 5DRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k6-20020a170902ce0600b0014f63facf03si2205939plg.81.2022.03.03.06.10.45; Thu, 03 Mar 2022 06:11:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232757AbiCCMYS convert rfc822-to-8bit (ORCPT + 99 others); Thu, 3 Mar 2022 07:24:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbiCCMYR (ORCPT ); Thu, 3 Mar 2022 07:24:17 -0500 Received: from mail.holtmann.org (coyote.holtmann.net [212.227.132.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E9081BD2EE for ; Thu, 3 Mar 2022 04:23:27 -0800 (PST) Received: from smtpclient.apple (p5b3d2910.dip0.t-ipconnect.de [91.61.41.16]) by mail.holtmann.org (Postfix) with ESMTPSA id D50E5CED23; Thu, 3 Mar 2022 13:23:26 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Re: [RFC] Bluetooth: HCI: Add HCI_QUIRK_ENHANCED_SETUP_SYNC_CONN quirk From: Marcel Holtmann In-Reply-To: <20220302225049.432025-1-luiz.dentz@gmail.com> Date: Thu, 3 Mar 2022 13:23:26 +0100 Cc: linux-bluetooth@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <2CF7A301-D806-4E9A-A441-BE661FF3AD5B@holtmann.org> References: <20220302225049.432025-1-luiz.dentz@gmail.com> To: Luiz Augusto von Dentz X-Mailer: Apple Mail (2.3693.60.0.1.1) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Luiz, > This adds HCI_QUIRK_ENHANCED_SETUP_SYNC_CONN quirk which can be used to > mark HCI_Enhanced_Setup_Synchronous_Connection as supported by > controller since using just the support command bits are not enough > since some controller report it as supported but the command don't work > properly with some configurations (e.g. BT_VOICE_TRANSPARENT/mSBC). > > Fixes: b2af264ad3af ("Bluetooth: Add support for HCI_Enhanced_Setup_Synchronous_Connection command") > Link: https://bugzilla.kernel.org/show_bug.cgi?id=215576 > Signed-off-by: Luiz Augusto von Dentz > --- > drivers/bluetooth/btusb.c | 58 +++++++++++++++++--------------- > include/net/bluetooth/hci.h | 9 +++++ > include/net/bluetooth/hci_core.h | 8 +++-- > 3 files changed, 46 insertions(+), 29 deletions(-) > > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c > index 558151f2f150..c862d0f963b5 100644 > --- a/drivers/bluetooth/btusb.c > +++ b/drivers/bluetooth/btusb.c > @@ -36,33 +36,34 @@ static bool reset = true; > > static struct usb_driver btusb_driver; > > -#define BTUSB_IGNORE 0x01 > -#define BTUSB_DIGIANSWER 0x02 > -#define BTUSB_CSR 0x04 > -#define BTUSB_SNIFFER 0x08 > -#define BTUSB_BCM92035 0x10 > -#define BTUSB_BROKEN_ISOC 0x20 > -#define BTUSB_WRONG_SCO_MTU 0x40 > -#define BTUSB_ATH3012 0x80 > -#define BTUSB_INTEL_COMBINED 0x100 > -#define BTUSB_INTEL_BOOT 0x200 > -#define BTUSB_BCM_PATCHRAM 0x400 > -#define BTUSB_MARVELL 0x800 > -#define BTUSB_SWAVE 0x1000 > -#define BTUSB_AMP 0x4000 > -#define BTUSB_QCA_ROME 0x8000 > -#define BTUSB_BCM_APPLE 0x10000 > -#define BTUSB_REALTEK 0x20000 > -#define BTUSB_BCM2045 0x40000 > -#define BTUSB_IFNUM_2 0x80000 > -#define BTUSB_CW6622 0x100000 > -#define BTUSB_MEDIATEK 0x200000 > -#define BTUSB_WIDEBAND_SPEECH 0x400000 > -#define BTUSB_VALID_LE_STATES 0x800000 > -#define BTUSB_QCA_WCN6855 0x1000000 > -#define BTUSB_INTEL_BROKEN_SHUTDOWN_LED 0x2000000 > -#define BTUSB_INTEL_BROKEN_INITIAL_NCMD 0x4000000 > -#define BTUSB_INTEL_NO_WBS_SUPPORT 0x8000000 > +#define BTUSB_IGNORE BIT(0) > +#define BTUSB_DIGIANSWER BIT(1) > +#define BTUSB_CSR BIT(2) > +#define BTUSB_SNIFFER BIT(3) > +#define BTUSB_BCM92035 BIT(4) > +#define BTUSB_BROKEN_ISOC BIT(5) > +#define BTUSB_WRONG_SCO_MTU BIT(6) > +#define BTUSB_ATH3012 BIT(7) > +#define BTUSB_INTEL_COMBINED BIT(8) > +#define BTUSB_INTEL_BOOT BIT(9) > +#define BTUSB_BCM_PATCHRAM BIT(10) > +#define BTUSB_MARVELL BIT(11) > +#define BTUSB_SWAVE BIT(12) > +#define BTUSB_AMP BIT(13) > +#define BTUSB_QCA_ROME BIT(14) > +#define BTUSB_BCM_APPLE BIT(15) > +#define BTUSB_REALTEK BIT(16) > +#define BTUSB_BCM2045 BIT(17) > +#define BTUSB_IFNUM_2 BIT(18) > +#define BTUSB_CW6622 BIT(19) > +#define BTUSB_MEDIATEK BIT(20) > +#define BTUSB_WIDEBAND_SPEECH BIT(21) > +#define BTUSB_VALID_LE_STATES BIT(22) > +#define BTUSB_QCA_WCN6855 BIT(23) > +#define BTUSB_INTEL_BROKEN_SHUTDOWN_LED BIT(24) > +#define BTUSB_INTEL_BROKEN_INITIAL_NCMD BIT(25) > +#define BTUSB_INTEL_NO_WBS_SUPPORT BIT(26) > +#define BTUSB_ENHANCED_SETUP_SYNC_CONN BIT(27) not in the same patch. > > static const struct usb_device_id btusb_table[] = { > /* Generic Bluetooth USB device */ > @@ -3848,6 +3849,9 @@ static int btusb_probe(struct usb_interface *intf, > set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); > } > > + if (id->driver_info & BTUSB_ENHANCED_SETUP_SYNC_CONN) > + set_bit(HCI_QUIRK_ENHANCED_SETUP_SYNC_CONN, &hdev->quirks); > + > if (id->driver_info & BTUSB_CSR) { > struct usb_device *udev = data->udev; > u16 bcdDevice = le16_to_cpu(udev->descriptor.bcdDevice); > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h > index 35c073d44ec5..7fe10ad044c1 100644 > --- a/include/net/bluetooth/hci.h > +++ b/include/net/bluetooth/hci.h > @@ -255,6 +255,15 @@ enum { > * during the hdev->setup vendor callback. > */ > HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, > + > + /* > + * When this quirk is set, enables the use of > + * HCI_OP_ENHANCED_SETUP_SYNC_CONN command to setup SCO connections. > + * > + * This quirk can be set before hci_register_dev is called or > + * during the hdev->setup vendor callback. > + */ > + HCI_QUIRK_ENHANCED_SETUP_SYNC_CONN, > }; And NO. We are not penalizing well behaving hardware. We mark broken hardware as broken. In addition, we really need to print out after ->setup() has run what quirks a given hardware sets and be verbose in dmesg about this mess. Companies really need to learn to get the stuff right or provide firmware updates to fix it. If this command is broken, then also WBS support should also be disabled. We need to make them feel this pain and give incentives to get this broken hardware fixed. Also I am only going to apply such a patch when I see the driver change to it as well. Regards Marcel