Skip to content

Audio fix#28

Open
deqrocks wants to merge 4 commits intot2linux:aurfrom
deqrocks:audio-fix-pr
Open

Audio fix#28
deqrocks wants to merge 4 commits intot2linux:aurfrom
deqrocks:audio-fix-pr

Conversation

@deqrocks
Copy link

@deqrocks deqrocks commented Mar 4, 2026

Issues adressed in this PR:

  • aaudio_handle_reply: No queued item found for tag: Sxxx
  • aaudio_pcm_pointer while not started
  • repeated timeout path around __aaudio_send_cmd_sync / aaudio_cmd_stop_io / aaudio_handle_timestamp
  • aaudio aaudio: invalid position: ..., pos = ..., buffer size = 16640, period size = 1

Issues were causing choppy playback, spamming logs and causing instability in pm sequence.
There seems to be an audio routing issue in Gnome not caused by the patch. I'm not sure if this needs to be adressed in the driver because it works in KDE without issues. The issue is only of minor nature. Audio output has to be changed manually in settings.

The patch was carefully tested with internal speakers, headphones,bluetooth, Massive Attack, Tool, Moderat and Lulu Rouge.

@clanoftheducks
Copy link

Thanks for the work. Unfortunately it doesn't seem to fix periodic stuttering (A2DP sink AAC or SBC over Bluetooth) on my MacBookPro15,1

@deqrocks
Copy link
Author

deqrocks commented Mar 5, 2026

Thanks for the work. Unfortunately it doesn't seem to fix periodic stuttering (A2DP sink AAC or SBC over Bluetooth) on my MacBookPro15,1

Thanks for testing. I assume it's either a BT driver or hardware related issue since the patch is doing good things on my MBA with bcm4377.
Can you confirm that the code changes do no harm compared to the main branch? Also did your console stay clean?

@4f1sh3r
Copy link

4f1sh3r commented Mar 5, 2026

I had less time to test this thoroughly than I had hoped, but based on what I've seen so far, it works very well for me.

I've never had any real audio stuttering issues (except for the first 10–15 seconds after an S3 resume) , but I've had a large number of kernel warnings and tracebacks regarding aaudio every day.

I have now tested the patch for about 24 hours. During this time I went through 3-4 S3 suspend/resume cycles and tested both the internal speakers and headphones. My dmesg output is now clean, there are no kernel warnings and no “invalid position” warnings any longer.

For me everything works perfectly fine. The patch appears to fix the problems I had before and does not introduce any new issues.

My system details:

OS: Fedora Linux 43 (Workstation Edition) x86_64
Host: MBP 16,2 (A2251)
BIOS: 2092.0.0.0.0 (iBridge: 23.16.10350.0.0,0) 08/05/2025
macOS: 15.7.x
Kernel: Linux 6.18.12-210.t2.fc43.x86_64
apple-bce: stock t2linux with PR23 (klizas) and PR28 (this one) merged in

@deqrocks
Copy link
Author

deqrocks commented Mar 5, 2026

about

Thank you very much for trying. That's the result i was hoping for actually. Could you please do us the favor and look up which BT controller you have by using lspci?

@4f1sh3r
Copy link

4f1sh3r commented Mar 6, 2026

Thank you very much for trying. That's the result i was hoping for actually. Could you please do us the favor and look up which BT controller you have by using lspci?

Sure, its the BCM4364

@clanoftheducks
Copy link

I also have a BCM4364 on a MacBookPro15,1 and I notice stuttering while the device is doing discovery due to a large decrease in throughput. (hence why only A2DP audio stutters while HFP/HSP can still make it through)

@4f1sh3r,

  • can you give the output of sudo journalctl -b --grep="bcm|brcm|broadcom"?
  • while playing back audio over Bluetooth headphones/speakers via an A2DP profile, can you make a ~90s Bluetooth capture with sudo btmon -w capture.btsnoop?

@4f1sh3r
Copy link

4f1sh3r commented Mar 6, 2026

can you give the output of sudo journalctl -b --grep="bcm|brcm|broadcom"?

