Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4422402pxu; Wed, 9 Dec 2020 17:21:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVZJPjmC0vCr2NkacUd+DF81nX8WZABlWo5p2tGnBhGxlHY57uhyG0qhUZuLtu68JRcaT/ X-Received: by 2002:a05:6402:45:: with SMTP id f5mr892926edu.273.1607563310877; Wed, 09 Dec 2020 17:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607563310; cv=none; d=google.com; s=arc-20160816; b=e+6IMZ/xCqPZ7T1amU57o3tOAGzGMVPxxPEnsbPTxDH8ugTAJqtEDrRiVJSGEPD6ic daJ0mouN9Gv3heNbUlAQWR85QMNlPyPuj3mo9xyixvZgkgU/fps6y2rIwJ8RI260uLB7 XsgTzu+jGj2Vga7XKN/W/ZsH5SAjrFm7n06uDw+12j9j+Gg3+ppWWKJMUBR5JOjxXiAQ Ecqs+T3vrpYl6alvzESG0A3kPVW1z1chHZWoDMtaMERnkuHSTkrZgu+ShYGdvr7Whav2 WVhbQUByxWoCggkfVEQcIBsHry9UfSsnFi92MWmFuRU7weX21jv9zmPPOTy6bZTMrud3 x1Sw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=TnX3YC7/PBJ67zZPtWlNRRmtdbF2hw55/iK7zw29u2k=; b=yzEImw9i48Ksjrtv+LVVP5Ef38vwjtAaSMHky7ONv5ACOBYI/G6kueN0JsQZlja3KY AjAnciNWk3raBZ2lfu7V5Ii3KWBHdTz0oscOUi1VMgXkOHjrRg5X3OLTswYBqA+1eTyU wqHgTjTYZzvuCRmOaeXlanXM6577uF3RuCFwq7IFwZl994wGANvGJXp39/9puHjPwLUB du8oD4jdGtQQsHomo7BJsTALWmAFBtvXETq6cDlCUgTSnvw/xD8nJKnYLFmwJME/Wtxq dHWxjZ1ymolfo/GTELba4t2Inhu2J4gvzXjJu6xwiJEsBIiIRmg5cqVO1f9w7BgZJd/b 8XIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TD5SIHwz; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si1724770ejf.698.2020.12.09.17.21.13; Wed, 09 Dec 2020 17:21:50 -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=@gmail.com header.s=20161025 header.b=TD5SIHwz; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731969AbgLJBVE (ORCPT + 99 others); Wed, 9 Dec 2020 20:21:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731943AbgLJBVE (ORCPT ); Wed, 9 Dec 2020 20:21:04 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DFB7C0613CF; Wed, 9 Dec 2020 17:20:24 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id x12so1453421plr.10; Wed, 09 Dec 2020 17:20:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TnX3YC7/PBJ67zZPtWlNRRmtdbF2hw55/iK7zw29u2k=; b=TD5SIHwzSQLGB7lAF6oefAYoP+OjXSSz3BPbsADRIAQE5tA2T5NRH1b5bcPivQTM1L uBnrwPsw+Xqh2JVdZu9UUvyOh5P1QfxYga1Z8DF7lp+Y0fPksBj9gfx2llBnKYBpolV/ sfoRRvgO/pv0N/G5+10WZYGuEqeD+QekMJBsgeysWqGzpkIRuDI5RMuhhinP5+SLFBY8 5Y8tJuilUgaVOLEenUWIf1vNzD4VSc2cZ2EC49E9tJnLyzmCtOGkEOSyrHb092MpPWb0 y+ob186mvmvwJtp7SQhEbEHDKWY0XM39YusyZq8Gyfgsx2UEdDTO3/lyWZ9zHiubmkKw 02pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TnX3YC7/PBJ67zZPtWlNRRmtdbF2hw55/iK7zw29u2k=; b=LafmFtBPCH3ljsKiq4haK4YeB2AxIViCg5x6/s06DE2ukjdA+qc7M1SMrfDSmRh9DR eUuUhTCSmYYNQxxjUY5Fw8evHpHFQw2bIPbNwCminzdA4VEvitIzRdd1G1bIYv+don0f J+kdW/5jqMU9JsHvg5d2ngP+4xifALe5R5XV+lFPIt4kVBN0M4uZ+DiCNu7Pfbfe+zHG aZo+t12fOl9UoiTsviGasJmETWYhY3Z5xYy2QunYTU6N4dYm2cfDq6OCoXR9yPutRBsS G8UkXQ7GkF0E8CtpPhpTCBfjpwtRfR/BMebtSjIywR7kje4N64LRoK+cUR1Wd9wc0JF4 4tIQ== X-Gm-Message-State: AOAM533pcFEFLvD6n/mD2F/uJsfq76APZvdHOWc9fc6mZ6wQdwEjmCSH Eolw67K+ePvfXpiRqiKTmEi+Qmq6EZ+qyv7x X-Received: by 2002:a17:902:bd8d:b029:da:fcd1:664 with SMTP id q13-20020a170902bd8db02900dafcd10664mr4626692pls.30.1607563223347; Wed, 09 Dec 2020 17:20:23 -0800 (PST) Received: from zen.local ([71.212.189.78]) by smtp.gmail.com with ESMTPSA id i123sm4138118pfb.28.2020.12.09.17.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 17:20:22 -0800 (PST) From: Trent Piepho To: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hilda Wu , Sathish Narasimman , Chethan T N , Hsin-Yu Chao , Amit K Bag , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Trent Piepho Subject: [PATCH] Bluetooth: btusb: Always fallback to alt 1 for WBS Date: Wed, 9 Dec 2020 17:20:03 -0800 Message-Id: <20201210012003.133000-1-tpiepho@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 --- drivers/bluetooth/btusb.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 03b83aa91277..1b690164ab5b 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -506,7 +506,6 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = { #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; @@ -1736,15 +1735,12 @@ static void btusb_work(struct work_struct *work) 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) @@ -4548,10 +4544,6 @@ static int btusb_probe(struct usb_interface *intf, * (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) -- 2.26.2