Skip to content

Conversation

ventureoo
Copy link
Member

Somehow, disabling power saving for NVIDIA audio device also prevents the dGPU from going into sleep mode.

See: #147 (comment)

Somehow, disabling power saving for NVIDIA audio device also prevents
the dGPU from going into sleep mode.

Signed-off-by: Vasiliy Stelmachenok <[email protected]>
@djkrnl
Copy link

djkrnl commented Jun 7, 2025

Happy to confirm that this fixes the issue :)
I'm equally surprised that RTD3 is THAT fragile...

@ventureoo
Copy link
Member Author

Happy to confirm that this fixes the issue :)

Nice, thanks for the quick report and testing!

I'm equally surprised that RTD3 is THAT fragile...

Yeah, it's a bit upsetting, but as it is...

@ventureoo ventureoo marked this pull request as ready for review June 7, 2025 16:41
@ventureoo ventureoo merged commit b1d7790 into master Jun 7, 2025
@asumagic
Copy link

asumagic commented Jun 7, 2025

FWIW I independently found #147 broke D3 for my GPU too - except I have an AMD 7900XT, not an NVIDIA GPU. So it affected AMD GPUs as well...

Mentioning this for the changelog, but that's not super important :)

@asumagic
Copy link

asumagic commented Jun 7, 2025

Oh wait -- I didn't actually try this PR, only removed the original file (as I don't use intel audio anyway). The workaround seems to exclude only NVIDIA GPUs, this is wrong for the reason above...

I don't have any such hardware to test, but maybe it might cause issues for intel dGPU HDMI audio?

@ventureoo
Copy link
Member Author

Oh wait -- I didn't actually try this PR, only removed the original file (as I don't use intel audio anyway). The workaround seems to exclude only NVIDIA GPUs, this is wrong for the reason above...

I don't have any such hardware to test, but maybe it might cause issues for intel dGPU HDMI audio?

Can you please share output of cat /sys/module/snd_hda_intel/drivers/*/*/class?

@asumagic
Copy link

asumagic commented Jun 7, 2025

Oh wait -- I didn't actually try this PR, only removed the original file (as I don't use intel audio anyway). The workaround seems to exclude only NVIDIA GPUs, this is wrong for the reason above...
I don't have any such hardware to test, but maybe it might cause issues for intel dGPU HDMI audio?

Can you please share output of cat /sys/module/snd_hda_intel/drivers/*/*/class?

0x040300
0x040300

The issue is, one appears to match the AMD GPU, and one is for my intel 265K desktop CPU...

(EDIT: Ah, sorry, the PR's udev rules do indeed check the vendor - I've probably misunderstood why you wanted to check the class.)

See:

$ cat /sys/module/snd_hda_intel/drivers/pci:snd_hda_intel/0000:04:00.1/vendor
0x1002
$ cat /sys/module/snd_hda_intel/drivers/pci:snd_hda_intel/0000:80:1f.3/vendor
0x8086

0x1002 being AMD and 0x8086 being intel.

It seems like that on my system the 80:1f.3 device is indeed the onboard audio seeing as my only "audio device"s in lspci are this one and the AMD dGPU:

04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 HDMI/DP Audio
80:1f.3 Audio device: Intel Corporation Device 7f50 (rev 10)

@ventureoo
Copy link
Member Author

ventureoo commented Jun 7, 2025

Oh wait -- I didn't actually try this PR, only removed the original file (as I don't use intel audio anyway). The workaround seems to exclude only NVIDIA GPUs, this is wrong for the reason above...
I don't have any such hardware to test, but maybe it might cause issues for intel dGPU HDMI audio?

Can you please share output of cat /sys/module/snd_hda_intel/drivers/*/*/class?

0x040300
0x040300

The issue is, one appears to match the AMD GPU, and one is for my intel 265K desktop CPU... See:

$ cat /sys/module/snd_hda_intel/drivers/pci:snd_hda_intel/0000:04:00.1/vendor
0x1002
$ cat /sys/module/snd_hda_intel/drivers/pci:snd_hda_intel/0000:80:1f.3/vendor
0x8086

0x1002 being AMD and 0x8086 being intel.

It seems like that on my system the 80:1f.3 device is indeed the onboard audio seeing as my only "audio device"s in lspci are this one and the AMD dGPU:

04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 HDMI/DP Audio
80:1f.3 Audio device: Intel Corporation Device 7f50 (rev 10)

I see, thank you. Could you also check if the problem is present if change values as in this diff:

diff --git a/usr/lib/modprobe.d/20-audio-pm.conf b/usr/lib/modprobe.d/20-audio-pm.conf
index 761a2fa..1a0d1b9 100644
--- a/usr/lib/modprobe.d/20-audio-pm.conf
+++ b/usr/lib/modprobe.d/20-audio-pm.conf
@@ -2,4 +2,4 @@
 # running on battery power. This is needed because it prevents audio cracks on
 # some hardware. If device starts working on battery power, same named udev rule
 # re-enables power saving.
-options snd_hda_intel power_save_controller=N
+options snd_hda_intel power_save=0
diff --git a/usr/lib/udev/rules.d/20-audio-pm.rules b/usr/lib/udev/rules.d/20-audio-pm.rules
index fa4f11c..b0f88a0 100644
--- a/usr/lib/udev/rules.d/20-audio-pm.rules
+++ b/usr/lib/udev/rules.d/20-audio-pm.rules
@@ -2,7 +2,7 @@
 # running on battery power. This is needed because it prevents audio cracks on
 # some hardware.
 SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", TEST=="/sys/module/snd_hda_intel", \
-    RUN+="/bin/sh -c 'echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller'"
+    RUN+="/bin/sh -c 'echo 0 > /sys/module/snd_hda_intel/parameters/power_save'"

 SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", TEST=="/sys/module/snd_hda_intel", \
-    RUN+="/bin/sh -c 'echo $(grep -w -q 0x10de /sys/module/snd_hda_intel/drivers/*/*/vendor && echo Y || echo N) > /sys/module/snd_hda_intel/parameters/power_save_controller'"
+    RUN+="/bin/sh -c 'echo 10 > /sys/module/snd_hda_intel/parameters/power_save'"

@asumagic
Copy link

asumagic commented Jun 7, 2025

snip

I see, thank you. Could you also check if the problem is present if change values as in this diff:

diff --git a/usr/lib/modprobe.d/20-audio-pm.conf b/usr/lib/modprobe.d/20-audio-pm.conf
index 761a2fa..1a0d1b9 100644
--- a/usr/lib/modprobe.d/20-audio-pm.conf
+++ b/usr/lib/modprobe.d/20-audio-pm.conf
@@ -2,4 +2,4 @@
 # running on battery power. This is needed because it prevents audio cracks on
 # some hardware. If device starts working on battery power, same named udev rule
 # re-enables power saving.
-options snd_hda_intel power_save_controller=N
+options snd_hda_intel power_save=0
diff --git a/usr/lib/udev/rules.d/20-audio-pm.rules b/usr/lib/udev/rules.d/20-audio-pm.rules
index fa4f11c..b0f88a0 100644
--- a/usr/lib/udev/rules.d/20-audio-pm.rules
+++ b/usr/lib/udev/rules.d/20-audio-pm.rules
@@ -2,7 +2,7 @@
 # running on battery power. This is needed because it prevents audio cracks on
 # some hardware.
 SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", TEST=="/sys/module/snd_hda_intel", \
-    RUN+="/bin/sh -c 'echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller'"
+    RUN+="/bin/sh -c 'echo 0 > /sys/module/snd_hda_intel/parameters/power_save'"

 SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", TEST=="/sys/module/snd_hda_intel", \
-    RUN+="/bin/sh -c 'echo $(grep -w -q 0x10de /sys/module/snd_hda_intel/drivers/*/*/vendor && echo Y || echo N) > /sys/module/snd_hda_intel/parameters/power_save_controller'"
+    RUN+="/bin/sh -c 'echo 10 > /sys/module/snd_hda_intel/parameters/power_save'"

Applied this and rebooted, the problem seems to be solved.

(also double-checked my /etc for modprobe/udev to make sure I'm not overriding anything there -- seems good too.)

ventureoo added a commit that referenced this pull request Jun 7, 2025
My mistake was that I blindly trusted information on the Arch Wiki,
which mentions the power_save_controller parameter without noting that
power_save=0 is sufficient to solve the issues, and
power_save_controller=N breaks power management completely.

Fixes: #149 (comment)
Fixes: #147 (comment)

Signed-off-by: Vasiliy Stelmachenok <[email protected]>
@ventureoo
Copy link
Member Author

snip

I see, thank you. Could you also check if the problem is present if change values as in this diff:

diff --git a/usr/lib/modprobe.d/20-audio-pm.conf b/usr/lib/modprobe.d/20-audio-pm.conf
index 761a2fa..1a0d1b9 100644
--- a/usr/lib/modprobe.d/20-audio-pm.conf
+++ b/usr/lib/modprobe.d/20-audio-pm.conf
@@ -2,4 +2,4 @@
 # running on battery power. This is needed because it prevents audio cracks on
 # some hardware. If device starts working on battery power, same named udev rule
 # re-enables power saving.
-options snd_hda_intel power_save_controller=N
+options snd_hda_intel power_save=0
diff --git a/usr/lib/udev/rules.d/20-audio-pm.rules b/usr/lib/udev/rules.d/20-audio-pm.rules
index fa4f11c..b0f88a0 100644
--- a/usr/lib/udev/rules.d/20-audio-pm.rules
+++ b/usr/lib/udev/rules.d/20-audio-pm.rules
@@ -2,7 +2,7 @@
 # running on battery power. This is needed because it prevents audio cracks on
 # some hardware.
 SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", TEST=="/sys/module/snd_hda_intel", \
-    RUN+="/bin/sh -c 'echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller'"
+    RUN+="/bin/sh -c 'echo 0 > /sys/module/snd_hda_intel/parameters/power_save'"

 SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", TEST=="/sys/module/snd_hda_intel", \
-    RUN+="/bin/sh -c 'echo $(grep -w -q 0x10de /sys/module/snd_hda_intel/drivers/*/*/vendor && echo Y || echo N) > /sys/module/snd_hda_intel/parameters/power_save_controller'"
+    RUN+="/bin/sh -c 'echo 10 > /sys/module/snd_hda_intel/parameters/power_save'"

Applied this and rebooted, the problem seems to be solved.

(also double-checked my /etc for modprobe/udev to make sure I'm not overriding anything there -- seems good too.)

Thanks, looks like this should be finally fixed.

@sankix69
Copy link

sankix69 commented Jun 8, 2025

I'm a bit confused - as far as I understand, this udev rule is supposed to set power_save to 0 when the laptop is charging, and to 10 when running on battery.

However, on my system, when the laptop is charging, the output of cat /sys/module/snd_hda_intel/parameters/power_save is 10, and when it's not charging, the output is 0.

Isn't this reversed?

@ventureoo
Copy link
Member Author

I'm a bit confused - as far as I understand, this udev rule is supposed to set power_save to 0 when the laptop is charging, and to 10 when running on battery.

However, on my system, when the laptop is charging, the output of cat /sys/module/snd_hda_intel/parameters/power_save is 10, and when it's not charging, the output is 0.

Isn't this reversed?

Sorry, I was a bit tired last night, so I didn't notice. But anyway it's already fixed in 81a5ef2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants