From 9e7fffdd5b8018c88c63e41387514cb0b8777aa7 Mon Sep 17 00:00:00 2001 From: Reno Reckling Date: Mon, 2 Sep 2019 19:11:30 +0200 Subject: [PATCH 1/2] Add better pulseaudio support for thinkpad t490 --- lenovo/thinkpad/t490/default.nix | 30 ++++++ lenovo/thinkpad/t490/t490-profile-set.conf | 107 +++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 lenovo/thinkpad/t490/default.nix create mode 100644 lenovo/thinkpad/t490/t490-profile-set.conf diff --git a/lenovo/thinkpad/t490/default.nix b/lenovo/thinkpad/t490/default.nix new file mode 100644 index 0000000..e795aa7 --- /dev/null +++ b/lenovo/thinkpad/t490/default.nix @@ -0,0 +1,30 @@ +{ nixos, pkgs, config, stdenv, ... }: +{ + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop/acpi_call.nix + ../../../common/pc/laptop/cpu-throttling-bug.nix + ../. + ]; + + services = { + # This fixes the pulseaudio profiles of the Thinkpad T490. + # The laptop contains a single audio card with 5 sub-devices. Default pulseaudio only offers a single sink + # which can only be switched between speaker/HDMI via a manual profile change. + # This configures a profile set for pulseaudio which offers multiple sinks corresponding to the + # speaker + 4 HDMI ports. This allows the user to play audio streams on the speaker and any of the 4 HDMI/USB-C + # ports at the same time. + udev.extraRules = let + t490ProfileSet = ./t490-profile-set.conf; + in '' + SUBSYSTEM!="sound", GOTO="pulseaudio_end" + ACTION!="change", GOTO="pulseaudio_end" + KERNEL!="card*", GOTO="pulseaudio_end" + + # Lenovo T490 + ATTRS{subsystem_vendor}=="0x17aa", ATTRS{subsystem_device}=="0x2279", ENV{PULSE_PROFILE_SET}="${t490ProfileSet}" + + LABEL="pulseaudio_end" + ''; + }; +} diff --git a/lenovo/thinkpad/t490/t490-profile-set.conf b/lenovo/thinkpad/t490/t490-profile-set.conf new file mode 100644 index 0000000..98f8f03 --- /dev/null +++ b/lenovo/thinkpad/t490/t490-profile-set.conf @@ -0,0 +1,107 @@ +[Profile speaker+hdmi-stereo] +description = Speaker + HDMI Stereo +output-mappings = analog-stereo hdmi-stereo hdmi-stereo-extra1 hdmi-stereo-extra2 +input-mappings = analog-stereo + +[Mapping analog-stereo] +device-strings = front:%f +channel-map = left,right +paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2 +paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic +priority = 15 + +[Mapping hdmi-stereo] +description = Stereo (HDMI) +device-strings = hdmi:%f +paths-output = hdmi-output-0 +channel-map = left,right +priority = 6 +direction = output + +[Mapping hdmi-stereo-extra1] +description = Stereo (HDMI 2) +device-strings = hdmi:%f,1 +paths-output = hdmi-output-1 +channel-map = left,right +priority = 8 +direction = output + +[Mapping hdmi-stereo-extra2] +description = Stereo (HDMI 3) +device-strings = hdmi:%f,2 +paths-output = hdmi-output-2 +channel-map = left,right +priority = 6 +direction = output + +[Profile speaker+hdmi-surround] +description = Speaker + HDMI 5.1 +output-mappings = analog-stereo hdmi-surround hdmi-surround-extra1 hdmi-surround-extra2 +input-mappings = analog-stereo + +[Mapping analog-stereo] +device-strings = front:%f +channel-map = left,right +paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2 +paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic +priority = 15 + +[Mapping hdmi-surround] +description = Digital Surround 5.1 (HDMI) +device-strings = hdmi:%f +paths-output = hdmi-output-0 +channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe +priority = 6 +direction = output + +[Mapping hdmi-surround-extra1] +description = Digital Surround 5.1 (HDMI 2) +device-strings = hdmi:%f,1 +paths-output = hdmi-output-1 +channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe +priority = 8 +direction = output + +[Mapping hdmi-surround-extra2] +description = Digital Surround 5.1 (HDMI 3) +device-strings = hdmi:%f,2 +paths-output = hdmi-output-2 +channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe +priority = 6 +direction = output + +[Profile speaker+hdmi-surround71] +description = Speaker + HDMI 7.1 +output-mappings = analog-stereo hdmi-surround71 hdmi-surround71-extra1 hdmi-surround71-extra2 +input-mappings = analog-stereo + +[Mapping analog-stereo] +device-strings = front:%f +channel-map = left,right +paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2 +paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic +priority = 15 + +[Mapping hdmi-surround71] +description = Digital Surround 7.1 (HDMI) +device-strings = hdmi:%f +paths-output = hdmi-output-0 +channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right +priority = 6 +direction = output + +[Mapping hdmi-surround71-extra1] +description = Digital Surround 7.1 (HDMI 2) +device-strings = hdmi:%f,1 +paths-output = hdmi-output-1 +channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right +priority = 8 +direction = output + +[Mapping hdmi-surround71-extra2] +description = Digital Surround 7.1 (HDMI 3) +device-strings = hdmi:%f,2 +paths-output = hdmi-output-2 +channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right +priority = 6 +direction = output From 5932cef1b9a45f97c5846f376a4252c49adf7a27 Mon Sep 17 00:00:00 2001 From: Reno Reckling Date: Tue, 3 Sep 2019 20:08:01 +0200 Subject: [PATCH 2/2] update readme for T490 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fbe9ff6..66ccdf7 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ imports = [ | Lenovo ThinkPad T460s | `` | | Lenovo ThinkPad T470s | `` | | Lenovo ThinkPad T480s | `` | +| Lenovo ThinkPad T490 | `` | | Lenovo ThinkPad X140e | `` | | Lenovo ThinkPad X220 | `` | | Lenovo ThinkPad X230 | `` |