mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	cannot replicate sleep problem without external monitor or any usb device plugged in
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
{ lib, ... }:
 | 
			
		||||
{ lib, pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ../../../common/gpu/nvidia.nix
 | 
			
		||||
@@ -22,12 +22,9 @@
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # reqired to make wireless work
 | 
			
		||||
  # required to make wireless work
 | 
			
		||||
  hardware.enableAllFirmware = true;
 | 
			
		||||
  
 | 
			
		||||
  # See sleep.nix inside this directory for code that allows the system to
 | 
			
		||||
  # sleep properly (out of the box, it will not) at the cost of battery life.
 | 
			
		||||
  #
 | 
			
		||||
 | 
			
		||||
  # throttled vs. thermald
 | 
			
		||||
  # -----------------------
 | 
			
		||||
  #
 | 
			
		||||
 
 | 
			
		||||
@@ -1,41 +0,0 @@
 | 
			
		||||
# Sleep
 | 
			
		||||
# -----
 | 
			
		||||
#
 | 
			
		||||
# Without this configuration, the system will not resume from sleep properly
 | 
			
		||||
# while on battery power in either offload mode or sync mode.  When it tries to
 | 
			
		||||
# resume, it gets to a state with a cursor in the top left hand side of the
 | 
			
		||||
# panel, the power LED goes from flashing to solid, and thereafter cannot be
 | 
			
		||||
# interacted with (even over SSH) and must be power cycled forcefully.
 | 
			
		||||
# Sometimes it doesn't even finish going to sleep before this behavior kicks
 | 
			
		||||
# in.
 | 
			
		||||
#
 | 
			
		||||
# When on AC, the machine either wakes up from sleep before being asked to
 | 
			
		||||
# (or maybe never gets to sleep state), or it goes into a sleep state and it
 | 
			
		||||
# appears consistently resume properly when it does.
 | 
			
		||||
#
 | 
			
		||||
# But the machine actually sleeps and resumes reliably when tlp is disabled
 | 
			
		||||
# fully or partially.  Disabling RUNTIME_PM and AHCI_RUNTIME_PM appears to be
 | 
			
		||||
# enough to allow it to work when tlp is active.  This will negatively effect
 | 
			
		||||
# battery life.  I couldn't figure out a more granular way to get it working,
 | 
			
		||||
# despite trying to do a per-device binary search via powertop.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
{config, lib, ...}:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  services.tlp = {
 | 
			
		||||
    settings = {
 | 
			
		||||
      # DISK_DEVICES must be specified for AHCI_RUNTIME_PM settings to work right.
 | 
			
		||||
      DISK_DEVICES = "nvme0n1 nvme1n1 sda sdb";
 | 
			
		||||
 | 
			
		||||
      # with AHCI_RUNTIME_PM_ON_AC/BAT set to defaults in battery mode, P51
 | 
			
		||||
      # can't resume from sleep and P50 can't go to sleep.
 | 
			
		||||
      AHCI_RUNTIME_PM_ON_AC = "on";
 | 
			
		||||
      AHCI_RUNTIME_PM_ON_BAT = "on";
 | 
			
		||||
 | 
			
		||||
      # with RUNTIME_PM_ON_BAT/AC set to defaults, P50/P51 can't go to sleep
 | 
			
		||||
      RUNTIME_PM_ON_AC = "on";
 | 
			
		||||
      RUNTIME_PM_ON_BAT = "on";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
@@ -23,12 +23,9 @@
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # reqired to make wireless work
 | 
			
		||||
  # required to make wireless work
 | 
			
		||||
  hardware.enableAllFirmware = true;
 | 
			
		||||
 | 
			
		||||
  # See sleep.nix inside this directory for code that allows the system to
 | 
			
		||||
  # sleep properly (out of the box, it will not) at the cost of battery life.
 | 
			
		||||
  #
 | 
			
		||||
  # throttled vs. thermald
 | 
			
		||||
  # -----------------------
 | 
			
		||||
  #
 | 
			
		||||
 
 | 
			
		||||
@@ -1,41 +0,0 @@
 | 
			
		||||
# Sleep
 | 
			
		||||
# -----
 | 
			
		||||
#
 | 
			
		||||
# Without this configuration, the system will not resume from sleep properly
 | 
			
		||||
# while on battery power in either offload mode or sync mode.  When it tries to
 | 
			
		||||
# resume, it gets to a state with a cursor in the top left hand side of the
 | 
			
		||||
# panel, the power LED goes from flashing to solid, and thereafter cannot be
 | 
			
		||||
# interacted with (even over SSH) and must be power cycled forcefully.
 | 
			
		||||
# Sometimes it doesn't even finish going to sleep before this behavior kicks
 | 
			
		||||
# in.
 | 
			
		||||
#
 | 
			
		||||
# When on AC, the machine either wakes up from sleep before being asked to
 | 
			
		||||
# (or maybe never gets to sleep state), or it goes into a sleep state and it
 | 
			
		||||
# appears consistently resume properly when it does.
 | 
			
		||||
#
 | 
			
		||||
# But the machine actually sleeps and resumes reliably when tlp is disabled
 | 
			
		||||
# fully or partially.  Disabling RUNTIME_PM and AHCI_RUNTIME_PM appears to be
 | 
			
		||||
# enough to allow it to work when tlp is active.  This will negatively effect
 | 
			
		||||
# battery life.  I couldn't figure out a more granular way to get it working,
 | 
			
		||||
# despite trying to do a per-device binary search via powertop.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
{config, lib, ...}:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  services.tlp = {
 | 
			
		||||
    settings = {
 | 
			
		||||
      # DISK_DEVICES must be specified for AHCI_RUNTIME_PM settings to work right.
 | 
			
		||||
      DISK_DEVICES = "nvme0n1 nvme1n1 sda sdb";
 | 
			
		||||
 | 
			
		||||
      # with AHCI_RUNTIME_PM_ON_AC/BAT set to defaults in battery mode, P51
 | 
			
		||||
      # can't resume from sleep and P50 can't go to sleep.
 | 
			
		||||
      AHCI_RUNTIME_PM_ON_AC = "on";
 | 
			
		||||
      AHCI_RUNTIME_PM_ON_BAT = "on";
 | 
			
		||||
 | 
			
		||||
      # with RUNTIME_PM_ON_BAT/AC set to defaults, P50/P51 can't go to sleep
 | 
			
		||||
      RUNTIME_PM_ON_AC = "on";
 | 
			
		||||
      RUNTIME_PM_ON_BAT = "on";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user