diff options
author | Michal Bachraty <michal.bachraty@streamunlimited.com> | 2013-04-19 09:28:03 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-23 09:50:21 -0400 |
commit | 7c21a78104d7f2c155e2c12279282f659d773d05 (patch) | |
tree | d8fc167baff5147da84de35266535714550a27c4 /sound | |
parent | 5cbad7d39ad229c68a724e5e139fd845b93766b2 (diff) |
ASoC: davinci-pcm, davinci-mcasp: Clean up active_serializers
As pointed of by Vaibhav, commit message: "ASoC: davinci-mcasp: Add support for multichannel playback"
number of active serializers can be hidden into fifo_level variable, which is set in davimci-mcasp.
Signed-off-by: Michal Bachraty <michal.bachraty@streamunlimited.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 8 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-pcm.c | 11 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-pcm.h | 1 |
3 files changed, 10 insertions, 10 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index aeb3a6627d6a..59143373afc6 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -834,17 +834,20 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
834 | int word_length; | 834 | int word_length; |
835 | u8 fifo_level; | 835 | u8 fifo_level; |
836 | u8 slots = dev->tdm_slots; | 836 | u8 slots = dev->tdm_slots; |
837 | u8 active_serializers; | ||
837 | int channels; | 838 | int channels; |
838 | struct snd_interval *pcm_channels = hw_param_interval(params, | 839 | struct snd_interval *pcm_channels = hw_param_interval(params, |
839 | SNDRV_PCM_HW_PARAM_CHANNELS); | 840 | SNDRV_PCM_HW_PARAM_CHANNELS); |
840 | channels = pcm_channels->min; | 841 | channels = pcm_channels->min; |
841 | 842 | ||
843 | active_serializers = (channels + slots - 1) / slots; | ||
844 | |||
842 | if (davinci_hw_common_param(dev, substream->stream, channels) == -EINVAL) | 845 | if (davinci_hw_common_param(dev, substream->stream, channels) == -EINVAL) |
843 | return -EINVAL; | 846 | return -EINVAL; |
844 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 847 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
845 | fifo_level = dev->txnumevt; | 848 | fifo_level = dev->txnumevt * active_serializers; |
846 | else | 849 | else |
847 | fifo_level = dev->rxnumevt; | 850 | fifo_level = dev->rxnumevt * active_serializers; |
848 | 851 | ||
849 | if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) | 852 | if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) |
850 | davinci_hw_dit_param(dev); | 853 | davinci_hw_dit_param(dev); |
@@ -889,7 +892,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
889 | dma_params->acnt = dma_params->data_type; | 892 | dma_params->acnt = dma_params->data_type; |
890 | 893 | ||
891 | dma_params->fifo_level = fifo_level; | 894 | dma_params->fifo_level = fifo_level; |
892 | dma_params->active_serializers = (channels + slots - 1) / slots; | ||
893 | davinci_config_channel_size(dev, word_length); | 895 | davinci_config_channel_size(dev, word_length); |
894 | 896 | ||
895 | return 0; | 897 | return 0; |
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 078031d61167..b2f27c2e5fdc 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c | |||
@@ -181,7 +181,6 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) | |||
181 | unsigned short acnt; | 181 | unsigned short acnt; |
182 | unsigned int count; | 182 | unsigned int count; |
183 | unsigned int fifo_level; | 183 | unsigned int fifo_level; |
184 | unsigned char serializers = prtd->params->active_serializers; | ||
185 | 184 | ||
186 | period_size = snd_pcm_lib_period_bytes(substream); | 185 | period_size = snd_pcm_lib_period_bytes(substream); |
187 | dma_offset = prtd->period * period_size; | 186 | dma_offset = prtd->period * period_size; |
@@ -195,14 +194,14 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) | |||
195 | data_type = prtd->params->data_type; | 194 | data_type = prtd->params->data_type; |
196 | count = period_size / data_type; | 195 | count = period_size / data_type; |
197 | if (fifo_level) | 196 | if (fifo_level) |
198 | count /= fifo_level * serializers; | 197 | count /= fifo_level; |
199 | 198 | ||
200 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 199 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
201 | src = dma_pos; | 200 | src = dma_pos; |
202 | dst = prtd->params->dma_addr; | 201 | dst = prtd->params->dma_addr; |
203 | src_bidx = data_type; | 202 | src_bidx = data_type; |
204 | dst_bidx = 4; | 203 | dst_bidx = 4; |
205 | src_cidx = data_type * fifo_level * serializers; | 204 | src_cidx = data_type * fifo_level; |
206 | dst_cidx = 0; | 205 | dst_cidx = 0; |
207 | } else { | 206 | } else { |
208 | src = prtd->params->dma_addr; | 207 | src = prtd->params->dma_addr; |
@@ -210,7 +209,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) | |||
210 | src_bidx = 0; | 209 | src_bidx = 0; |
211 | dst_bidx = data_type; | 210 | dst_bidx = data_type; |
212 | src_cidx = 0; | 211 | src_cidx = 0; |
213 | dst_cidx = data_type * fifo_level * serializers; | 212 | dst_cidx = data_type * fifo_level; |
214 | } | 213 | } |
215 | 214 | ||
216 | acnt = prtd->params->acnt; | 215 | acnt = prtd->params->acnt; |
@@ -225,8 +224,8 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) | |||
225 | ASYNC); | 224 | ASYNC); |
226 | else | 225 | else |
227 | edma_set_transfer_params(prtd->asp_link[0], acnt, | 226 | edma_set_transfer_params(prtd->asp_link[0], acnt, |
228 | fifo_level * serializers, | 227 | fifo_level, |
229 | count, fifo_level * serializers, | 228 | count, fifo_level, |
230 | ABSYNC); | 229 | ABSYNC); |
231 | } | 230 | } |
232 | 231 | ||
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h index 32d7634d7b26..b6ef7039dd09 100644 --- a/sound/soc/davinci/davinci-pcm.h +++ b/sound/soc/davinci/davinci-pcm.h | |||
@@ -27,7 +27,6 @@ struct davinci_pcm_dma_params { | |||
27 | unsigned char data_type; /* xfer data type */ | 27 | unsigned char data_type; /* xfer data type */ |
28 | unsigned char convert_mono_stereo; | 28 | unsigned char convert_mono_stereo; |
29 | unsigned int fifo_level; | 29 | unsigned int fifo_level; |
30 | unsigned char active_serializers; /* num. of active audio serializers */ | ||
31 | }; | 30 | }; |
32 | 31 | ||
33 | int davinci_soc_platform_register(struct device *dev); | 32 | int davinci_soc_platform_register(struct device *dev); |