From ee94f43c05e80c7a7e5d94ec78426f2bc92a63dd Mon Sep 17 00:00:00 2001 From: Bu Kun <65808665+pokon548@users.noreply.github.com> Date: Sun, 18 May 2025 17:23:47 +0800 Subject: [PATCH] Add Lenovo Ideapad 5 Pro 14IMH9 / XiaoXin Pro 14IMH9 2024 --- README.md | 2 + flake.nix | 1 + lenovo/ideapad/14imh9/README.md | 16 +++++ lenovo/ideapad/14imh9/default.nix | 110 ++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+) create mode 100644 lenovo/ideapad/14imh9/README.md create mode 100644 lenovo/ideapad/14imh9/default.nix diff --git a/README.md b/README.md index cbc8896d..a329894f 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,7 @@ See code for all available configurations. | [Lenovo IdeaPad 3 15alc6](lenovo/ideapad/15alc6) | `` | | [Lenovo IdeaPad Gaming 3 15arh05](lenovo/ideapad/15arh05) | `` | | [Lenovo IdeaPad Gaming 3 15ach6](lenovo/ideapad/15ach6) | `` | +| [Lenovo IdeaPad 5 Pro 14imh9](lenovo/ideapad/14imh9) | `` | | [Lenovo IdeaPad 5 Pro 16ach6](lenovo/ideapad/16ach6) | `` | | [Lenovo IdeaPad Z510](lenovo/ideapad/z510) | `` | | [Lenovo IdeaPad Slim 5](lenovo/ideapad/slim-5) | `` | @@ -324,6 +325,7 @@ See code for all available configurations. | [Lenovo ThinkPad Z Series](lenovo/thinkpad/z) | `` | | [Lenovo ThinkPad Z13 Gen 1](lenovo/thinkpad/z/gen1/z13) | `` | | [Lenovo ThinkPad Z13 Gen 2](lenovo/thinkpad/z/gen2/z13) | `` | +| [Lenovo XiaoXin Pro 14imh9 2024](lenovo/ideapad/14imh9) | `` | | [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `` | | [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/amdgpu) | `` | | [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/nvidia) | `` | diff --git a/flake.nix b/flake.nix index 9d3dacb2..a091503f 100644 --- a/flake.nix +++ b/flake.nix @@ -153,6 +153,7 @@ hp-notebook-14-df0023 = import ./hp/notebook/14-df0023; intel-nuc-8i7beh = import ./intel/nuc/8i7beh; lenovo-ideacentre-k330 = import ./lenovo/ideacentre/k330; + lenovo-ideapad-14imh9 = import ./lenovo/ideapad/14imh9; lenovo-ideapad-15alc6 = import ./lenovo/ideapad/15alc6; lenovo-ideapad-15arh05 = import ./lenovo/ideapad/15arh05; lenovo-ideapad-15ach6 = import ./lenovo/ideapad/15ach6; diff --git a/lenovo/ideapad/14imh9/README.md b/lenovo/ideapad/14imh9/README.md new file mode 100644 index 00000000..f3950701 --- /dev/null +++ b/lenovo/ideapad/14imh9/README.md @@ -0,0 +1,16 @@ +# Lenovo Ideapad 5 Pro 14IMH9 / XiaoXin Pro 14IMH9 2024 + +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. + +`lspci`: +``` +00:02.0 VGA compatible controller: Intel Corporation Meteor Lake-P [Intel Arc Graphics] (rev 08) +``` +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). + +## Extra Configuration +### Bluetooth +To enable bluetooth support, set `hardware.bluetooth.enable = true;`. + +### Sound +This laptop need extra firmware for hi-quality sound. To enable that, set `hardware.firmware = [ pkgs.sof-firmware ];`. \ No newline at end of file diff --git a/lenovo/ideapad/14imh9/default.nix b/lenovo/ideapad/14imh9/default.nix new file mode 100644 index 00000000..f2bb0f52 --- /dev/null +++ b/lenovo/ideapad/14imh9/default.nix @@ -0,0 +1,110 @@ +{ lib, pkgs, ... }: + +{ + imports = [ + ../../../common/cpu/intel/meteor-lake + ../../../common/pc/laptop + ../../../common/pc/ssd + ]; + + boot = { + # Workaround: Out of the box, resuming from hibernation will break sounds. + # See https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/766 + extraModprobeConfig = '' + options snd-hda-intel model=generic + options snd-hda-intel snd-intel-dspcfg.dsp_driver=1 + blacklist snd_soc_skl + ''; + + kernelParams = [ + # Workaround: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe A + # See https://www.dedoimedo.com/computers/intel-microcode-atomic-update.html + "i915.enable_psr=0" + + # Workaround: Seems like guc on VT-d is faulty and may also cause GUC: TLB invalidation response timed out. + # It will cause random gpu resets under hw video decoding. + # See https://wiki.archlinux.org/title/Dell_XPS_16_(9640)#Random_freezes + "iommu.strict=1" + "iommu.passthrough=1" + ]; + }; + + environment.variables = { + # Workaround: GPU HANG: ecode 12:1:85dffdfb, in CanvasRenderer [4408] + # See https://gitlab.freedesktop.org/mesa/mesa/-/issues/7755 + INTEL_DEBUG = "no32"; + }; + + systemd = { + # Workaround: Sometimes xhci driver will become malfunctional after resuming from hibernate / suspend. + # This will cause (almost) all external devices stop working. + # A simple reset is enough to bring external devices alive :) + # + # Note: to avoid unnecessary resets, we firstly check if integrated camera is presented + # (Should always be there as it was built into machine!). + # If not, just do the reset. + services.workaround-reset-xhci-driver-after-resume-if-needed = { + script = '' + result=$(${pkgs.usbutils}/bin/lsusb | ${pkgs.gnugrep}/bin/grep Chicony) + if [[ -z $result ]]; then + ${pkgs.kmod}/bin/rmmod xhci_pci xhci_hcd + ${pkgs.kmod}/bin/modprobe xhci_pci xhci_hcd + fi + ''; + after = [ + "suspend.target" + "hibernate.target" + "hybrid-sleep.target" + ]; + wantedBy = [ + "suspend.target" + "hibernate.target" + "hybrid-sleep.target" + "multi-user.target" + ]; + }; + + # Workaround: Lenovo seems write bad acpi power management firmware. Without this config, + # suspend (to ram / disk) will simply reboot instead of power off. :( + sleep.extraConfig = '' + HibernateMode=shutdown + ''; + }; + + # TPM2 module + security.tpm2.enable = lib.mkDefault true; + + hardware = { + enableRedistributableFirmware = lib.mkDefault true; # WiFi + + # Workaround: Lenovo wrote bad screen edid firmware that will cause system + # not able to use 120Hz screen fresh rate. + # Manually patch it with correct value fixes this problem. + # + # TODO: This laptop actually support VRR (Variable refresh rate). + # But I do not have any interests in supporting this. + # PR is welecomed :) + display = { + edid.packages = [ + (pkgs.runCommand "edid-14imh9" { } '' + mkdir -p "$out/lib/firmware/edid" + base64 -d > "$out/lib/firmware/edid/14imh9.bin" <<'EOF' + AP///////wAObxYUAAAAAAAgAQS1HhN4AyEVqFNJnCUPUFQAAAABAQEBAQEBAQEBAQEBAQEBzodAoLAIanAwIDYALbwQAAAYAAAA/QAoeOXlRgEKICAgICAgAAAA/gBDU09UIFQzCiAgICAgAAAA/gBNTkUwMDdaQTEtNQogAa9wE3kAAAMBFJoPAQU/C58ALwAfAAcHaQACAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4kA== + EOF + '') + ]; + + outputs = { + "eDP-1".edid = "14imh9.bin"; + }; + }; + + i2c.enable = lib.mkDefault true; # Touchpad + }; + + services = { + fwupd.enable = lib.mkDefault true; # Firmware Upgrades. Partially supported. + hardware.bolt.enable = lib.mkDefault true; # Thunderbolt + thermald.enable = lib.mkDefault true; # This will save you money and possibly your life! + }; +}