4070 / 555 and 560 drivers wont stay in D3cold, Lenovo Legion Slim 5

Hi @raven2555 ,

From a fresh install of Arch using the latest version of Plasma with Wayland, the following is ALL that is required to get D3cold to function on a 16APH8 with latest BIOS. NOTE: Sometimes if I change performance profiles with FN+Q, I’ll find if I power up laptop it won’t go into D3cold, a reboot fixes this. Sometimes this happens from a cold boot with laptop off as well, a reboot fixes this.

Other advice I have found is incorrect and will result in a broken D3 state where the dGPU will not return to D3cold after it is accessed.

For working D3cold on dGPU, the following is required, functioning on Kernel 6.10.4-arch2-1 with Nvidia 555.58.02 drivers

(I need lib32-nvidia-utils for steam games, uncomment multilib in /etc/pacman.cfg)

sudo pacman -S nvidia-dkms nvidia-util nvidia-prime lib32-nvidia-utils

/etc/modprobe.d/nvidia.conf

options nvidia_drm modeset=1 fbdev=1
options nvidia NVreg_DynamicPowerManagementVideoMemoryThreshold=0

/etc/udev/rules.d/nvidia.rules

# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{remove}="1"

# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{remove}="1"

Enable NVIDIA power management

sudo systemctl enable --now nvidia-powerd

Need for CPU power management

# CPU power management in KDE.
sudo pacman -S power-profiles-daemon python-gobject
systemctl enable --now power-profiles-daemon

And that’s it, at 55% brightness 60Hz on battery I idle at less that 7W when power profile is set to power save in KDE. While watching a 1080p Youtube video, I’m sitting at roughly 10W.

I use the follow in KDE to automatically switch from 240Hz to 60Hz when off and on battery:

The following commands to switch refresh rate as above in the screenshot:

kscreen-doctor output.eDP-1.mode.2560x1600@240
kscreen-doctor output.eDP-1.mode.2560x1600@60

Note that sometimes eDP-1 can be different, find the correct output via:

kscreen-doctor -o

That’s it, fully functioning D3cold with 555 driver, any other config changes will break this, I’ve tried so many different things over a week long period that I lost track of config file changes. Note other software such as optimus-manager and TLP break this and leave config modifications lying around.

I wrote some C code (quick and dirty, don’t judge it) to use with the Command Output plasma widget which I have in my tray telling me what is going on with D3 states and also battery discharge/charge.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    FILE *fp = fopen("/sys/class/power_supply/ACAD/online","r");
    float bat;
    fscanf(fp, "%f", &bat);
    if (fp != NULL) {
        printf("%c", bat?'+':'-');
        fclose(fp);
    }
    else
        printf("ERROR reading battery");

    fp = NULL;
    fp = fopen("/sys/class/power_supply/BAT1/power_now","r");
    fscanf(fp, "%f", &bat);
    if (fp != NULL) {
        printf("%.2fW ", bat/1000000);
        fclose(fp);
    }
    else
        printf("ERROR reading battery");
    fp = NULL;
    fp = fopen("/sys/class/drm/card0/device/power_state","r");
    if (fp != NULL) {
        char videoStatus[1024];
        fscanf(fp,"%s",&videoStatus);
        printf("%s / ", videoStatus);
        fclose(fp);
    }
    else {
        printf("dGPU\n");
    }
    fp = NULL;
    fp = fopen("/sys/class/drm/card1/device/power_state","r");
    if (fp != NULL) {
        char videoStatus[1024];
        fscanf(fp,"%s",&videoStatus);
        printf("%s\n", videoStatus);
        fclose(fp);
    }
    else {
        printf("dGPU\n");
    }
    return 0;
}

gcc d3info.c -o d3info