1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-23 11:29:42 +01:00
nixos-hardware/apple/macbook-pro/12-1/default.nix
Sergey Yelin 64d900abe4
Unload brcmfmac_wcc (if loaded) before brcmfmac (#1200)
Module brcmfmac cannot be unloaded with rmmod when brcmfmac_wcc is loaded.
This leads brcmfmac to crash on wake up.

Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2024-10-23 15:42:09 +02:00

29 lines
1,014 B
Nix

{ lib, pkgs, modulesPath, ... }:
{
imports = [
../.
../../../common/pc/laptop/ssd
"${modulesPath}/hardware/network/broadcom-43xx.nix"
];
powerManagement = {
# Enable gradually increasing/decreasing CPU frequency, rather than using
# "powersave", which would keep CPU frequency at 0.8GHz.
cpuFreqGovernor = lib.mkDefault "conservative";
# brcmfmac being loaded during hibernation would not let a successful resume
# https://bugzilla.kernel.org/show_bug.cgi?id=101681#c116.
# Also brcmfmac could randomly crash on resume from sleep.
powerUpCommands = lib.mkBefore "${pkgs.kmod}/bin/modprobe brcmfmac";
powerDownCommands = lib.mkBefore ''
${pkgs.kmod}/bin/rmmod -f -v brcmfmac_wcc 2>/dev/null || true
${pkgs.kmod}/bin/rmmod brcmfmac
'';
};
# USB subsystem wakes up MBP right after suspend unless we disable it.
services.udev.extraRules = lib.mkDefault ''
SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"
'';
}