Skip to contentSkip to conversation

Bluetooth: btmtkuart: rely on BT_MTK module

PATCH In review [email protected] 3 participants 5 messages Mar 9, 2022 – Mar 10, 2022

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/3 Bluetooth: btmtkuart: rely on BT_MTK module

From: Sean Wang <[email protected]>

Rely on btmtk module to reduce duplicated code

---
 drivers/bluetooth/Kconfig     |   1 +
 drivers/bluetooth/btmtk.c     |   1 +
 drivers/bluetooth/btmtk.h     |   1 +
 drivers/bluetooth/btmtkuart.c | 184 +++++-----------------------------
 4 files changed, 29 insertions(+), 158 deletions(-)
drivers/bluetooth/Kconfig +1 -0
index 36380e618ba4..e30707405455 100644
@@ -400,6 +400,7 @@ config BT_MTKSDIO
 config BT_MTKUART
 	tristate "MediaTek HCI UART driver"
 	depends on SERIAL_DEV_BUS
+	select BT_MTK
 	help
 	  MediaTek Bluetooth HCI UART driver.
 	  This driver is required if you want to use MediaTek Bluetooth
drivers/bluetooth/btmtk.c +1 -0
index 526dfdf1fe01..809762d64fc6 100644
@@ -285,6 +285,7 @@ MODULE_AUTHOR("Mark Chen <[email protected]>");
 MODULE_DESCRIPTION("Bluetooth support for MediaTek devices ver " VERSION);
 MODULE_VERSION(VERSION);
 MODULE_LICENSE("GPL");
+MODULE_FIRMWARE(FIRMWARE_MT7622);
 MODULE_FIRMWARE(FIRMWARE_MT7663);
 MODULE_FIRMWARE(FIRMWARE_MT7668);
 MODULE_FIRMWARE(FIRMWARE_MT7961);
drivers/bluetooth/btmtk.h +1 -0
index 013850fd2055..2a88ea8e475e 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: ISC */
 /* Copyright (C) 2021 MediaTek Inc. */
 
+#define FIRMWARE_MT7622		"mediatek/mt7622pr2h.bin"
 #define FIRMWARE_MT7663		"mediatek/mt7663pr2h.bin"
 #define FIRMWARE_MT7668		"mediatek/mt7668pr2h.bin"
 #define FIRMWARE_MT7961		"mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin"
drivers/bluetooth/btmtkuart.c +26 -158

312 lines not on this page · raw message

Signature · 7 lines
2.25.1


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
author maintainer
#1 lore raw

PATCH 2/3 Bluetooth: btmtkuart: add .set_bdaddr support

From: Sean Wang <[email protected]>

add .set_bdaddr support

---
 drivers/bluetooth/btmtkuart.c | 1 +
 1 file changed, 1 insertion(+)
drivers/bluetooth/btmtkuart.c +1 -0
index 136b901eb6f2..7d405a16f864 100644
@@ -878,6 +878,7 @@ static int btmtkuart_probe(struct serdev_device *serdev)
 	hdev->setup    = btmtkuart_setup;
 	hdev->shutdown = btmtkuart_shutdown;
 	hdev->send     = btmtkuart_send_frame;
+	hdev->set_bdaddr = btmtk_set_bdaddr;
 	SET_HCIDEV_DEV(hdev, &serdev->dev);
 
 	hdev->manufacturer = 70;
Signature · 7 lines
2.25.1


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
author maintainer
#2 lore raw

PATCH 3/3 Bluetooth: btmtkuart: fix the conflict between mtk and msft vendor event

In reply to [email protected]

From: Sean Wang <[email protected]>

There is a conflict between MediaTek wmt event and msft vendor extension logic in the core layer since 145373cb1b1f ("Bluetooth: Add framework for Microsoft vendor extension") was introduced because we changed the type of mediatek wmt event to the type of msft vendor event in the driver.

But the purpose we reported mediatek event to the core layer is for the diagnostic purpose with that we are able to see the full packet trace via monitoring socket with btmon. Thus, it is harmless we keep the original type of mediatek vendor event here to avoid breaking the msft extension function especially they can be supported by Mediatek future devices.

---
 drivers/bluetooth/btmtkuart.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/bluetooth/btmtkuart.c +1 -8
index 7d405a16f864..695e1225b08c 100644
@@ -192,13 +192,6 @@ static int btmtkuart_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
 	struct hci_event_hdr *hdr = (void *)skb->data;
 	int err;
 
-	/* Fix up the vendor event id with 0xff for vendor specific instead
-	 * of 0xe4 so that event send via monitoring socket can be parsed
-	 * properly.
-	 */
-	if (hdr->evt == 0xe4)
-		hdr->evt = HCI_EV_VENDOR;
-
 	/* When someone waits for the WMT event, the skb is being cloned
 	 * and being processed the events from there then.
 	 */
@@ -214,7 +207,7 @@ static int btmtkuart_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
 	if (err < 0)
 		goto err_free_skb;
 
-	if (hdr->evt == HCI_EV_VENDOR) {
+	if (hdr->evt == HCI_EV_WMT) {
 		if (test_and_clear_bit(BTMTKUART_TX_WAIT_VND_EVT,
 				       &bdev->tx_state)) {
 			/* Barrier to sync with other CPUs */
Signature · 7 lines
2.25.1


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#3 lore raw
In reply to [email protected]

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=621709

---Test result---

Test Summary:

CheckPatch                    PASS      5.30 seconds
GitLint                       PASS      3.01 seconds
SubjectPrefix                 PASS      2.69 seconds
BuildKernel                   PASS      30.30 seconds
BuildKernel32                 PASS      26.74 seconds
Incremental Build with patchesPASS      47.71 seconds
TestRunner: Setup             PASS      462.52 seconds
TestRunner: l2cap-tester      PASS      15.38 seconds
TestRunner: bnep-tester       PASS      6.03 seconds
TestRunner: mgmt-tester       PASS      98.68 seconds
TestRunner: rfcomm-tester     PASS      7.74 seconds
TestRunner: sco-tester        PASS      7.46 seconds
TestRunner: smp-tester        PASS      7.50 seconds
TestRunner: userchan-tester   PASS      6.29 seconds

---
Regards,
Linux Bluetooth

maintainer
#4 lore raw
In reply to [email protected]

Hi Sean,

Quoted 9 lines

Rely on btmtk module to reduce duplicated code

---

drivers/bluetooth/Kconfig     |   1 +
drivers/bluetooth/btmtk.c     |   1 +
drivers/bluetooth/btmtk.h     |   1 +
drivers/bluetooth/btmtkuart.c | 184 +++++-----------------------------
4 files changed, 29 insertions(+), 158 deletions(-)

all 3 patches have been applied to bluetooth-next tree.

Regards

Marcel