Skip to content

Commit ee94f43

Browse files
committed
Add Lenovo Ideapad 5 Pro 14IMH9 / XiaoXin Pro 14IMH9 2024
1 parent e81fd16 commit ee94f43

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ See code for all available configurations.
215215
| [Lenovo IdeaPad 3 15alc6](lenovo/ideapad/15alc6) | `<nixos-hardware/lenovo/ideapad/15alc6>` |
216216
| [Lenovo IdeaPad Gaming 3 15arh05](lenovo/ideapad/15arh05) | `<nixos-hardware/lenovo/ideapad/15arh05>` |
217217
| [Lenovo IdeaPad Gaming 3 15ach6](lenovo/ideapad/15ach6) | `<nixos-hardware/lenovo/ideapad/15ach6>` |
218+
| [Lenovo IdeaPad 5 Pro 14imh9](lenovo/ideapad/14imh9) | `<nixos-hardware/lenovo/ideapad/14imh9>` |
218219
| [Lenovo IdeaPad 5 Pro 16ach6](lenovo/ideapad/16ach6) | `<nixos-hardware/lenovo/ideapad/16ach6>` |
219220
| [Lenovo IdeaPad Z510](lenovo/ideapad/z510) | `<nixos-hardware/lenovo/ideapad/z510>` |
220221
| [Lenovo IdeaPad Slim 5](lenovo/ideapad/slim-5) | `<nixos-hardware/lenovo/ideapad/slim-5>` |
@@ -324,6 +325,7 @@ See code for all available configurations.
324325
| [Lenovo ThinkPad Z Series](lenovo/thinkpad/z) | `<nixos-hardware/lenovo/thinkpad/z>` |
325326
| [Lenovo ThinkPad Z13 Gen 1](lenovo/thinkpad/z/gen1/z13) | `<nixos-hardware/lenovo/thinkpad/z/gen1/z13>` |
326327
| [Lenovo ThinkPad Z13 Gen 2](lenovo/thinkpad/z/gen2/z13) | `<nixos-hardware/lenovo/thinkpad/z/gen2/z13>` |
328+
| [Lenovo XiaoXin Pro 14imh9 2024](lenovo/ideapad/14imh9) | `<nixos-hardware/lenovo/ideapad/14imh9>` |
327329
| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `<nixos-hardware/lenovo/yoga/6/13ALC6>` |
328330
| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/amdgpu) | `<nixos-hardware/lenovo/yoga/7/14ARH7/amdgpu>` |
329331
| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/nvidia) | `<nixos-hardware/lenovo/yoga/7/14ARH7/nvidia>` |

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
hp-notebook-14-df0023 = import ./hp/notebook/14-df0023;
154154
intel-nuc-8i7beh = import ./intel/nuc/8i7beh;
155155
lenovo-ideacentre-k330 = import ./lenovo/ideacentre/k330;
156+
lenovo-ideapad-14imh9 = import ./lenovo/ideapad/14imh9;
156157
lenovo-ideapad-15alc6 = import ./lenovo/ideapad/15alc6;
157158
lenovo-ideapad-15arh05 = import ./lenovo/ideapad/15arh05;
158159
lenovo-ideapad-15ach6 = import ./lenovo/ideapad/15ach6;

