All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Why my linux OS has only 8 sound cards ? How can I modify it ?
       [not found] <8c87f06b-dbfc-4035-8e5b-044e598939ae@i13g2000prg.googlegroups.com>
@ 2011-11-08 15:43 ` Linus Torvalds
  2011-11-08 15:57   ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2011-11-08 15:43 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel; +Cc: Chris Shen

Chris - you need to pick a better set of people to ask. A mailing
list, right maintainer etc.

Takashi, any idea? Do we have some 8-sound-card limit somewhere?

I do see that we have that odd

        if (card && card->number >= 8)
                return 0; /* ignore silently */

in sound/core/sound_oss.c: snd_register_oss_device(), but it has no
comments. The thing goes back to 2005 with the commit log entry of
"[ALSA] dynamic minors (6/6): increase maximum number of sound cards",
but the value '8'isn't explained.

                Linus


On Tue, Nov 8, 2011 at 12:30 AM, Chris Shen <chris2shen@gmail.com> wrote:
> Hi,everyone!
>   My  version of kernel is linux-2.6.35 .And my board has 10 sounds
> cards.After system was up,I used the comand "aplay -l ".Then console
> would display this:
> **** List of PLAYBACK Hardware Devices ****
> card 0: imx3stack [imx-3stack], device 0: WM8731 WM8731-0 []
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: default [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 2: default_1 [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 3: default_2 [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 4: default_3 [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 5: default_4 [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 6: default_5 [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 7: default_6 [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 8: default_7 [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 9: default_8 [C-Media USB Headphone Set  ], device 0: USB Audio
> [USB Audio]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> But,when I used the command "ls /dev/dsp*" ,the console display:
> /dev/dsp   /dev/dsp2  /dev/dsp4  /dev/dsp6
> /dev/dsp1  /dev/dsp3  /dev/dsp5  /dev/dsp7
> when the board is up ,I found have this err "unable to register OSS
> mixer device 8:0" and "unable to register OSS mixer device 9:0" .
> I think the kernel's max sound cards is 8 .How can I modify it ?
> Thank you!
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why my linux OS has only 8 sound cards ? How can I modify it ?
  2011-11-08 15:43 ` Why my linux OS has only 8 sound cards ? How can I modify it ? Linus Torvalds
@ 2011-11-08 15:57   ` Takashi Iwai
  2011-11-08 17:37     ` Clemens Ladisch
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2011-11-08 15:57 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: alsa-devel, Chris Shen

At Tue, 8 Nov 2011 07:43:26 -0800,
Linus Torvalds wrote:
> 
> Chris - you need to pick a better set of people to ask. A mailing
> list, right maintainer etc.
> 
> Takashi, any idea? Do we have some 8-sound-card limit somewhere?
> 
> I do see that we have that odd
> 
>         if (card && card->number >= 8)
>                 return 0; /* ignore silently */
> 
> in sound/core/sound_oss.c: snd_register_oss_device(), but it has no
> comments. The thing goes back to 2005 with the commit log entry of
> "[ALSA] dynamic minors (6/6): increase maximum number of sound cards",
> but the value '8'isn't explained.

ALSA itself can support 32 cards when CONFIG_SND_DYNAMIC_MINORS is
set, which assumes the use of udev.  Most of modern distros set this
already.  That's why Chris got already more than 8 devices seen in
ALSA side.

The above code is, however, about OSS-emulation.  And I guess it's
just a left-over of the old static limitation.  Actually OSS could
support up to 16 cards (in theory).

Below is an untested fix patch.  Does it work?


thanks,

Takashi

