From patchwork Tue Jun 30 13:09:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilda Wu X-Patchwork-Id: 11633937 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D8D8138C for ; Tue, 30 Jun 2020 13:12:53 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C05A320674 for ; Tue, 30 Jun 2020 13:12:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PdvhRQrN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ePF+8Cr+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C05A320674 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=fhq6otYOPvz8iD8cqB44yIuvwkOyX9FZT1t9UP11rB4=; b=PdvhRQrNETm4oNqCobf7/EMu4m cGLqBpEyhHfEpokcuDLhQqnT72eVU28MG7R0RkVwlgUPhj9HfoVO2HgAW6chO1Wk4ItSKfasHTWI2 pe/tnEQvLz2FlOGJ2xD/4PA2bSPjO4zAd43oy8xhql+b0WmJ03Q5MD/2ELv4rVcn3svVm0imZhEF+ 7tev9LmD2ZlBNY7je39t4m243UOsf3c2zswmGb15Ct+Qw/tk0tpJEiOnQoipirpLL6er9QEGblopP oeeHwem2PK+R/1vCHbY5/6/AWBqt3oMB9/e+f6FEYgZlKI1PcSmIZRUBr+FrcMaLNRA91snjnRxzl 1tcufnIg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqG2S-0001dC-8q; Tue, 30 Jun 2020 13:11:04 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqG2Q-0001d2-4o; Tue, 30 Jun 2020 13:11:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:Message-ID: Date:Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=jTBibtHkltaqNAWlHzgNxM8/MHLn4koGJ0YxXX+vzVk=; b=ePF+8Cr+Gmssno4tl+JGeYWCGW A7oImyFekRXy7BrDvUH2bn/Bw+dwD5RDhiXsDu93fQBF0ObPOLGsSydikjkLkSQwzSPbpEuhD4kjz hlApJlqwyPVpVPU/dKC1A6HTcM2NG1XofLoLp/l4KvbU+7gRsjCVJWEYcXmjvOalfvfNpD3EDF90Q V3invqTXMhUAzR4I6vt89LV9tFZNmdX2KPBVYCgYW9Ox8RUk/+yT1K3nhMx5+H5Utk3Z39hKI9Y3A RNcOjDkGG9N84xY5R5z2G7KF8TTt9ny96IHmLz8nfRkk4JXc+Vz32fOhCojHmjCxoI3txGx0msHxJ vLOm+MgA==; Received: from rtits2.realtek.com ([211.75.126.72] helo=rtits2.realtek.com.tw) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqG1s-0006QV-Q9; Tue, 30 Jun 2020 13:10:59 +0000 Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.69 with qID 05UD9m3N2022713, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexmb06.realtek.com.tw[172.21.6.99]) by rtits2.realtek.com.tw (8.15.2/2.66/5.86) with ESMTPS id 05UD9m3N2022713 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 30 Jun 2020 21:09:48 +0800 Received: from RTEXMB04.realtek.com.tw (172.21.6.97) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Tue, 30 Jun 2020 21:09:48 +0800 Received: from localhost.localdomain (172.21.87.237) by RTEXMB04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Tue, 30 Jun 2020 21:09:47 +0800 From: To: Subject: [PATCH v2] Bluetooth: btusb: USB alternate setting 1 for WBS Date: Tue, 30 Jun 2020 21:09:40 +0800 Message-ID: <20200630130940.14339-1-hildawu@realtek.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [172.21.87.237] X-ClientProxiedBy: RTEXMB03.realtek.com.tw (172.21.6.96) To RTEXMB04.realtek.com.tw (172.21.6.97) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200630_141031_824954_CF211B46 X-CRM114-Status: GOOD ( 15.74 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: max.chou@realtek.com, johan.hedberg@gmail.com, kidman@realtek.com, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, alex_lu@realsil.com.cn, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Hilda Wu RTL8822CE supports transparent WBS to apply USB alternate setting 1. Add a flag to the device match data to apply alternate setting 1 which meet the transfer speed for WBS support. Signed-off-by: Hilda Wu --- Changes in v2: - More descriptive commit log and short description. - Use BTUSB_USE_ALT1_FOR_WBS replace BTUSB_WBS_ALT1 for descriptive name. - Move alternate setting 1 check into the btusb_probe() function and adjust position of data->isoc for alternate setting check. --- --- drivers/bluetooth/btusb.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c7cc8e594166..e4a12c58501e 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -453,6 +453,7 @@ 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; @@ -1666,14 +1667,15 @@ static void btusb_work(struct work_struct *work) new_alts = data->sco_num; } } else if (data->air_mode == HCI_NOTIFY_ENABLE_SCO_TRANSP) { - - data->usb_alt6_packet_flow = true; - /* Check if Alt 6 is supported for Transparent audio */ - if (btusb_find_altsetting(data, 6)) + if (btusb_find_altsetting(data, 6)) { + data->usb_alt6_packet_flow = true; new_alts = 6; - else + } 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"); + } } if (btusb_switch_alt_setting(hdev, new_alts) < 0) @@ -3954,6 +3956,15 @@ static int btusb_probe(struct usb_interface *intf, btusb_check_needs_reset_resume(intf); } + if (id->driver_info & BTUSB_AMP) { + /* AMP controllers do not support SCO packets */ + data->isoc = NULL; + } else { + /* Interface orders are hardcoded in the specification */ + data->isoc = usb_ifnum_to_if(data->udev, ifnum_base + 1); + data->isoc_ifnum = ifnum_base + 1; + } + if (IS_ENABLED(CONFIG_BT_HCIBTUSB_RTL) && (id->driver_info & BTUSB_REALTEK)) { hdev->setup = btrtl_setup_realtek; @@ -3965,21 +3976,16 @@ 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"); err = usb_autopm_get_interface(intf); if (err < 0) goto out_free_dev; } - if (id->driver_info & BTUSB_AMP) { - /* AMP controllers do not support SCO packets */ - data->isoc = NULL; - } else { - /* Interface orders are hardcoded in the specification */ - data->isoc = usb_ifnum_to_if(data->udev, ifnum_base + 1); - data->isoc_ifnum = ifnum_base + 1; - } - if (!reset) set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);