diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-12 08:57:04 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-12 08:57:04 -0400 |
commit | 38e8c895d33b0642dc341f83cce0adde4cffbc82 (patch) | |
tree | 3657c043986d5c944f971c9685ae4a68f5a5b035 /sound/soc/mxs | |
parent | d66e065c5b8b64b03a9d9b8a7c5d674c7dfa2e3d (diff) | |
parent | 69b6f19622ce0aef41df884b75e3f789c64b89c0 (diff) |
Merge remote-tracking branch 'asoc/topic/dma' into asoc-next
Diffstat (limited to 'sound/soc/mxs')
-rw-r--r-- | sound/soc/mxs/mxs-pcm.c | 43 | ||||
-rw-r--r-- | sound/soc/mxs/mxs-pcm.h | 4 | ||||
-rw-r--r-- | sound/soc/mxs/mxs-saif.c | 6 |
3 files changed, 11 insertions, 42 deletions
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c index 564b5b60319d..ebbef8597554 100644 --- a/sound/soc/mxs/mxs-pcm.c +++ b/sound/soc/mxs/mxs-pcm.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/dmaengine.h> | 30 | #include <linux/dmaengine.h> |
31 | #include <linux/fsl/mxs-dma.h> | ||
32 | 31 | ||
33 | #include <sound/core.h> | 32 | #include <sound/core.h> |
34 | #include <sound/initval.h> | 33 | #include <sound/initval.h> |
@@ -39,11 +38,6 @@ | |||
39 | 38 | ||
40 | #include "mxs-pcm.h" | 39 | #include "mxs-pcm.h" |
41 | 40 | ||
42 | struct mxs_pcm_dma_data { | ||
43 | struct mxs_dma_data dma_data; | ||
44 | struct mxs_pcm_dma_params *dma_params; | ||
45 | }; | ||
46 | |||
47 | static struct snd_pcm_hardware snd_mxs_hardware = { | 41 | static struct snd_pcm_hardware snd_mxs_hardware = { |
48 | .info = SNDRV_PCM_INFO_MMAP | | 42 | .info = SNDRV_PCM_INFO_MMAP | |
49 | SNDRV_PCM_INFO_MMAP_VALID | | 43 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -66,8 +60,7 @@ static struct snd_pcm_hardware snd_mxs_hardware = { | |||
66 | 60 | ||
67 | static bool filter(struct dma_chan *chan, void *param) | 61 | static bool filter(struct dma_chan *chan, void *param) |
68 | { | 62 | { |
69 | struct mxs_pcm_dma_data *pcm_dma_data = param; | 63 | struct mxs_pcm_dma_params *dma_params = param; |
70 | struct mxs_pcm_dma_params *dma_params = pcm_dma_data->dma_params; | ||
71 | 64 | ||
72 | if (!mxs_dma_is_apbx(chan)) | 65 | if (!mxs_dma_is_apbx(chan)) |
73 | return false; | 66 | return false; |
@@ -75,7 +68,7 @@ static bool filter(struct dma_chan *chan, void *param) | |||
75 | if (chan->chan_id != dma_params->chan_num) | 68 | if (chan->chan_id != dma_params->chan_num) |
76 | return false; | 69 | return false; |
77 | 70 | ||
78 | chan->private = &pcm_dma_data->dma_data; | 71 | chan->private = &dma_params->dma_data; |
79 | 72 | ||
80 | return true; | 73 | return true; |
81 | } | 74 | } |
@@ -91,37 +84,11 @@ static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream, | |||
91 | static int snd_mxs_open(struct snd_pcm_substream *substream) | 84 | static int snd_mxs_open(struct snd_pcm_substream *substream) |
92 | { | 85 | { |
93 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 86 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
94 | struct mxs_pcm_dma_data *pcm_dma_data; | ||
95 | int ret; | ||
96 | |||
97 | pcm_dma_data = kzalloc(sizeof(*pcm_dma_data), GFP_KERNEL); | ||
98 | if (pcm_dma_data == NULL) | ||
99 | return -ENOMEM; | ||
100 | |||
101 | pcm_dma_data->dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | ||
102 | pcm_dma_data->dma_data.chan_irq = pcm_dma_data->dma_params->chan_irq; | ||
103 | |||
104 | ret = snd_dmaengine_pcm_open(substream, filter, pcm_dma_data); | ||
105 | if (ret) { | ||
106 | kfree(pcm_dma_data); | ||
107 | return ret; | ||
108 | } | ||
109 | 87 | ||
110 | snd_soc_set_runtime_hwparams(substream, &snd_mxs_hardware); | 88 | snd_soc_set_runtime_hwparams(substream, &snd_mxs_hardware); |
111 | 89 | ||
112 | snd_dmaengine_pcm_set_data(substream, pcm_dma_data); | 90 | return snd_dmaengine_pcm_open(substream, filter, |
113 | 91 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream)); | |
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static int snd_mxs_close(struct snd_pcm_substream *substream) | ||
118 | { | ||
119 | struct mxs_pcm_dma_data *pcm_dma_data = snd_dmaengine_pcm_get_data(substream); | ||
120 | |||
121 | snd_dmaengine_pcm_close(substream); | ||
122 | kfree(pcm_dma_data); | ||
123 | |||
124 | return 0; | ||
125 | } | 92 | } |
126 | 93 | ||
127 | static int snd_mxs_pcm_mmap(struct snd_pcm_substream *substream, | 94 | static int snd_mxs_pcm_mmap(struct snd_pcm_substream *substream, |
@@ -137,7 +104,7 @@ static int snd_mxs_pcm_mmap(struct snd_pcm_substream *substream, | |||
137 | 104 | ||
138 | static struct snd_pcm_ops mxs_pcm_ops = { | 105 | static struct snd_pcm_ops mxs_pcm_ops = { |
139 | .open = snd_mxs_open, | 106 | .open = snd_mxs_open, |
140 | .close = snd_mxs_close, | 107 | .close = snd_dmaengine_pcm_close, |
141 | .ioctl = snd_pcm_lib_ioctl, | 108 | .ioctl = snd_pcm_lib_ioctl, |
142 | .hw_params = snd_mxs_pcm_hw_params, | 109 | .hw_params = snd_mxs_pcm_hw_params, |
143 | .trigger = snd_dmaengine_pcm_trigger, | 110 | .trigger = snd_dmaengine_pcm_trigger, |
diff --git a/sound/soc/mxs/mxs-pcm.h b/sound/soc/mxs/mxs-pcm.h index 35ba2ca42384..3aa918f9ed3e 100644 --- a/sound/soc/mxs/mxs-pcm.h +++ b/sound/soc/mxs/mxs-pcm.h | |||
@@ -19,8 +19,10 @@ | |||
19 | #ifndef _MXS_PCM_H | 19 | #ifndef _MXS_PCM_H |
20 | #define _MXS_PCM_H | 20 | #define _MXS_PCM_H |
21 | 21 | ||
22 | #include <linux/fsl/mxs-dma.h> | ||
23 | |||
22 | struct mxs_pcm_dma_params { | 24 | struct mxs_pcm_dma_params { |
23 | int chan_irq; | 25 | struct mxs_dma_data dma_data; |
24 | int chan_num; | 26 | int chan_num; |
25 | }; | 27 | }; |
26 | 28 | ||
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 3e78ba866681..abf4ddf4ed89 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c | |||
@@ -757,9 +757,9 @@ static int mxs_saif_probe(struct platform_device *pdev) | |||
757 | return ret; | 757 | return ret; |
758 | } | 758 | } |
759 | 759 | ||
760 | saif->dma_param.chan_irq = platform_get_irq(pdev, 1); | 760 | saif->dma_param.dma_data.chan_irq = platform_get_irq(pdev, 1); |
761 | if (saif->dma_param.chan_irq < 0) { | 761 | if (saif->dma_param.dma_data.chan_irq < 0) { |
762 | ret = saif->dma_param.chan_irq; | 762 | ret = saif->dma_param.dma_data.chan_irq; |
763 | dev_err(&pdev->dev, "failed to get dma irq resource: %d\n", | 763 | dev_err(&pdev->dev, "failed to get dma irq resource: %d\n", |
764 | ret); | 764 | ret); |
765 | return ret; | 765 | return ret; |