From 7d3b9ac70acdba5a6417809d0a723a1a26c3dfa3 Mon Sep 17 00:00:00 2001 From: Zidan Wang Date: Wed, 1 Apr 2015 15:19:21 +0800 Subject: MLK-10528 ASoC: imx-wm8958: add constraint list for capture wm8958 doesn't support ADC sample rate 88.2k and 96k, so add a constraint list for capture. Signed-off-by: Zidan Wang --- sound/soc/fsl/imx-wm8958.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/fsl/imx-wm8958.c b/sound/soc/fsl/imx-wm8958.c index 2bfbebb79d87..544f8b276692 100644 --- a/sound/soc/fsl/imx-wm8958.c +++ b/sound/soc/fsl/imx-wm8958.c @@ -228,13 +228,22 @@ static int imx_hifi_hw_free(struct snd_pcm_substream *substream) return 0; } +static u32 imx_wm8958_adc_rates[] = { + 8000, 11025, 12000, 16000, 22050, + 24000, 32000, 44100, 48000 +}; + +static struct snd_pcm_hw_constraint_list imx_wm8958_adc_rate_constraints = { + .count = ARRAY_SIZE(imx_wm8958_adc_rates), + .list = imx_wm8958_adc_rates, +}; static int imx_hifi_startup(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_card *card = rtd->card; struct imx_wm8958_data *data = snd_soc_card_get_drvdata(card); - int ret; + int ret = 0; if (!IS_ERR(data->mclk)) { ret = clk_prepare_enable(data->mclk); @@ -244,7 +253,10 @@ static int imx_hifi_startup(struct snd_pcm_substream *substream) } } - return 0; + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + ret = snd_pcm_hw_constraint_list(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, &imx_wm8958_adc_rate_constraints); + return ret; } static void imx_hifi_shutdown(struct snd_pcm_substream *substream) -- cgit v1.2.3