alex@afis-fedora-mac:~$ journalctl -b --no-hostname --grep="bcm|brcm|broadcom"
Mär 04 22:48:59 kernel: Bluetooth: HCI UART protocol Broadcom registered
Mär 04 22:48:59 kernel: hci_uart_bcm serial0-0: Unexpected ACPI gpio_int_idx: -1
Mär 04 22:48:59 kernel: hci_uart_bcm serial0-0: Unexpected number of ACPI GPIOs: 0
Mär 04 22:48:59 kernel: hci_uart_bcm serial0-0: No reset resource, using default baud rate
Mär 04 22:49:00 kernel: usbcore: registered new interface driver brcmfmac
Mär 04 22:49:00 kernel: brcmfmac 0000:e5:00.0: enabling device (0000 -> 0002)
Mär 04 22:49:00 kernel: Bluetooth: hci0: BCM: failed to write update baudrate (-16)
Mär 04 22:49:00 kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364b3-pcie for chip BCM4364/4
Mär 04 22:49:00 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7-X3.bin failed with error -2
Mär 04 22:49:00 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7.bin failed with error -2
Mär 04 22:49:00 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u.bin failed with error -2
Mär 04 22:49:00 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN.bin failed with error -2
Mär 04 22:49:00 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-X3.bin failed with error -2
Mär 04 22:49:00 kernel: Bluetooth: hci0: BCM: chip id 150
Mär 04 22:49:00 kernel: Bluetooth: hci0: BCM: features 0x07
Mär 04 22:49:00 kernel: Bluetooth: hci0: BCM4364B3 Trinidad Olympic GEN (MFG)
Mär 04 22:49:00 kernel: Bluetooth: hci0: BCM (001.016.091) build 0115
Mär 04 22:49:00 kernel: Bluetooth: hci0: BCM: firmware Patch file not found, tried:
Mär 04 22:49:00 kernel: Bluetooth: hci0: BCM: 'brcm/BCM.hcd'
Mär 04 22:49:01 kernel: brcmfmac: brcmf_c_process_txcap_blob: TxCap blob found, loading
Mär 04 22:49:01 kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/4 wl0: Jul 26 2024 22:36:01 version 9.30.514.0.32.5.94 FWID 01-68d7ff80
Mär 04 22:49:01 kernel: brcmfmac 0000:e5:00.0 wlp229s0: renamed from wlan0
Mär 04 22:49:01 NetworkManager[1099]: <info>  [1772660941.9312] rfkill1: found Wi-Fi radio killswitch (at /sys/devices/pci0000:00/0000:00:1c.0/0000:e5:00.0/ieee80211/phy0/rfkill1) (driver brcmfmac)
Mär 04 22:49:02 kernel: ieee80211 phy0: brcmf_p2p_set_firmware: failed to update device address ret -52
Mär 04 22:49:02 kernel: ieee80211 phy0: brcmf_p2p_create_p2pdev: set p2p_disc error
Mär 04 22:49:02 kernel: ieee80211 phy0: brcmf_cfg80211_add_iface: add iface p2p-dev-wlp229s type 10 failed: err=-52
Mär 04 22:49:44 kernel: usbcore: deregistering interface driver brcmfmac
Mär 04 22:49:44 sh[4787]: /bin/sh: line 1: /sys/bus/pci/drivers/brcmfmac/unbind: No such file or directory
Mär 04 22:50:56 kernel: usbcore: registered new interface driver brcmfmac
Mär 04 22:50:56 kernel: brcmfmac 0000:e5:00.0: enabling device (0000 -> 0002)
Mär 04 22:50:56 kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364b3-pcie for chip BCM4364/4
Mär 04 22:50:56 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7-X3.bin failed with error -2
Mär 04 22:50:56 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7.bin failed with error -2
Mär 04 22:50:56 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u.bin failed with error -2
Mär 04 22:50:56 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN.bin failed with error -2
Mär 04 22:50:56 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-X3.bin failed with error -2
Mär 04 22:50:57 kernel: brcmfmac: brcmf_c_process_txcap_blob: TxCap blob found, loading
Mär 04 22:50:57 kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/4 wl0: Jul 26 2024 22:36:01 version 9.30.514.0.32.5.94 FWID 01-68d7ff80
Mär 04 22:50:57 NetworkManager[1099]: <info>  [1772661057.1589] rfkill2: found Wi-Fi radio killswitch (at /sys/devices/pci0000:00/0000:00:1c.0/0000:e5:00.0/ieee80211/phy1/rfkill2) (driver brcmfmac)
Mär 04 22:50:57 kernel: brcmfmac 0000:e5:00.0 wlp229s0: renamed from wlan0
Mär 04 22:50:57 kernel: ieee80211 phy1: brcmf_p2p_set_firmware: failed to update device address ret -52
Mär 04 22:50:57 kernel: ieee80211 phy1: brcmf_p2p_create_p2pdev: set p2p_disc error
Mär 04 22:50:57 kernel: ieee80211 phy1: brcmf_cfg80211_add_iface: add iface p2p-dev-wlp229s type 10 failed: err=-52
Mär 04 22:55:34 kernel: usbcore: deregistering interface driver brcmfmac
Mär 04 22:55:34 sh[8292]: /bin/sh: line 1: /sys/bus/pci/drivers/brcmfmac/unbind: No such file or directory
Mär 05 07:53:40 kernel: usbcore: registered new interface driver brcmfmac
Mär 05 07:53:40 kernel: brcmfmac 0000:e5:00.0: enabling device (0000 -> 0002)
Mär 05 07:53:40 kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364b3-pcie for chip BCM4364/4
Mär 05 07:53:40 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7-X3.bin failed with error -2
Mär 05 07:53:40 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7.bin failed with error -2
Mär 05 07:53:40 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u.bin failed with error -2
Mär 05 07:53:40 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN.bin failed with error -2
Mär 05 07:53:40 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-X3.bin failed with error -2
Mär 05 07:53:40 kernel: brcmfmac: brcmf_c_process_txcap_blob: TxCap blob found, loading
Mär 05 07:53:40 kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/4 wl0: Jul 26 2024 22:36:01 version 9.30.514.0.32.5.94 FWID 01-68d7ff80
Mär 05 07:53:40 NetworkManager[1099]: <info>  [1772693620.8670] rfkill3: found Wi-Fi radio killswitch (at /sys/devices/pci0000:00/0000:00:1c.0/0000:e5:00.0/ieee80211/phy2/rfkill3) (driver brcmfmac)
Mär 05 07:53:40 kernel: brcmfmac 0000:e5:00.0 wlp229s0: renamed from wlan0
Mär 05 07:53:41 kernel: ieee80211 phy2: brcmf_p2p_set_firmware: failed to update device address ret -52
Mär 05 07:53:41 kernel: ieee80211 phy2: brcmf_p2p_create_p2pdev: set p2p_disc error
Mär 05 07:53:41 kernel: ieee80211 phy2: brcmf_cfg80211_add_iface: add iface p2p-dev-wlp229s type 10 failed: err=-52
Mär 05 16:28:13 kernel: usbcore: deregistering interface driver brcmfmac
Mär 05 16:28:13 sh[95667]: /bin/sh: line 1: /sys/bus/pci/drivers/brcmfmac/unbind: No such file or directory
Mär 05 21:48:39 kernel: usbcore: registered new interface driver brcmfmac
Mär 05 21:48:39 kernel: brcmfmac 0000:e5:00.0: enabling device (0000 -> 0002)
Mär 05 21:48:39 kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364b3-pcie for chip BCM4364/4
Mär 05 21:48:39 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7-X3.bin failed with error -2
Mär 05 21:48:39 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7.bin failed with error -2
Mär 05 21:48:39 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u.bin failed with error -2
Mär 05 21:48:39 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN.bin failed with error -2
Mär 05 21:48:39 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-X3.bin failed with error -2
Mär 05 21:48:39 kernel: brcmfmac: brcmf_c_process_txcap_blob: TxCap blob found, loading
Mär 05 21:48:39 kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/4 wl0: Jul 26 2024 22:36:01 version 9.30.514.0.32.5.94 FWID 01-68d7ff80
Mär 05 21:48:39 NetworkManager[1099]: <info>  [1772743719.9505] rfkill4: found Wi-Fi radio killswitch (at /sys/devices/pci0000:00/0000:00:1c.0/0000:e5:00.0/ieee80211/phy3/rfkill4) (driver brcmfmac)
Mär 05 21:48:39 kernel: brcmfmac 0000:e5:00.0 wlp229s0: renamed from wlan0
Mär 05 21:48:40 kernel: ieee80211 phy3: brcmf_p2p_set_firmware: failed to update device address ret -52
Mär 05 21:48:40 kernel: ieee80211 phy3: brcmf_p2p_create_p2pdev: set p2p_disc error
Mär 05 21:48:40 kernel: ieee80211 phy3: brcmf_cfg80211_add_iface: add iface p2p-dev-wlp229s type 10 failed: err=-52
Mär 05 22:10:05 kernel: usbcore: deregistering interface driver brcmfmac
Mär 05 22:10:05 sh[99011]: /bin/sh: line 1: /sys/bus/pci/drivers/brcmfmac/unbind: No such file or directory
Mär 06 08:20:55 kernel: usbcore: registered new interface driver brcmfmac
Mär 06 08:20:55 kernel: brcmfmac 0000:e5:00.0: enabling device (0000 -> 0002)
Mär 06 08:20:55 kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364b3-pcie for chip BCM4364/4
Mär 06 08:20:55 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7-X3.bin failed with error -2
Mär 06 08:20:55 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u-7.7.bin failed with error -2
Mär 06 08:20:55 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN-u.bin failed with error -2
Mär 06 08:20:55 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-HRPN.bin failed with error -2
Mär 06 08:20:55 kernel: brcmfmac 0000:e5:00.0: Direct firmware load for brcm/brcmfmac4364b3-pcie.apple,trinidad-X3.bin failed with error -2
Mär 06 08:20:55 kernel: brcmfmac: brcmf_c_process_txcap_blob: TxCap blob found, loading
Mär 06 08:20:55 kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/4 wl0: Jul 26 2024 22:36:01 version 9.30.514.0.32.5.94 FWID 01-68d7ff80
Mär 06 08:20:55 kernel: brcmfmac 0000:e5:00.0 wlp229s0: renamed from wlan0
Mär 06 08:20:56 NetworkManager[1099]: <info>  [1772781656.2551] rfkill5: found Wi-Fi radio killswitch (at /sys/devices/pci0000:00/0000:00:1c.0/0000:e5:00.0/ieee80211/phy4/rfkill5) (driver brcmfmac)
Mär 06 08:20:56 kernel: ieee80211 phy4: brcmf_p2p_set_firmware: failed to update device address ret -52
Mär 06 08:20:56 kernel: ieee80211 phy4: brcmf_p2p_create_p2pdev: set p2p_disc error
Mär 06 08:20:56 kernel: ieee80211 phy4: brcmf_cfg80211_add_iface: add iface p2p-dev-wlp229s type 10 failed: err=-52
Mär 06 08:21:00 kernel: ieee80211 phy4: brcmf_cfg80211_scan: Scanning suppressed: status (4)

