From 34c1bf11bb48717f097a831ff248998b421a24bf Mon Sep 17 00:00:00 2001 From: Ivan Kovnatsky Date: Tue, 1 Dec 2020 10:57:29 +0200 Subject: [PATCH] apple/macbook-pro/12-1: PM: set cpuFreqGovernor and power Up/Down commands (#214) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- apple/macbook-pro/12-1/README.md | 15 +++++++++++++++ apple/macbook-pro/12-1/default.nix | 13 ++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 apple/macbook-pro/12-1/README.md diff --git a/apple/macbook-pro/12-1/README.md b/apple/macbook-pro/12-1/README.md new file mode 100644 index 0000000..6618dc9 --- /dev/null +++ b/apple/macbook-pro/12-1/README.md @@ -0,0 +1,15 @@ +# MacBook Pro 12,1 + +## Wireless won't get reconnected after resume/hibernate + +The wifi driver is unloaded before suspend/hibernate to workaround driver issues. +This means it might be required to restart your wifi deamon i.e. wpa_supplicant: + +```nix +powerManagement.powerUpCommands = '' + ${pkgs.systemd}/bin/systemctl restart wpa_supplicant.service +''; +}; +``` + +You can apply this to your network management software of choice. diff --git a/apple/macbook-pro/12-1/default.nix b/apple/macbook-pro/12-1/default.nix index 02c6f32..f9dff3b 100644 --- a/apple/macbook-pro/12-1/default.nix +++ b/apple/macbook-pro/12-1/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ lib, pkgs, ... }: { imports = [ @@ -7,6 +7,17 @@ ]; + 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 + powerUpCommands = lib.mkBefore "${pkgs.kmod}/bin/modprobe brcmfmac"; + powerDownCommands = lib.mkBefore "${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"