[alsa-devel] [PATCH] ASoC: ics43432: Add codec driver for InvenSense ICS-43432

Lars-Peter Clausen lars at metafoo.de
Thu Aug 13 16:57:06 CEST 2015


On 08/13/2015 03:55 PM, Ricard Wanderlof wrote:
> +
> +#define ICS43432_RATE_MIN 7190 /* Hz, from data sheet */
> +#define ICS43432_RATE_MAX 52800  /* Hz, from data sheet */

If the part can work with continuous rates between those two values set
rate_min and rate_max in the DAI struct and set the rates field of the same
struct to SNDRV_PCM_RATE_CONTINUOUS.

> +
> +static int ics43432_hw_params(struct snd_pcm_substream *substream,
> +	struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
> +{
> +	unsigned int rate = params_rate(params);
> +
> +	if (rate < ICS43432_RATE_MIN || rate > ICS43432_RATE_MAX)
> +		return -EINVAL;

And then drop all of this. The ALSA core will take care of enforcing the
constraints.

> +
> +	return 0;
> +}



More information about the Alsa-devel mailing list