Merge pull request #432 from mcdonc/p50-and-p51

Add Lenovo Thinkpad P50 and P51
This commit is contained in:
Jörg Thalheim 2022-07-14 08:53:36 +02:00 committed by GitHub
commit 76c9664813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 156 additions and 0 deletions

View File

@ -124,6 +124,8 @@ See code for all available configurations.
| [Lenovo ThinkPad P1 Gen 3](lenovo/thinkpad/p1/3th-gen) | `<nixos-hardware/lenovo/thinkpad/p1/3th-gen>` |
| [Lenovo ThinkPad P14s AMD Gen 2](lenovo/thinkpad/p14s/amd/gen2) | `<nixos-hardware/lenovo/thinkpad/p14s/amd/gen2>` |
| [Lenovo ThinkPad P1](thinkpad/p1) | `<nixos-hardware/lenovo/thinkpad/p1>` |
| [Lenovo ThinkPad P50](lenovo/thinkpad/p50) | `<nixos-hardware/lenovo/thinkpad/p50>` |
| [Lenovo ThinkPad P51](lenovo/thinkpad/p51) | `<nixos-hardware/lenovo/thinkpad/p51>` |
| [Lenovo ThinkPad P52](lenovo/thinkpad/p52) | `<nixos-hardware/lenovo/thinkpad/p52>` |
| [Lenovo ThinkPad P53](lenovo/thinkpad/p53) | `<nixos-hardware/lenovo/thinkpad/p53>` |
| [Lenovo ThinkPad T14 AMD Gen 1](lenovo/thinkpad/t14/amd/gen1) | `<nixos-hardware/lenovo/thinkpad/t14/amd/gen1>` |

View File

@ -66,6 +66,8 @@
lenovo-thinkpad-p1 = import ./lenovo/thinkpad/p1;
lenovo-thinkpad-p1-gen3 = import ./lenovo/thinkpad/p1/3th-gen;
lenovo-thinkpad-p14s-amd-gen2 = import ./lenovo/thinkpad/p14s/amd/gen2;
lenovo-thinkpad-p50 = import ./lenovo/thinkpad/p50;
lenovo-thinkpad-p51 = import ./lenovo/thinkpad/p51;
lenovo-thinkpad-p52 = import ./lenovo/thinkpad/p52;
lenovo-thinkpad-p53 = import ./lenovo/thinkpad/p53;
lenovo-thinkpad-t14 = import ./lenovo/thinkpad/t14;

View File

@ -0,0 +1,74 @@
{ lib, config, ... }: {
imports = [
../../../common/gpu/nvidia.nix
../../../common/cpu/intel
../../../common/pc/laptop/acpi_call.nix
../.
];
hardware = {
nvidia = {
prime = {
intelBusId = lib.mkDefault "PCI:0:2:0";
nvidiaBusId = lib.mkDefault "PCI:1:0:0";
};
};
# is this too much? It's convenient for Steam.
opengl = {
driSupport = lib.mkDefault true;
driSupport32Bit = lib.mkDefault true;
};
};
# required to make wireless work
hardware.enableAllFirmware = lib.mkDefault true;
# fix suspend/resume screen corruption in sync mode
hardware.nvidia.powerManagement =
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true;
};
# fix screen tearing in sync mode
hardware.nvidia.modesetting =
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true;
};
# Make the DPI the same in sync mode as in offload mode (disabled because
# these thinkpads come with many kinds of screens, but this is valid for the
# 1920x1080 ones)
#services.xserver.dpi = 96;
# throttled vs. thermald
# -----------------------
#
# NB: the p53 profile currently uses throttled to prevent too-eager CPU
# throttling. I understand throttled to have been a workaround solution at
# the time the p53 profile was created (throttled's original name was
# "lenovo_fix"). thermald would have been preferred if it worked at the
# time.
#
# I read
# https://wiki.archlinux.org/title/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues
# as saying that thermald is fixed under the circumstance that led to the
# development of throttled given version 5.12+ of the kernel combined
# with version 2.4.3+ of thermald. At the time of this writing, the
# stable NixOS kernel is 5.15 and 2.4.9 of thermald.
#
# In the meantime, I also ran the "s-tui" program which can stress test the
# system, while eyeing up the core temps and CPU frequency under three
# scenarios: under thermald, under throttled, and with neither. None of the
# scenarios seem to have massively improved fan behavior, core temps, or
# average CPU frequency than another. The highest core temp always seems to
# hover around 90 degrees C, the lowest CPU Ghz around 3.4 on a 3.8Ghz machine.
#
# I ended up choosing throttled because subjectively, the fans seem quieter
# when it's stressed and it allows the average temps to get a degree or two
# higher when running throttled than when running in the other two scenarios,
# but still substantially under critical temp.
services.throttled.enable = lib.mkDefault true;
}

View File

@ -0,0 +1,78 @@
{ config, lib, ... }: {
imports = [
../../../common/gpu/nvidia.nix
../../../common/cpu/intel
../../../common/cpu/intel/kaby-lake
../../../common/pc/laptop/acpi_call.nix
../.
];
hardware = {
nvidia = {
prime = {
intelBusId = lib.mkDefault "PCI:0:2:0";
nvidiaBusId = lib.mkDefault "PCI:1:0:0";
};
};
# is this too much? It's convenient for Steam.
opengl = {
driSupport = lib.mkDefault true;
driSupport32Bit = lib.mkDefault true;
};
};
# required to make wireless work
hardware.enableAllFirmware = lib.mkDefault true;
# fix suspend/resume screen corruption in sync mode
hardware.nvidia.powerManagement =
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true;
};
# fix screen tearing in sync mode
hardware.nvidia.modesetting =
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true;
};
# Make the DPI the same in sync mode as in offload mode (disabled because
# these thinkpads come with many kinds of screens, but this is valid for the
# 1920x1080 ones)
#services.xserver.dpi = 96;
# silence ACPI "errors" at boot shown before NixOS stage 1 output (default is 4)
#boot.consoleLogLevel = 3;
# throttled vs. thermald
# -----------------------
#
# NB: the p53 profile currently uses throttled to prevent too-eager CPU
# throttling. I understand throttled to have been a workaround solution at
# the time the p53 profile was created (throttled's original name was
# "lenovo_fix"). thermald would have been preferred if it worked at the
# time.
#
# I read
# https://wiki.archlinux.org/title/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues
# as saying that thermald is fixed under the circumstance that led to the
# development of throttled given version 5.12+ of the kernel combined
# with version 2.4.3+ of thermald. At the time of this writing, the
# stable NixOS kernel is 5.15 and 2.4.9 of thermald.
#
# In the meantime, I also ran the "s-tui" program which can stress test the
# system, while eyeing up the core temps and CPU frequency under three
# scenarios: under thermald, under throttled, and with neither. None of the
# scenarios seem to have massively improved fan behavior, core temps, or
# average CPU frequency than another. The highest core temp always seems to
# hover around 90 degrees C, the lowest CPU Ghz around 3.4 on a 3.8Ghz machine.
#
# I ended up choosing throttled because subjectively, the fans seem quieter
# when it's stressed and it allows the average temps to get a degree or two
# higher when running throttled than when running in the other two scenarios,
# but still substantially under critical temp.
services.throttled.enable = lib.mkDefault true;
}