* [PATCH v2] Bluetooth: btrtl: Enable WBS for the specific Realtek devices
@ 2021-01-19 6:07 max.chou
2021-01-21 18:07 ` Abhishek Pandit-Subedi
0 siblings, 1 reply; 2+ messages in thread
From: max.chou @ 2021-01-19 6:07 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel
Cc: alex_lu, hildawu, kidman, max.chou, abhishekpandit, josephsih
From: Max Chou <max.chou@realtek.com>
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 <hildawu@realtek.com>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Max Chou <max.chou@realtek.com>
---
v2:
- edit the null check
---
drivers/bluetooth/btrtl.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 24f03a1f8d57..363e23b15faf 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, /* index 0 for RTL8723A*/
+ CHIP_ID_8723B, /* index 1 for RTL8723B*/
+ CHIP_ID_8821A, /* index 2 for RTL8821A*/
+ CHIP_ID_8761A, /* index 3 for RTL8761A*/
+ CHIP_ID_8822B = 8, /* index 8 for RTL8822B */
+ CHIP_ID_8723D, /* index 9 for RTL8723D */
+ CHIP_ID_8821C, /* index 10 for RTL8821C */
+ CHIP_ID_8822C = 13, /* index 13 for RTL8822C */
+ CHIP_ID_8761B, /* index 14 for RTL8761B */
+ CHIP_ID_8852A = 18, /* index 18 for RTL8852A */
+};
+
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,18 +735,22 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
*/
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
- if (!btrtl_dev->ic_info)
+ if (!btrtl_dev->project_id)
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;
}
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Bluetooth: btrtl: Enable WBS for the specific Realtek devices
2021-01-19 6:07 [PATCH v2] Bluetooth: btrtl: Enable WBS for the specific Realtek devices max.chou
@ 2021-01-21 18:07 ` Abhishek Pandit-Subedi
0 siblings, 0 replies; 2+ messages in thread
From: Abhishek Pandit-Subedi @ 2021-01-21 18:07 UTC (permalink / raw)
To: max.chou
Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
Bluez mailing list, LKML, Alex Lu, hildawu, kidman,
Shyh-In Hwang
Hi Max,
On Mon, Jan 18, 2021 at 10:07 PM <max.chou@realtek.com> wrote:
>
> From: Max Chou <max.chou@realtek.com>
>
> 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 <hildawu@realtek.com>
> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> Signed-off-by: Max Chou <max.chou@realtek.com>
>
> ---
> v2:
> - edit the null check
> ---
> drivers/bluetooth/btrtl.c | 28 ++++++++++++++++++++++++----
> 1 file changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index 24f03a1f8d57..363e23b15faf 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, /* index 0 for RTL8723A*/
> + CHIP_ID_8723B, /* index 1 for RTL8723B*/
> + CHIP_ID_8821A, /* index 2 for RTL8821A*/
> + CHIP_ID_8761A, /* index 3 for RTL8761A*/
> + CHIP_ID_8822B = 8, /* index 8 for RTL8822B */
> + CHIP_ID_8723D, /* index 9 for RTL8723D */
> + CHIP_ID_8821C, /* index 10 for RTL8821C */
> + CHIP_ID_8822C = 13, /* index 13 for RTL8822C */
> + CHIP_ID_8761B, /* index 14 for RTL8761B */
> + CHIP_ID_8852A = 18, /* index 18 for RTL8852A */
> +};
> +
> 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,18 +735,22 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
> */
> set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
>
> - if (!btrtl_dev->ic_info)
> + if (!btrtl_dev->project_id)
> goto done;
Since btrtl_dev->project_id is not a pointer, this check should not be
necessary. The switch below has a default case that prints when
project_id = 0.
>
> /* 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;
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-21 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 6:07 [PATCH v2] Bluetooth: btrtl: Enable WBS for the specific Realtek devices max.chou
2021-01-21 18:07 ` Abhishek Pandit-Subedi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®