nixos-hardware/apple/macbook-pro/14-1/disable-nvme-d3cold.sh
Zane van Iperen 99ed0bc663
apple/macbook-pro: add support for 14,1
Extracted from my system configs. There's still a few issues with this
machine:

1. Audio is a lost cause. Will probably need to bribe an Apple or Cirrus
   engineer for the datasheet.
2. The thunderbolt module will oops upon system resume, and subsequently
   refuse to work until next reboot.
3. The d3cold state needs to be disabled on the NVME controller for it
   to wake up.
4. The Bluetooth UART (/dev/ttyS0) is created and then deleted by udev
   in early boot. I am yet to figure out why. Hack around it by
   reloading the 8250_dw module, causing it to be re-created.
2022-10-21 00:29:37 +10:00

19 lines
385 B
Bash
Executable file

#!/usr/bin/env bash
driver_path=/sys/bus/pci/devices/0000:01:00.0
if [[ ! -e "$driver_path" ]]; then
echo "$driver_path does not exist, exiting..."
exit 1
fi
driver=$(basename $(readlink "$driver_path/driver"))
if [[ "$driver" -ne "nvme" ]]; then
echo "$driver_path is not an NVME device, got $driver, exiting..."
exit 1
fi
echo 0 > "$driver_path/d3cold_allowed"