aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-09-07 11:52:14 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:46:46 -0400
commite08a007d1041e0bc3df6b855043d8efde91851aa (patch)
treeace6ac98dec5bfc7a658df9aa6d0c78393b8598b
parentdafbbb1fdbf103b24d0f7aa645625b6bd558c896 (diff)
[ALSA] hda-codec - Fix SPDIF device number of ALC codecs
Assign the SPDIF always to the secondary device (dev#1) to keep the same configuration. Move the optional capture device to the third device (dev#2). hda_intel now just ignores the NULL entries in the pcm arrays from codecs. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--sound/pci/hda/hda_intel.c10
-rw-r--r--sound/pci/hda/patch_realtek.c38
2 files changed, 28 insertions, 20 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index bfd74a526b85..6309e0c67e6a 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1242,7 +1242,12 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec,
1242 struct snd_pcm *pcm; 1242 struct snd_pcm *pcm;
1243 struct azx_pcm *apcm; 1243 struct azx_pcm *apcm;
1244 1244
1245 snd_assert(cpcm->stream[0].substreams || cpcm->stream[1].substreams, return -EINVAL); 1245 /* if no substreams are defined for both playback and capture,
1246 * it's just a placeholder. ignore it.
1247 */
1248 if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams)
1249 return 0;
1250
1246 snd_assert(cpcm->name, return -EINVAL); 1251 snd_assert(cpcm->name, return -EINVAL);
1247 1252
1248 err = snd_pcm_new(chip->card, cpcm->name, pcm_dev, 1253 err = snd_pcm_new(chip->card, cpcm->name, pcm_dev,
@@ -1268,7 +1273,8 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec,
1268 snd_dma_pci_data(chip->pci), 1273 snd_dma_pci_data(chip->pci),
1269 1024 * 64, 1024 * 128); 1274 1024 * 64, 1024 * 128);
1270 chip->pcm[pcm_dev] = pcm; 1275 chip->pcm[pcm_dev] = pcm;
1271 chip->pcm_devs = pcm_dev + 1; 1276 if (chip->pcm_devs < pcm_dev + 1)
1277 chip->pcm_devs = pcm_dev + 1;
1272 1278
1273 return 0; 1279 return 0;
1274} 1280}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d037051b66b4..ba9e050e2012 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1796,25 +1796,9 @@ static int alc_build_pcms(struct hda_codec *codec)
1796 } 1796 }
1797 } 1797 }
1798 1798
1799 /* If the use of more than one ADC is requested for the current 1799 /* SPDIF for stream index #1 */
1800 * model, configure a second analog capture-only PCM.
1801 */
1802 if (spec->num_adc_nids > 1) {
1803 codec->num_pcms++;
1804 info++;
1805 info->name = spec->stream_name_analog;
1806 /* No playback stream for second PCM */
1807 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
1808 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
1809 if (spec->stream_analog_capture) {
1810 snd_assert(spec->adc_nids, return -EINVAL);
1811 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
1812 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
1813 }
1814 }
1815
1816 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 1800 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1817 codec->num_pcms++; 1801 codec->num_pcms = 2;
1818 info++; 1802 info++;
1819 info->name = spec->stream_name_digital; 1803 info->name = spec->stream_name_digital;
1820 if (spec->multiout.dig_out_nid && 1804 if (spec->multiout.dig_out_nid &&
@@ -1829,6 +1813,24 @@ static int alc_build_pcms(struct hda_codec *codec)
1829 } 1813 }
1830 } 1814 }
1831 1815
1816 /* If the use of more than one ADC is requested for the current
1817 * model, configure a second analog capture-only PCM.
1818 */
1819 /* Additional Analaog capture for index #2 */
1820 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
1821 spec->adc_nids) {
1822 codec->num_pcms = 3;
1823 info++;
1824 info->name = spec->stream_name_analog;
1825 /* No playback stream for second PCM */
1826 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
1827 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
1828 if (spec->stream_analog_capture) {
1829 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
1830 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
1831 }
1832 }
1833
1832 return 0; 1834 return 0;
1833} 1835}
1834 1836