summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-04-01 15:19:21 +0800
committerJason Liu <r64343@freescale.com>2015-05-08 16:33:42 +0800
commit83993b693b28209899a14eb578fed966fb6db382 (patch)
treeb1233b17e8217ffca2eaa6002265e23f184c6da5 /sound
parent7bbc61d81ecd880c8f20487efb12d2d9f201f811 (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')
-rw-r--r--sound/soc/fsl/imx-wm8958.c16
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)