diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2010-07-29 02:51:26 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-08-02 05:37:43 -0400 |
commit | 81ec027e64f459f06ff20d8871f2867cff4a5e85 (patch) | |
tree | 7ceba6c7318971023bbe4fba5e1c7e635a22870d | |
parent | a577b318fc7cb0c46f9f0cdefb5b267490ff8ce5 (diff) |
ASoC: omap-mcbsp: Restructure the code within omap_mcbsp_dai_hw_params
In preparation for the extended threshold mode (sDMA packet mode
support), the code need to be restructured.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index aebd3af2ab79..88ca71c57c2b 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -348,11 +348,13 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
348 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 348 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
349 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 349 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
350 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 350 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
351 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; | 351 | struct omap_pcm_dma_data *dma_data; |
352 | int dma, bus_id = mcbsp_data->bus_id; | ||
352 | int wlen, channels, wpf, sync_mode = OMAP_DMA_SYNC_ELEMENT; | 353 | int wlen, channels, wpf, sync_mode = OMAP_DMA_SYNC_ELEMENT; |
353 | unsigned long port; | 354 | unsigned long port; |
354 | unsigned int format, div, framesize, master; | 355 | unsigned int format, div, framesize, master; |
355 | 356 | ||
357 | dma_data = &omap_mcbsp_dai_dma_params[cpu_dai->id][substream->stream]; | ||
356 | if (cpu_class_is_omap1()) { | 358 | if (cpu_class_is_omap1()) { |
357 | dma = omap1_dma_reqs[bus_id][substream->stream]; | 359 | dma = omap1_dma_reqs[bus_id][substream->stream]; |
358 | port = omap1_mcbsp_port[bus_id][substream->stream]; | 360 | port = omap1_mcbsp_port[bus_id][substream->stream]; |
@@ -365,8 +367,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
365 | } else if (cpu_is_omap343x()) { | 367 | } else if (cpu_is_omap343x()) { |
366 | dma = omap24xx_dma_reqs[bus_id][substream->stream]; | 368 | dma = omap24xx_dma_reqs[bus_id][substream->stream]; |
367 | port = omap34xx_mcbsp_port[bus_id][substream->stream]; | 369 | port = omap34xx_mcbsp_port[bus_id][substream->stream]; |
368 | omap_mcbsp_dai_dma_params[id][substream->stream].set_threshold = | 370 | dma_data->set_threshold = omap_mcbsp_set_threshold; |
369 | omap_mcbsp_set_threshold; | ||
370 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ | 371 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ |
371 | if (omap_mcbsp_get_dma_op_mode(bus_id) == | 372 | if (omap_mcbsp_get_dma_op_mode(bus_id) == |
372 | MCBSP_DMA_MODE_THRESHOLD) | 373 | MCBSP_DMA_MODE_THRESHOLD) |
@@ -374,26 +375,22 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
374 | } else { | 375 | } else { |
375 | return -ENODEV; | 376 | return -ENODEV; |
376 | } | 377 | } |
377 | omap_mcbsp_dai_dma_params[id][substream->stream].name = | 378 | dma_data->name = substream->stream ? "Audio Capture" : "Audio Playback"; |
378 | substream->stream ? "Audio Capture" : "Audio Playback"; | 379 | dma_data->dma_req = dma; |
379 | omap_mcbsp_dai_dma_params[id][substream->stream].dma_req = dma; | 380 | dma_data->port_addr = port; |
380 | omap_mcbsp_dai_dma_params[id][substream->stream].port_addr = port; | 381 | dma_data->sync_mode = sync_mode; |
381 | omap_mcbsp_dai_dma_params[id][substream->stream].sync_mode = sync_mode; | ||
382 | switch (params_format(params)) { | 382 | switch (params_format(params)) { |
383 | case SNDRV_PCM_FORMAT_S16_LE: | 383 | case SNDRV_PCM_FORMAT_S16_LE: |
384 | omap_mcbsp_dai_dma_params[id][substream->stream].data_type = | 384 | dma_data->data_type = OMAP_DMA_DATA_TYPE_S16; |
385 | OMAP_DMA_DATA_TYPE_S16; | ||
386 | break; | 385 | break; |
387 | case SNDRV_PCM_FORMAT_S32_LE: | 386 | case SNDRV_PCM_FORMAT_S32_LE: |
388 | omap_mcbsp_dai_dma_params[id][substream->stream].data_type = | 387 | dma_data->data_type = OMAP_DMA_DATA_TYPE_S32; |
389 | OMAP_DMA_DATA_TYPE_S32; | ||
390 | break; | 388 | break; |
391 | default: | 389 | default: |
392 | return -EINVAL; | 390 | return -EINVAL; |
393 | } | 391 | } |
394 | 392 | ||
395 | snd_soc_dai_set_dma_data(cpu_dai, substream, | 393 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); |
396 | &omap_mcbsp_dai_dma_params[id][substream->stream]); | ||
397 | 394 | ||
398 | if (mcbsp_data->configured) { | 395 | if (mcbsp_data->configured) { |
399 | /* McBSP already configured by another stream */ | 396 | /* McBSP already configured by another stream */ |