You'll want to use a tool such as hdajackretask , pavucontrol and pavumeter for the pin re-assignments and audio output monitoring afterwards respectively. The tools are installed by running:
sudo apt-get install alsa-tools-gui pavumeter pavucontrol
When done, launch the tool with administrative privileges as shown:
From here, you'll then need to re-assign each required pin. Note that this tool, depending on your sound card, will most likely detect them by the color panel layout (see the back of your card and confirm if its' pins are color coded) or by the jack designator.
Either way, when you're done and you select "Apply", you'll need to reboot and the settings will apply on the next startup.
Before you reboot, confirm that pulseaudio is configured to utilize the channel layout as desired.
Of note is that for
/etc/pulse/daemon.conf , the following changes must be made (with your preferred text editor):
(a). For 5.1 channel sound, set:
default-sample-channels = 6
(b). Ensure that
enable-lfe-remixing is set to
(c). The default channel map option for 5.1 audio should be set as:
How the tool works:
The tool generates a firmware patch (under
/lib/firmware/hda-jack-retask.fw ) entry that's also called up by a module configuration file (under
/etc/modprobe.d/hda-jack-retask.conf or similar) , whose settings are applied on every boot. That's what the "boot override" option does, overriding the sound card's pin assignments on every boot. To undo this in the case the configuration is no longer needed, just delete both files after purging hdajackretask.
To get the Clevo P751DM2-G's Audio jacks to work with the Logitech Z506 surround sound speaker system that uses three 3.5mm jacks as input for 5.1 surround sound audio, I had to override the pins as shown in the generated configuration file below (confirm with the screen shots attached at the bottom for my use case, your mileage may vary depending on your exact sound card):
(a). Contents of
/lib/firmware/hda-jack-retask.fw after setup:
0x10ec0899 0x15587504 0
(b). Contents of the
/etc/modprobe.d/hda-jack-retask.conf file after setup:
# 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 patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw
Then rebooted the system. Confirming the successful override by running grep on dmesg on boot:
dmesg | grep hda-jack-retask
[ 5.183912] snd_hda_intel 0000:00:1f.3: Applying patch firmware 'hda-jack-retask.fw'
[ 5.184524] snd_hda_intel 0000:01:00.1: Applying patch firmware 'hda-jack-retask.fw'
3.5mm audio jack connections to the sound card on the laptop/motherboard:
On the rear of the Logitech system, all the I/Os are color coded. In my case, I swapped the GREEN line with the YELLOW line such that the GREEN line feed would correspond to the Center/LFE feed, as it does on Windows under the Realtek HD Audio manager panel. Then, on the computer, I connected the feeds in the order, top to bottom: Black, Green then Yellow at the very end.
Final step after reboot to use the new setup:
Use pavucontrol (search for it in the app launcher or launch from terminal) and under the configuration tab, select the "Analog Surround 5.1 Output" profile. This is important, because apps won't use your speaker layout UNTIL this is selected.
When done, you can verify your setup (as shown below) with the sound settings applet on Ubuntu by running the audio tests. Confirm that audio is routed correctly to each speaker. If not, remap the pin layout again using hdajackretask and retest again.
Screen shots of success:
pavucontrol, run it, and see the settings in the "Configuration" tab. The commandline way is running
alsamixerin a terminal, select the right sound card and change the channel mode. Similar to most right mixer setting in this screenshot.