diff options
Diffstat (limited to 'sound/soc/davinci/davinci-mcasp.c')
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index aeb3a6627d6a..8b85049daab0 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -636,11 +636,12 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev, | |||
636 | * callback, take it into account here. That allows us to for example | 636 | * callback, take it into account here. That allows us to for example |
637 | * send 32 bits per channel to the codec, while only 16 of them carry | 637 | * send 32 bits per channel to the codec, while only 16 of them carry |
638 | * audio payload. | 638 | * audio payload. |
639 | * The clock ratio is given for a full period of data (both left and | 639 | * The clock ratio is given for a full period of data (for I2S format |
640 | * right channels), so it has to be divided by 2. | 640 | * both left and right channels), so it has to be divided by number of |
641 | * tdm-slots (for I2S - divided by 2). | ||
641 | */ | 642 | */ |
642 | if (dev->bclk_lrclk_ratio) | 643 | if (dev->bclk_lrclk_ratio) |
643 | word_length = dev->bclk_lrclk_ratio / 2; | 644 | word_length = dev->bclk_lrclk_ratio / dev->tdm_slots; |
644 | 645 | ||
645 | /* mapping of the XSSZ bit-field as described in the datasheet */ | 646 | /* mapping of the XSSZ bit-field as described in the datasheet */ |
646 | fmt = (word_length >> 1) - 1; | 647 | fmt = (word_length >> 1) - 1; |
@@ -834,17 +835,20 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
834 | int word_length; | 835 | int word_length; |
835 | u8 fifo_level; | 836 | u8 fifo_level; |
836 | u8 slots = dev->tdm_slots; | 837 | u8 slots = dev->tdm_slots; |
838 | u8 active_serializers; | ||
837 | int channels; | 839 | int channels; |
838 | struct snd_interval *pcm_channels = hw_param_interval(params, | 840 | struct snd_interval *pcm_channels = hw_param_interval(params, |
839 | SNDRV_PCM_HW_PARAM_CHANNELS); | 841 | SNDRV_PCM_HW_PARAM_CHANNELS); |
840 | channels = pcm_channels->min; | 842 | channels = pcm_channels->min; |
841 | 843 | ||
844 | active_serializers = (channels + slots - 1) / slots; | ||
845 | |||
842 | if (davinci_hw_common_param(dev, substream->stream, channels) == -EINVAL) | 846 | if (davinci_hw_common_param(dev, substream->stream, channels) == -EINVAL) |
843 | return -EINVAL; | 847 | return -EINVAL; |
844 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 848 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
845 | fifo_level = dev->txnumevt; | 849 | fifo_level = dev->txnumevt * active_serializers; |
846 | else | 850 | else |
847 | fifo_level = dev->rxnumevt; | 851 | fifo_level = dev->rxnumevt * active_serializers; |
848 | 852 | ||
849 | if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) | 853 | if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) |
850 | davinci_hw_dit_param(dev); | 854 | davinci_hw_dit_param(dev); |
@@ -889,7 +893,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
889 | dma_params->acnt = dma_params->data_type; | 893 | dma_params->acnt = dma_params->data_type; |
890 | 894 | ||
891 | dma_params->fifo_level = fifo_level; | 895 | dma_params->fifo_level = fifo_level; |
892 | dma_params->active_serializers = (channels + slots - 1) / slots; | ||
893 | davinci_config_channel_size(dev, word_length); | 896 | davinci_config_channel_size(dev, word_length); |
894 | 897 | ||
895 | return 0; | 898 | return 0; |