Skip to content

bluetooth: hci_bcm4377: Implement Runtime PM support#535

Open
gg582 wants to merge 1 commit into
AsahiLinux:fairydustfrom
maintaining-m1-linux:fix-bluetooth-bcm4377-pm
Open

bluetooth: hci_bcm4377: Implement Runtime PM support#535
gg582 wants to merge 1 commit into
AsahiLinux:fairydustfrom
maintaining-m1-linux:fix-bluetooth-bcm4377-pm

Conversation

@gg582

@gg582 gg582 commented Jul 1, 2026

Copy link
Copy Markdown

No description provided.

@gg582 gg582 force-pushed the fix-bluetooth-bcm4377-pm branch from 78e1921 to c7b72f1 Compare July 1, 2026 10:42
@gg582

gg582 commented Jul 1, 2026

Copy link
Copy Markdown
Author

I guess this is affecting M1 2020

@gg582

gg582 commented Jul 3, 2026

Copy link
Copy Markdown
Author

This is still buggy...

@gg582

gg582 commented Jul 3, 2026

Copy link
Copy Markdown
Author
[    4.855206] systemd[1]: Finished systemd-udev-load-credentials.service - Load udev Rules from Credentials.
[    4.855296] audit: type=1130 audit(1783036502.689:5): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-udev-load-credentials comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    4.871005] systemd[1]: Finished systemd-backlight@backlight:apple-panel-bl.service - Load/Save Screen Backlight Brightness of backlight:apple-panel-bl.
[    4.871209] systemd[1]: Finished systemd-random-seed.service - Load/Save OS Random Seed.
[    4.871634] audit: type=1130 audit(1783036502.705:6): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-backlight@backlight:apple-panel-bl comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    4.871637] audit: type=1130 audit(1783036502.705:7): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-random-seed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    4.872227] Adding 8388576k swap on /var/swap/swapfile.  Priority:-1 extents:2 across:10575248k SS
[    4.872298] systemd[1]: Activated swap var-swap-swapfile.swap - /var/swap/swapfile.
[    4.874087] systemd[1]: Started systemd-journald.service - Journal Service.
[    4.874140] audit: type=1130 audit(1783036502.708:8): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-journald comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    4.896222] audit: type=1334 audit(1783036502.730:9): prog-id=48 op=LOAD
[    4.896262] audit: type=1334 audit(1783036502.730:10): prog-id=49 op=LOAD
[    4.901016] systemd-journald[579]: Received client request to flush runtime journal.
[    4.920495] systemd-journald[579]: /var/log/journal/3486f7f25ddd4a3f9d3bf30aa8444a87/system.journal: Realtime clock jumped backwards relative to last journal entry, rotating.
[    4.920503] systemd-journald[579]: Rotating system journal.
[    5.114255] kauditd_printk_skb: 6 callbacks suppressed
[    5.114258] audit: type=1130 audit(1783036502.948:17): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-tmpfiles-setup-dev comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    5.118222] audit: type=1334 audit(1783036502.952:18): prog-id=23 op=UNLOAD
[    5.118228] audit: type=1334 audit(1783036502.952:19): prog-id=22 op=UNLOAD
[    5.205966] audit: type=1334 audit(1783036503.040:20): prog-id=52 op=LOAD
[    5.206005] audit: type=1334 audit(1783036503.040:21): prog-id=53 op=LOAD
[    5.207207] audit: type=1130 audit(1783036503.041:22): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-resolved comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    5.208692] audit: type=1130 audit(1783036503.043:23): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-udev-trigger comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    5.214041] audit: type=1130 audit(1783036503.048:24): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-growfs-root comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    5.283474] audit: type=1130 audit(1783036503.117:25): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-udevd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    5.421443] zram0: detected capacity change from 0 to 15366144
[    5.437346] audit: type=1130 audit(1783036503.269:26): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-zram-setup@zram0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[    5.478047] Adding 7683056k swap on /dev/zram0.  Priority:100 extents:1 across:7683056k SSDsc
[    5.550987] tlp: vm.laptop_mode is deprecated. Ignoring setting.
[    5.598397] leds_pwm led-controller: failed to read period for kbd_backlight, default to off
[    5.678066] powersaver-appl: vm.laptop_mode is deprecated. Ignoring setting.
[    5.688655] apple-dcp 231c00000.dcp: dcp_poweron() starting
[    5.688816] apple-dcp 231c00000.dcp: dcp_set_power_state_req returned, 10000 ms remaining
[    5.688819] apple-dcp 231c00000.dcp: set_digital_out_mode(color:1 timing:2) "2560x1600": 60 266630 2560 2568 2600 2642 1600 1632 1640 1682 0x48 0x0
[    5.688821] apple-dcp 231c00000.dcp: set_digital_out_mode() color mode depth:8 format:0 colorimetry:16 eotf:0 range:0 vrr:0
[    5.688875] apple-dcp 231c00000.dcp: RTKit: syslog message: nifiedPipeline.cpp:7462: set_digital_out_mode: Modeset requested for colorID: 1, timingID: 2
[    5.688910] apple-dcp 231c00000.dcp: RTKit: syslog message: PPipeDCP_H13P.cpp:18011: Dual pipe disabled offset 0
[    5.688936] apple-dcp 231c00000.dcp: RTKit: syslog message: nifiedPipeline.cpp:7465: set_digital_out_mode returned 8000000b
[    5.688940] apple-dcp 231c00000.dcp: set_digital_out_mode finished:8500
[    5.708615] powersaver-appl: vm.laptop_mode is deprecated. Ignoring setting.
[    5.713189] powersaver-appl: vm.laptop_mode is deprecated. Ignoring setting.
[    5.714965] cpu cpu0: EM: created perf domain
[    5.722473] cpu cpu4: EM: created perf domain
[    5.722476] energy_model: updating cpu0 cpu_cap=493 old capacity=714
[    5.722511] /soc/dsi@228600000: Fixed dependency cycle(s) with /soc/dsi@228600000/panel@0
[    5.722892] /soc/dsi@228600000/panel@0: Fixed dependency cycle(s) with /soc/dsi@228600000
[    5.725328] mc: Linux media interface: v0.10
[    5.730265] cs42l83 2-0048: supply VA not found, using dummy regulator
[    5.730604] cs42l83 2-0048: supply VP not found, using dummy regulator
[    5.730613] cs42l83 2-0048: supply VCP not found, using dummy regulator
[    5.731131] cs42l83 2-0048: supply VD_FILT not found, using dummy regulator
[    5.731915] cs42l83 2-0048: supply VL not found, using dummy regulator
[    5.741497] input: MacBookPro17,1 Touch Bar as /devices/platform/soc/235100000.spi/spi_master/spi0/spi0.0/input/input2
[    5.760367] cs42l83 2-0048: Cirrus Logic CS42L83, Revision: B0
[    5.817602] powersaver-appl: vm.laptop_mode is deprecated. Ignoring setting.
[    5.818913] input: Apple SMC power/lid events as /devices/platform/soc/23e400000.smc/macsmc-input/input/input4
[    5.829603] EXT4-fs (nvme0n1p6): Supports (experimental) DIO atomic writes awu_min: 4096, awu_max: 4096
[    5.833519] apple_aop 24ac00000.aop: RTKit: syslog message: udioPDMNodeBase.cpp:115: PDMDev<pdm0> LPClkCfg=Src:pll ,Freq:2400000
[    5.833544] apple_aop 24ac00000.aop: RTKit: syslog message: udioPDMNodeBase.cpp:554: PDMDev<pdm0> off ->xi0 , 0->2400000 AP state 1
[    5.838268] powersaver-appl: vm.laptop_mode is deprecated. Ignoring setting.
[    5.838597] EXT4-fs (nvme0n1p6): mounted filesystem 42f7822b-1631-47e3-8cf5-649f6750d95e r/w with ordered data mode. Quota mode: none.
[    5.860572] input: MacBook Pro J293 Headphone Jack as /devices/platform/sound/sound/card0/input3
[    5.866548] FAT-fs (nvme0n1p5): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    5.890933] [drm] Initialized adp 0.1.0 for 228200000.display-pipe on minor 1
[    5.902250] spi-nor spi1.0: supply vcc not found, using dummy regulator
[    5.912170] videodev: Linux video capture interface: v2.00
[    5.914580] 1 fixed-partitions partitions found on MTD device spi1.0
[    5.914590] Creating 1 MTD partitions on "spi1.0":
[    5.914620] 0x000000700000-0x000000800000 : "nvram"
[    5.929344] Bluetooth: Core ver 2.22
[    5.929360] NET: Registered PF_BLUETOOTH protocol family
[    5.929360] Bluetooth: HCI device and connection manager initialized
[    5.929364] Bluetooth: HCI socket layer initialized
[    5.929366] Bluetooth: L2CAP socket layer initialized
[    5.929368] Bluetooth: SCO socket layer initialized
[    5.930804] apple-isp 22a000000.isp: ISP firmware-compat: 13.5 (FW: 13.5)
[    5.931345] apple-isp 22a000000.isp: IPC surface iova: 0x1000000
[    5.931358] apple-isp 22a000000.isp: Data surface iova: 0x101c000
[    5.947771] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    5.949152] hci_bcm4377 0000:01:00.1: resetting
[    5.959105] Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    5.959234] Loaded X.509 cert 'wens: 61c038651aabdcf94bd0ac7ff06c7248db18c600'
[    5.990689] usbcore: registered new interface driver brcmfmac
[    5.990885] brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)
[    6.003809] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4378b1-pcie for chip BCM4378/3
[    6.005035] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac4378b1-pcie.apple,honshu-RASP-u-6.5-X3.bin failed with error -2
[    6.005055] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac4378b1-pcie.apple,honshu-RASP-u-6.5.bin failed with error -2
[    6.005071] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac4378b1-pcie.apple,honshu-RASP-u.bin failed with error -2
[    6.005087] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac4378b1-pcie.apple,honshu-RASP.bin failed with error -2
[    6.005105] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac4378b1-pcie.apple,honshu-X3.bin failed with error -2
[    6.006362] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac4378b1-pcie.sig failed with error -2
[    6.060010] hci_bcm4377 0000:01:00.1: reset done
[    6.162353] hci_bcm4377 0000:01:00.1: enabling device (0000 -> 0002)
[    6.648178] hci_bcm4377 0000:01:00.1: Unbalanced pm_runtime_enable!
[    6.651725] brcmfmac: brcmf_c_process_txcap_blob: TxCap blob found, loading
[    6.653325] brcmfmac: brcmf_c_process_cal_blob: Calibration blob provided by platform, loading
[    6.665589] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4378/3 wl0: May 13 2023 07:20:48 version 18.20.383.15.7.8.150 FWID 01-b37727a5
[    6.865346] Bluetooth: hci0: HCI LE Coded PHY feature bit is set, but its usage is not supported.
[    6.889233] RPC: Registered named UNIX socket transport module.
[    6.889238] RPC: Registered udp transport module.
[    6.889238] RPC: Registered tcp transport module.
[    6.889239] RPC: Registered tcp-with-tls transport module.
[    6.889240] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    6.892727] apple-isp: CISP_CMD_CONFIG_GET: 
[    6.892734] apple-isp: 00000000 00000003 016e3600 00000001 0000000a 00000000 00000001
[    6.892846] apple-isp 22a000000.isp: found sensor 248 CC212962UXQJ3Y327 on ch 0
[    6.892849] apple-isp: ch: CISP_CMD_CH_INFO_GET: 0
[    6.892851] apple-isp: ch: 00000000 0000010d 00000000 07db0001 0006004d 00040007 00000005 00000001
[    6.892853] apple-isp: ch: 00000248 00000007 00000001 00000001 00000000 00000000 00000000 00000000
[    6.892855] apple-isp: ch: 00000000 00000000 00000000 00010000 00000001 00000000 00000004 00000020
[    6.892857] apple-isp: ch: 00000001 00000000 00004680 00000040 00000001 00000002 00004000 00000040
[    6.892858] apple-isp: ch: 00000001 00000000 00000000 00000036 00000000 00000000 000f4240 43430000
[    6.892860] apple-isp: ch: 39323132 58553236 59334a51 00373233 00000000 00000008 00000000 00000000
[    6.892862] apple-isp: ch: 00000004 00000000 00000000 00000000 00000000 00000000 00000000 00ff0000
[    6.892864] apple-isp: ch: 00000c00 00000000 0000001c 00000680 00000004 00000004 00000000 00000000
[    6.892865] apple-isp: ch: 00000000 00000000 00000000 00000000 05100000 000002e0
[    6.892990] apple-isp: ps: CISP_CMD_CH_CAMERA_CONFIG_GET: 0
[    6.892993] apple-isp: ps: 00000000 00000106 00000000 00000000 02e00510 02e00510 00000000 00001df8
[    6.892994] apple-isp: ps: 00000100 00000001 00000040 00000040 00000040 00000040 00000040 00000040
[    6.892996] apple-isp: ps: 00000003 00000040 00000040 00000005 00000000 00000528 00000001 00000000
[    6.892998] apple-isp: ps: 0249f000 00000006 00000007 00000000 00000009 000f4240 00000025 00000000
[    6.893000] apple-isp: ps: 00004000 00000014 00000015 00000000 00000000 00000000 00000510 000002e0
[    6.893001] apple-isp: ps: 00010000 b9680000 0ef80000 00000000 0000001f 00000000 00000000 00000000
[    6.893003] apple-isp: ps: 00000510 000002e0 00000100 00000000 00000000 00000510 000002e0
[    6.911324] apple-isp 22a000000.isp: apple-isp probe!
[    6.967356] brcmfmac 0000:01:00.0 wld0: renamed from wlan0
[    7.011156] snd-soc-macaudio sound: Speaker volumes unlocked
[    7.031456] nvme nvme0: using unchecked data buffer
[    7.033448] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    7.033452] Bluetooth: BNEP filters: protocol multicast
[    7.033456] Bluetooth: BNEP socket layer initialized
[    7.037946] Bluetooth: MGMT ver 1.23
[    7.159256] NET: Registered PF_QIPCRTR protocol family
[    8.360414] ieee80211 phy0: brcmf_dongle_roam: WLC_SET_ROAM_DELTA error (-52)
[    8.995123] ieee80211 phy0: brcmf_p2p_set_firmware: failed to update device address ret -52
[    8.995625] ieee80211 phy0: brcmf_p2p_create_p2pdev: set p2p_disc error
[    8.995645] ieee80211 phy0: brcmf_cfg80211_add_iface: add iface p2p-dev-wld0 type 10 failed: err=-52
[   11.106887] nvme-apple 27bcc0000.nvme: RTKit: syslog message: blog.c:102: New BlogBuf low 28

