aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_hdmi.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-06-01 13:14:17 -0400
committerTakashi Iwai <tiwai@suse.de>2011-06-06 06:48:59 -0400
commit7c9359762797ba7a70bbaa6364aaecc16786ac83 (patch)
tree82830d36c0bc7d934deed1e99b9c4bb80f404b11 /sound/pci/hda/patch_hdmi.c
parentc3d52105753dafdf2d993e540cc3192f23447dac (diff)
ALSA: hda: Allow multple SPDIF controls per codec
Currently, the data that backs the kcontrols created by snd_hda_create_spdif_out_ctls is stored directly in struct hda_codec. When multiple sets of these controls are stored, they will all manipulate the same data, causing confusion. Instead, store an array of this data, one copy per converter, to isolate the controls. This patch would cause a behavioural change in the case where snd_hda_create_spdif_out_ctls was called multiple times for a single codec. As best I can tell, this is never the case for any codec. This will be relevant at least for some HDMI audio codecs, such as the NVIDIA GeForce 520 and Intel Ibex Peak. A future change will modify the driver's handling of those codecs to create multiple PCMs per codec. Note that this issue isn't affected by whether one creates a PCM-per-converter or PCM-per-pin; there are multiple of both within a single codec in both of those codecs. Note that those codecs don't currently create multiple PCMs for the codec due to the default HW mux state of all pins being to point at the same converter, hence there is only a single converter routed to any pin, and hence only a single PCM. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_hdmi.c')
-rw-r--r--sound/pci/hda/patch_hdmi.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 8ccec72a8f0c..86b35a071a83 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1352,6 +1352,9 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1352 int chs; 1352 int chs;
1353 unsigned int dataDCC1, dataDCC2, channel_id; 1353 unsigned int dataDCC1, dataDCC2, channel_id;
1354 int i; 1354 int i;
1355 struct hdmi_spec *spec = codec->spec;
1356 struct hda_spdif_out *spdif =
1357 snd_hda_spdif_out_of_nid(codec, spec->cvt[0]);
1355 1358
1356 mutex_lock(&codec->spdif_mutex); 1359 mutex_lock(&codec->spdif_mutex);
1357 1360
@@ -1361,12 +1364,12 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1361 dataDCC2 = 0x2; 1364 dataDCC2 = 0x2;
1362 1365
1363 /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ 1366 /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */
1364 if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) 1367 if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE))
1365 snd_hda_codec_write(codec, 1368 snd_hda_codec_write(codec,
1366 nvhdmi_master_con_nid_7x, 1369 nvhdmi_master_con_nid_7x,
1367 0, 1370 0,
1368 AC_VERB_SET_DIGI_CONVERT_1, 1371 AC_VERB_SET_DIGI_CONVERT_1,
1369 codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); 1372 spdif->ctls & ~AC_DIG1_ENABLE & 0xff);
1370 1373
1371 /* set the stream id */ 1374 /* set the stream id */
1372 snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0, 1375 snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0,
@@ -1378,12 +1381,12 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1378 1381
1379 /* turn on again (if needed) */ 1382 /* turn on again (if needed) */
1380 /* enable and set the channel status audio/data flag */ 1383 /* enable and set the channel status audio/data flag */
1381 if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) { 1384 if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) {
1382 snd_hda_codec_write(codec, 1385 snd_hda_codec_write(codec,
1383 nvhdmi_master_con_nid_7x, 1386 nvhdmi_master_con_nid_7x,
1384 0, 1387 0,
1385 AC_VERB_SET_DIGI_CONVERT_1, 1388 AC_VERB_SET_DIGI_CONVERT_1,
1386 codec->spdif_ctls & 0xff); 1389 spdif->ctls & 0xff);
1387 snd_hda_codec_write(codec, 1390 snd_hda_codec_write(codec,
1388 nvhdmi_master_con_nid_7x, 1391 nvhdmi_master_con_nid_7x,
1389 0, 1392 0,
@@ -1400,12 +1403,12 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1400 *otherwise the IEC958 bits won't be updated 1403 *otherwise the IEC958 bits won't be updated
1401 */ 1404 */
1402 if (codec->spdif_status_reset && 1405 if (codec->spdif_status_reset &&
1403 (codec->spdif_ctls & AC_DIG1_ENABLE)) 1406 (spdif->ctls & AC_DIG1_ENABLE))
1404 snd_hda_codec_write(codec, 1407 snd_hda_codec_write(codec,
1405 nvhdmi_con_nids_7x[i], 1408 nvhdmi_con_nids_7x[i],
1406 0, 1409 0,
1407 AC_VERB_SET_DIGI_CONVERT_1, 1410 AC_VERB_SET_DIGI_CONVERT_1,
1408 codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); 1411 spdif->ctls & ~AC_DIG1_ENABLE & 0xff);
1409 /* set the stream id */ 1412 /* set the stream id */
1410 snd_hda_codec_write(codec, 1413 snd_hda_codec_write(codec,
1411 nvhdmi_con_nids_7x[i], 1414 nvhdmi_con_nids_7x[i],
@@ -1421,12 +1424,12 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1421 /* turn on again (if needed) */ 1424 /* turn on again (if needed) */
1422 /* enable and set the channel status audio/data flag */ 1425 /* enable and set the channel status audio/data flag */
1423 if (codec->spdif_status_reset && 1426 if (codec->spdif_status_reset &&
1424 (codec->spdif_ctls & AC_DIG1_ENABLE)) { 1427 (spdif->ctls & AC_DIG1_ENABLE)) {
1425 snd_hda_codec_write(codec, 1428 snd_hda_codec_write(codec,
1426 nvhdmi_con_nids_7x[i], 1429 nvhdmi_con_nids_7x[i],
1427 0, 1430 0,
1428 AC_VERB_SET_DIGI_CONVERT_1, 1431 AC_VERB_SET_DIGI_CONVERT_1,
1429 codec->spdif_ctls & 0xff); 1432 spdif->ctls & 0xff);
1430 snd_hda_codec_write(codec, 1433 snd_hda_codec_write(codec,
1431 nvhdmi_con_nids_7x[i], 1434 nvhdmi_con_nids_7x[i],
1432 0, 1435 0,