[PATCH] [UBUNTU:sound/pci/hda/] Fix SPDIF subdevice for Realtek HDA codecs
crimsun at fungus.sh.nu
crimsun at fungus.sh.nu
Thu Sep 14 23:41:51 UTC 2006
From 45e9d3374f056c00f9105aaa58d68f3d8d60df1b Mon Sep 17 00:00:00 2001
From: Daniel T. Chen <crimsun at garnish.localdomain>
Date: Thu, 14 Sep 2006 19:28:45 -0400
Subject: [PATCH] [UBUNTU:sound/pci/hda/] Fix SPDIF subdevice for Realtek HDA codecs
UpstreamStatus: Added in upstream alsa-kernel hg changeset:
a254bc814ec3 [http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=a254bc814ec351c7fb14b4badee95927ce304340;style=raw]
Takashi Iwai added this commit that sets the SPDIF subdevice to the
second one (#1) so that configurations are identical for numerous
codecs. This has the side effect of setting the optional capture
device to the third one (#2).
This commit is applicable to both Dapper and Edgy linux-source.
Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>
---
sound/pci/hda/hda_intel.c | 10 ++++++++--
sound/pci/hda/patch_realtek.c | 38 ++++++++++++++++++++------------------
2 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 1529550..81b36d2 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1215,7 +1215,12 @@ static int __devinit create_codec_pcm(az
snd_pcm_t *pcm;
struct azx_pcm *apcm;
- snd_assert(cpcm->stream[0].substreams || cpcm->stream[1].substreams, return -EINVAL);
+ /* if no substreams are defined for both playback and capture,
+ * it's just a placeholder. ignore it.
+ */
+ if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams)
+ return 0;
+
snd_assert(cpcm->name, return -EINVAL);
err = snd_pcm_new(chip->card, cpcm->name, pcm_dev,
@@ -1241,7 +1246,8 @@ static int __devinit create_codec_pcm(az
snd_dma_pci_data(chip->pci),
1024 * 64, 1024 * 128);
chip->pcm[pcm_dev] = pcm;
- chip->pcm_devs = pcm_dev + 1;
+ if (chip->pcm_devs < pcm_dev + 1)
+ chip->pcm_devs = pcm_dev + 1;
return 0;
}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c308488..e1993bb 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1766,25 +1766,9 @@ static int alc_build_pcms(struct hda_cod
}
}
- /* If the use of more than one ADC is requested for the current
- * model, configure a second analog capture-only PCM.
- */
- if (spec->num_adc_nids > 1) {
- codec->num_pcms++;
- info++;
- info->name = spec->stream_name_analog;
- /* No playback stream for second PCM */
- info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
- info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
- if (spec->stream_analog_capture) {
- snd_assert(spec->adc_nids, return -EINVAL);
- info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
- info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
- }
- }
-
+ /* SPDIF for stream index #1 */
if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
- codec->num_pcms++;
+ codec->num_pcms = 2;
info++;
info->name = spec->stream_name_digital;
if (spec->multiout.dig_out_nid &&
@@ -1799,6 +1783,24 @@ static int alc_build_pcms(struct hda_cod
}
}
+ /* If the use of more than one ADC is requested for the current
+ * model, configure a second analog capture-only PCM.
+ */
+ /* Additional Analaog capture for index #2 */
+ if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
+ spec->adc_nids) {
+ codec->num_pcms = 3;
+ info++;
+ info->name = spec->stream_name_analog;
+ /* No playback stream for second PCM */
+ info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
+ info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
+ if (spec->stream_analog_capture) {
+ info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
+ info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
+ }
+ }
+
return 0;
}
--
1.4.1
--
Daniel T. Chen crimsun at ubuntu.com
GPG key: 0xC88ABDA3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060914/b6dbb24e/attachment.sig>
More information about the kernel-team
mailing list