Enabling nForce4 optical SPDIF output
Background
Many users with Nvidia4 based motherboards have problems enabling the digital audio output (optical and/or coax) from their motherboard in Linux. The default values set by the alsa driver do not enable the digital output, and it is not possible to enable it using the alsamixer.
A solution was found by changing the asound.state file directly.
Short howto:
- Close mythfrontend if it is running.
- Save the asound.state file below to
~/asound.state - Enter the command
alsactl -f ~/asound.state restoreSee "Troubleshooting" below if this command returns any errors. - Once the
alsactlcommand can be run without error, start mythfrontend. - In mythfrontend go to Utilities/Setup -> Setup -> General and for Audio output device put ALSA:digital. However, if the next step doesn't work, you may need to enter ALSA:default instead.
- Test both surround sound output and stereo output. Try watching a standard definition or analogue TV channel (for a stereo test) and a DVD with Dolby and/or DTS surround sound (for a surround sound test).
Once everything is working satisfactory, you will want to ensure that these changes are preserved after reboot.
- Locate your distributions existing
asound.statefile. It is usually located at/etc/asound.stateor/var/lib/alsa/asound.stateThe commandalsactl --helphelped me find the default location in Ubuntu. Refer to your distributions documentation for further guidance. - Change into the directory of your distributions asound.state file
cd /etcorcd /var/lib/alsa(or per your distribution). - Create a backup copy of your distributions existing asound.state
cp asound.state asound.state.orig - Move the file that you created above, to replace your distributions
mv ~/asound.state asound.state - Enter the command
alsactl restoreif there are no errors then you should be done. - If there are errors stating that 'no state is present for XXX' where XXX is any device other than CK804, locate the devices state in your original
asound.state.origfile and copy into the newasound.state
Troubleshooting
Due to differences in the ALSA driver and the support circuits you might experience error messages of the following kind:
alsactl: set_control:894: warning: name mismatch (Mic Boost (+20dB)/Mic Boost (+20dB) Capture Switch) for control #17 alsactl: set_control:896: warning: index mismatch (0/0) for control #17 alsactl: set_control:898: failed to obtain info for control #17 (Operation not permitted)
This means that on your hardware, the name of control #17 is not "Mic Boost (+20dB) Capture Switch" but instead "Mic Boost (+20dB)". To fix this problem, edit the asound.state file and change the name of control to the correct name.
Control #30 may also give this error. Change its name in asound.state from "Mic Select Capture Switch" to "Mic Select".
You may also receive an error of the form:
alsactl: set_control:1273: failed to obtain info for control #17 (No such file or directory)
This is less helpful, as you will need to find the correct name for the control using a program such as alsamixer, which should hopefully be quite simple to figure out, since the name of each control is shown in the upper left corner.
If the name is not clear from alsamixer then you will want to try to locate the name of the control from your distributions existing asound.state file. The 2nd half of the howto above has instructions for locating your distributions asound.state file. Once you find it, read though it to find the correct name for the control.
The last error you may receive is
No state is present for card CX8811
This refers to another sound card or sound hardware on a TV tuner card in the system. If you're not using that card for your sound output (and if you are, then this page is of no use to you!), then this message can be safely ignored.
asound.state File
Save the following file as ~/asound.state
state.CK804 {
control.1 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Master Playback Switch'
value true
}
control.2 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Master Playback Volume'
value.0 22
value.1 22
}
control.3 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Center Playback Switch'
value false
}
control.4 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'Center Playback Volume'
value 31
}
control.5 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'LFE Playback Switch'
value true
}
control.6 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'LFE Playback Volume'
value 13
}
control.7 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 2
iface MIXER
name 'Surround Playback Switch'
value.0 false
value.1 false
}
control.8 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Surround Playback Volume'
value.0 0
value.1 0
}
control.9 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Master Mono Playback Switch'
value false
}
control.10 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'Master Mono Playback Volume'
value 0
}
control.11 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'PC Speaker Playback Switch'
value false
}
control.12 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 15'
iface MIXER
name 'PC Speaker Playback Volume'
value 0
}
control.13 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Phone Playback Switch'
value false
}
control.14 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'Phone Playback Volume'
value 0
}
control.15 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Mic Playback Switch'
value false
}
control.16 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'Mic Playback Volume'
value 0
}
control.17 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Mic Boost (+20dB) Capture Switch'
value false
}
control.18 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Line Playback Switch'
value false
}
control.19 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Line Playback Volume'
value.0 0
value.1 0
}
control.20 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'CD Playback Switch'
value false
}
control.21 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'CD Playback Volume'
value.0 0
value.1 0
}
control.22 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Aux Playback Switch'
value false
}
control.23 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Aux Playback Volume'
value.0 0
value.1 0
}
control.24 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'PCM Playback Switch'
value true
}
control.25 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'PCM Playback Volume'
value.0 22
value.1 22
}
control.26 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 2
comment.item.0 Mic
comment.item.1 CD
comment.item.2 Video
comment.item.3 Aux
comment.item.4 Line
comment.item.5 Mix
comment.item.6 'Mix Mono'
comment.item.7 Phone
iface MIXER
name 'Capture Source'
value.0 Mic
value.1 Mic
}
control.27 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Capture Switch'
value true
}
control.28 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 15'
iface MIXER
name 'Capture Volume'
value.0 0
value.1 0
}
control.29 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 Mix
comment.item.1 Mic
iface MIXER
name 'Mono Output Select'
value Mix
}
control.30 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 Mic1
comment.item.1 Mic2
iface MIXER
name 'Mic Select Capture Switch'
value Mic1
}
control.31 {
comment.access read
comment.type IEC958
comment.count 1
iface MIXER
name 'IEC958 Playback Con Mask'
value '0fff000f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
}
control.32 {
comment.access read
comment.type IEC958
comment.count 1
iface MIXER
name 'IEC958 Playback Pro Mask'
value cf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
}
control.33 {
comment.access 'read write'
comment.type IEC958
comment.count 1
iface MIXER
name 'IEC958 Playback Default'
value '0082000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
}
control.34 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'IEC958 Playback Switch'
value true
}
control.35 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 3'
iface MIXER
name 'IEC958 Playback AC97-SPSA'
value 0
}
control.36 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Duplicate Front'
value false
}
control.37 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Mic Front Input Switch'
value false
}
control.38 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 Shared
comment.item.1 Independent
iface MIXER
name 'Surround Jack Mode'
value Shared
}
control.39 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 '2ch'
comment.item.1 '4ch'
comment.item.2 '6ch'
iface MIXER
name 'Channel Mode'
value '2ch'
}
control.40 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'IEC958 Capture Switch'
value false
}
control.41 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 PCM
comment.item.1 'Analog In'
comment.item.2 'IEC958 In'
iface MIXER
name 'IEC958 Playback Source'
value PCM
}
control.42 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'External Amplifier'
value true
}
}