aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/Kconfig1
-rw-r--r--sound/pci/hda/hda_codec.c19
2 files changed, 15 insertions, 5 deletions
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 80a7d44bcf81..0c5371abecd2 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -140,7 +140,6 @@ config SND_HDA_CODEC_VIA
140 140
141config SND_HDA_CODEC_HDMI 141config SND_HDA_CODEC_HDMI
142 bool "Build HDMI/DisplayPort HD-audio codec support" 142 bool "Build HDMI/DisplayPort HD-audio codec support"
143 select SND_DYNAMIC_MINORS
144 default y 143 default y
145 help 144 help
146 Say Y here to include HDMI and DisplayPort HD-audio codec 145 Say Y here to include HDMI and DisplayPort HD-audio codec
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