Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1527232pxb; Mon, 22 Feb 2021 04:29:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYl3yHVY8VnCu6REsXuuSZpecb4JdMeOLxiKrERhqr7sCOMsTUF/jHPIx6/NCqRYovpSqT X-Received: by 2002:a17:906:511:: with SMTP id j17mr8908811eja.143.1613996978081; Mon, 22 Feb 2021 04:29:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613996978; cv=none; d=google.com; s=arc-20160816; b=Xbu9Ae+dWsF7hw6cY4//JZd/ytusg5+STD3fqfS/ZL8AhlymMKAErDyoA9Y0xia7CJ s3M+k5AkEWPMQU7GZ6gE38mkuiV+m2UTu4TtzQDvg6fYcPHKJTDh03gjcNp5kBBsxo4u 0OE6r3m7y240Des73VkDwRUfTGmy/ch4l7AKWVprmxstFwuAo4RSFoql04dQyIfYq9oz zTWxye6wHLqv9fjpspMd+KSe4Xrr5fVPrs+A55jda5BddhHsButXnYxEkQo+uDRh0i0f H4k2VJIkyh4El5h1o0xDqd8qFFaZ6LqoWAPx6izEj7lRc1YiV0ywPdySAPLeOod1yPGY NyqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+J1iGlaypMMQNfov8+AeYY9ISv8IW4VXZo2BDD+W/pc=; b=YOHN4tg05Rss2m5UcJaYRn3Q1cA90XSiqQwyEwyaGZcRYFLjV0ZgcqtdBRwq+BfYLH P3n1Lz6KlWpQgzqIxc6fgm1hva31VWjXoBCNNpeNsxcPiEAcbzv2ZFmC9snk7h3lTsBw nln/7E1TPoJx9uY08eQis4PoYp3o7n25JY+wqle5ZQ2E/6ymI503bkYhr/hYl2pQg9zs dPcp1gPnV6XG5o0ZXVWNkGLUj0+GprF0/dqRFPslTKxcahOg7jCw6/m/IKRX38/hUBYC ezjKUxTxo6AZLfyxvh7MGlTXcn7DlaiY3QNvkjtzcJKl1VI6u5UH3RjXLyL1YuC0MCr+ u8aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dtGjsS7H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 f1si7738466edu.216.2021.02.22.04.29.15; Mon, 22 Feb 2021 04:29:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=dtGjsS7H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S230174AbhBVM2H (ORCPT + 99 others); Mon, 22 Feb 2021 07:28:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:44932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbhBVMPp (ORCPT ); Mon, 22 Feb 2021 07:15:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E568464E05; Mon, 22 Feb 2021 12:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613996092; bh=TpxiZbi5b+MklyBDanEH4NAloJpXBHVpjJfBip9LBV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dtGjsS7HnSbgheEjHEz7g0OX1s1SHXXkNJ6n5scMiLxNn7fN40XuZcXoxEpsXUrGK Owi6y3sn/s3fSMBgbXa903qDlLemoJCngyvu1AOt5AW/eMSNr4b65/Pq0gHPiysr9F VU0pn6qXUurbhURmf/aGooZwkkOTG0qllrop+auU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trent Piepho , Marcel Holtmann , Salvatore Bonaccorso , Sjoerd Simons , Sebastian Reichel Subject: [PATCH 5.10 26/29] Bluetooth: btusb: Always fallback to alt 1 for WBS Date: Mon, 22 Feb 2021 13:13:20 +0100 Message-Id: <20210222121025.315105569@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210222121019.444399883@linuxfoundation.org> References: <20210222121019.444399883@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trent Piepho commit 517b693351a2d04f3af1fc0e506ac7e1346094de upstream. When alt mode 6 is not available, fallback to the kernel <= 5.7 behavior of always using alt mode 1. Prior to kernel 5.8, btusb would always use alt mode 1 for WBS (Wide Band Speech aka mSBC aka transparent SCO). In commit baac6276c0a9 ("Bluetooth: btusb: handle mSBC audio over USB Endpoints") this was changed to use alt mode 6, which is the recommended mode in the Bluetooth spec (Specifications of the Bluetooth System, v5.0, Vol 4.B ยง2.2.1). However, many if not most BT USB adapters do not support alt mode 6. In fact, I have been unable to find any which do. In kernel 5.8, this was changed to use alt mode 6, and if not available, use alt mode 0. But mode 0 has a zero byte max packet length and can not possibly work. It is just there as a zero-bandwidth dummy mode to work around a USB flaw that would prevent device enumeration if insufficient bandwidth were available for the lowest isoc mode supported. In effect, WBS was broken for all USB-BT adapters that do not support alt 6, which appears to nearly all of them. Then in commit 461f95f04f19 ("Bluetooth: btusb: USB alternate setting 1 for WBS") the 5.7 behavior was restored, but only for Realtek adapters. I've tested a Broadcom BRCM20702A and CSR 8510 adapter, both work with the 5.7 behavior and do not with the 5.8. So get rid of the Realtek specific flag and use the 5.7 behavior for all adapters as a fallback when alt 6 is not available. This was the kernel's behavior prior to 5.8 and I can find no adapters for which it is not correct. And even if there is an adapter for which this does not work, the current behavior would be to fall back to alt 0, which can not possibly work either, and so is no better. Signed-off-by: Trent Piepho Signed-off-by: Marcel Holtmann Cc: Salvatore Bonaccorso Cc: Sjoerd Simons Cc: Sebastian Reichel Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/btusb.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -480,7 +480,6 @@ static const struct dmi_system_id btusb_ #define BTUSB_HW_RESET_ACTIVE 12 #define BTUSB_TX_WAIT_VND_EVT 13 #define BTUSB_WAKEUP_DISABLE 14 -#define BTUSB_USE_ALT1_FOR_WBS 15 struct btusb_data { struct hci_dev *hdev; @@ -1710,15 +1709,12 @@ static void btusb_work(struct work_struc new_alts = data->sco_num; } } else if (data->air_mode == HCI_NOTIFY_ENABLE_SCO_TRANSP) { - /* Check if Alt 6 is supported for Transparent audio */ - if (btusb_find_altsetting(data, 6)) { - data->usb_alt6_packet_flow = true; - new_alts = 6; - } else if (test_bit(BTUSB_USE_ALT1_FOR_WBS, &data->flags)) { - new_alts = 1; - } else { - bt_dev_err(hdev, "Device does not support ALT setting 6"); - } + /* Bluetooth USB spec recommends alt 6 (63 bytes), but + * many adapters do not support it. Alt 1 appears to + * work for all adapters that do not have alt 6, and + * which work with WBS at all. + */ + new_alts = btusb_find_altsetting(data, 6) ? 6 : 1; } if (btusb_switch_alt_setting(hdev, new_alts) < 0) @@ -4149,10 +4145,6 @@ static int btusb_probe(struct usb_interf * (DEVICE_REMOTE_WAKEUP) */ set_bit(BTUSB_WAKEUP_DISABLE, &data->flags); - if (btusb_find_altsetting(data, 1)) - set_bit(BTUSB_USE_ALT1_FOR_WBS, &data->flags); - else - bt_dev_err(hdev, "Device does not support ALT setting 1"); } if (!reset)