> 
>                 Linus
> 
> 
> On Tue, Nov 8, 2011 at 12:30 AM, Chris Shen <chris2shen@gmail.com> wrote:
> > Hi,everyone!
> >   My  version of kernel is linux-2.6.35 .And my board has 10 sounds
> > cards.After system was up,I used the comand "aplay -l ".Then console
> > would display this:
> > **** List of PLAYBACK Hardware Devices ****
> > card 0: imx3stack [imx-3stack], device 0: WM8731 WM8731-0 []
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 1: default [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 2: default_1 [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 3: default_2 [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 4: default_3 [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 5: default_4 [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 6: default_5 [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 7: default_6 [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 8: default_7 [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > card 9: default_8 [C-Media USB Headphone Set  ], device 0: USB Audio
> > [USB Audio]
> >  Subdevices: 1/1
> >  Subdevice #0: subdevice #0
> > But,when I used the command "ls /dev/dsp*" ,the console display:
> > /dev/dsp   /dev/dsp2  /dev/dsp4  /dev/dsp6
> > /dev/dsp1  /dev/dsp3  /dev/dsp5  /dev/dsp7
> > when the board is up ,I found have this err "unable to register OSS
> > mixer device 8:0" and "unable to register OSS mixer device 9:0" .
> > I think the kernel's max sound cards is 8 .How can I modify it ?
> > Thank you!
> >
> 

---
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: Fix the card number limit of OSS-emulation

There are left-over codes from the ancient days with the static device
number limitation of 8.  Actaully OSS can support up to 16 cards.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/sound_oss.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index c700920..075fc86 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -111,7 +111,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
 	int register1 = -1, register2 = -1;
 	struct device *carddev = snd_card_get_device_link(card);
 
-	if (card && card->number >= 8)
+	if (card && card->number >= SNDRV_MINOR_OSS_DEVICES)
 		return 0; /* ignore silently */
 	if (minor < 0)
 		return minor;
@@ -170,7 +170,7 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
 	int track2 = -1;
 	struct snd_minor *mptr;
 
-	if (card && card->number >= 8)
+	if (card && card->number >= SNDRV_MINOR_OSS_DEVICES)
 		return 0;
 	if (minor < 0)
 		return minor;
-- 
1.7.7

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Why my linux OS has only 8 sound cards ? How can I modify it ?
  2011-11-08 15:57   ` Takashi Iwai
@ 2011-11-08 17:37     ` Clemens Ladisch
  2011-11-08 17:42       ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Clemens Ladisch @ 2011-11-08 17:37 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Linus Torvalds, Chris Shen

Takashi Iwai wrote:
> Linus Torvalds wrote:
> > Takashi, any idea? Do we have some 8-sound-card limit somewhere?
> > 
> > I do see that we have that odd
> > 
> >         if (card && card->number >= 8)
> >                 return 0; /* ignore silently */
> > 
> > in sound/core/sound_oss.c: snd_register_oss_device(), but it has no
> > comments. The thing goes back to 2005 with the commit log entry of
> > "[ALSA] dynamic minors (6/6): increase maximum number of sound cards",
> > but the value '8'isn't explained.
> 
> ALSA itself can support 32 cards when CONFIG_SND_DYNAMIC_MINORS is
> set ...
> The above code is, however, about OSS-emulation.  And I guess it's
> just a left-over of the old static limitation.

Yes; I didn't change the limit in the OSS emulation because the minor
number layout doesn't have space for all 32 cards, and extending the
limit to 16 did not seem worth the effort for a 'legacy' interface.

> Actually OSS could support up to 16 cards (in theory).
> 
> Below is an untested fix patch.  Does it work?

Not without increasing SNDRV_OSS_MINORS, too:


diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index 0c164e5..d6dbe46 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -34,7 +34,7 @@
 #include <linux/sound.h>
 #include <linux/mutex.h>

-#define SNDRV_OSS_MINORS 128
+#define SNDRV_OSS_MINORS 256

 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
 static DEFINE_MUTEX(sound_oss_mutex);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Why my linux OS has only 8 sound cards ? How can I modify it ?
  2011-11-08 17:37     ` Clemens Ladisch
@ 2011-11-08 17:42       ` Takashi Iwai
       [not found]         ` <CALprvwVuTdNUnxCvPNLu-KQZw2pcoeeRa4Q7V7wctTGXY9GYpA@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2011-11-08 17:42 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, Linus Torvalds, Chris Shen

At Tue, 08 Nov 2011 18:37:53 +0100,
Clemens Ladisch wrote:
> 
> Takashi Iwai wrote:
> > Linus Torvalds wrote:
> > > Takashi, any idea? Do we have some 8-sound-card limit somewhere?
> > > 
> > > I do see that we have that odd
> > > 
> > >         if (card && card->number >= 8)
> > >                 return 0; /* ignore silently */
> > > 
> > > in sound/core/sound_oss.c: snd_register_oss_device(), but it has no
> > > comments. The thing goes back to 2005 with the commit log entry of
> > > "[ALSA] dynamic minors (6/6): increase maximum number of sound cards",
> > > but the value '8'isn't explained.
> > 
> > ALSA itself can support 32 cards when CONFIG_SND_DYNAMIC_MINORS is
> > set ...
> > The above code is, however, about OSS-emulation.  And I guess it's
> > just a left-over of the old static limitation.
> 
> Yes; I didn't change the limit in the OSS emulation because the minor
> number layout doesn't have space for all 32 cards, and extending the
> limit to 16 did not seem worth the effort for a 'legacy' interface.
> 
> > Actually OSS could support up to 16 cards (in theory).
> > 
> > Below is an untested fix patch.  Does it work?
> 
> Not without increasing SNDRV_OSS_MINORS, too:

Ah, good catch.  Below is the revised patch.


Takashi

---
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: Fix the card number limit of OSS-emulation

There are left-over codes from the ancient days with the static device
number limitation of 8.  Actaully OSS can support up to 16 cards.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
v2: fix SNDRV_OSS_MINORS, too

 sound/core/sound_oss.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index c700920..e952833 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -35,7 +35,7 @@
 #include <linux/sound.h>
 #include <linux/mutex.h>
 
-#define SNDRV_OSS_MINORS 128
+#define SNDRV_OSS_MINORS 256
 
 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
 static DEFINE_MUTEX(sound_oss_mutex);
@@ -111,7 +111,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
 	int register1 = -1, register2 = -1;
 	struct device *carddev = snd_card_get_device_link(card);
 
-	if (card && card->number >= 8)
+	if (card && card->number >= SNDRV_MINOR_OSS_DEVICES)
 		return 0; /* ignore silently */
 	if (minor < 0)
 		return minor;
@@ -170,7 +170,7 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
 	int track2 = -1;
 	struct snd_minor *mptr;
 
-	if (card && card->number >= 8)
+	if (card && card->number >= SNDRV_MINOR_OSS_DEVICES)
 		return 0;
 	if (minor < 0)
 		return minor;
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Why my linux OS has only 8 sound cards ? How can I modify it ?
       [not found]         ` <CALprvwVuTdNUnxCvPNLu-KQZw2pcoeeRa4Q7V7wctTGXY9GYpA@mail.gmail.com>
@ 2011-11-09  8:10           ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2011-11-09  8:10 UTC (permalink / raw)
  To: 沈发旺; +Cc: Linus Torvalds, alsa-devel, Clemens Ladisch

[Please stop using HTML mail for posting to a ML...]

At Wed, 9 Nov 2011 10:24:41 +0800,
沈发旺 wrote:
> 
> Hi,Takashi Iwai :
>     * I used your patch ,but it also display this when I used the command
> "ls /dev/dsp*".*
> */dev/dsp   /dev/dsp2  /dev/dsp4  /dev/dsp6
> /dev/dsp1  /dev/dsp3  /dev/dsp5  /dev/dsp7*
> *It also display this when board up:*
> *input: C-Media USB Headphone Set   as
> /devices/platform/fsl-ehci.1/usb2/2-1/2-1.5/2-1.5:1.3/input/input7
> generic-usb 0003:0D8C:000C.0007: input: USB HID v1.00 Device [C-Media USB
> Headphone Set  ] on usb-fsl-ehci.1-1.5/input3
> usb 2-1.6: new full speed USB device using fsl-ehci and address 8
> unable to register OSS PCM device 8:0
> unable to register OSS mixer device 8:0
> input: C-Media USB Headphone Set   as
> /devices/platform/fsl-ehci.1/usb2/2-1/2-1.6/2-1.6:1.3/input/input8
> generic-usb 0003:0D8C:000C.0008: input: USB HID v1.00 Device [C-Media USB
> Headphone Set  ] on usb-fsl-ehci.1-1.6/input3
> usb 2-1.7: new full speed USB device using fsl-ehci and address 9
> unable to register OSS PCM device 9:0
> unable to register OSS mixer device 9:0
> input: C-Media USB Headphone Set   as
> /devices/platform/fsl-ehci.1/usb2/2-1/2-1.7/2-1.7:1.3/input/input9
> generic-usb 0003:0D8C:000C.0009: input: USB HID v1.00 Device [C-Media USB
> Headphone Set  ] on usb-fsl-ehci.1-1.7/input3
> **when the sound cards exceed 8 ,I found it return err from
> sound/sound_core.c:__sound_insert_unit( ) . I read this code and found
> modify the function of "register_sound_special_device " -> max_unit = 128 +
> chain; when I change to :** max_unit = 256 + chain, my board will display
> 10 sound cards :*

So it's a limitation in sound_core.c.  (BTW, 256+chain is wrong.
It should be simply 256.)

I vaguely remember why we left the limit 8 in ALSA side.  One reason
was that sound_core itself doesn't support more than 8, and we weren't
sure whether changing it would regress or not.  For example, don't
apps expect only a single digit after /dev/dsp?

OTOH, having 11 sound devices with OSS must be a rare case and I'm
sure a legacy system using OSS won't have such a configuration.
And fixing the code is basically a right thing.

That being said, I'm fine to change that part for the upstream, if no
one objects.


thanks,

Takashi

> /dev/dsp   /dev/dsp2  /dev/dsp4  /dev/dsp6  /dev/dsp8
> /dev/dsp1  /dev/dsp3  /dev/dsp5  /dev/dsp7  /dev/dsp9
> *Thank you vary mach !*
> 2011/11/9 Takashi Iwai <tiwai@suse.de>
> 
> > At Tue, 08 Nov 2011 18:37:53 +0100,
> > Clemens Ladisch wrote:
> > >
> > > Takashi Iwai wrote:
> > > > Linus Torvalds wrote:
> > > > > Takashi, any idea? Do we have some 8-sound-card limit somewhere?
> > > > >
> > > > > I do see that we have that odd
> > > > >
> > > > >         if (card && card->number >= 8)
> > > > >                 return 0; /* ignore silently */
> > > > >
> > > > > in sound/core/sound_oss.c: snd_register_oss_device(), but it has no
> > > > > comments. The thing goes back to 2005 with the commit log entry of
> > > > > "[ALSA] dynamic minors (6/6): increase maximum number of sound
> > cards",
> > > > > but the value '8'isn't explained.
> > > >
> > > > ALSA itself can support 32 cards when CONFIG_SND_DYNAMIC_MINORS is
> > > > set ...
> > > > The above code is, however, about OSS-emulation.  And I guess it's
> > > > just a left-over of the old static limitation.
> > >
> > > Yes; I didn't change the limit in the OSS emulation because the minor
> > > number layout doesn't have space for all 32 cards, and extending the
> > > limit to 16 did not seem worth the effort for a 'legacy' interface.
> > >
> > > > Actually OSS could support up to 16 cards (in theory).
> > > >
> > > > Below is an untested fix patch.  Does it work?
> > >
> > > Not without increasing SNDRV_OSS_MINORS, too:
> >
> > Ah, good catch.  Below is the revised patch.
> >
> >
> > Takashi
> >
> > ---
> > From: Takashi Iwai <tiwai@suse.de>
> > Subject: [PATCH] ALSA: Fix the card number limit of OSS-emulation
> >
> > There are left-over codes from the ancient days with the static device
> > number limitation of 8.  Actaully OSS can support up to 16 cards.
> >
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> > v2: fix SNDRV_OSS_MINORS, too
> >
> >  sound/core/sound_oss.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
> > index c700920..e952833 100644
> > --- a/sound/core/sound_oss.c
> > +++ b/sound/core/sound_oss.c
> > @@ -35,7 +35,7 @@
> >  #include <linux/sound.h>
> >  #include <linux/mutex.h>
> >
> > -#define SNDRV_OSS_MINORS 128
> > +#define SNDRV_OSS_MINORS 256
> >
> >  static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
> >  static DEFINE_MUTEX(sound_oss_mutex);
> > @@ -111,7 +111,7 @@ int snd_register_oss_device(int type, struct snd_card
> > *card, int dev,
> >        int register1 = -1, register2 = -1;
> >        struct device *carddev = snd_card_get_device_link(card);
> >
> > -       if (card && card->number >= 8)
> > +       if (card && card->number >= SNDRV_MINOR_OSS_DEVICES)
> >                 return 0; /* ignore silently */
> >         if (minor < 0)
> >                return minor;
> > @@ -170,7 +170,7 @@ int snd_unregister_oss_device(int type, struct
> > snd_card *card, int dev)
> >        int track2 = -1;
> >        struct snd_minor *mptr;
> >
> > -       if (card && card->number >= 8)
> > +       if (card && card->number >= SNDRV_MINOR_OSS_DEVICES)
> >                return 0;
> >        if (minor < 0)
> >                return minor;
> > --
> > 1.7.7
> >
> >
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-09  8:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <8c87f06b-dbfc-4035-8e5b-044e598939ae@i13g2000prg.googlegroups.com>
2011-11-08 15:43 ` Why my linux OS has only 8 sound cards ? How can I modify it ? Linus Torvalds
2011-11-08 15:57   ` Takashi Iwai
2011-11-08 17:37     ` Clemens Ladisch
2011-11-08 17:42       ` Takashi Iwai
     [not found]         ` <CALprvwVuTdNUnxCvPNLu-KQZw2pcoeeRa4Q7V7wctTGXY9GYpA@mail.gmail.com>
2011-11-09  8:10           ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.