Added support for Lenovo Legion Slim 5 (16APH8)

Added PPD after researching the Framework laptops with AMD 7000 series
This commit is contained in:
Will Lucas 2023-12-28 10:41:41 -06:00 committed by mergify[bot]
parent f752581d67
commit c2f991b91e
4 changed files with 77 additions and 2 deletions

View file

@ -1,4 +1,4 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
# Sets the kernel version to the latest kernel to make the usage of the iGPU possible if your kernel version is too old # Sets the kernel version to the latest kernel to make the usage of the iGPU possible if your kernel version is too old
@ -10,7 +10,7 @@
boot = lib.mkMerge [ boot = lib.mkMerge [
(lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") { (lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") {
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
kernelParams = ["amdgpu.sg_display=0"]; kernelParams = ["amdgpu.sg_display=0"];
}) })
(lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.2") { (lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.2") {

View file

@ -97,6 +97,7 @@
lenovo-legion-16ach6h-nvidia = import ./lenovo/legion/16ach6h/nvidia; lenovo-legion-16ach6h-nvidia = import ./lenovo/legion/16ach6h/nvidia;
lenovo-legion-16achg6-hybrid = import ./lenovo/legion/16achg6/hybrid; lenovo-legion-16achg6-hybrid = import ./lenovo/legion/16achg6/hybrid;
lenovo-legion-16achg6-nvidia = import ./lenovo/legion/16achg6/nvidia; lenovo-legion-16achg6-nvidia = import ./lenovo/legion/16achg6/nvidia;
lenovo-legion-16aph8 = import ./lenovo/legion/16aph8;
lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6; lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6;
lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h; lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h;
lenovo-legion-y530-15ich = import ./lenovo/legion/15ich; lenovo-legion-y530-15ich = import ./lenovo/legion/15ich;

View file

@ -0,0 +1,38 @@
I was unable to get the hybrid settings working well with lightdm or sddm, but Optimus Sync
mode seems to work the best for me.
I am running the Linux 6.6 LTS kernel with KDE + SDDM, and it seems to be working well.
## hardware-configuration.nix
I have the following customizations added for my nvidia drivers.
```
hardware.nvidia = {
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
```
## Setup at the time of testing
### nix-info
```
$ nix-info -m
- system: `"x86_64-linux"`
- host os: `Linux 6.1.68, NixOS, 23.11 (Tapir), 23.11.20231220.d65bcea`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.18.1`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
```
### lspci
```
$ lspci
...
01:00.0 VGA compatible controller: NVIDIA Corporation AD107M [GeForce RTX 4060 Max-Q / Mobile] (rev a1)
...
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 (rev c2)
...
```

View file

@ -0,0 +1,36 @@
{ lib, pkgs, ... }:
{
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/amd
../../../common/gpu/nvidia
../../../common/pc/laptop
../../../common/pc/laptop/ssd
];
# Use latest LTS kernel for more Raphael fixes
boot = lib.mkMerge [
(lib.mkIf (lib.versionOlder pkgs.linux.version "6.6") {
kernelPackages = pkgs.linuxPackages_6_6;
kernelParams = ["amdgpu.sg_display=0"];
})
];
hardware.nvidia = {
modesetting.enable = lib.mkDefault true;
powerManagement.enable = lib.mkDefault false;
powerManagement.finegrained = lib.mkDefault false;
open = lib.mkDefault false;
prime = {
sync.enable = lib.mkDefault true;
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
services.power-profiles-daemon.enable = lib.mkDefault true;
}