aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci/davinci-mcasp.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-02-03 07:51:50 -0500
committerMark Brown <broonie@linaro.org>2014-02-03 13:26:59 -0500
commita7e46bd9a19c1e0058c7c8c0b4cc3e6cf101e12a (patch)
tree70e398d2812cfdc795a00dea557cb9be205a9526 /sound/soc/davinci/davinci-mcasp.c
parent135014adc6ae5a1ab0f2f20abaf81d1860138d38 (diff)
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.c20
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,
611 u8 fifo_level; 611 u8 fifo_level;
612 u8 slots = mcasp->tdm_slots; 612 u8 slots = mcasp->tdm_slots;
613 u8 active_serializers; 613 u8 active_serializers;
614 int channels; 614 int channels = params_channels(params);
615 int ret; 615 int ret;
616 struct snd_interval *pcm_channels = hw_param_interval(params,
617 SNDRV_PCM_HW_PARAM_CHANNELS);
618 616
619 /* If mcasp is BCLK master we need to set BCLK divider */ 617 /* If mcasp is BCLK master we need to set BCLK divider */
620 if (mcasp->bclk_master) { 618 if (mcasp->bclk_master) {
@@ -627,19 +625,10 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
627 cpu_dai, 1, mcasp->sysclk_freq / bclk_freq); 625 cpu_dai, 1, mcasp->sysclk_freq / bclk_freq);
628 } 626 }
629 627
630 channels = pcm_channels->min;
631
632 active_serializers = (channels + slots - 1) / slots;
633
634 ret = mcasp_common_hw_param(mcasp, substream->stream, channels); 628 ret = mcasp_common_hw_param(mcasp, substream->stream, channels);
635 if (ret) 629 if (ret)
636 return ret; 630 return ret;
637 631
638 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
639 fifo_level = mcasp->txnumevt * active_serializers;
640 else
641 fifo_level = mcasp->rxnumevt * active_serializers;
642
643 if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE) 632 if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
644 ret = mcasp_dit_hw_param(mcasp); 633 ret = mcasp_dit_hw_param(mcasp);
645 else 634 else
@@ -680,6 +669,13 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
680 return -EINVAL; 669 return -EINVAL;
681 } 670 }
682 671
672 /* Calculate FIFO level */
673 active_serializers = (channels + slots - 1) / slots;
674 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
675 fifo_level = mcasp->txnumevt * active_serializers;
676 else
677 fifo_level = mcasp->rxnumevt * active_serializers;
678
683 if (mcasp->version == MCASP_VERSION_2 && !fifo_level) 679 if (mcasp->version == MCASP_VERSION_2 && !fifo_level)
684 dma_params->acnt = 4; 680 dma_params->acnt = 4;
685 else 681 else