Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293408
b: refs/heads/master
c: 95a771c
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Feb 22, 2012
1 parent f54cd5f commit 143690c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 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: 4564d10f3066a1abf5053936684e2c8495163def
refs/heads/master: 95a771ca16ad63cfd665bebadbc543857db6fa4e
28 changes: 8 additions & 20 deletions trunk/sound/soc/mxs/mxs-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ static bool filter(struct dma_chan *chan, void *param)
return true;
}

static int mxs_dma_alloc(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
static int mxs_dma_alloc(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_pcm_runtime *runtime = substream->runtime;
Expand All @@ -112,11 +111,7 @@ static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream,
struct mxs_pcm_runtime_data *iprtd = runtime->private_data;
unsigned long dma_addr;
struct dma_chan *chan;
int ret;

ret = mxs_dma_alloc(substream, params);
if (ret)
return ret;
chan = iprtd->dma_chan;

iprtd->periods = params_periods(params);
Expand All @@ -143,19 +138,6 @@ static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream,
return 0;
}

static int snd_mxs_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct mxs_pcm_runtime_data *iprtd = runtime->private_data;

if (iprtd->dma_chan) {
dma_release_channel(iprtd->dma_chan);
iprtd->dma_chan = NULL;
}

return 0;
}

static int snd_mxs_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct snd_pcm_runtime *runtime = substream->runtime;
Expand Down Expand Up @@ -208,6 +190,12 @@ static int snd_mxs_open(struct snd_pcm_substream *substream)
return ret;
}

ret = mxs_dma_alloc(substream);
if (ret) {
kfree(iprtd);
return ret;
}

snd_soc_set_runtime_hwparams(substream, &snd_mxs_hardware);

return 0;
Expand All @@ -218,6 +206,7 @@ static int snd_mxs_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct mxs_pcm_runtime_data *iprtd = runtime->private_data;

dma_release_channel(iprtd->dma_chan);
kfree(iprtd);

return 0;
Expand All @@ -239,7 +228,6 @@ static struct snd_pcm_ops mxs_pcm_ops = {
.close = snd_mxs_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_mxs_pcm_hw_params,
.hw_free = snd_mxs_pcm_hw_free,
.trigger = snd_mxs_pcm_trigger,
.pointer = snd_mxs_pcm_pointer,
.mmap = snd_mxs_pcm_mmap,
Expand Down

0 comments on commit 143690c

Please sign in to comment.