From d0a8097eec8cabbcd50fcff20548d7882feb7d8b Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Thu, 31 May 2018 15:56:43 +0200 Subject: Add basic support for 6th-gen X1 --- lenovo/thinkpad/x1/6th-gen/QHD/default.nix | 9 +++++++++ lenovo/thinkpad/x1/6th-gen/default.nix | 5 +++++ lenovo/thinkpad/x1/default.nix | 6 ++++++ 3 files changed, 20 insertions(+) create mode 100644 lenovo/thinkpad/x1/6th-gen/QHD/default.nix create mode 100644 lenovo/thinkpad/x1/6th-gen/default.nix create mode 100644 lenovo/thinkpad/x1/default.nix (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix new file mode 100644 index 0000000..55438fd --- /dev/null +++ b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix @@ -0,0 +1,9 @@ +# X1 6th generation with a QHD (2560x1440px) display +{ + imports = [ + ../. + ]; + + services.xserver.dpi = 210; + fonts.fontconfig.dpi = 210; +} diff --git a/lenovo/thinkpad/x1/6th-gen/default.nix b/lenovo/thinkpad/x1/6th-gen/default.nix new file mode 100644 index 0000000..665d3d4 --- /dev/null +++ b/lenovo/thinkpad/x1/6th-gen/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../. + ]; +} diff --git a/lenovo/thinkpad/x1/default.nix b/lenovo/thinkpad/x1/default.nix new file mode 100644 index 0000000..870d9a8 --- /dev/null +++ b/lenovo/thinkpad/x1/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ../. + ../../../common/cpu/intel + ]; +} -- cgit v1.2.3 From e0a8e0107321a86e307e9c01d91bd27b03d665d7 Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Thu, 31 May 2018 18:04:02 +0200 Subject: Give TLP more control over the battery and enable battery life saver parameters --- lenovo/thinkpad/x1/6th-gen/QHD/default.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix index 55438fd..1122d77 100644 --- a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix @@ -1,9 +1,26 @@ # X1 6th generation with a QHD (2560x1440px) display +{ config, ... }: + { imports = [ ../. ]; + # give tlp more control over battery + boot = { + extraModulePackages = with config.boot.kernelPackages; [ + acpi_call + ]; + kernelModules = [ + "acpi_call" + ]; + }; + # see https://linrunner.de/en/tlp/docs/tlp-faq.html#battery + services.tlp.extraConfig = '' +START_CHARGE_THRESH_BAT0=75 +STOP_CHARGE_THRESH_BAT0=80 +''; + # fix font sizes in X services.xserver.dpi = 210; fonts.fontconfig.dpi = 210; } -- cgit v1.2.3 From 5dd535392df4ed2299ed39c4500bbd432e62cff0 Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Sun, 3 Jun 2018 01:28:40 +0200 Subject: Move battery settings to the configuration for all the 6th gen models --- lenovo/thinkpad/x1/6th-gen/QHD/default.nix | 15 --------------- lenovo/thinkpad/x1/6th-gen/default.nix | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix index 1122d77..6b53d5e 100644 --- a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix @@ -5,21 +5,6 @@ imports = [ ../. ]; - # give tlp more control over battery - boot = { - extraModulePackages = with config.boot.kernelPackages; [ - acpi_call - ]; - kernelModules = [ - "acpi_call" - ]; - }; - - # see https://linrunner.de/en/tlp/docs/tlp-faq.html#battery - services.tlp.extraConfig = '' -START_CHARGE_THRESH_BAT0=75 -STOP_CHARGE_THRESH_BAT0=80 -''; # fix font sizes in X services.xserver.dpi = 210; fonts.fontconfig.dpi = 210; diff --git a/lenovo/thinkpad/x1/6th-gen/default.nix b/lenovo/thinkpad/x1/6th-gen/default.nix index 665d3d4..ea63de0 100644 --- a/lenovo/thinkpad/x1/6th-gen/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/default.nix @@ -2,4 +2,19 @@ imports = [ ../. ]; + # Give TLP service more control over battery + boot = { + extraModulePackages = with config.boot.kernelPackages; [ + acpi_call + ]; + kernelModules = [ + "acpi_call" + ]; + }; + + # See https://linrunner.de/en/tlp/docs/tlp-faq.html#battery + services.tlp.extraConfig = '' +START_CHARGE_THRESH_BAT0=75 +STOP_CHARGE_THRESH_BAT0=80 +''; } -- cgit v1.2.3 From 654262071f8b9f0c15704d4da195c60739707e4b Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Sun, 3 Jun 2018 01:31:17 +0200 Subject: Add the temporary fix for the cpu-throttling issue See https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues --- lenovo/thinkpad/x1/6th-gen/default.nix | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/default.nix b/lenovo/thinkpad/x1/6th-gen/default.nix index ea63de0..848cc00 100644 --- a/lenovo/thinkpad/x1/6th-gen/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/default.nix @@ -1,3 +1,4 @@ +{ config, pkgs, ... }: { imports = [ ../. @@ -17,4 +18,41 @@ START_CHARGE_THRESH_BAT0=75 STOP_CHARGE_THRESH_BAT0=80 ''; + + # Temporary fix for cpu throttling issues visible in the kernel log + # (journalctl -k) by setting the same temperature limits used by + # Window$ + # See https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues + systemd.services.cpu-throttling = { + enable = true; + description = "Sets the offset to 3 °C, so the new trip point is 97 °C"; + documentation = [ + "https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues" + ]; + path = [ pkgs.msr-tools ]; + script = "wrmsr -a 0x1a2 0x3000000"; + serviceConfig = { + Type = "oneshot"; + }; + wantedBy = [ + "timers.target" + ]; + }; + + systemd.timers.cpu-throttling = { + enable = true; + description = "Set cpu heating limit to 97 °C"; + documentation = [ + "https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues" + ]; + timerConfig = { + OnActiveSec = 60; + OnUnitActiveSec = 60; + Unit = "cpu-throttling.service"; + }; + wantedBy = [ + "timers.target" + ]; + }; + } -- cgit v1.2.3 From 179bcde845464be4f21e4b170877e3ef61fec2b3 Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Sun, 3 Jun 2018 01:32:16 +0200 Subject: Add stub for the S3 suspend state issue See https://delta-xi.net/#056 --- lenovo/thinkpad/x1/6th-gen/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/default.nix b/lenovo/thinkpad/x1/6th-gen/default.nix index 848cc00..c0b4fbd 100644 --- a/lenovo/thinkpad/x1/6th-gen/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/default.nix @@ -55,4 +55,14 @@ STOP_CHARGE_THRESH_BAT0=80 ]; }; + # Enable S3 suspend state: you have to manually follow the + # instructions shown here: https://delta-xi.net/#056 in order to + # produce the ACPI patched table. Put the CPIO archive in /boot and + # then enable the following lines + # boot.kernelParams = [ + # "mem_sleep_default=deep" + # ]; + # boot.initrd.prepend = [ + # "/boot/acpi_override" + # ]; } -- cgit v1.2.3 From b42212f6f0c617e7bbe0435fbb9e072545508521 Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Sun, 3 Jun 2018 01:33:21 +0200 Subject: Add a bit of documentation --- lenovo/thinkpad/x1/6th-gen/default.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/default.nix b/lenovo/thinkpad/x1/6th-gen/default.nix index c0b4fbd..7044d28 100644 --- a/lenovo/thinkpad/x1/6th-gen/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/default.nix @@ -1,3 +1,8 @@ +# A good source of information about how to fix the issues still +# standing with kernel 4.6.11 is the following wiki page: +# https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6). The +# TrackPoint and TouchPad issues there seem to have been fixed already. + { config, pkgs, ... }: { imports = [ -- cgit v1.2.3 From b132065a431e73410cbca167118ab353647c47d6 Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Sun, 3 Jun 2018 01:33:37 +0200 Subject: Cosmetic --- lenovo/thinkpad/x1/6th-gen/QHD/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix index 6b53d5e..86b2eb4 100644 --- a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix @@ -5,7 +5,7 @@ imports = [ ../. ]; - # fix font sizes in X + # Fix font sizes in X services.xserver.dpi = 210; fonts.fontconfig.dpi = 210; } -- cgit v1.2.3 From 32a7893b8c3068a32f42eab45f08faebd3a16359 Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Sun, 3 Jun 2018 01:55:59 +0200 Subject: Set a default to fix GTK/GNOME ui elements appareance --- lenovo/thinkpad/x1/6th-gen/QHD/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix index 86b2eb4..f99326a 100644 --- a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix @@ -1,11 +1,18 @@ # X1 6th generation with a QHD (2560x1440px) display -{ config, ... }: +{ config, lib, ... }: { imports = [ ../. ]; + # Fix font sizes in X services.xserver.dpi = 210; fonts.fontconfig.dpi = 210; + + # Fix sizes of GTK/GNOME ui elements + environment.variables = { + GDK_SCALE = lib.mkDefault "2"; + GDK_DPI_SCALE= lib.mkDefault "0.5"; + }; } -- cgit v1.2.3 From 7a640afbb236b093794364f7e3d718fa15832cef Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Tue, 17 Jul 2018 17:44:31 +0200 Subject: Add optional console font configuration to make it readable on QHD displays --- lenovo/thinkpad/x1/6th-gen/QHD/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix index f99326a..257b9a0 100644 --- a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix @@ -15,4 +15,22 @@ GDK_SCALE = lib.mkDefault "2"; GDK_DPI_SCALE= lib.mkDefault "0.5"; }; + # Enable readable font on console. The example configuration that + # foollows is taliored towards western languages. To see how to + # configure the font download the source tarball from + # http://terminus-font.sourceforge.net/ and read the README file on + # the root dir + + # i18n = { + # # this means ISO8859-1 or ISO8859-15 or Windows-1252 codepages + # # (ter-1), 16x32 px (32), normal font weight (n) + # consoleFont = "ter-132n"; + # consoleKeyMap = "us"; + # defaultLocale = "en_US.UTF-8"; + # consolePackages = [ pkgs.terminus_font ]; + # }; + + # Early configure the console to make the font readable from the + # start + # boot.earlyVconsoleSetup = true; } -- cgit v1.2.3 From a3210f1d6bf3fda69c6c190fa899699d9999d2fb Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Tue, 17 Jul 2018 17:53:53 +0200 Subject: Fix typo --- lenovo/thinkpad/x1/6th-gen/QHD/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix index 257b9a0..599e1e5 100644 --- a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix @@ -16,7 +16,7 @@ GDK_DPI_SCALE= lib.mkDefault "0.5"; }; # Enable readable font on console. The example configuration that - # foollows is taliored towards western languages. To see how to + # follows is taliored towards western languages. To see how to # configure the font download the source tarball from # http://terminus-font.sourceforge.net/ and read the README file on # the root dir -- cgit v1.2.3 From b84f46f208d215f429fa9884db1753148bb36c1c Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Tue, 17 Jul 2018 18:55:21 +0200 Subject: Add missing pkgs parameter --- lenovo/thinkpad/x1/6th-gen/QHD/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix index 599e1e5..0b8555f 100644 --- a/lenovo/thinkpad/x1/6th-gen/QHD/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/QHD/default.nix @@ -1,5 +1,5 @@ # X1 6th generation with a QHD (2560x1440px) display -{ config, lib, ... }: +{ config, lib, pkgs, ... }: { imports = [ -- cgit v1.2.3 From 4428c70b17e47cff73c05ca9459a0f146b712ba6 Mon Sep 17 00:00:00 2001 From: Alberto Berti Date: Sat, 21 Jul 2018 21:20:25 +0200 Subject: Enable powersave features when on battery (taken from #60) --- lenovo/thinkpad/x1/6th-gen/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lenovo') diff --git a/lenovo/thinkpad/x1/6th-gen/default.nix b/lenovo/thinkpad/x1/6th-gen/default.nix index 7044d28..b28fb5b 100644 --- a/lenovo/thinkpad/x1/6th-gen/default.nix +++ b/lenovo/thinkpad/x1/6th-gen/default.nix @@ -20,9 +20,11 @@ # See https://linrunner.de/en/tlp/docs/tlp-faq.html#battery services.tlp.extraConfig = '' -START_CHARGE_THRESH_BAT0=75 -STOP_CHARGE_THRESH_BAT0=80 -''; + START_CHARGE_THRESH_BAT0=75 + STOP_CHARGE_THRESH_BAT0=80 + CPU_SCALING_GOVERNOR_ON_BAT=powersave + ENERGY_PERF_POLICY_ON_BAT=powersave + ''; # Temporary fix for cpu throttling issues visible in the kernel log # (journalctl -k) by setting the same temperature limits used by -- cgit v1.2.3