diff options
author | Nicolin Chen <Guangyu.Chen@freescale.com> | 2013-12-20 08:41:01 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:36:20 (GMT) |
commit | d88f9a0651a94d7a827a98f8bc08d3f04e0804b4 (patch) | |
tree | caf3930b514f0e1829d14497468a6aa36a32caaa /sound/soc/fsl/fsl_sai.c | |
parent | bd4069918cb3df50208967f35b32b75a0aa3679b (diff) | |
download | linux-fsl-qoriq-d88f9a0651a94d7a827a98f8bc08d3f04e0804b4.tar.xz |
ASoC: fsl_sai: Use snd_pcm_format_width()
Use common helper function snd_pcm_format_width() to make code neater.
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
---
This patch is pulled back from upstream:
commit 1d7003092771bd2feec30e2f3e5a06aa33479e08
Change-Id: I6baf4f7c72a0d9f6aa332745f9251069c9600ab4
Reviewed-on: http://git.am.freescale.net:8181/19741
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'sound/soc/fsl/fsl_sai.c')
-rw-r--r-- | sound/soc/fsl/fsl_sai.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index e19dd95..d7b6950 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -244,9 +244,10 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *cpu_dai) { - u32 val_cr4, val_cr5, val_mr, reg_cr4, reg_cr5, reg_mr, word_width; + u32 val_cr4, val_cr5, val_mr, reg_cr4, reg_cr5, reg_mr; unsigned int channels = params_channels(params); struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai); + u32 word_width = snd_pcm_format_width(params_format(params)); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { reg_cr4 = FSL_SAI_TCR4; @@ -267,20 +268,6 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, val_cr5 &= ~FSL_SAI_CR5_W0W_MASK; val_cr5 &= ~FSL_SAI_CR5_FBT_MASK; - switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: - word_width = 16; - break; - case SNDRV_PCM_FORMAT_S20_3LE: - word_width = 20; - break; - case SNDRV_PCM_FORMAT_S24_LE: - word_width = 24; - break; - default: - return -EINVAL; - } - val_cr4 |= FSL_SAI_CR4_SYWD(word_width); val_cr5 |= FSL_SAI_CR5_WNW(word_width); val_cr5 |= FSL_SAI_CR5_W0W(word_width); |