[alsa-devel] ASoC : question about custom rate

Lars-Peter Clausen lars at metafoo.de
Tue Sep 9 12:44:40 CEST 2014


On 09/09/2014 10:43 AM, Matt Flax wrote:
> Hi there,
>
> I have an ASIC running on an ASoC with a custom rate @ 18750 Hz.
> I would like ALSA to report the correct rate.
>
> If I do nothing, then the following reports 16000 Hz :
> cat /proc/asound/card0/pcm0c/sub0/hw_params
>
> I have verified that the hardware is running at the expected 18750 Hz.
> I am wondering what/where is the correct place to setup the actual rate ?
>
> I am trying to set the rates at startup like so but ALSA will not work with
> the driver when I do this :
>
> static int implant_startup(struct snd_pcm_substream *substream, struct
> snd_soc_dai *dai)
> {
>      snd_pcm_hw_constraint_minmax(substream->runtime,
> SNDRV_PCM_HW_PARAM_RATE, 18750, 18750);


This is the correct approach. But it is quite likely that your I2S driver 
will set additional constraints (e.g. just 16k, 32k, etc.) that results in 
an empty list for the rate constraints. If the I2S driver works fine maybe 
change the constraints to only set a minimum and maximum rate instead of 
specific rates.

- Lars



More information about the Alsa-devel mailing list