- Existing guides
- Laptop speakers
- Hybernate/Sleep fix
- Enable freesync
- Fixing refresh rate for hybrid mode (Wayland)
- Lenovo Legion Linux is for various sensors, drivers, power modes, fan curves and other legion specific stuff.
- Plasma vantage is a plasma widget for controling Legion specific settings.
- https://github.com/cszach/linux-on-lenovo-legion?tab=readme-ov-file
To make laptop speakers have better quality (to match sound in Windows), you can extract impulse response information from Windows. I used this guide to extract .irs
file for my laptop, but any laptop works for this.
To use .irs file set up any kind of sound effects software with convolver (EasyEffects/JamesDSP/...) and import .irs file to the convolver. Longer .irs files (500ms+) create noticable playback delay. Personaly I use 100ms sample with fade in and fade out applied to the irs.
I've added my profile for easy effects. After importing it you need to manually add correct .irs file in the convolver.
By default, it may not suspend pc correctly, notifying it in dmesg
that it fails to unload Nvidia drivers. To fix you need to enable Nvidia suspend services. Source
sudo systemctl enable nvidia-suspend.service
sudo systemctl enable nvidia-hibernate.service
sudo systemctl enable nvidia-resume.service
This makes it more stable, but laptop sometimes can't resume from sleep if it's on battery.
sudo kernelstub -a "amdgpu.freesync_video=1"
Currently, AMD iGPU driver generates wrong EDID file (Extended Display Identification Data), but when on Nvidia graphics discrete mode (mux), or windows - it works correctly. This solution also often fixes missing resolutions or not working displays.
You can get it either from running discrete GPU mode and take it from /sys/class/drm/*/edid
. I added my laptop's EDID files.
Also it's possible to export it from Windows, but need to additionaly patch the file with updated checksum, or linux kernel wont load it.
- Use this script to list currently available display ports (disconnect external displays beforehand).
for p in /sys/class/drm/*/status; do con=${p%/status}; echo -n "${con#*/card?-}: "; cat $p; done
```sudo chmod +x /usr/local/bin/code
Find your laptop's display port name, mine was `eDP-1`, switching distros could change it.
#### 5.2 Placing EDID file
More info in [Arch wiki - Forcing modes and EDID](https://wiki.archlinux.org/title/kernel_mode_setting#Forcing_modes_and_EDID)
This works for Pop! OS (22.04) on Wayland.
- Place EDID file in `/usr/lib/firmware/edid` directory and add to kernel cmd
```sh
sudo cp from-linux.bin /usr/lib/firmware/edid/from-linux.bin
- Add EDID file in kernel boot options (either systemd-boot or edit grub, whichever you have) Systemd-boot:
sudo kernelstub -a "drm.edid_firmware=eDP-1:edid/from-linux.bin"
Grub:
sudo nvim /etc/default/grub
sudo update-grub
Ubuntu based distros use initramfs-tools, while others may use mkinitcpio.conf
Create hook file /etc/initramfs-tools/hooks/edid
sudo vim /etc/initramfs-tools/hooks/edid
Add this script
#!/bin/sh
PREREQ=""
prereqs() {
echo "$PREREQ"
}
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
copy_files() {
local src_dir="/lib/firmware/edid/"
local dest_dir="${DESTDIR}/usr/lib/firmware/edid/"
if [ -d "$src_dir" ]; then
mkdir -p "$dest_dir"
find "$src_dir" -type f | while read -r file; do
cp -a "$file" "$dest_dir"
done
fi
}
copy_files
Add execution rights for this hook:
sudo chmod +x edid
Update initramfs and reboot
sudo update-initramfs -u
sudo reboot
You need to edit your /etc/mkinitcpio.conf (e.g. via sudo nano /etc/mkinitcpio.conf) and add a new hook (I called it edid
at the very end of this line):
HOOKS=(base udev autodetect keyboard keymap modconf block filesystems fsck edid)
Now that mkinitpio will call our hook (edid), we need to actually create the hook. To do so, create the file /etc/initcpio/install/edid
and place this script inside:
#! /usr/bin/bash
build() {
msg ":: Copying EDIDs from /usr/lib/firmware/edid/"
add_file /usr/lib/firmware/edid/*
}
help() {
echo "This hook copies EDIDs into initramfs."
}
Add execution rights for this hook:
sudo chmod +x edid
Finally, invoke mkinitcpio and reboot:
sudo mkinitcpio -P
sudo reboot
You can also directly create new resolution mode in the grub/systemd-boot. You should't use this if EDID method works.
- systemd-boot:
sudo kernelstub -a "video=eDP-1:[email protected]"
Caution: after adding this custom profile, it started heavy flickering at 60hz and ghosting at 165hz after trying it once, even in Windows or BIOS afterwards!
To fix this:
- Revert resolution changes in grub/systemd-boot
- You can try this, but wont always work: Disable battery in bios / plug out battery, take out AC, hold power button for few seconds and wait a few minutes.
- I found that after reverting changes just using the pc eventually fixes itself, or leaving it off overnight.
This is not lenovo specific, but rather KDE+Brave. On shutdown/restart it doesn't kill brave correctly, losing the current session. Systemd methods doesn't work, but KDE hook works here.
mkdir -p ~/.config/plasma-workspace/shutdown/
cp pre-shutdown.sh ~/.config/plasma-workspace/shutdown/pre-shutdown.sh
chmod +x ~/.config/plasma-workspace/shutdown/pre-shutdown.sh
Optional: Go to Settings -> Autostart -> Logout script
to add it from settings app.