summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-04-03 18:12:55 +0800
committerJason Liu <r64343@freescale.com>2015-05-08 17:24:08 +0800
commit74e3297decd1ded815112c44ef40cdf262d8cb9b (patch)
tree78b182c7a7da443c7bb4859d326db8838f772509 /sound
parentd97b25db871a43d0926ca04fa91243f7cc49068e (diff)
MLK-10581 ASoC: imx-wm8958: add constraint for 24bit playback and capture
wm8958 codec support list below: playback 16 bit: 8k, 11.025k, 16k, 22.050k, 32k, 44k, 48k, 88.2k, 96k. playback 24 bit: 8k, 11.025k, 16k, 22.050k, 32k, 44k, 48k. capture 16 bit: 8k, 11.025k, 16k, 22.050k, 32k, 44k, 48k. capture 24 bit: 8k, 11.025k, 16k, 22.050k, 32k. Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/imx-wm8958.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sound/soc/fsl/imx-wm8958.c b/sound/soc/fsl/imx-wm8958.c
index 49ce823cc9bc..fd029e05babd 100644
--- a/sound/soc/fsl/imx-wm8958.c
+++ b/sound/soc/fsl/imx-wm8958.c
@@ -130,9 +130,22 @@ static int imx_hifi_hw_params(struct snd_pcm_substream *substream,
struct device *dev = card->dev;
struct imx_wm8958_data *data = snd_soc_card_get_drvdata(card);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ unsigned int sample_rate = params_rate(params);
unsigned int pll_out;
int ret;
+ if (tx && params_width(params) == 24) {
+ if (sample_rate == 88200 || sample_rate == 96000) {
+ dev_err(dev, "Can't support sample rate %dHZ\n", sample_rate);
+ return -EINVAL;
+ }
+ } else if (!tx && params_width(params) == 24) {
+ if (sample_rate == 44100 || sample_rate == 48000) {
+ dev_err(dev, "Can't support sample rate %dHZ\n", sample_rate);
+ return -EINVAL;
+ }
+ }
+
ret = snd_soc_dai_set_fmt(codec_dai, data->dai.dai_fmt);
if (ret) {
dev_err(dev, "failed to set codec dai fmt: %d\n", ret);
@@ -161,7 +174,7 @@ static int imx_hifi_hw_params(struct snd_pcm_substream *substream,
return ret;
}
} else {
- data->sr_stream[tx] = params_rate(params);
+ data->sr_stream[tx] = sample_rate;
if (params_width(params) == 24)
pll_out = data->sr_stream[tx] * 384;