diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2014-02-03 13:51:50 +0100 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-02-03 19:26:59 +0100 |
commit | a7e46bd9a19c1e0058c7c8c0b4cc3e6cf101e12a (patch) | |
tree | 70e398d2812cfdc795a00dea557cb9be205a9526 /sound/soc/davinci/davinci-mcasp.c | |
parent | ASoC: davinci-mcasp: Move pm callbacks from platform device to soc_dai_driver (diff) | |
download | linux-a7e46bd9a19c1e0058c7c8c0b4cc3e6cf101e12a.tar.xz linux-a7e46bd9a19c1e0058c7c8c0b4cc3e6cf101e12a.zip |
ASoC: davinci-mcasp: Code cleanup in davinci_mcasp_hw_params()
Rearrange the code in the function for readability.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/davinci/davinci-mcasp.c')
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 0518ff2d960c..63b1ecc97cb1 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -611,10 +611,8 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, u8 fifo_level; u8 slots = mcasp->tdm_slots; u8 active_serializers; - int channels; + int channels = params_channels(params); int ret; - struct snd_interval *pcm_channels = hw_param_interval(params, - SNDRV_PCM_HW_PARAM_CHANNELS); /* If mcasp is BCLK master we need to set BCLK divider */ if (mcasp->bclk_master) { @@ -627,19 +625,10 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, cpu_dai, 1, mcasp->sysclk_freq / bclk_freq); } - channels = pcm_channels->min; - - active_serializers = (channels + slots - 1) / slots; - ret = mcasp_common_hw_param(mcasp, substream->stream, channels); if (ret) return ret; - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - fifo_level = mcasp->txnumevt * active_serializers; - else - fifo_level = mcasp->rxnumevt * active_serializers; - if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE) ret = mcasp_dit_hw_param(mcasp); else @@ -680,6 +669,13 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } + /* Calculate FIFO level */ + active_serializers = (channels + slots - 1) / slots; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + fifo_level = mcasp->txnumevt * active_serializers; + else + fifo_level = mcasp->rxnumevt * active_serializers; + if (mcasp->version == MCASP_VERSION_2 && !fifo_level) dma_params->acnt = 4; else |