aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-04-25 07:02:35 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-25 07:02:35 -0400
commit2fc565e4eaf8fc633bfc741b90e1f28dba732ee1 (patch)
tree98c994692f84aee07cf1c7b4cda245ae5235a94d /sound/soc/davinci
parent7fc7d047216aa4923d401c637be2ebc6e3d5bd9b (diff)
parent5cc50fc858a5ab37dc2744d72d7ffed96f23afd8 (diff)
Merge tag 'asoc-v3.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: More updates for v3.10 A few more fixes, nothing too major though the DMA changes fix modular builds.
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-mcasp.c15
-rw-r--r--sound/soc/davinci/davinci-mcasp.h2
-rw-r--r--sound/soc/davinci/davinci-pcm.c11
-rw-r--r--sound/soc/davinci/davinci-pcm.h1
4 files changed, 15 insertions, 14 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;
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h
index 0edd3b5a37fd..a9ac0c11da71 100644
--- a/sound/soc/davinci/davinci-mcasp.h
+++ b/sound/soc/davinci/davinci-mcasp.h
@@ -38,7 +38,7 @@ struct davinci_audio_dev {
38 u8 num_serializer; 38 u8 num_serializer;
39 u8 *serial_dir; 39 u8 *serial_dir;
40 u8 version; 40 u8 version;
41 u8 bclk_lrclk_ratio; 41 u16 bclk_lrclk_ratio;
42 42
43 /* McASP FIFO related */ 43 /* McASP FIFO related */
44 u8 txnumevt; 44 u8 txnumevt;
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
33int davinci_soc_platform_register(struct device *dev); 32int davinci_soc_platform_register(struct device *dev);