aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-06-06 06:10:24 -0400
committerTakashi Iwai <tiwai@suse.de>2013-06-06 06:21:20 -0400
commit36bb00d4b2463b0b8b37fb0ce753813bf729b997 (patch)
treed6158f30c1551e4185eb965ca81dcce5d74da2f8 /sound/pci/hda/hda_codec.c
parent2c38d990fbdfc76176b03d60bc5e1a93d270760d (diff)
ALSA: hda - Drop hard dependency on CONFIG_SND_DYNAMIC_MINORS
Currently HDMI codec driver sets the hard dependency (reverse selection) on CONFIG_SND_DYNAMIC_MINORS because the recent codecs may support more than two PCMs. But, this doesn't mean that we need always this option, since there can be a single PCM stream even with the modern codecs. This patch drops the hard dependency again but give more sensible error message when no enough PCMs are available due to the lack of this option. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 55108b5fb291..679fba44bdb5 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4461,12 +4461,13 @@ const char *snd_hda_pcm_type_name[HDA_PCM_NTYPES] = {
4461 4461
4462/* 4462/*
4463 * get the empty PCM device number to assign 4463 * get the empty PCM device number to assign
4464 *
4465 * note the max device number is limited by HDA_MAX_PCMS, currently 10
4466 */ 4464 */
4467static int get_empty_pcm_device(struct hda_bus *bus, int type) 4465static int get_empty_pcm_device(struct hda_bus *bus, unsigned int type)
4468{ 4466{
4469 /* audio device indices; not linear to keep compatibility */ 4467 /* audio device indices; not linear to keep compatibility */
4468 /* assigned to static slots up to dev#10; if more needed, assign
4469 * the later slot dynamically (when CONFIG_SND_DYNAMIC_MINORS=y)
4470 */
4470 static int audio_idx[HDA_PCM_NTYPES][5] = { 4471 static int audio_idx[HDA_PCM_NTYPES][5] = {
4471 [HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 }, 4472 [HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 },
4472 [HDA_PCM_TYPE_SPDIF] = { 1, -1 }, 4473 [HDA_PCM_TYPE_SPDIF] = { 1, -1 },
@@ -4480,18 +4481,28 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type)
4480 return -EINVAL; 4481 return -EINVAL;
4481 } 4482 }
4482 4483
4483 for (i = 0; audio_idx[type][i] >= 0 ; i++) 4484 for (i = 0; audio_idx[type][i] >= 0; i++) {
4485#ifndef CONFIG_SND_DYNAMIC_MINORS
4486 if (audio_idx[type][i] >= 8)
4487 break;
4488#endif
4484 if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) 4489 if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits))
4485 return audio_idx[type][i]; 4490 return audio_idx[type][i];
4491 }
4486 4492
4493#ifdef CONFIG_SND_DYNAMIC_MINORS
4487 /* non-fixed slots starting from 10 */ 4494 /* non-fixed slots starting from 10 */
4488 for (i = 10; i < 32; i++) { 4495 for (i = 10; i < 32; i++) {
4489 if (!test_and_set_bit(i, bus->pcm_dev_bits)) 4496 if (!test_and_set_bit(i, bus->pcm_dev_bits))
4490 return i; 4497 return i;
4491 } 4498 }
4499#endif
4492 4500
4493 snd_printk(KERN_WARNING "Too many %s devices\n", 4501 snd_printk(KERN_WARNING "Too many %s devices\n",
4494 snd_hda_pcm_type_name[type]); 4502 snd_hda_pcm_type_name[type]);
4503#ifndef CONFIG_SND_DYNAMIC_MINORS
4504 snd_printk(KERN_WARNING "Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y\n");
4505#endif
4495 return -EAGAIN; 4506 return -EAGAIN;
4496} 4507}
4497 4508