Repetitive pm runtime enable caused an error. Patching...

@gg582 gg582 force-pushed the fix-bluetooth-bcm4377-pm branch from c7b72f1 to a05fbe2 Compare July 3, 2026 01:13
@gg582

gg582 commented Jul 3, 2026

Copy link
Copy Markdown
Author

Other mac series uses different broadcom chips.

My device is Macbook Pro(M1, 2020) j293. I'll submit dmesg result and suspend/resume check after testing a05fbe2

@gg582 gg582 force-pushed the fix-bluetooth-bcm4377-pm branch 2 times, most recently from 1e33ac0 to 00ec730 Compare July 3, 2026 04:52
Signed-off-by: Lee Yunjin <gzblues61@gmail.com>
@gg582 gg582 force-pushed the fix-bluetooth-bcm4377-pm branch from 00ec730 to aa5d485 Compare July 3, 2026 09:34
@gg582

gg582 commented Jul 3, 2026

Copy link
Copy Markdown
Author
yjlee@fedora:~$ sudo ./check.sh 
[sudo] yjlee 암호: 
Found device address: 0000:01:00.1
Power control path: /sys/bus/pci/devices/0000:01:00.1/power
--------------------------------------------------
[1/3] Setting Runtime PM control to 'auto'...
[2/3] Waiting 3 seconds for the device to enter runtime suspend...
(Driver autosuspend delay is configured to 2000ms)
Current status: active
Result: Runtime Suspend FAILED
Note: Ensure no active bluetooth sessions or processes are holding the device active.
--------------------------------------------------
[3/3] Forcing device wakeup by changing control to 'on'...
Current status: active
Result: Runtime Resume SUCCESS
yjlee@fedora:~$ 