lenovo/ideapad/14imh9/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Lenovo Ideapad 5 Pro 14IMH9 / XiaoXin Pro 14IMH9 2024
2+
3+
These devices support Conservation mode which charges the battery to 79/80%. See [TLP docs](https://linrunner.de/tlp/settings/bc-vendors.html#lenovo-non-thinkpad-series) and [auto-cpu freq](https://github.com/AdnanHodzic/auto-cpufreq?tab=readme-ov-file#battery-charging-thresholds) to enable it.
4+
5+
`lspci`:
6+
```
7+
00:02.0 VGA compatible controller: Intel Corporation Meteor Lake-P [Intel Arc Graphics] (rev 08)
8+
```
9+
There is no dedicated graphics card. See specs [here](https://psref.lenovo.com/syspool/Sys/PDF/IdeaPad/IdeaPad_Pro_5_14IMH9/IdeaPad_Pro_5_14IMH9_Spec.pdf).
10+
11+
## Extra Configuration
12+
### Bluetooth
13+
To enable bluetooth support, set `hardware.bluetooth.enable = true;`.
14+
15+
### Sound
16+
This laptop need extra firmware for hi-quality sound. To enable that, set `hardware.firmware = [ pkgs.sof-firmware ];`.

lenovo/ideapad/14imh9/default.nix

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{ lib, pkgs, ... }:
2+
3+
{
4+
imports = [
5+
../../../common/cpu/intel/meteor-lake
6+
../../../common/pc/laptop
7+
../../../common/pc/ssd
8+
];
9+
10+
boot = {
11+
# Workaround: Out of the box, resuming from hibernation will break sounds.
12+
# See https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/766
13+
extraModprobeConfig = ''
14+
options snd-hda-intel model=generic
15+
options snd-hda-intel snd-intel-dspcfg.dsp_driver=1
16+
blacklist snd_soc_skl
17+
'';
18+
19+
kernelParams = [
20+
# Workaround: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A
21+
# See https://www.dedoimedo.com/computers/intel-microcode-atomic-update.html
22+
"i915.enable_psr=0"
23+
24+
# Workaround: Seems like guc on VT-d is faulty and may also cause GUC: TLB invalidation response timed out.
25+
# It will cause random gpu resets under hw video decoding.
26+
# See https://wiki.archlinux.org/title/Dell_XPS_16_(9640)#Random_freezes
27+
"iommu.strict=1"
28+
"iommu.passthrough=1"
29+
];
30+
};
31+
32+
environment.variables = {
33+
# Workaround: GPU HANG: ecode 12:1:85dffdfb, in CanvasRenderer [4408]
34+
# See https://gitlab.freedesktop.org/mesa/mesa/-/issues/7755
35+
INTEL_DEBUG = "no32";
36+
};
37+
38+
systemd = {
39+
# Workaround: Sometimes xhci driver will become malfunctional after resuming from hibernate / suspend.
40+
# This will cause (almost) all external devices stop working.
41+
# A simple reset is enough to bring external devices alive :)
42+
#
43+
# Note: to avoid unnecessary resets, we firstly check if integrated camera is presented
44+
# (Should always be there as it was built into machine!).
45+
# If not, just do the reset.
46+
services.workaround-reset-xhci-driver-after-resume-if-needed = {
47+
script = ''
48+
result=$(${pkgs.usbutils}/bin/lsusb | ${pkgs.gnugrep}/bin/grep Chicony)
49+
if [[ -z $result ]]; then
50+
${pkgs.kmod}/bin/rmmod xhci_pci xhci_hcd
51+
${pkgs.kmod}/bin/modprobe xhci_pci xhci_hcd
52+
fi
53+
'';
54+
after = [
55+
"suspend.target"
56+
"hibernate.target"
57+
"hybrid-sleep.target"
58+
];
59+
wantedBy = [
60+
"suspend.target"
61+
"hibernate.target"
62+
"hybrid-sleep.target"
63+
"multi-user.target"
64+
];
65+
};
66+
67+
# Workaround: Lenovo seems write bad acpi power management firmware. Without this config,
68+
# suspend (to ram / disk) will simply reboot instead of power off. :(
69+
sleep.extraConfig = ''
70+
HibernateMode=shutdown
71+
'';
72+
};
73+
74+
# TPM2 module
75+
security.tpm2.enable = lib.mkDefault true;
76+
77+
hardware = {
78+
enableRedistributableFirmware = lib.mkDefault true; # WiFi
79+
80+
# Workaround: Lenovo wrote bad screen edid firmware that will cause system
81+
# not able to use 120Hz screen fresh rate.
82+
# Manually patch it with correct value fixes this problem.
83+
#
84+
# TODO: This laptop actually support VRR (Variable refresh rate).
85+
# But I do not have any interests in supporting this.
86+
# PR is welecomed :)
87+
display = {
88+
edid.packages = [
89+
(pkgs.runCommand "edid-14imh9" { } ''
90+
mkdir -p "$out/lib/firmware/edid"
91+
base64 -d > "$out/lib/firmware/edid/14imh9.bin" <<'EOF'
92+
AP///////wAObxYUAAAAAAAgAQS1HhN4AyEVqFNJnCUPUFQAAAABAQEBAQEBAQEBAQEBAQEBzodAoLAIanAwIDYALbwQAAAYAAAA/QAoeOXlRgEKICAgICAgAAAA/gBDU09UIFQzCiAgICAgAAAA/gBNTkUwMDdaQTEtNQogAa9wE3kAAAMBFJoPAQU/C58ALwAfAAcHaQACAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4kA==
93+
EOF
94+
'')
95+
];
96+
97+
outputs = {
98+
"eDP-1".edid = "14imh9.bin";
99+
};
100+
};
101+
102+
i2c.enable = lib.mkDefault true; # Touchpad
103+
};
104+
105+
services = {
106+
fwupd.enable = lib.mkDefault true; # Firmware Upgrades. Partially supported.
107+
hardware.bolt.enable = lib.mkDefault true; # Thunderbolt
108+
thermald.enable = lib.mkDefault true; # This will save you money and possibly your life!
109+
};
110+
}

0 commit comments

Comments
 (0)