linux/sound/pci
Stephen Warren 384a48d715 ALSA: hda: HDMI: Support codecs with fewer cvts than pins
The general concept of this change is to create a PCM device for each
pin widget instead of each converter widget. Whenever a PCM is opened,
a converter is dynamically selected to drive that pin based on those
available for muxing into the pin.

The one thing this model doesn't support is a single PCM/converter
sending audio to multiple pin widgets at once.

Note that this means that a struct hda_pcm_stream's nid variable is
set to 0 except between a stream's open and cleanup calls. The dynamic
de-assignment of converters to PCMs occurs within cleanup, not close,
in order for it to co-incide with when controller stream IDs are
cleaned up from converters.

While the PCM for a pin is not open, the pin is disabled (its widget
control's PIN_OUT bit is cleared) so that if the currently routed
converter is used to drive a different PCM/pin, that audio does not
leak out over a disabled pin.

We use the recently added SPDIF virtualization feature in order to
create SPDIF controls for each pin widget instead of each converter
widget, so that state is specific to a PCM.

In order to support this, a number of more mechanical changes are made:

* s/nid/pin_nid/ or s/nid/cvt_nid/ in many places in order to make it
  clear exactly what the code is dealing with.

* We now have per_pin and per_cvt arrays in hdmi_spec to store relevant
  data. In particular, we store a converter's capabilities in the per_cvt
  entry, rather than relying on a combination of codec_pcm_pars and
  the struct hda_pcm_stream.

* ELD-related workarounds were removed from hdmi_channel_allocation
  into hdmi_instrinsic in order to simplifiy infoframe calculations and
  remove HW dependencies.

* Various functions only apply to a single pin, since there is now
  only 1 pin per PCM. For example, hdmi_setup_infoframe,
  hdmi_setup_stream.

* hdmi_add_pin and hdmi_add_cvt are more oriented at pure codec parsing
  and data retrieval, rather than determining which pins/converters
  are to be used for creating PCMs.

This is quite a large change; it may be appropriate to simply read the
result of the patch rather than the diffs. Some small parts of the change
might be separable into different patches, but I think the bulk of the
change will probably always be one large patch. Hopefully the change
isn't too opaque!

This has been tested on:

* NVIDIA GeForce 400 series discrete graphics card. This model has the
  classical 1:1:1 codec:converter:pcm widget model. Tested stereo PCM
  audio to a PC monitor that supports audio.

* NVIDIA GeForce 520 discrete graphics card. This model is the new
  1 codec n converters m pins m>n model. Tested stereo PCM audio to a
  PC monitor that supports audio.

* NVIDIA GeForce 400 series laptop graphics chip. This model has the
  classical 1:1:1 codec:converter:pcm widget model. Tested stereo PCM,
  multi-channel PCM, and AC3 pass-through to an AV receiver.

* Intel Ibex Peak laptop. This model is the new 1 codec n converters m
  pins m>n model. Tested stereo PCM, multi-channel PCM, and AC3 pass-
  through to an AV receiver.

Note that I'm not familiar at all with AC3 pass-through. Hence, I may
not have covered all possible mechanisms that are applicable here. I do
know that my receiver definitely received AC3, not decoded PCM. I tested
with mplayer's "-afm hwac3" and/or "-af lavcac3enc" options, and alsa a
WAV file that I believe has AC3 content rather than PCM.

I also tested:
* Play a stream
* Mute while playing
* Stop stream
* Play some other streams to re-assign the converter to a different
  pin, PCM, set of SPDIF controls, ... hence hopefully triggering
  cleanup for the original PCM.
* Unmute original stream while not playing
* Play a stream on the original pin/PCM.

This was to test SPDIF control virtualization.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-06 12:58:14 +02:00
..
ac97 ALSA: azt3328: hook up new emulated AC97 on AC97 patch side 2011-02-19 16:03:08 +01:00
ali5451 sound: use DEFINE_PCI_DEVICE_TABLE 2010-02-09 11:08:33 +01:00
asihpi ALSA: asihpi: Use angle brackets for system includes 2011-06-03 11:46:37 +02:00
au88x0 Merge branch 'topic/misc' into for-linus 2011-05-22 10:01:29 +02:00
aw2 ALSA: aw2-alsa.c: use pci_ids.h defines and fix checkpatch.pl noise 2010-05-25 08:39:28 +02:00
ca0106 Fix common misspellings 2011-03-31 11:26:23 -03:00
cs46xx ALSA: cs46xx memory management fixes for cs46xx_dsp_spos_create() 2010-11-01 10:26:23 +01:00
cs5535audio PCI: make pci_restore_state return void 2010-12-23 12:53:09 -08:00
ctxfi Fix common misspellings 2011-03-31 11:26:23 -03:00
echoaudio ALSA: echoaudio: check kmalloc() result 2010-07-19 17:59:04 +02:00
emu10k1 Merge branch 'topic/misc' into for-linus 2011-05-22 10:01:29 +02:00
hda ALSA: hda: HDMI: Support codecs with fewer cvts than pins 2011-06-06 12:58:14 +02:00
ice1712 Fix common misspellings 2011-03-31 11:26:23 -03:00
korg1212 sound: use DEFINE_PCI_DEVICE_TABLE 2010-02-09 11:08:33 +01:00
lola ALSA: lola - fix lola build 2011-05-04 19:55:13 +02:00
lx6464es ALSA: lx6464es - make 1 bit signed bitfield unsigned 2010-11-01 10:28:35 +01:00
mixart Fix common misspellings 2011-03-31 11:26:23 -03:00
nm256 sound: use DEFINE_PCI_DEVICE_TABLE 2010-02-09 11:08:33 +01:00
oxygen ALSA: oxygen: fix output routing on Xonar DG 2011-01-31 12:00:02 +01:00
pcxhr Fix common misspellings 2011-03-31 11:26:23 -03:00
riptide ALSA: riptide - Fix detection / load of firmware files 2010-08-16 08:08:48 +02:00
rme9652 Fix common misspellings 2011-03-31 11:26:23 -03:00
trident fix typos concerning "initiali[zs]e" 2010-06-16 18:05:05 +02:00
vx222 sound: use DEFINE_PCI_DEVICE_TABLE 2010-02-09 11:08:33 +01:00
ymfpci ALSA: ymfpci: use enum control info helper 2011-01-10 16:47:03 +01:00
ad1889.c Fix common misspellings 2011-03-31 11:26:23 -03:00
ad1889.h
ak4531_codec.c
als300.c sound: use DEFINE_PCI_DEVICE_TABLE 2010-02-09 11:08:33 +01:00
als4000.c ALSA: als4000: Fix potentially invalid DMA mode setup 2010-08-04 23:18:33 +02:00
atiixp_modem.c ALSA: atiixp - Fix wrong time-out checks during ac-link reset 2011-03-11 15:45:32 +01:00
atiixp.c ALSA: atiixp - Fix wrong time-out checks during ac-link reset 2011-03-11 15:45:32 +01:00
azt3328.c Fix common misspellings 2011-03-31 11:26:23 -03:00
azt3328.h
bt87x.c ALSA: bt87x: use enum control info helper 2011-01-10 16:46:56 +01:00
cmipci.c Fix common misspellings 2011-03-31 11:26:23 -03:00
cs4281.c ALSA: info - Check file position validity in common layer 2010-04-13 12:01:14 +02:00
cs5530.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
ens1370.c ALSA: ens1371: fix Creative Ectiva support 2011-03-30 08:57:27 +02:00
ens1371.c
es1938.c sound: use DEFINE_PCI_DEVICE_TABLE 2010-02-09 11:08:33 +01:00
es1968.c ALSA: tea575x: use better card and bus names 2011-05-13 19:43:24 +02:00
fm801.c ALSA: fm801: add error handling if auto-detect fails 2011-06-03 10:11:17 +02:00
intel8x0.c Fix common misspellings 2011-03-31 11:26:23 -03:00
intel8x0m.c Merge branch 'topic/misc' into for-linus 2011-05-22 10:01:29 +02:00
Kconfig Merge branch 'topic/misc' into for-linus 2011-05-22 10:01:29 +02:00
maestro3.c ALSA: maestro3: Clear interrupts before enabling them 2010-05-08 11:51:13 +02:00
Makefile ALSA: Add the driver for Digigram Lola PCI-e boards 2011-05-03 16:31:05 +02:00
rme32.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
rme96.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sis7019.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sis7019.h
sonicvibes.c sound: use DEFINE_PCI_DEVICE_TABLE 2010-02-09 11:08:33 +01:00
via82xx_modem.c sound: use DEFINE_PCI_DEVICE_TABLE 2010-02-09 11:08:33 +01:00
via82xx.c ALSA: via82xx: allow changing the initial DXS volume 2010-07-12 17:25:27 +02:00