Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp494242pxb; Wed, 27 Jan 2021 12:58:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvgsxqICyABRm1xPkTI4d4i8yL6mh0dAHjYmcuXJ31ma5ClzSY4fRqSReMc6e25bu4T2ea X-Received: by 2002:a50:bacb:: with SMTP id x69mr10725788ede.39.1611781106529; Wed, 27 Jan 2021 12:58:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611781106; cv=none; d=google.com; s=arc-20160816; b=T15N0SEuSSV3nSaHPkm1wjFztsO78aPTuGX5zqnTEPDXv4HiH+gjX8RsZvawng4z0k ivvFpVDMbjeBVQ22uy7vbTgkmycqd+ToGgU3ceYC+QoTyLvraapP/3PC1JPeHRbxTnvy On344ghIokg+Roz6KDTlnwPMEbS06n/vIblAra4WzTC4WmDtkupIzzINa99Bg9OZ7HEa O4RwCMam+SeI1XyHZo30wsfcBBvv6Al4DtWt96bEuZ1lhdDnd5uc1Xda3tivYTPBCxR9 hIxE8rhL94swRrXmLUteyirzrIIW5Vd2di/Cn/UE5ybAWQROsv4pYeLcOxwzdk7IfLpg jKgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :authenticated-by; bh=zES7XserQoARopwbStyQLmBII6ildXd60W2yw1qhTxs=; b=m+5WXQLWhcZ5Yey5bMd82f2ORP1jqw3pUuq7YZFxDg4TL7zNtVvP04jk+8IXoyGz+2 ulbPbsKJIJblBs0BA1vpqy8jk3SfAFkO4u2vvHxsNQF5v6aFyywM0sacedaV/uidJW2/ d3M6jWzb9lVHD9jGBr/9umk38UCktoNfv3JwBv4ttucL9TZt8xzAF8v+v6ImN+Qy3YPW 6LIUoL8C/m/HfV7VLnOue7BmMGdDft1DYcLZ8Nv/DU92MKiMXmhfrZxLqQUl2XsB52lw XJDVRNyLvscVqGrPhk7MmEJi1zmk09zSLWfjCLcuK2l5Fp7H86mJQZS5M+BBGVhSw0s/ j83w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l22si1549116edr.554.2021.01.27.12.58.01; Wed, 27 Jan 2021 12:58:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238054AbhA0EFP (ORCPT + 99 others); Tue, 26 Jan 2021 23:05:15 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:42340 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbhA0DDC (ORCPT ); Tue, 26 Jan 2021 22:03:02 -0500 Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.73 with qID 10R31uiA6028033, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexmbs03.realtek.com.tw[172.21.6.96]) by rtits2.realtek.com.tw (8.15.2/2.70/5.88) with ESMTPS id 10R31uiA6028033 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 27 Jan 2021 11:01:56 +0800 Received: from localhost.localdomain (172.21.132.186) by RTEXMBS03.realtek.com.tw (172.21.6.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 27 Jan 2021 11:01:56 +0800 From: To: , , , , CC: , , , , , Subject: [PATCH v6] Bluetooth: btrtl: Enable WBS for the specific Realtek devices Date: Wed, 27 Jan 2021 11:01:52 +0800 Message-ID: <20210127030152.3940-1-max.chou@realtek.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.132.186] X-ClientProxiedBy: RTEXMBS01.realtek.com.tw (172.21.6.94) To RTEXMBS03.realtek.com.tw (172.21.6.96) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Max Chou By this change, it will enable WBS supported on the specific Realtek BT devices, such as RTL8822C and RTL8852A. In the future, it's able to maintain what the Realtek devices support WBS here. Tested-by: Hilda Wu Reviewed-by: Abhishek Pandit-Subedi Signed-off-by: Max Chou --- change in v6 -remove lable 'done' in btrtl_setup_realtek() --- drivers/bluetooth/btrtl.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 24f03a1f8d57..e7fe5fb22753 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -38,6 +38,19 @@ .hci_ver = (hciv), \ .hci_bus = (bus) +enum btrtl_chip_id { + CHIP_ID_8723A, + CHIP_ID_8723B, + CHIP_ID_8821A, + CHIP_ID_8761A, + CHIP_ID_8822B = 8, + CHIP_ID_8723D, + CHIP_ID_8821C, + CHIP_ID_8822C = 13, + CHIP_ID_8761B, + CHIP_ID_8852A = 18, +}; + struct id_table { __u16 match_flags; __u16 lmp_subver; @@ -58,6 +71,7 @@ struct btrtl_device_info { u8 *cfg_data; int cfg_len; bool drop_fw; + int project_id; }; static const struct id_table ic_id_table[] = { @@ -307,8 +321,10 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev, /* Find project_id in table */ for (i = 0; i < ARRAY_SIZE(project_id_to_lmp_subver); i++) { - if (project_id == project_id_to_lmp_subver[i].id) + if (project_id == project_id_to_lmp_subver[i].id) { + btrtl_dev->project_id = project_id; break; + } } if (i >= ARRAY_SIZE(project_id_to_lmp_subver)) { @@ -719,22 +735,22 @@ int btrtl_setup_realtek(struct hci_dev *hdev) */ set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); - if (!btrtl_dev->ic_info) - goto done; - /* Enable central-peripheral role (able to create new connections with * an existing connection in slave role). */ - switch (btrtl_dev->ic_info->lmp_subver) { - case RTL_ROM_LMP_8822B: + /* Enable WBS supported for the specific Realtek devices. */ + switch (btrtl_dev->project_id) { + case CHIP_ID_8822C: + case CHIP_ID_8852A: set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); break; default: rtl_dev_dbg(hdev, "Central-peripheral role not enabled."); + rtl_dev_dbg(hdev, "WBS supported not enabled."); break; } -done: btrtl_free(btrtl_dev); return ret; } -- 2.17.1