summaryrefslogtreecommitdiffstats
path: root/apple
diff options
context:
space:
mode:
authorRehno Lindeque <errantkid@gmail.com>2018-07-28 13:41:15 -0400
committerRehno Lindeque <errantkid@gmail.com>2018-07-30 17:55:13 -0400
commit694fd85397db316fdf18b7cf23bcbbdee2e84a67 (patch)
tree7eb3959b67cc57257f6e55d7c1dbc742e3798923 /apple
parente31b17512822fb7be589ee3701621413a36b1c64 (diff)
apple/macbookpro/11-5: Prevent intermittent xhci wakeup after suspend
Diffstat (limited to 'apple')
-rw-r--r--apple/macbook-pro/11-5/README.md20
-rw-r--r--apple/macbook-pro/11-5/default.nix15
2 files changed, 34 insertions, 1 deletions
diff --git a/apple/macbook-pro/11-5/README.md b/apple/macbook-pro/11-5/README.md
index 49ddc4a..17e5ef1 100644
--- a/apple/macbook-pro/11-5/README.md
+++ b/apple/macbook-pro/11-5/README.md
@@ -2,6 +2,26 @@
This configuration will **not** work with MacBook Pro 11,2 or 11,3 models.
+## Notable features
+
+* Prevent intermittent USB 3.0 controller wakeup signal when the lid is closed. Without this fix your laptop may get very hot and drain the battery after waking up in your laptop bag.
+
+ You can see for yourself which devices are allowed to wake up your laptop using the command:
+
+ ```shell
+ cat /proc/acpi/wakeup
+ ```
+
+ This fix works for Linux kernel 3.13 and above.
+
+ Sources:
+
+ * [Fix unwanted laptop resume after lid is closed](https://medium.com/@laurynas.karvelis_95228/install-arch-linux-on-macbook-pro-11-2-retina-install-guide-for-year-2017-2034ceed4cb2#66ba)
+ * [Arch wiki: MacBookPro11,x Suspend](https://wiki.archlinux.org/index.php/MacBookPro11,x#Suspend)
+ * [simonvandel/dotfiles (nix config)](https://github.com/simonvandel/dotfiles/blob/f254a4a607257faee295ce798ed215273c342850/nixos/vandel-macair/configuration.nix#L45)
+
+## Graphics
+
The [MacBookPro11,4 and MacBookPro11,5](https://support.apple.com/kb/SP719) models ship with a discrete ATI graphics card (whereas MacBookPro11,2 and MacBookPro11,3 ship with NVidia cards). This is alongside the usual integrated Intel GPU.
You may wish to look into dynamic switching between integrated and discrete graphics, but this config doesn't attempt it.
diff --git a/apple/macbook-pro/11-5/default.nix b/apple/macbook-pro/11-5/default.nix
index b5c36a6..28ce18c 100644
--- a/apple/macbook-pro/11-5/default.nix
+++ b/apple/macbook-pro/11-5/default.nix
@@ -1,4 +1,10 @@
-{ lib, pkgs, ... }:
+{ lib, config, pkgs, ... }:
+
+let
+
+ kernelPackages = config.boot.kernelPackages;
+
+in
{
imports = [
@@ -14,4 +20,11 @@
hardware.opengl.driSupport32Bit = false;
services.xserver.videoDrivers = [ "ati" ];
+
+ services.udev.extraRules =
+ # Disable XHC1 wakeup signal to avoid resume getting triggered some time
+ # after suspend. Reboot required for this to take effect.
+ lib.optionalString
+ (lib.versionAtLeast kernelPackages.kernel.version "3.13")
+ ''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"'';
}