* [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips
@ 2022-10-05 8:43 hildawu
2022-10-05 8:43 ` [PATCH v4 1/2] Bluetooth: btrtl: Add btrealtek data struct hildawu
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: hildawu @ 2022-10-05 8:43 UTC (permalink / raw)
To: marcel
Cc: johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
apusaka, yinghsu, max.chou, alex_lu, kidman
From: Hilda Wu <hildawu@realtek.com>
Add btrealtek data struct and use definition of vendor flags to manage
the specific chip.
The Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for
specific chip need to transmit mSBC data continuously without the
zero length of USB packets.
---
Changes in v4:
- Since the original 0002 patch has no dependency with this 0001 patch.
So let the 0002 patch submit independent.
Changes in v3:
- Use the vendor function to replace btus_recv_isoc.
- For ignore_usb_alt6_packet_flow, manage the common flag by the vendor private flag.
Changes in v2:
- Set the proper priv_size to hci_alloc_dev_priv().
- Separate commits for functions.
---
Thank you for your review and suggestions.
Hilda Wu (2):
Bluetooth: btrtl: Add btrealtek data struct
Bluetooth: btsub: Ignore zero length of USB packets on ALT 6 for
specific chip
drivers/bluetooth/btrtl.c | 7 +++++++
drivers/bluetooth/btrtl.h | 21 +++++++++++++++++++++
drivers/bluetooth/btusb.c | 28 ++++++++++++++++++++++++++--
3 files changed, 54 insertions(+), 2 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 1/2] Bluetooth: btrtl: Add btrealtek data struct
2022-10-05 8:43 [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips hildawu
@ 2022-10-05 8:43 ` hildawu
2022-10-05 9:19 ` Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips bluez.test.bot
2022-10-05 8:43 ` [PATCH v4 2/2] Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for specific chip hildawu
2022-10-11 20:50 ` [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips patchwork-bot+bluetooth
2 siblings, 1 reply; 5+ messages in thread
From: hildawu @ 2022-10-05 8:43 UTC (permalink / raw)
To: marcel
Cc: johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
apusaka, yinghsu, max.chou, alex_lu, kidman
From: Hilda Wu <hildawu@realtek.com>
This patch adds a data structure for btrealtek object, and the
definition of vendor behavior flags. It also adds macros to set/test/get
the flags.
Signed-off-by: Hilda Wu <hildawu@realtek.com>
---
Changes in v4:
- Since the original 0002 patch has no dependency with this 0001 patch.
So let the 0002 patch submit another.
Changes in v3:
- Update private flag.
Changes in v2:
- Set the proper priv_size to hci_alloc_dev_priv().
- Separate commits for functions.
---
---
drivers/bluetooth/btrtl.h | 21 +++++++++++++++++++++
drivers/bluetooth/btusb.c | 3 +++
2 files changed, 24 insertions(+)
diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h
index 2c441bda390a..ebf0101c959b 100644
--- a/drivers/bluetooth/btrtl.h
+++ b/drivers/bluetooth/btrtl.h
@@ -47,6 +47,27 @@ struct rtl_vendor_config {
struct rtl_vendor_config_entry entry[];
} __packed;
+enum {
+ REALTEK_ALT6_CONTINUOUS_TX_CHIP,
+
+ __REALTEK_NUM_FLAGS,
+};
+
+struct btrealtek_data {
+ DECLARE_BITMAP(flags, __REALTEK_NUM_FLAGS);
+};
+
+#define btrealtek_set_flag(hdev, nr) \
+ do { \
+ struct btrealtek_data *realtek = hci_get_priv((hdev)); \
+ set_bit((nr), realtek->flags); \
+ } while (0)
+
+#define btrealtek_get_flag(hdev) \
+ (((struct btrealtek_data *)hci_get_priv(hdev))->flags)
+
+#define btrealtek_test_flag(hdev, nr) test_bit((nr), btrealtek_get_flag(hdev))
+
#if IS_ENABLED(CONFIG_BT_RTL)
struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 271963805a38..4243936c0583 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3755,6 +3755,9 @@ static int btusb_probe(struct usb_interface *intf,
/* Override the rx handlers */
data->recv_event = btusb_recv_event_intel;
data->recv_bulk = btusb_recv_bulk_intel;
+ } else if (id->driver_info & BTUSB_REALTEK) {
+ /* Allocate extra space for Realtek device */
+ priv_size += sizeof(struct btrealtek_data);
}
data->recv_acl = hci_recv_frame;
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v4 2/2] Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for specific chip
2022-10-05 8:43 [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips hildawu
2022-10-05 8:43 ` [PATCH v4 1/2] Bluetooth: btrtl: Add btrealtek data struct hildawu
@ 2022-10-05 8:43 ` hildawu
2022-10-11 20:50 ` [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips patchwork-bot+bluetooth
2 siblings, 0 replies; 5+ messages in thread
From: hildawu @ 2022-10-05 8:43 UTC (permalink / raw)
To: marcel
Cc: johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
apusaka, yinghsu, max.chou, alex_lu, kidman
From: Hilda Wu <hildawu@realtek.com>
For USB ALT 6 settings some Realtek chips need to transmit mSBC data
continuously without the zero length of USB packets.
In this commit, create BTUSB_ALT6_CONTINUOUS_TX to manage the behavior.
Therefore, create REALTEK_ALT6_CONTINUOUS_TX_CHIP to manage the specific
chip model for the behavior.
Signed-off-by: Max Chou <max.chou@realtek.com>
Signed-off-by: Hilda Wu <hildawu@realtek.com>
---
Changes in v4:
- Since the original 0002 patch has no dependency with the 0001 patch.
So let the 0002 patch submit another.
Changes in V3
- For ignore_usb_alt6_packet_flow, manage the common flag by the vendor
private flag.
---
---
drivers/bluetooth/btrtl.c | 7 +++++++
drivers/bluetooth/btusb.c | 25 +++++++++++++++++++++++--
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index fb52313a1d45..69c3fe649ca7 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -781,6 +781,13 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
case CHIP_ID_8852C:
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
+
+ /* RTL8852C needs to transmit mSBC data continuously without
+ * the zero length of USB packets for the ALT 6 supported chips
+ */
+ if (btrtl_dev->project_id == CHIP_ID_8852C)
+ btrealtek_set_flag(hdev, REALTEK_ALT6_CONTINUOUS_TX_CHIP);
+
hci_set_aosp_capable(hdev);
break;
default:
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4243936c0583..4d787a455c00 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -632,6 +632,7 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
#define BTUSB_TX_WAIT_VND_EVT 13
#define BTUSB_WAKEUP_AUTOSUSPEND 14
#define BTUSB_USE_ALT3_FOR_WBS 15
+#define BTUSB_ALT6_CONTINUOUS_TX 16
struct btusb_data {
struct hci_dev *hdev;
@@ -1276,11 +1277,17 @@ static void btusb_isoc_complete(struct urb *urb)
static inline void __fill_isoc_descriptor_msbc(struct urb *urb, int len,
int mtu, struct btusb_data *data)
{
- int i, offset = 0;
+ int i = 0, offset = 0;
unsigned int interval;
BT_DBG("len %d mtu %d", len, mtu);
+ /* For mSBC ALT 6 settings some chips need to transmit the data
+ * continuously without the zero length of USB packets.
+ */
+ if (test_bit(BTUSB_ALT6_CONTINUOUS_TX, &data->flags))
+ goto ignore_usb_alt6_packet_flow;
+
/* For mSBC ALT 6 setting the host will send the packet at continuous
* flow. As per core spec 5, vol 4, part B, table 2.1. For ALT setting
* 6 the HCI PACKET INTERVAL should be 7.5ms for every usb packets.
@@ -1300,6 +1307,7 @@ static inline void __fill_isoc_descriptor_msbc(struct urb *urb, int len,
urb->iso_frame_desc[i].length = offset;
}
+ignore_usb_alt6_packet_flow:
if (len && i < BTUSB_MAX_ISOC_FRAMES) {
urb->iso_frame_desc[i].offset = offset;
urb->iso_frame_desc[i].length = len;
@@ -2315,6 +2323,19 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
return -EILSEQ;
}
+static int btusb_setup_realtek(struct hci_dev *hdev)
+{
+ struct btusb_data *data = hci_get_drvdata(hdev);
+ int ret;
+
+ ret = btrtl_setup_realtek(hdev);
+
+ if (btrealtek_test_flag(data->hdev, REALTEK_ALT6_CONTINUOUS_TX_CHIP))
+ set_bit(BTUSB_ALT6_CONTINUOUS_TX, &data->flags);
+
+ return ret;
+}
+
/* UHW CR mapping */
#define MTK_BT_MISC 0x70002510
#define MTK_BT_SUBSYS_RST 0x70002610
@@ -3916,7 +3937,7 @@ static int btusb_probe(struct usb_interface *intf,
if (IS_ENABLED(CONFIG_BT_HCIBTUSB_RTL) &&
(id->driver_info & BTUSB_REALTEK)) {
- hdev->setup = btrtl_setup_realtek;
+ hdev->setup = btusb_setup_realtek;
hdev->shutdown = btrtl_shutdown_realtek;
hdev->cmd_timeout = btusb_rtl_cmd_timeout;
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips
2022-10-05 8:43 ` [PATCH v4 1/2] Bluetooth: btrtl: Add btrealtek data struct hildawu
@ 2022-10-05 9:19 ` bluez.test.bot
0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-10-05 9:19 UTC (permalink / raw)
To: linux-bluetooth, hildawu
[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=683169
---Test result---
Test Summary:
CheckPatch PASS 3.08 seconds
GitLint FAIL 1.68 seconds
SubjectPrefix PASS 1.21 seconds
BuildKernel PASS 39.08 seconds
BuildKernel32 PASS 35.06 seconds
Incremental Build with patchesPASS 58.68 seconds
TestRunner: Setup PASS 581.82 seconds
TestRunner: l2cap-tester PASS 19.08 seconds
TestRunner: iso-tester PASS 19.65 seconds
TestRunner: bnep-tester PASS 7.43 seconds
TestRunner: mgmt-tester PASS 118.61 seconds
TestRunner: rfcomm-tester PASS 11.81 seconds
TestRunner: sco-tester PASS 10.97 seconds
TestRunner: ioctl-tester PASS 12.64 seconds
TestRunner: smp-tester PASS 10.99 seconds
TestRunner: userchan-tester PASS 7.79 seconds
Details
##############################
Test: GitLint - FAIL - 1.68 seconds
Run gitlint with rule in .gitlint
[v4,2/2] Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for specific chip
1: T1 Title exceeds max length (87>80): "[v4,2/2] Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for specific chip"
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips
2022-10-05 8:43 [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips hildawu
2022-10-05 8:43 ` [PATCH v4 1/2] Bluetooth: btrtl: Add btrealtek data struct hildawu
2022-10-05 8:43 ` [PATCH v4 2/2] Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for specific chip hildawu
@ 2022-10-11 20:50 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2022-10-11 20:50 UTC (permalink / raw)
To: Hilda Wu
Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
apusaka, yinghsu, max.chou, alex_lu, kidman
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 5 Oct 2022 16:43:29 +0800 you wrote:
> From: Hilda Wu <hildawu@realtek.com>
>
> Add btrealtek data struct and use definition of vendor flags to manage
> the specific chip.
>
> The Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for
> specific chip need to transmit mSBC data continuously without the
> zero length of USB packets.
>
> [...]
Here is the summary with links:
- [v4,1/2] Bluetooth: btrtl: Add btrealtek data struct
https://git.kernel.org/bluetooth/bluetooth-next/c/a0acc8e27228
- [v4,2/2] Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for specific chip
https://git.kernel.org/bluetooth/bluetooth-next/c/d6a615c8b539
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-11 20:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-05 8:43 [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips hildawu
2022-10-05 8:43 ` [PATCH v4 1/2] Bluetooth: btrtl: Add btrealtek data struct hildawu
2022-10-05 9:19 ` Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips bluez.test.bot
2022-10-05 8:43 ` [PATCH v4 2/2] Bluetooth: btusb: Ignore zero length of USB packets on ALT 6 for specific chip hildawu
2022-10-11 20:50 ` [PATCH v4 0/2] Bluetooth: Add btrealtek data struct and improve SCO sound quality of RTK chips patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).