aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/mmp-pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa/mmp-pcm.c')
-rw-r--r--sound/soc/pxa/mmp-pcm.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c
index 190eb0bccf5f..6c3980252bf6 100644
--- a/sound/soc/pxa/mmp-pcm.c
+++ b/sound/soc/pxa/mmp-pcm.c
@@ -118,9 +118,8 @@ static int mmp_pcm_open(struct snd_pcm_substream *substream)
118 struct snd_soc_pcm_runtime *rtd = substream->private_data; 118 struct snd_soc_pcm_runtime *rtd = substream->private_data;
119 struct platform_device *pdev = to_platform_device(rtd->platform->dev); 119 struct platform_device *pdev = to_platform_device(rtd->platform->dev);
120 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 120 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
121 struct mmp_dma_data *dma_data; 121 struct mmp_dma_data dma_data;
122 struct resource *r; 122 struct resource *r;
123 int ret;
124 123
125 r = platform_get_resource(pdev, IORESOURCE_DMA, substream->stream); 124 r = platform_get_resource(pdev, IORESOURCE_DMA, substream->stream);
126 if (!r) 125 if (!r)
@@ -128,33 +127,11 @@ static int mmp_pcm_open(struct snd_pcm_substream *substream)
128 127
129 snd_soc_set_runtime_hwparams(substream, 128 snd_soc_set_runtime_hwparams(substream,
130 &mmp_pcm_hardware[substream->stream]); 129 &mmp_pcm_hardware[substream->stream]);
131 dma_data = devm_kzalloc(&pdev->dev,
132 sizeof(struct mmp_dma_data), GFP_KERNEL);
133 if (dma_data == NULL)
134 return -ENOMEM;
135 130
136 dma_data->dma_res = r; 131 dma_data.dma_res = r;
137 dma_data->ssp_id = cpu_dai->id; 132 dma_data.ssp_id = cpu_dai->id;
138 133
139 ret = snd_dmaengine_pcm_open(substream, filter, dma_data); 134 return snd_dmaengine_pcm_open(substream, filter, &dma_data);
140 if (ret) {
141 devm_kfree(&pdev->dev, dma_data);
142 return ret;
143 }
144
145 snd_dmaengine_pcm_set_data(substream, dma_data);
146 return 0;
147}
148
149static int mmp_pcm_close(struct snd_pcm_substream *substream)
150{
151 struct mmp_dma_data *dma_data = snd_dmaengine_pcm_get_data(substream);
152 struct snd_soc_pcm_runtime *rtd = substream->private_data;
153 struct platform_device *pdev = to_platform_device(rtd->platform->dev);
154
155 snd_dmaengine_pcm_close(substream);
156 devm_kfree(&pdev->dev, dma_data);
157 return 0;
158} 135}
159 136
160static int mmp_pcm_mmap(struct snd_pcm_substream *substream, 137static int mmp_pcm_mmap(struct snd_pcm_substream *substream,
@@ -171,7 +148,7 @@ static int mmp_pcm_mmap(struct snd_pcm_substream *substream,
171 148
172struct snd_pcm_ops mmp_pcm_ops = { 149struct snd_pcm_ops mmp_pcm_ops = {
173 .open = mmp_pcm_open, 150 .open = mmp_pcm_open,
174 .close = mmp_pcm_close, 151 .close = snd_dmaengine_pcm_close,
175 .ioctl = snd_pcm_lib_ioctl, 152 .ioctl = snd_pcm_lib_ioctl,
176 .hw_params = mmp_pcm_hw_params, 153 .hw_params = mmp_pcm_hw_params,
177 .trigger = snd_dmaengine_pcm_trigger, 154 .trigger = snd_dmaengine_pcm_trigger,