[alsa-devel] question on snd minors

Takashi Iwai tiwai at suse.de
Tue Nov 15 11:12:11 CET 2011


At Tue, 15 Nov 2011 14:55:33 +0530,
Vinod Koul wrote:
> 
> On Tue, 2011-11-15 at 09:11 +0100, Takashi Iwai wrote:
> > > For compressed path (i had posted RFC roughly two months back [1]),
> > we
> > > are creating new devices /dev/snd/comprCxDxp which would be
> > registered
> > > as SNDRV_DEV_COMPRESS. For the registration part we need to assign
> > the
> > > minors, right? Hence the above question
> > > 
> > > Or did I miss something very obvious here...
> > 
> > Yes, take a look at PCM devices, for example.  They have sub-streams.
> > So, you can open a single device file multiple times to assign
> > multiple sub-streams.  If any specific substream with a given index is
> > needed, it can be specified via ioctl before open.  Otherwise, the
> > next empty substream is assigned.
> > 
> > The similar implementation is found in rawmidi, too.
> Okay Thanks a bunch, I wanted to avoid these kind of mistakes :)
> 
> right now we don't have PCM devices or substreams notion. The DSP driver
> registers the compressed_ops (not pcm) with framework and we create the
> device nodes. framework would call them based on state and file_ops
> called.
> 
> >From what I read in rawmidi and your suggestion about PCM devices, I
> think you are suggesting to use a single file ops only (this a single
> minor number (or two, including capture) would suffice instead of a
> range, right? Any suggestion of which number to use?
> (well i followed the usually convention of PCM for minor numbers,
> although I cannot envision a device with multiple/large DSPs for audio
> offload)

OK, if there aren't so many devices, we may still reserved slots
(minor 2 and 3).  These can be assigned for the new type.  Will be
there two completely different DSPs?  If it's unlikely, just grab one
minor as the start, I'd say.  You can still implement the substreams
in a single device.

Note that the above story is only for the case without
CONFIG_SND_DYNAMIC_MIONRS.  If you use CONFIG_SND_DYNAMIC_MINORS (this
is usually set for all modern distros), there is no restriction but
the total number of minors since the minor numbers are assigned
dynamically.  So you can forget all in the above.


Takashi


More information about the Alsa-devel mailing list