apple-bce is now deprecated and was rewritten to t2bce, which is prepared to be upstreamed: https://github.com/deqrocks/t2bce
Buffer Copy Engine fork for Intel Macs with a T2 chip with stateful and no-state resume support.
These kernel parameters have to be set in Linux commandline:
mem_sleep_default=deepThis is S3. S2 and 4 should also workpm_async=offneeded on some machines to make pm ordering sequential. Since V0.04 it should work without it.acpi_osi=!Darwin acpi_osi=Linuxfor using the correct ACPI tables
A fixed apple-bce doesn't fix suspend. While it was broken for many years, developers of other T2 patches/drivers did not take care of implementing suspend/resume methods because suspend was broken by apple-bce anyways. Also Apple never cared for Linux (on some Macbooks ACPI tables have real issues). And finally we have the T2 and Apple-modified hardware/platform to deal with. Not all hope is lost though. We can work around most of it using systemd units.
The below units will help you around the roughest cliffs. Note that you can combine them into one unit. Also note the minus sign in for example ExecStart=-/usr/bin... will let the systemd unit continue in case of error. For example if you haven't tiny-dfr installed, the service should still continue to execute - with cosmetic errors in journal. Feel free to remove what you don't need.
The code blocks are full commands. They will create the units and activate them. Copy them, modify them to your needs if you want and execute them. But don't forget the important bits like daemon-reload and systemctl enable.
On dGPU Macs, suspend may still fail or resume may take very long unless the iGPU is set as the default GPU. The 15,1 is notorious for a dead dGPU on resume (black screen with running fans). Do this:
echo "options apple-gmux force_igd=y" | sudo tee /etc/modprobe.d/apple-gmux.confThen create a systemd service to unload amdgpu when suspending by copy/pasting the whole code block below:
sudo tee /etc/systemd/system/amdgpu-suspend-fix.service >/dev/null <<'EOF'
[Unit]
Description=Unload and Reload Modules amdgpu for Suspend and Resume
Before=sleep.target
StopWhenUnneeded=yes
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/rmmod -f amdgpu
ExecStop=-/usr/bin/modprobe amdgpu
[Install]
WantedBy=sleep.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable amdgpu-suspend-fix.service
The touchbar/keyboard drivers are missing proper PM paths and the Touchbar will be broken after resuming. On some macs the kbd backlight stops working. On Macs with tiny-dfr installed, tiny DFR will sit on old FD's before suspend.
Run
journalctl -b --grep="Product: Touch Bar Display"
If needed, replace any occurencies of 3-6 with the number from the output of the command above.
sudo tee /etc/systemd/system/touchbar-suspend-fix.service >/dev/null <<'EOF'
[Unit]
Description=Unload and Reload Modules for Suspend and Resume
Before=sleep.target
StopWhenUnneeded=yes
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/sh -c "/usr/bin/echo 0 | /usr/bin/tee /sys/class/leds/apple::kbd_backlight/brightness" # this is for butterfly keyboards
ExecStart=-/usr/bin/sh -c "/usr/bin/echo 0 | /usr/bin/tee /sys/class/leds/:white:kbd_backlight/brightness" # this is for magic keyboards
ExecStart=-/usr/bin/systemctl stop tiny-dfr.service
ExecStart=-/usr/bin/modprobe -r hid_appletb_kbd
ExecStop=-/usr/bin/modprobe hid_appletb_kbd
ExecStop=-/usr/bin/sh -c 'echo 0 > /sys/bus/usb/devices/3-6/bConfigurationValue'
ExecStop=-/usr/bin/sleep 1
ExecStop=-/usr/bin/sh -c 'echo 2 > /sys/bus/usb/devices/3-6/bConfigurationValue'
ExecStop=-/usr/bin/udevadm settle
ExecStop=-/usr/bin/systemctl restart tiny-dfr.service
ExecStopPost=-/usr/bin/sh -c "/usr/bin/echo 200 | /usr/bin/tee /sys/class/leds/apple::kbd_backlight/brightness"
ExecStopPost=-/usr/bin/sh -c "/usr/bin/echo 200 | /usr/bin/tee /sys/class/leds/:white:kbd_backlight/brightness"
[Install]
WantedBy=sleep.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable touchbar-suspend-fix.service
The 4377 chip is notorious for not managing to transition between power states. Thus it will refuse to enter sleep and wake the system again with all VHCI devices, like keyboard and trackpad not working. Do this:
sudo tee /etc/systemd/system/4377-suspend-fix.service >/dev/null <<'EOF'
[Unit]
Description=Unload and Reload BCM4377 for Suspend and Resume
Before=sleep.target
StopWhenUnneeded=yes
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/rmmod hci_bcm4377
ExecStart=-/usr/bin/rmmod brcmfmac_wcc
ExecStart=-/usr/bin/rmmod brcmfmac
ExecStop=-/usr/bin/modprobe brcmfmac
ExecStop=-/usr/bin/modprobe brcmfmac_wcc
ExecStop=-/usr/bin/modprobe hci_bcm4377
[Install]
WantedBy=sleep.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable 4377-suspend-fix.service
Download the zip file and go into the extracted apple-bce folder with terminal. Type
make && sudo make install
sudo depmod -a
sudo rebootAfter reboot type modinfo apple-bce. The output should show a version number > 0.04 and author: MrARM/modified by André Eikmeyer
Install the source tree and register the module with DKMS (apple-bce version 0.041 as example here):
version=0.041
sudo install -d "/usr/src/apple-bce-${version}"
git archive --format=tar HEAD | sudo tar -x -C "/usr/src/apple-bce-${version}"
sudo dkms add -m apple-bce -v "${version}"
sudo dkms install -m apple-bce -v "${version}"DKMS will automatically rebuild the module for newly installed kernels.
To remove the DKMS installation:
sudo dkms remove -m apple-bce -v 0.041 --all
sudo rm -rf /usr/src/apple-bce-0.041If this work helps you and you want to support it: