fix(hardware): add Alienware Area-51 Realtek/SOF audio quirk workaround#5194
fix(hardware): add Alienware Area-51 Realtek/SOF audio quirk workaround#5194long-island wants to merge 2 commits intobasecamp:devfrom
Conversation
There was a problem hiding this comment.
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.serviceand patch the RT1320 UCM configuration. - Add an Alienware-gated installer script and systemd drop-in to delay
iwd.servicestartup 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.
| @@ -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 | |||
There was a problem hiding this comment.
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).
| 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 |
There was a problem hiding this comment.
Fixed — added run_logged entry for the audio script in all.sh.
| run_logged $OMARCHY_INSTALL/config/hardware/fix-dell-xps-audio.sh | ||
| run_logged $OMARCHY_INSTALL/config/hardware/fix-alienware-area51-wifi-boot-delay.sh |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| # 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" |
There was a problem hiding this comment.
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.
| # 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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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).
| 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 |
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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.
| Description=Reload SOF audio driver to fix initialization race | |
| Description=Reload SOF audio driver to fix initialization race | |
| Wants=sound.target |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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).
| 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' |
There was a problem hiding this comment.
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.
8df4cc8 to
29e4c0c
Compare
29e4c0c to
5f327fb
Compare
There was a problem hiding this comment.
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.
| # 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Problem
On Alienware Area-51 AA18250 systems, audio is silent after boot due to two compounding issues:
SOF/SoundWire init race — the
snd_sof_pci_intel_mtldriver initialises before the SoundWire bus is stable, leaving/proc/asound/sofsoundwireabsent and the codec unconfigured.RT1320 UCM mismatch — the system ships with two RT1320 amplifiers, but the stock
rt1320.confUCM 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 ofL,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 onConditionPathExists=!/proc/asound/sofsoundwire) that:snd_sof_pci_intel_mtlto resolve the init race/proc/asound/cardsrt1320 Amp 1 Switch/rt1320 Amp 2 Switch)2. UCM override — copies
/usr/share/alsa/ucm2/sof-soundwire/rt1320.confto/etc/alsa/ucm2/sof-soundwire/rt1320.conf(only if not already present), then patches the override in-place:rt1320-2control referenceL,L→L,RWriting to
/etc/alsa/ucm2/ensures the override survivesalsa-ucm-confpackage upgrades.Hardware
snd_sof_pci_intel_mtl)Testing
Tested stable on the hardware described above. Audio output functional after boot without manual intervention.