Getting your Asus ROG motherboard (or other HDA audio chips) to work like it did in windows.
I've seen a bunch of issues here about Asus ROG motherboards and their sound devices that work fine in windows, not working in linux/pipewire. A quick web search shows that it's not uncommon. I had to go to a lot of trouble to get mine to behave, so I'm making an issue here with the solutions I found, so that there's some kind of record for others to use if they want to get good results.
This is all because every sound chip on every motherboard has it's own special setup, and asus modifies the stock realtek driver for your specific hardware, on windows, but linux uses a generic one-size-fits-all driver, then applies some specific 'quirks' as required, which may or may not include the changes you need for your specific setup. This is especially true of new, rare, or high-end boards (this includes gaming laptops) which haven't had their specific setup's quirks built into the kernel/ALSA stack, yet.
In my case, I have a motherboard which, in windows, I can open the realtek control panel and tick a box and it treats every output as a separate sound device. This lets me use the front panel's, and both sets of rear panel's, inputs and outputs, as separate devices, playing different sounds at the same time. In linux, my audio worked 'out of the box', but this feature was nowhere to be found. And I need it working.
First off, some links to kernel documentation about this:
https://www.kernel.org/doc/html/latest/sound/hd-audio/notes.html
https://www.kernel.org/doc/html/latest/sound/hd-audio/models.html
https://www.kernel.org/doc/html/latest/sound/hd-audio/controls.html#realtek-codecs
Next up, if you really need to tinker with it, you might need to use a tool call hdajackretask
. This lets you specify what the kernel thinks your jacks do, and tell it specifically what they really do.
Last of all, even once you get all that working, ALSA ACP/UCM profiles will apply further settings to your system, which include such 'useful' (read: 'potentially breaking') things as muting inputs and outputs, disabling volume controls, disabling input or output selectors in the mixer, etc.
I can't tell you what specific changes will be needed for your specific motherboard and codec (chip), but what I'll do here is leave the changes I needed for mine - FWIW that's an Asus ROG Strix B550-E Gaming (and I'd bet that all of the ROG B550 and X570 boards will need these same tweaks), to give you an idea of what's in store.
Thankfully in my case in hdajackretask
, the default pin configurations were actually correct. That being said, I still needed to use the tool to create a firmware patch which included three important items, to get things working. Those were the model
of the codec to use (which could be specified elsewhere but since I needed these other two I make use of it here), and two kernel hints
, enabling the option to select line-level or headphone-level outputs on those jacks, and enabling a separate volume control for my front panel headphone jack (so that it didn't have to share that control with the rear panel).
That file is named /lib/firmware/hda-jack-retask.fw and mine looks like this:
cat /lib/firmware/hda-jack-retask.fw
[codec]
0x10ec1168 0x104387d3 0
[pincfg]
0x12 0x40170040
0x14 0x01014010
0x15 0x01011012
0x16 0x01016011
0x17 0x01a18030
0x18 0x01a19031
0x19 0x02a19040
0x1a 0x0181303f
0x1b 0x02214020
0x1d 0x4047e629
0x1e 0x01456150
[model]
dual-codecs
[hints]
add_jack_modes=yes
indep_hp=yes
The codec
and pincfg
are the defaults and hdajackretask
leaves them in place. I could probably just remove them, but I'm inclined to leave them as they are since they work.
The dual-codecs model
is what enables the separate physical outputs to be treated as independent sound cards and not just one card with a bunch of outputs that can only be used one-at-a-time (ie, now if I plug headphones in the front and rear panel, they don't play the same sound, they each have their own output I can choose to play different sounds, which is important if you want to apply headphone treatment like AutoEQ or virtual surround (tip: try the pipewire SOFA filter, it will blow your mind), or if I want to take a pro-audio approach to things and use one set as a headphone monitor and the other set as line-level I/O for a hardware synthesizer. The hints
section gives me add_jack_modes
so that in alsamixer I can now select whether the jacks are supposed to amplify the signal for headphones, or leave it at line-level for the synths. The indep_hp
hint gives me a separate volume control for the front and for the rear panel audio, rather than just sharing one slider for both.
Now, in order to actually apply this firmware patch, I have to have another file in place, in modprobe.d
(this is where you could just apply the model
, if that's all you need)
That file is as follows: cat /etc/modprobe.d/hda-jack-retask.conf
# This file was added by the program 'hda-jack-retask'.
# If you want to revert the changes made by this program, you can simply erase this file and reboot your computer.
options snd-hda-intel enable_msi=on patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw
All of that is enough to get it working - kinda-sorta. The ability for things to work was there, but every time I'd reboot, it'd be broken again. Outputs were disabled, inputs were disabled, and volumes were set to 60% (why 60? because reasons I guess.)
Turns out that's UCM profiles being set up to disable things I need. I modify the profiles directly by means of search+replace with sed
:
# Stop ALSA UCM from disabling our I/O
sudo sed -i "s/Playback Switch' off\"/Playback Switch' on\"/" /usr/share/alsa/ucm2/HDA/DualCodecs/HiFi.conf
sudo sed -i "s/Capture Switch' off\"/Capture Switch' on\"/" /usr/share/alsa/ucm2/HDA/DualCodecs/HiFi.conf
sudo sed -i "s/60\%/100\%/" /usr/share/alsa/ucm2/HDA/init.conf
This next step could be done manually in alsamixer but while I'm copypasting from my setup doc ;)
# Headphones are turned down by default, let's fix that
amixer -c1 cset numid=9 100%
The specific model
and hints
and pincfg
settings you need, and the modifications you'll need to make to UCM to stop it from turning off your expensive features, are specific to your motherboard model, and I can't tell you what they are, you're just going to have to figure it out (or hope someone else did and shared it online like I'm doing right now).
Once all of that is done, if your distro is set up properly, when you reboot, it should save that state and then restore it when you boot up again, so you shouldn't need to touch it. All your volume and mute controls in pipewire are respected, these changes we've made are effecting things at a lower level, so you needn't worry about that.
As for the mechanics of how all that works, again, while I'm copypasting from my build docs, I'll just keep going (with minor modifications to remove my machine-specific backup location, and some foul language hahah:
# After this, it should be saved at shutdown and restored at startup, systemd's alsa-restore.service:
sudo systemctl status alsa-restore.service
# But you can make sure of it by running it manually with
sudo /usr/sbin/alsactl store
# and it will write it to /var/lib/alsa/asound.state
# So you can back that up:
sudo cp /var/lib/alsa/asound.state /some/place/you/make/your/backups/
# And restore it like should happen at boot time, with
sudo cp /some/place/you/make/your/backups/asound.state /var/lib/alsa/
sudo /usr/sbin/alsactl restore
# But it SHOULD all be automatic. Once the UCM files are 'modified'.
So, if you've got an Asus AM4 (B550 or X570) motherboard, or any other motherboard with the high-end gaming sound chips from realtek on it, I hope you enjoy having its full functionality, and if you've got some other board with similar issues, I hope this gives you some hints and direction to take, to hopefully find a way to get it to work.