Page MenuHomeFreeBSD

Initial cut at Intel AX210 bluetooth support
Needs ReviewPublic

Authored by shurd on Apr 19 2024, 3:46 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 9, 7:23 PM
Unknown Object (File)
Sat, Nov 9, 7:23 PM
Unknown Object (File)
Sat, Nov 9, 7:23 PM
Unknown Object (File)
Sat, Nov 9, 7:23 PM
Unknown Object (File)
Sat, Nov 9, 7:23 PM
Unknown Object (File)
Tue, Nov 5, 11:35 AM
Unknown Object (File)
Sun, Nov 3, 12:48 AM
Unknown Object (File)
Thu, Oct 31, 8:22 PM

Details

Reviewers
adrian
markj
wulf
Summary

This allows loading the firmware and attaching the driver. I haven't yet managed to pair with aything.

Test Plan

Will test with BT stuff I have laying around.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 57249
Build 54137: arc lint + arc unit

Event Timeline

shurd requested review of this revision.Apr 19 2024, 3:46 AM
shurd retitled this revision from Initial work... doesn't. to Initial cut at Intel AX210 bluetooth support.Apr 19 2024, 3:48 AM
shurd edited the summary of this revision. (Show Details)
shurd edited the test plan for this revision. (Show Details)

Tested with Google Pixel Buds A... with virtual_oss, pairs and right channel works.

  • Retry reset command up to twice.
  • Add macros for TLV types

Going on vacation for a couple weeks, and will look at this again when I get back... adding adrian@ as a reviewer, feel free to add more appropriate reviewers as actionable feedback will be welcome when I return.

I wonder if that'll support a lot more than just AX210?

With minor modifications and updated comms/iwmbtfw it works with AX211.

diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c
index 058b9137dd8e..ecaa06c2d21e 100644
--- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c
+++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c
@@ -99,8 +99,9 @@ static const STRUCT_USB_HOST_ID ubt_intel_devs[] =
 	{ USB_VPI(USB_VENDOR_INTEL2, 0x0025, UBT_INTEL_DEVICE_8260) },
 	{ USB_VPI(USB_VENDOR_INTEL2, 0x0026, UBT_INTEL_DEVICE_8260) },
 	{ USB_VPI(USB_VENDOR_INTEL2, 0x0029, UBT_INTEL_DEVICE_8260) },
-	/* Intel AX210 */
+	/* Intel AX210, AX211 */
 	{ USB_VPI(USB_VENDOR_INTEL2, 0x0032, UBT_INTEL_DEVICE_TLV) },