while playing back audio over Bluetooth headphones/speakers via an A2DP profile, can you make a ~90s Bluetooth capture with sudo btmon -w capture.btsnoop?

Sure! That was ~90s audio from Spotify Lossless to my JBL Flip 4 speakers. No stuttering, perfect quality.

capture.zip

EDIT: I've just noticed stuttering when I have the GNOME Bluetooth settings open - i.e. BT discovery runs. It stops and plays smooth as soon as I close the Bluetooth settings page. Not a big deal for me.

@clanoftheducks
Copy link

clanoftheducks commented Mar 6, 2026

Bluetooth audio stuttering was narrowed down to kdeconnectd. It triggers discoveries often and the Broadcom driver or firmware doesn't like it.
If you use KDE and have such issues, uninstall kdeconnectd and kill kdeconnectd. If you need it, I suppose you can make it start only when you need it.
Conversely, if you have such issues and don't use KDE, it'd be interesting to see if the root cause is the same.

That said, apple-bce/aaudio still requires attention :)

@deqrocks
Copy link
Author

deqrocks commented Mar 6, 2026

Bluetooth audio stuttering was narrowed down to kdeconnectd

I have no doubt in that but before this patch i experienced intermittend 'clicks' while BT and headphone playback testing with aptx receiver and flac files that are now gone.
So we are most likely talking about two different issues. Or it was related to MBA 9,1 only. Log showed a clear relation to the queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants