Skip to content

udev: Skip audio power_save override for AMD HDA controllers (#204)#206

Closed
ptr1337 wants to merge 1 commit intomasterfrom
sound_powersave
Closed

udev: Skip audio power_save override for AMD HDA controllers (#204)#206
ptr1337 wants to merge 1 commit intomasterfrom
sound_powersave

Conversation

@ptr1337
Copy link
Copy Markdown
Member

@ptr1337 ptr1337 commented Feb 12, 2026

On AMD Strix/Krackan laptops, the audio controller shares a PCI bus with the GPU. Forcing power_save=0 keeps the codec in D0 state, causing audible electrical interference/buzzing during GPU and NVMe activity.

Restrict the power_save=0 override to Intel HDA controllers (vendor 0x8086), which are the hardware affected by the audio popping that this rule was designed to prevent. AMD HDA controllers now keep their default power_save behavior, allowing them to suspend when idle and eliminating the EMI noise.

Also guard the AC/battery power_supply rules on the flag file existence so they only fire on systems where the boot rule actually applied.

Closes #204

On AMD Strix/Krackan laptops, the audio controller shares a PCI bus with
the GPU. Forcing power_save=0 keeps the codec in D0 state, causing
audible electrical interference/buzzing during GPU and NVMe activity.

Restrict the power_save=0 override to Intel HDA controllers
(vendor 0x8086), which are the hardware affected by the audio popping
that this rule was designed to prevent. AMD HDA controllers now keep
their default power_save behavior, allowing them to suspend when idle
and eliminating the EMI noise.

Also guard the AC/battery power_supply rules on the flag file existence
so they only fire on systems where the boot rule actually applied.

Closes #204

Signed-off-by: Peter Jung <admin@ptr1337.dev>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the snd_hda_intel udev power-management behavior to avoid forcing power_save=0 on AMD HDA controllers (reported to cause EMI/buzzing on Strix/Krackan-class systems), while keeping the original “prevent popping” behavior targeted at Intel HDA hardware.

Changes:

  • Restrict the power_save=0 override to Intel HDA controllers via ATTRS{vendor}=="0x8086".
  • Gate AC/battery power_supply handlers on the presence of the /run/udev/snd-hda-intel-powersave state file so they only run on systems where the boot-time rule matched.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 7 to 9
RUN+="/usr/bin/bash -c 'touch /run/udev/snd-hda-intel-powersave; \
[[ $$(cat /sys/class/power_supply/BAT0/status 2>/dev/null) != \"Discharging\" ]] && \
echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave && \
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RUN script always touches /run/udev/snd-hda-intel-powersave before the battery check. If the system is already discharging at boot, this leaves the file empty (no saved value), which can later be treated as a valid value by the AC/battery handlers. Consider only creating the file when you also write the saved parameter value (or always write the current power_save into it regardless of charging state).

Suggested change
RUN+="/usr/bin/bash -c 'touch /run/udev/snd-hda-intel-powersave; \
[[ $$(cat /sys/class/power_supply/BAT0/status 2>/dev/null) != \"Discharging\" ]] && \
echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave && \
RUN+="/usr/bin/bash -c 'echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave; \
[[ $$(cat /sys/class/power_supply/BAT0/status 2>/dev/null) != \"Discharging\" ]] && \

Copilot uses AI. Check for mistakes.
Comment on lines 13 to 14
RUN+="/usr/bin/bash -c 'echo $$(cat /run/udev/snd-hda-intel-powersave 2>/dev/null || \
echo 10) > /sys/module/snd_hda_intel/parameters/power_save'"
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cat /run/udev/snd-hda-intel-powersave 2>/dev/null || echo 10 does not fall back when the file exists but is empty (because cat still exits 0). With an empty saved-value file, this expands to an empty string and can attempt to write an invalid value to /sys/module/snd_hda_intel/parameters/power_save. Handle the empty-file case explicitly (e.g., validate the value is non-empty/numeric before writing, otherwise use a default).

Suggested change
RUN+="/usr/bin/bash -c 'echo $$(cat /run/udev/snd-hda-intel-powersave 2>/dev/null || \
echo 10) > /sys/module/snd_hda_intel/parameters/power_save'"
RUN+="/usr/bin/bash -c 'val=$$(cat /run/udev/snd-hda-intel-powersave 2>/dev/null); \
case $$val in (""|*[!0-9]*) val=10 ;; esac; \
echo $$val > /sys/module/snd_hda_intel/parameters/power_save'"

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@ventureoo ventureoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove also fallback as 10 value in the cat, since it's not needed with TEST

@ptr1337 ptr1337 closed this Feb 23, 2026
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.

Electrical interference/buzzing on AMD Ryzen AI (Strix/Krackan) due to forced audio power management

3 participants