diff --git a/install/config/all.sh b/install/config/all.sh index 0c3b839822..e17de875f2 100644 --- a/install/config/all.sh +++ b/install/config/all.sh @@ -63,6 +63,7 @@ run_logged $OMARCHY_INSTALL/config/hardware/framework/qmk-hid.sh run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-spi-keyboard.sh run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-suspend-nvme.sh +run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-suspend-async.sh run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-t2.sh run_logged $OMARCHY_INSTALL/config/hardware/lenovo/fix-yoga-pro7-bass-speakers.sh diff --git a/install/config/hardware/apple/fix-suspend-async.sh b/install/config/hardware/apple/fix-suspend-async.sh new file mode 100644 index 0000000000..281da091da --- /dev/null +++ b/install/config/hardware/apple/fix-suspend-async.sh @@ -0,0 +1,31 @@ +# Fix intermittent suspend hang on T2 MacBooks caused by async device suspend. +# +# On T2 Macs the kernel default of asynchronous (parallel) device suspend +# (/sys/power/pm_async=1) intermittently HARD-HANGS the machine the instant it +# enters suspend: black screen, dead keyboard/trackpad/Touch Bar, no wake, only +# a forced power-off recovers. pm_trace fingerprints the hang in the async +# device-suspend core (drivers/base/power/main.c), not in any single driver. +# Forcing synchronous device suspend serialises it and resolves the hang. +# +# Confirmed on MacBookPro16,2 (5/5 clean suspend cycles with the fix vs 5/5 +# hangs without). Independent of suspend mode (deep or s2idle). See +# basecamp/omarchy#1840 for the broader set of affected T2 models. +if lspci -nn | grep -q "106b:180[12]"; then + echo "Detected MacBook with T2 chip. Applying synchronous device-suspend fix..." + + cat </dev/null +[Unit] +Description=Omarchy synchronous device-suspend fix for T2 MacBook +ConditionPathExists=/sys/power/pm_async + +[Service] +Type=oneshot +ExecStart=/bin/bash -c 'echo 0 > /sys/power/pm_async' + +[Install] +WantedBy=multi-user.target +EOF + + chrootable_systemctl_enable omarchy-pm-async-suspend-fix.service + sudo systemctl daemon-reload +fi diff --git a/migrations/1782742549.sh b/migrations/1782742549.sh new file mode 100644 index 0000000000..b7471bbb17 --- /dev/null +++ b/migrations/1782742549.sh @@ -0,0 +1,3 @@ +echo "Fix intermittent suspend hang on T2 MacBooks (force synchronous device suspend)" + +source $OMARCHY_PATH/install/config/hardware/apple/fix-suspend-async.sh