+	{ USB_VPI(USB_VENDOR_INTEL2, 0x0033, UBT_INTEL_DEVICE_TLV) },
 };
 
 /*
diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8 b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8
index 700108ac8379..d47f9e91ae0f 100644
--- a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8
+++ b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.8
@@ -28,7 +28,7 @@
 .Os
 .Sh NAME
 .Nm iwmbtfw
-.Nd firmware download utility for Intel Wireless 7260/8260/8265/AX210 chip based Bluetooth
+.Nd firmware download utility for Intel Wireless 7260/8260/8265/AX210/AX211 chip based Bluetooth
 USB devices
 .Sh SYNOPSIS
 .Nm
@@ -45,7 +45,7 @@ device.
 .Pp
 This utility will
 .Em only
-work with Intel Wireless 7260/8260/8265/AX210 chip based Bluetooth USB devices and some of
+work with Intel Wireless 7260/8260/8265/AX210/AX211 chip based Bluetooth USB devices and some of
 their successors.
 The identification is currently based on USB vendor ID/product ID pair.
 The vendor ID should be 0x8087
diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf
index 77ed79e8458e..070aa0b4c20d 100644
--- a/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf
+++ b/usr.sbin/bluetooth/iwmbtfw/iwmbtfw.conf
@@ -6,6 +6,6 @@ notify 100 {
 	match "subsystem"	"DEVICE";
 	match "type"		"ATTACH";
 	match "vendor"		"0x8087";
-	match "product"		"(0x07dc|0x0a2a|0x0aa7|0x0a2b|0x0aaa|0x0025|0x0026|0x0029|0x0032)";
+	match "product"		"(0x07dc|0x0a2a|0x0aa7|0x0a2b|0x0aaa|0x0025|0x0026|0x0029|0x0032|0x0033)";
 	action "/usr/sbin/iwmbtfw -d $cdev -f /usr/local/share/iwmbt-firmware";
 };
diff --git a/usr.sbin/bluetooth/iwmbtfw/main.c b/usr.sbin/bluetooth/iwmbtfw/main.c
index 662967f090c1..caf6924228e9 100644
--- a/usr.sbin/bluetooth/iwmbtfw/main.c
+++ b/usr.sbin/bluetooth/iwmbtfw/main.c
@@ -77,6 +77,7 @@ static struct iwmbt_devid iwmbt_list_82xx[] = {
 static struct iwmbt_devid iwmbt_list_tlv[] = {
 
 	{ .vendor_id = 0x8087, .product_id = 0x0032 },
+	{ .vendor_id = 0x8087, .product_id = 0x0033 },
 
 };
 
@@ -718,6 +719,8 @@ main(int argc, char *argv[])
 		switch (ver.hw_variant) {
 			case 0x17:
 				break;
+			case 0x18:
+				break;
 			default:
 				iwmbt_err("unknown hw_variant 0x%02x", (int) ver.hw_variant);
 				goto shutdown;

I tested this change in 14.1-STABLE and a pair of Fairbuds XL. After ensuring the firmware was loaded, I ran the following commands:

  1. service bluetooth start ubt0
  2. hccontrol -n ubt0hci inquiry
  3. hccontrol -n ubt0hci create_connection headphones
  4. <added entries to /etc/bluetooth/hcsecd.conf and /etc/bluetooth/hosts>`
  5. virtual_oss -T /dev/sndstat -S -a o,-4 -C 2 -c 2 -r 44100 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/headphones -d dspbt -t vdsp.ctl

I tried this both with and without running hccontrol -n ubt0hci write_authentication_enable 1, and settings the -P device name to /dev/bluetooth/headphones and /dev/bluetooth/<BT_ADDR>

With the Fairbuds, I received backend_bt: PSM=0x19 and backend_bt: Could not connect to HC: 60 after running the virtual_oss command.

I'll add markj to reviews as he was the one to add the last additions if I remember correctly and actually knows the code.
Also wulf has been active in that area in the past if I don't misremember.

Might help you to actually get a good review.

Here is a patch for AX210/AX211 bluetooth adapters we use @work for quite some time: https://people.freebsd.org/~wulf/iwmbtfw.diff

Here is a patch for AX210/AX211 bluetooth adapters we use @work for quite some time: https://people.freebsd.org/~wulf/iwmbtfw.diff

Can this be placed as a separate review?

Can this be placed as a separate review?

Yes it can. Along with realtek BT firmware loader. But I don't know who is willing to review that. Volunteers are welcome.

Can this be placed as a separate review?

Yes it can. Along with realtek BT firmware loader. But I don't know who is willing to review that. Volunteers are welcome.

If you open dedicated reviews for these leave the numbers here; I might even have a look. Out of curiosity -- which realtek?

tl88

In D44861#1052291, @bz wrote:

Can this be placed as a separate review?

Yes it can. Along with realtek BT firmware loader. But I don't know who is willing to review that. Volunteers are welcome.

If you open dedicated reviews for these leave the numbers here; I might even have a look. Out of curiosity -- which realtek?

RTL88 or something around that called v1 in Linux sources. I did not started RTL89(v2) porting.

In D44861#1052291, @bz wrote:

If you open dedicated reviews for these leave the numbers here; I might even have a look.

Done: D46734 D46735 D46736 D46737 D46738 D46739 D46740