diff options
Diffstat (limited to 'sound/soc/omap/omap-mcbsp.c')
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 580de5a8dba6..f5387d962f5d 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -144,7 +144,14 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) | |||
144 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 144 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
145 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 145 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
146 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 146 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
147 | int samples = snd_pcm_lib_period_bytes(substream) >> 1; | 147 | int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id); |
148 | int samples; | ||
149 | |||
150 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ | ||
151 | if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) | ||
152 | samples = snd_pcm_lib_period_bytes(substream) >> 1; | ||
153 | else | ||
154 | samples = 1; | ||
148 | 155 | ||
149 | /* Configure McBSP internal buffer usage */ | 156 | /* Configure McBSP internal buffer usage */ |
150 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 157 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -166,6 +173,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | |||
166 | err = omap_mcbsp_request(bus_id); | 173 | err = omap_mcbsp_request(bus_id); |
167 | 174 | ||
168 | if (cpu_is_omap343x()) { | 175 | if (cpu_is_omap343x()) { |
176 | int dma_op_mode = omap_mcbsp_get_dma_op_mode(bus_id); | ||
169 | int max_period; | 177 | int max_period; |
170 | 178 | ||
171 | /* | 179 | /* |
@@ -187,7 +195,8 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | |||
187 | max_period++; | 195 | max_period++; |
188 | max_period <<= 1; | 196 | max_period <<= 1; |
189 | 197 | ||
190 | snd_pcm_hw_constraint_minmax(substream->runtime, | 198 | if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) |
199 | snd_pcm_hw_constraint_minmax(substream->runtime, | ||
191 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES, | 200 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES, |
192 | 32, max_period); | 201 | 32, max_period); |
193 | } | 202 | } |
@@ -269,7 +278,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
269 | port = omap34xx_mcbsp_port[bus_id][substream->stream]; | 278 | port = omap34xx_mcbsp_port[bus_id][substream->stream]; |
270 | omap_mcbsp_dai_dma_params[id][substream->stream].set_threshold = | 279 | omap_mcbsp_dai_dma_params[id][substream->stream].set_threshold = |
271 | omap_mcbsp_set_threshold; | 280 | omap_mcbsp_set_threshold; |
272 | sync_mode = OMAP_DMA_SYNC_FRAME; | 281 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ |
282 | if (omap_mcbsp_get_dma_op_mode(bus_id) == | ||
283 | MCBSP_DMA_MODE_THRESHOLD) | ||
284 | sync_mode = OMAP_DMA_SYNC_FRAME; | ||
273 | } else { | 285 | } else { |
274 | return -ENODEV; | 286 | return -ENODEV; |
275 | } | 287 | } |