Skip to content

fix(hardware): add Alienware Area-51 Realtek/SOF audio quirk workaround#5194

Open
long-island wants to merge 2 commits intobasecamp:devfrom
long-island:fix/alienware-area51-realtek-audio-quirk
Open

fix(hardware): add Alienware Area-51 Realtek/SOF audio quirk workaround#5194
long-island wants to merge 2 commits intobasecamp:devfrom
long-island:fix/alienware-area51-realtek-audio-quirk

Conversation

@long-island
Copy link
Copy Markdown

@long-island long-island commented Apr 3, 2026

Problem

On Alienware Area-51 AA18250 systems, audio is silent after boot due to two compounding issues:

  1. SOF/SoundWire init race — the snd_sof_pci_intel_mtl driver initialises before the SoundWire bus is stable, leaving /proc/asound/sofsoundwire absent and the codec unconfigured.

  2. RT1320 UCM mismatch — the system ships with two RT1320 amplifiers, but the stock rt1320.conf UCM file references a third (Macro.num3.rt1320spk) that does not exist on this board, and uses incorrect channel routing (L,L) for the second amp instead of L,R.

Fix

Two-part, hardware-gated workaround (DMI-matched on ^alienware$ / ^(alienware 18 area-51|aa18250)$):

1. fix-sof-audio.service — a oneshot systemd service (Wants=+After=sound.target, gated on ConditionPathExists=!/proc/asound/sofsoundwire) that:

  • Unloads and reloads snd_sof_pci_intel_mtl to resolve the init race
  • Detects the SOF card dynamically via /proc/asound/cards
  • Re-enables the RT1320 amplifier controls by name (rt1320 Amp 1 Switch / rt1320 Amp 2 Switch)

2. UCM override — copies /usr/share/alsa/ucm2/sof-soundwire/rt1320.conf to /etc/alsa/ucm2/sof-soundwire/rt1320.conf (only if not already present), then patches the override in-place:

  • Removes the nonexistent rt1320-2 control reference
  • Corrects channel routing for the second amp from L,LL,R

Writing to /etc/alsa/ucm2/ ensures the override survives alsa-ucm-conf package upgrades.

Hardware

  • Machine: Alienware 18 Area-51 AA18250
  • CPU: Intel Core Ultra 9 275HX
  • Audio: Realtek RT1320 × 2 via SoundWire, SOF firmware (snd_sof_pci_intel_mtl)
  • Kernel: 6.19.6-arch1-1, OS: Omarchy (Arch-based)

Testing

Tested stable on the hardware described above. Audio output functional after boot without manual intervention.

Copilot AI review requested due to automatic review settings April 3, 2026 04:24
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

This PR introduces Alienware Area-51 (AA18250) hardware-specific workarounds intended to restore broken audio at boot by reloading the SOF driver and adjusting RT1320 configuration, plus an additional iwd startup delay tweak for intermittent WiFi auth failures.

Changes:

  • Add an Alienware-gated installer script to install/enable a fix-sof-audio.service and patch the RT1320 UCM configuration.
  • Add an Alienware-gated installer script and systemd drop-in to delay iwd.service startup by 3 seconds.
  • Wire the WiFi workaround script into install/config/all.sh (but not the audio script).

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
install/config/hardware/fix-alienware-area51-wifi-boot-delay.sh DMI-gated installer step to install an iwd drop-in that delays startup.
install/config/hardware/fix-alienware-area51-realtek-audio.sh DMI-gated installer step to install/enable SOF reload service and patch RT1320 UCM.
install/config/all.sh Runs the new WiFi hardware fix script during config.
default/systemd/system/iwd.service.d/delay-start.conf iwd drop-in to add ExecStartPre=/bin/sleep 3.
default/systemd/system/fix-sof-audio.service Oneshot service to reload SOF modules and set amp controls when the SoundWire proc node is missing.

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

Comment thread install/config/all.sh Outdated
@@ -48,6 +48,7 @@ run_logged $OMARCHY_INSTALL/config/hardware/fix-asus-rog-audio-mixer.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-asus-rog-mic.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-yt6801-ethernet-adapter.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-dell-xps-audio.sh
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The PR adds fix-alienware-area51-realtek-audio.sh, but it is never invoked from the installer flow (only the WiFi workaround script is added here). As-is, the audio workaround won’t be applied on installs unless called elsewhere—add a run_logged entry for the audio script (or otherwise wire it into the install path).

Suggested change
run_logged $OMARCHY_INSTALL/config/hardware/fix-dell-xps-audio.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-dell-xps-audio.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-alienware-area51-realtek-audio.sh

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

Choose a reason for hiding this comment

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

Fixed — added run_logged entry for the audio script in all.sh.

Comment thread install/config/all.sh Outdated
Comment on lines +50 to +51
run_logged $OMARCHY_INSTALL/config/hardware/fix-dell-xps-audio.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-alienware-area51-wifi-boot-delay.sh
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This change introduces an Alienware-specific iwd startup delay, but the PR description only discusses the SOF/RT1320 audio workaround. Either update the PR description to cover this WiFi workaround (including rationale/testing), or split it into a separate PR to keep scope and review surface clear.

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

Choose a reason for hiding this comment

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

The wifi all.sh entry comes from the stacked wifi branch commit (PR #5193). The audio commit now also adds its own all.sh entry. The wifi entry is intentional context, not audio scope.

Comment on lines +14 to +22
# Patch UCM to avoid referencing nonexistent rt1320-2 controls on this hardware.
ucm_file="/usr/share/alsa/ucm2/sof-soundwire/rt1320.conf"
if [[ -f "$ucm_file" ]]; then
if [[ ! -f "${ucm_file}.omarchy-backup" ]]; then
sudo cp "$ucm_file" "${ucm_file}.omarchy-backup"
fi

sudo sed -i '/Macro\.num3\.rt1320spk/d' "$ucm_file"
sudo sed -i 's/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,L" }/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,R" }/' "$ucm_file"
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This script patches /usr/share/alsa/ucm2/.../rt1320.conf in-place. That path is owned by the alsa-ucm-conf package and can be replaced on package upgrades, potentially reintroducing the issue. Prefer installing an override into a config-owned location (e.g., /etc/alsa/ucm2/...) or otherwise ensure the patch is reapplied after updates.

Suggested change
# Patch UCM to avoid referencing nonexistent rt1320-2 controls on this hardware.
ucm_file="/usr/share/alsa/ucm2/sof-soundwire/rt1320.conf"
if [[ -f "$ucm_file" ]]; then
if [[ ! -f "${ucm_file}.omarchy-backup" ]]; then
sudo cp "$ucm_file" "${ucm_file}.omarchy-backup"
fi
sudo sed -i '/Macro\.num3\.rt1320spk/d' "$ucm_file"
sudo sed -i 's/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,L" }/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,R" }/' "$ucm_file"
# Install a UCM override in /etc so the workaround survives alsa-ucm-conf upgrades.
source_ucm_file="/usr/share/alsa/ucm2/sof-soundwire/rt1320.conf"
override_ucm_file="/etc/alsa/ucm2/sof-soundwire/rt1320.conf"
if [[ -f "$source_ucm_file" ]]; then
sudo mkdir -p "$(dirname "$override_ucm_file")"
if [[ ! -f "$override_ucm_file" ]]; then
sudo cp "$source_ucm_file" "$override_ucm_file"
fi
sudo sed -i '/Macro\.num3\.rt1320spk/d' "$override_ucm_file"
sudo sed -i 's/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,L" }/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,R" }/' "$override_ucm_file"

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

Choose a reason for hiding this comment

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

Fixed — UCM override now written to /etc/alsa/ucm2/sof-soundwire/rt1320.conf so it survives alsa-ucm-conf upgrades. The /usr/share backup logic is removed.

fi

sudo sed -i '/Macro\.num3\.rt1320spk/d' "$ucm_file"
sudo sed -i 's/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,L" }/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,R" }/' "$ucm_file"
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The sed replacement for the Macro.num2.rt1320spk ... Sel "L,L" line matches the entire line exactly, so small upstream formatting changes (spacing, ordering, additional fields) will cause the patch to silently not apply. Consider making the substitution more robust (e.g., target only the Sel "L,L" portion within the Macro.num2.rt1320spk stanza, or verify the change and emit a warning/failure if it didn’t apply).

Suggested change
sudo sed -i 's/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,L" }/Macro.num2.rt1320spk { ForAmps "2" Amp 1 Sel "L,R" }/' "$ucm_file"
sudo sed -i '/Macro\.num2\.rt1320spk[[:space:]]*{/,/}/{ s/Sel "L,L"/Sel "L,R"/; }' "$ucm_file"
if ! sudo grep -Eq 'Macro\.num2\.rt1320spk[[:space:]]*\{[^}]*Sel "L,R"' "$ucm_file"; then
echo "Failed to patch $ucm_file: Macro.num2.rt1320spk does not contain Sel \"L,R\" after update." >&2
exit 1
fi

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

Choose a reason for hiding this comment

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

Fixed — switched to a stanza-scoped sed (/Macro\.num2\.rt1320spk {/,/}/{s/Sel "L,L"/Sel "L,R"/;}) with a verification check that warns if L,L still appears after the patch.

@@ -0,0 +1,12 @@
[Unit]
Description=Reload SOF audio driver to fix initialization race
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

After=sound.target only provides ordering if sound.target is part of the same transaction; it does not pull it in. If this unit needs to reliably run after the sound stack is brought up, add Wants=sound.target (or Requires= as appropriate) so the ordering constraint is meaningful.

Suggested change
Description=Reload SOF audio driver to fix initialization race
Description=Reload SOF audio driver to fix initialization race
Wants=sound.target

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

Choose a reason for hiding this comment

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

Fixed — added Wants=sound.target so the ordering constraint is meaningful.


[Service]
Type=oneshot
ExecStart=/bin/bash -c 'sleep 2 && modprobe -r snd_soc_sof_sdw snd_sof_pci_intel_mtl && sleep 1 && modprobe snd_sof_pci_intel_mtl && sleep 5 && amixer -c 1 cset numid=58 on && amixer -c 1 cset numid=59 on'
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The unit hardcodes amixer -c 1 and uses numeric numid values (58/59). Both the card index and control numids can vary across systems/kernel/alsa-ucm-conf versions, making this brittle. To reduce breakage risk, resolve the target card dynamically (as other hardware scripts do) and prefer addressing controls by name (or otherwise validate the expected controls exist before attempting to set them).

Suggested change
ExecStart=/bin/bash -c 'sleep 2 && modprobe -r snd_soc_sof_sdw snd_sof_pci_intel_mtl && sleep 1 && modprobe snd_sof_pci_intel_mtl && sleep 5 && amixer -c 1 cset numid=58 on && amixer -c 1 cset numid=59 on'
ExecStart=/bin/bash -eu -c 'sleep 2 && modprobe -r snd_soc_sof_sdw snd_sof_pci_intel_mtl && sleep 1 && modprobe snd_sof_pci_intel_mtl && sleep 5 && card="$(awk '"'"'/[[:space:]](sof|SOF|soundwire|SoundWire)/ { print $1; exit }'"'"' /proc/asound/cards)" && [ -n "$card" ] && controls="$(amixer -c "$card" controls)" && printf "%s\n" "$controls" | grep -q "numid=58," && printf "%s\n" "$controls" | grep -q "numid=59," && amixer -c "$card" cset numid=58 on && amixer -c "$card" cset numid=59 on'

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

Choose a reason for hiding this comment

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

Fixed — card is now detected dynamically via /proc/asound/cards (matching sofsoundwire), and amp controls are addressed by name (rt1320 Amp 1 Switch / rt1320 Amp 2 Switch) rather than hardcoded numids. Service also uses -eu for stricter error handling.

@long-island long-island force-pushed the fix/alienware-area51-realtek-audio-quirk branch from 8df4cc8 to 29e4c0c Compare April 3, 2026 04:38
Copilot AI review requested due to automatic review settings April 3, 2026 04:47
@long-island long-island force-pushed the fix/alienware-area51-realtek-audio-quirk branch from 29e4c0c to 5f327fb Compare April 3, 2026 04:47
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


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

Comment on lines +14 to +21
# Write UCM override to /etc/alsa/ucm2/ so it survives alsa-ucm-conf upgrades.
source_ucm="/usr/share/alsa/ucm2/sof-soundwire/rt1320.conf"
override_ucm="/etc/alsa/ucm2/sof-soundwire/rt1320.conf"
if [[ -f "$source_ucm" ]]; then
sudo mkdir -p "$(dirname "$override_ucm")"
if [[ ! -f "$override_ucm" ]]; then
sudo cp "$source_ucm" "$override_ucm"
fi
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

PR description says the original UCM file is backed up to rt1320.conf.omarchy-backup, but this script currently just copies to /etc/alsa/ucm2/.../rt1320.conf (when missing) and then edits it in-place. Either add the promised backup behavior (especially before modifying an existing override file) or update the PR description so it matches the implemented behavior.

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

Choose a reason for hiding this comment

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

Updated the PR description — removed the stale omarchy-backup mention. The override is written to /etc/alsa/ucm2/ (package-upgrade-safe) so no separate backup is needed.

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.

2 participants