Script

#!/bin/bash

# Check root privileges
if [ "$EUID" -ne 0 ]; then
  echo "Error: This script must be run with root privileges (sudo)."
  exit 1
fi

# Find bcm4377 PCI device address
PCI_ADDR=$(lspci -d :bcm4377 2>/dev/null | awk '{print $1}')
if [ -z "$PCI_ADDR" ]; then
    # Fallback: find via driver symlink if lspci device ID matching fails
    PCI_ADDR=$(basename $(readlink /sys/bus/pci/drivers/hci_bcm4377/* 2>/dev/null | head -n 1))
fi

if [ -z "$PCI_ADDR" ] || [ "$PCI_ADDR" = "drivers" ]; then
    echo "Error: hci_bcm4377 device not found. Ensure the driver is loaded."
    exit 1
fi

DEVICE_DIR="/sys/bus/pci/devices/$PCI_ADDR/power"
echo "Found device address: $PCI_ADDR"
echo "Power control path: $DEVICE_DIR"
echo "--------------------------------------------------"

# 1. Enable Runtime PM and set to auto
echo "[1/3] Setting Runtime PM control to 'auto'..."
echo "auto" > "$DEVICE_DIR/control"
sleep 1

# 2. Test Runtime Suspend (Idle state)
echo "[2/3] Waiting 3 seconds for the device to enter runtime suspend..."
echo "(Driver autosuspend delay is configured to 2000ms)"
sleep 3

STATUS=$(cat "$DEVICE_DIR/runtime_status")
echo "Current status: $STATUS"

if [ "$STATUS" = "suspended" ]; then
    echo "Result: Runtime Suspend SUCCESS"
else
    echo "Result: Runtime Suspend FAILED"
    echo "Note: Ensure no active bluetooth sessions or processes are holding the device active."
fi
echo "--------------------------------------------------"

# 3. Test Runtime Resume (Force Wakeup)
echo "[3/3] Forcing device wakeup by changing control to 'on'..."
echo "on" > "$DEVICE_DIR/control"
sleep 0.5

STATUS_ON=$(cat "$DEVICE_DIR/runtime_status")
echo "Current status: $STATUS_ON"

if [ "$STATUS_ON" = "active" ]; then
    echo "Result: Runtime Resume SUCCESS"
else
    echo "Result: Runtime Resume FAILED"
fi

# Restore configuration to auto
echo "auto" > "$DEVICE_DIR/control"

@gg582

gg582 commented Jul 3, 2026

Copy link
Copy Markdown
Author
yjlee@fedora:~$ sudo dmesg | grep bcm4377
[sudo] yjlee 암호: 
[    5.406745] hci_bcm4377 0000:01:00.1: resetting
[    5.513855] hci_bcm4377 0000:01:00.1: reset done
[    5.618317] hci_bcm4377 0000:01:00.1: enabling device (0000 -> 0002)

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.

1 participant