User:Nathanlkoch/Tutorials/Lenovo/Hardware/X1Carbon5thGen

From Gentoo Wiki
Jump to:navigation Jump to:search

Lenovo X1 Carbon 5th Gen

Kernel Config

The following Kernel conf will enable all features on the Lenovo X1 Carbon Gen 5 with Docking support.

FILE /etc/modprobe.d/i915.conf
options i915 enable_fbc=1 enable_guc=1

Kernel config is for 6.2 Kernel. https://kernel.org/ tarballs work with genkernel.

root #emerge --ask sys-kernel/linux-firmware
FILE /etc/genkernel.conf
COMPRESS_INITRD_TYPE="lz4"

LZ4 is way faster.

Use genkernel as per usual, loading the kernel file submitted.

Xorg - Acceleration

FILE /etc/portage/make.conf
VIDEO_CARDS="iris intel"
USE="vaapi vdpau opencl opengl gles3 vulkan"

The Iris driver works on the 9th Gen Skylake Intel Graphics. Use it.

root #emerge -av media-libs/libva-intel-media-driver
root #emerge -av media-libs/vulkan-loader
FILE /etc/environment
export LIBVA_DRIVERS_PATH=/usr/lib64/va/drivers/
export LIBVA_DRIVER_NAME=iHD

Hardware decoding of Video.

FILE /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
        Identifier  "Intel Graphics"
        Driver      "intel"
        Option      "AccelMethod"    "sna"
        Option      "DRI"         "iris"
        Option      "TripleBuffer" "true"
#      Option      "TearFree"     "true"
EndSection
FILE /etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
   Option "DPMS" "true"
EndSection

Audio

Install EasyEffects

root #emerge -av media-sound/easyeffects

Install EasyEffects Presets

The Laptop Speakers one sounds way better. Da bass!

Thunderbolt

root #emerge -av sys-apps/thunderbolt-software-user-space

Userspace Thunderbolt for Docks and GPUs. Increased graphics performance visible.

Lenovo-UserAuth.png

Enable Passthrough

Bluetooth

The following settings will enable fastconnect and battery polling for devices.

FILE /etc/bluetooth/main.conf
Experimental=true
FastConnectable = true

Systemd services for Laptops

root #emerge -av app-laptop/laptop-mode-tools
root #emerge -av sys-power/thermald
root #systemctl enable --now thermald
root #systemctl enable --now laptop-mode

Laptop mode tools on Gentoo doesn't come with default config files.

You can grab them here https://github.com/rickysarraf/laptop-mode-tools/tree/lmt-upstream/etc/laptop-mode/conf.d

Place them in /etc/laptop-mode/conf.d/ as needed.

Optionally I would add tlp to sqeeze as much out of the battery as you can...

root #emerge -av sys-power/tlp
root #systemctl enable --now tlp
root #systemctl mask systemd-rfkill.service
root #systemctl mask systemd-rfkill.socket

You will need to adjust /etc/tlp.conf to your liking... I would recommend lowering the amount of cores used, disabling turbo boost, changing p_state scheduling, changing max frequency, slowing down nvme performance, auto enabling and disabling devices. I use my system docked most of the time. For people who run mobile a majority of the time this probably isn't recommended.

My tlp.conf. https://raw.githubusercontent.com/anathonous/Lenovo/main/Hardware/X1C5thGen/tlp.conf

Do not uncomment CPU_SCALING_FREQ in the tlp.conf it will scale to 400Mhz and you will have a bad time.

Also TLP changes my IO to DISK_IOSCHED="bfq bfq" which shows a huge performance increase.

Also you will want to enable proper thermal control.

root #emerge -av sys-apps/lm-sensors
root #sensors-detect
root #systemctl enable --now lm_sensors

This should get you up and running with proper power saving features.

Battery

With the following settings. I am getting a calculated estimate power expectancy of 10 to 9 hours.