[alsa-devel] How do I tell ALSA that my driver supports every possible sample rate?

Liam Girdwood lg at opensource.wolfsonmicro.com
Wed Jul 25 17:24:11 CEST 2007


On Wed, 2007-07-25 at 17:12 +0200, Takashi Iwai wrote:
> At Wed, 25 Jul 2007 17:08:41 +0200,
> I wrote:
> > 
> > At Wed, 25 Jul 2007 09:37:34 -0500,
> > Timur Tabi wrote:
> > > 
> > > Takashi Iwai wrote:
> > > 
> > > >> So can I do this?
> > > >>
> > > >> static const struct snd_pcm_hardware mpc86xx_pcm_hardware = {
> > > >>
> > > >> 	.rates			= SNDRV_PCM_RATE_CONTINUOUS,
> > > >> 	.rate_min		= 1,
> > > >> 	.rate_max		= (unsigned int) -1,
> > > > 
> > > > In theory, yes, but these rate_min and rate_max are nothing but
> > > > confusing in practice.  Your hardware won't support definitely such
> > > > rates, but the application can't know.  Set some reasonable values
> > > > there.
> > > 
> > > This is an ASOC driver.  My understanding is that ASOC will take all
> > > the values from the machine, PCM, I2S, and codec drivers and create
> > > the subset that matches all drivers.  That's the point I was trying
> > > to make: my PCM driver does *not* decide what the capabilities of
> > > the system are, because my DMA controller can handle all speeds.  So
> > > I don't want to put some arbitrary limits in the PCM driver, and
> > > then perhaps one day it gets attached to a codec driver that can
> > > handle 4000Hz, but ASOC won't allow it because I used
> > > SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATES_5512 in my PCM driver.
> > > ASOC would incorrectly believe that the PCM driver can't handle
> > > 4000Hz. 
> > 
> > Then,
> > 	rates = -1U,
> > 	rate_min = 0,
> > 	rate_max = -1U,
> > are the correct values.
> 
> ... of course, this assumes that codec and platform have the sane rate
> setting.  ASoC should do some sanity checks...
> 

Ok, I've marked this on my todo list ;)

Liam



More information about the Alsa-devel mailing list