Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332132
b: refs/heads/master
c: 03945e9
h: refs/heads/master
v: v3
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Sep 22, 2012
1 parent 662e85d commit 902f669
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 061fb36db7c0187aa90b95f1ba56f6192f42b984
refs/heads/master: 03945e99a8ac4f596dad9a679816e5b4bb77e5d2
31 changes: 29 additions & 2 deletions trunk/sound/soc/omap/omap-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,24 @@ static int omap_pcm_hw_free(struct snd_pcm_substream *substream)
return 0;
}

static int omap_pcm_get_dma_type(int num_bits)
{
int data_type;

switch (num_bits) {
case 16:
data_type = OMAP_DMA_DATA_TYPE_S16;
break;
case 32:
data_type = OMAP_DMA_DATA_TYPE_S32;
break;
default:
data_type = -EINVAL;
break;
}
return data_type;
}

static int omap_pcm_prepare(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
Expand All @@ -163,7 +181,16 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
return 0;

memset(&dma_params, 0, sizeof(dma_params));
dma_params.data_type = dma_data->data_type;

if (dma_data->data_type)
dma_params.data_type = dma_data->data_type;
else
dma_params.data_type = omap_pcm_get_dma_type(
snd_pcm_format_physical_width(runtime->format));

if (dma_params.data_type < 0)
return dma_params.data_type;

dma_params.trigger = dma_data->dma_req;

if (dma_data->packet_size)
Expand Down Expand Up @@ -195,7 +222,7 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
* still can get an interrupt at each period bounary
*/
bytes = snd_pcm_lib_period_bytes(substream);
dma_params.elem_count = bytes >> dma_data->data_type;
dma_params.elem_count = bytes >> dma_params.data_type;
dma_params.frame_count = runtime->periods;
omap_set_dma_params(prtd->dma_ch, &dma_params);

Expand Down

0 comments on commit 902f669

Please sign in to comment.