diff options
author | Zidan Wang <zidan.wang@freescale.com> | 2015-04-01 15:19:21 +0800 |
---|---|---|
committer | Frank Li <Frank.Li@freescale.com> | 2015-04-24 23:02:51 +0800 |
commit | 7d3b9ac70acdba5a6417809d0a723a1a26c3dfa3 (patch) | |
tree | 45cac8940bc50c1bf531ed5869b1ad2b56ee9ec2 /sound/soc | |
parent | 8bb01077305f6e381e17db080447490174166545 (diff) |
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 <zidan.wang@freescale.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/fsl/imx-wm8958.c | 16 |
1 files changed, 14 insertions, 2 deletions
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) |