
2012-10-12 下午11:19 於 "Takashi Iwai" tiwai@suse.de 寫道:
Hi,
there is a long-standing problem in HD-audio regarding IEC958 controls. When both an SPDIF and an HDMI are created on the same card (e.g. one from analog codec and one from graphics chip), the driver assigns the IEC958 controls just with new indices, 0, 1, 2...
The problem is that there is no way to connect between this index and the actual PCM device. Currently, alsa-lib HDA-Intel.conf has a fixed configuration: spdif -> IEC958 xxx index=0, PCM dev=1 hdmi,0 -> IEC958 xxx index=0, PCM dev=3 hdmi,1 -> IEC958 xxx index=1, PCM dev=7 hdmi,2 -> IEC958 xxx index=2, PCM dev=8 hdmi,3 -> IEC958 xxx index=3, PCM dev=9
So obviously spdif and the first hdmi conflict.
Basically this can be fixed by reassigning each IEC958 control with the same device number corresponding to the PCM device. That is, for SPDIF, assign a control element with device=1, for HDMI, device=3,7... However, this obviously breaks the old configuration unless user upgrades the alsa-lib configuration. Thus this is no-go.
Now here is a compromise: the IEC958 control for SPDIF is reassigned to device=1 *only* when SPDIF and HDMI coexist. Since the configuration is anyway broken as is now in such a case, it's no big deal to fix one side in an incompatible way. (The reason why SPDIF is re-assigned is that I guess majority of user require more HDMI than SPDIF in such a configuration.)
In addition, we need a fix in alsa-lib. Also not for breaking the compatibility with older kernel, we need some fallback check. I did a quick hack to alsa-lib conf code and added "skip_rest" option to the hook element, so that only the first matching element is taken.
how about those hdmi jack and iec958 on ad1989b?
there is no device 3 but [Jack] SPDIF Out at Ext Rear and [Jack] Digital Out at Int HDMI
**** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: Intel [HDA Intel], device 1: AD198x Digital [AD198x Digital] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: Intel [HDA Intel], device 2: AD198x Headphone [AD198x Headphone] Subdevices: 1/1 Subdevice #0: subdevice #0
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/995169/+attachmen...
Node 0x1b [Pin Complex] wcaps 0x40030d: Stereo Digital Amp-Out Control: name="IEC958 Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000010: OUT Pin Default 0x0145f1a0: [Jack] SPDIF Out at Ext Rear Conn = Optical, Color = Other DefAssociation = 0xa, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Connection: 1 0x02
Node 0x1d [Pin Complex] wcaps 0x40030d: Stereo Digital Amp-Out Control: name="HDMI Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=1 Amp-Out vals: [0x27 0x27] Pincap 0x00000010: OUT Pin Default 0x1856f1b0: [Jack] Digital Out at Int HDMI Conn = Digital, Color = Other DefAssociation = 0xb, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Connection: 1 0x0b