diff options
Diffstat (limited to 'sound/soc/imx')
-rw-r--r-- | sound/soc/imx/eukrea-tlv320.c | 8 | ||||
-rw-r--r-- | sound/soc/imx/imx-pcm-dma-mx2.c | 221 | ||||
-rw-r--r-- | sound/soc/imx/imx-ssi.c | 44 | ||||
-rw-r--r-- | sound/soc/imx/imx-ssi.h | 4 | ||||
-rw-r--r-- | sound/soc/imx/phycore-ac97.c | 5 |
5 files changed, 136 insertions, 146 deletions
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c index b59675257ce5..dd4fffdbd177 100644 --- a/sound/soc/imx/eukrea-tlv320.c +++ b/sound/soc/imx/eukrea-tlv320.c | |||
@@ -34,8 +34,8 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream, | |||
34 | struct snd_pcm_hw_params *params) | 34 | struct snd_pcm_hw_params *params) |
35 | { | 35 | { |
36 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 36 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
37 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 37 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
38 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 38 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
39 | int ret; | 39 | int ret; |
40 | 40 | ||
41 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | 41 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | |
@@ -79,10 +79,10 @@ static struct snd_soc_ops eukrea_tlv320_snd_ops = { | |||
79 | static struct snd_soc_dai_link eukrea_tlv320_dai = { | 79 | static struct snd_soc_dai_link eukrea_tlv320_dai = { |
80 | .name = "tlv320aic23", | 80 | .name = "tlv320aic23", |
81 | .stream_name = "TLV320AIC23", | 81 | .stream_name = "TLV320AIC23", |
82 | .codec_dai = "tlv320aic23-hifi", | 82 | .codec_dai_name = "tlv320aic23-hifi", |
83 | .platform_name = "imx-pcm-audio.0", | 83 | .platform_name = "imx-pcm-audio.0", |
84 | .codec_name = "tlv320aic23-codec.0-001a", | 84 | .codec_name = "tlv320aic23-codec.0-001a", |
85 | .cpu_dai = "imx-ssi.0", | 85 | .cpu_dai_name = "imx-ssi.0", |
86 | .ops = &eukrea_tlv320_snd_ops, | 86 | .ops = &eukrea_tlv320_snd_ops, |
87 | }; | 87 | }; |
88 | 88 | ||
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c index fd493ee1428e..671ef8dd524c 100644 --- a/sound/soc/imx/imx-pcm-dma-mx2.c +++ b/sound/soc/imx/imx-pcm-dma-mx2.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/dmaengine.h> | ||
23 | 24 | ||
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | #include <sound/initval.h> | 26 | #include <sound/initval.h> |
@@ -27,165 +28,146 @@ | |||
27 | #include <sound/pcm_params.h> | 28 | #include <sound/pcm_params.h> |
28 | #include <sound/soc.h> | 29 | #include <sound/soc.h> |
29 | 30 | ||
30 | #include <mach/dma-mx1-mx2.h> | 31 | #include <mach/dma.h> |
31 | 32 | ||
32 | #include "imx-ssi.h" | 33 | #include "imx-ssi.h" |
33 | 34 | ||
34 | struct imx_pcm_runtime_data { | 35 | struct imx_pcm_runtime_data { |
35 | int sg_count; | 36 | int period_bytes; |
36 | struct scatterlist *sg_list; | ||
37 | int period; | ||
38 | int periods; | 37 | int periods; |
39 | unsigned long dma_addr; | ||
40 | int dma; | 38 | int dma; |
41 | struct snd_pcm_substream *substream; | ||
42 | unsigned long offset; | 39 | unsigned long offset; |
43 | unsigned long size; | 40 | unsigned long size; |
44 | unsigned long period_cnt; | ||
45 | void *buf; | 41 | void *buf; |
46 | int period_time; | 42 | int period_time; |
43 | struct dma_async_tx_descriptor *desc; | ||
44 | struct dma_chan *dma_chan; | ||
45 | struct imx_dma_data dma_data; | ||
47 | }; | 46 | }; |
48 | 47 | ||
49 | /* Called by the DMA framework when a period has elapsed */ | 48 | static void audio_dma_irq(void *data) |
50 | static void imx_ssi_dma_progression(int channel, void *data, | ||
51 | struct scatterlist *sg) | ||
52 | { | 49 | { |
53 | struct snd_pcm_substream *substream = data; | 50 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *)data; |
54 | struct snd_pcm_runtime *runtime = substream->runtime; | 51 | struct snd_pcm_runtime *runtime = substream->runtime; |
55 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 52 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
56 | 53 | ||
57 | if (!sg) | 54 | iprtd->offset += iprtd->period_bytes; |
58 | return; | 55 | iprtd->offset %= iprtd->period_bytes * iprtd->periods; |
59 | |||
60 | runtime = iprtd->substream->runtime; | ||
61 | 56 | ||
62 | iprtd->offset = sg->dma_address - runtime->dma_addr; | 57 | snd_pcm_period_elapsed(substream); |
63 | |||
64 | snd_pcm_period_elapsed(iprtd->substream); | ||
65 | } | 58 | } |
66 | 59 | ||
67 | static void imx_ssi_dma_callback(int channel, void *data) | 60 | static bool filter(struct dma_chan *chan, void *param) |
68 | { | 61 | { |
69 | pr_err("%s shouldn't be called\n", __func__); | 62 | struct imx_pcm_runtime_data *iprtd = param; |
70 | } | ||
71 | 63 | ||
72 | static void snd_imx_dma_err_callback(int channel, void *data, int err) | 64 | if (!imx_dma_is_general_purpose(chan)) |
73 | { | 65 | return false; |
74 | struct snd_pcm_substream *substream = data; | ||
75 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
76 | struct imx_pcm_dma_params *dma_params = | ||
77 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | ||
78 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
79 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
80 | int ret; | ||
81 | 66 | ||
82 | pr_err("DMA timeout on channel %d -%s%s%s%s\n", | 67 | chan->private = &iprtd->dma_data; |
83 | channel, | ||
84 | err & IMX_DMA_ERR_BURST ? " burst" : "", | ||
85 | err & IMX_DMA_ERR_REQUEST ? " request" : "", | ||
86 | err & IMX_DMA_ERR_TRANSFER ? " transfer" : "", | ||
87 | err & IMX_DMA_ERR_BUFFER ? " buffer" : ""); | ||
88 | 68 | ||
89 | imx_dma_disable(iprtd->dma); | 69 | return true; |
90 | ret = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count, | ||
91 | IMX_DMA_LENGTH_LOOP, dma_params->dma_addr, | ||
92 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | ||
93 | DMA_MODE_WRITE : DMA_MODE_READ); | ||
94 | if (!ret) | ||
95 | imx_dma_enable(iprtd->dma); | ||
96 | } | 70 | } |
97 | 71 | ||
98 | static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) | 72 | static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream, |
73 | struct snd_pcm_hw_params *params) | ||
99 | { | 74 | { |
100 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 75 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
101 | struct imx_pcm_dma_params *dma_params; | 76 | struct imx_pcm_dma_params *dma_params; |
102 | struct snd_pcm_runtime *runtime = substream->runtime; | 77 | struct snd_pcm_runtime *runtime = substream->runtime; |
103 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 78 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
79 | struct dma_slave_config slave_config; | ||
80 | dma_cap_mask_t mask; | ||
81 | enum dma_slave_buswidth buswidth; | ||
104 | int ret; | 82 | int ret; |
105 | 83 | ||
106 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 84 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
107 | 85 | ||
108 | iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); | 86 | iprtd->dma_data.peripheral_type = IMX_DMATYPE_SSI; |
109 | if (iprtd->dma < 0) { | 87 | iprtd->dma_data.priority = DMA_PRIO_HIGH; |
110 | pr_err("Failed to claim the audio DMA\n"); | 88 | iprtd->dma_data.dma_request = dma_params->dma; |
111 | return -ENODEV; | ||
112 | } | ||
113 | 89 | ||
114 | ret = imx_dma_setup_handlers(iprtd->dma, | 90 | /* Try to grab a DMA channel */ |
115 | imx_ssi_dma_callback, | 91 | dma_cap_zero(mask); |
116 | snd_imx_dma_err_callback, substream); | 92 | dma_cap_set(DMA_SLAVE, mask); |
117 | if (ret) | 93 | iprtd->dma_chan = dma_request_channel(mask, filter, iprtd); |
118 | goto out; | 94 | if (!iprtd->dma_chan) |
95 | return -EINVAL; | ||
119 | 96 | ||
120 | ret = imx_dma_setup_progression_handler(iprtd->dma, | 97 | switch (params_format(params)) { |
121 | imx_ssi_dma_progression); | 98 | case SNDRV_PCM_FORMAT_S16_LE: |
122 | if (ret) { | 99 | buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES; |
123 | pr_err("Failed to setup the DMA handler\n"); | 100 | break; |
124 | goto out; | 101 | case SNDRV_PCM_FORMAT_S20_3LE: |
102 | case SNDRV_PCM_FORMAT_S24_LE: | ||
103 | buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
104 | break; | ||
105 | default: | ||
106 | return 0; | ||
125 | } | 107 | } |
126 | 108 | ||
127 | ret = imx_dma_config_channel(iprtd->dma, | 109 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
128 | IMX_DMA_MEMSIZE_16 | IMX_DMA_TYPE_FIFO, | 110 | slave_config.direction = DMA_TO_DEVICE; |
129 | IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR, | 111 | slave_config.dst_addr = dma_params->dma_addr; |
130 | dma_params->dma, 1); | 112 | slave_config.dst_addr_width = buswidth; |
131 | if (ret < 0) { | 113 | slave_config.dst_maxburst = dma_params->burstsize; |
132 | pr_err("Cannot configure DMA channel: %d\n", ret); | 114 | } else { |
133 | goto out; | 115 | slave_config.direction = DMA_FROM_DEVICE; |
116 | slave_config.src_addr = dma_params->dma_addr; | ||
117 | slave_config.src_addr_width = buswidth; | ||
118 | slave_config.src_maxburst = dma_params->burstsize; | ||
134 | } | 119 | } |
135 | 120 | ||
136 | imx_dma_config_burstlen(iprtd->dma, dma_params->burstsize * 2); | 121 | ret = dmaengine_slave_config(iprtd->dma_chan, &slave_config); |
122 | if (ret) | ||
123 | return ret; | ||
137 | 124 | ||
138 | return 0; | 125 | return 0; |
139 | out: | ||
140 | imx_dma_free(iprtd->dma); | ||
141 | return ret; | ||
142 | } | 126 | } |
143 | 127 | ||
144 | static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, | 128 | static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, |
145 | struct snd_pcm_hw_params *params) | 129 | struct snd_pcm_hw_params *params) |
146 | { | 130 | { |
131 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
147 | struct snd_pcm_runtime *runtime = substream->runtime; | 132 | struct snd_pcm_runtime *runtime = substream->runtime; |
148 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 133 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
149 | int i; | ||
150 | unsigned long dma_addr; | 134 | unsigned long dma_addr; |
135 | struct dma_chan *chan; | ||
136 | struct imx_pcm_dma_params *dma_params; | ||
137 | int ret; | ||
151 | 138 | ||
152 | imx_ssi_dma_alloc(substream); | 139 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
140 | ret = imx_ssi_dma_alloc(substream, params); | ||
141 | if (ret) | ||
142 | return ret; | ||
143 | chan = iprtd->dma_chan; | ||
153 | 144 | ||
154 | iprtd->size = params_buffer_bytes(params); | 145 | iprtd->size = params_buffer_bytes(params); |
155 | iprtd->periods = params_periods(params); | 146 | iprtd->periods = params_periods(params); |
156 | iprtd->period = params_period_bytes(params); | 147 | iprtd->period_bytes = params_period_bytes(params); |
157 | iprtd->offset = 0; | 148 | iprtd->offset = 0; |
158 | iprtd->period_time = HZ / (params_rate(params) / | 149 | iprtd->period_time = HZ / (params_rate(params) / |
159 | params_period_size(params)); | 150 | params_period_size(params)); |
160 | 151 | ||
161 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 152 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); |
162 | 153 | ||
163 | if (iprtd->sg_count != iprtd->periods) { | ||
164 | kfree(iprtd->sg_list); | ||
165 | |||
166 | iprtd->sg_list = kcalloc(iprtd->periods + 1, | ||
167 | sizeof(struct scatterlist), GFP_KERNEL); | ||
168 | if (!iprtd->sg_list) | ||
169 | return -ENOMEM; | ||
170 | iprtd->sg_count = iprtd->periods + 1; | ||
171 | } | ||
172 | |||
173 | sg_init_table(iprtd->sg_list, iprtd->sg_count); | ||
174 | dma_addr = runtime->dma_addr; | 154 | dma_addr = runtime->dma_addr; |
175 | 155 | ||
176 | for (i = 0; i < iprtd->periods; i++) { | 156 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; |
177 | iprtd->sg_list[i].page_link = 0; | 157 | |
178 | iprtd->sg_list[i].offset = 0; | 158 | iprtd->desc = chan->device->device_prep_dma_cyclic(chan, dma_addr, |
179 | iprtd->sg_list[i].dma_address = dma_addr; | 159 | iprtd->period_bytes * iprtd->periods, |
180 | iprtd->sg_list[i].length = iprtd->period; | 160 | iprtd->period_bytes, |
181 | dma_addr += iprtd->period; | 161 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? |
162 | DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
163 | if (!iprtd->desc) { | ||
164 | dev_err(&chan->dev->device, "cannot prepare slave dma\n"); | ||
165 | return -EINVAL; | ||
182 | } | 166 | } |
183 | 167 | ||
184 | /* close the loop */ | 168 | iprtd->desc->callback = audio_dma_irq; |
185 | iprtd->sg_list[iprtd->sg_count - 1].offset = 0; | 169 | iprtd->desc->callback_param = substream; |
186 | iprtd->sg_list[iprtd->sg_count - 1].length = 0; | 170 | |
187 | iprtd->sg_list[iprtd->sg_count - 1].page_link = | ||
188 | ((unsigned long) iprtd->sg_list | 0x01) & ~0x02; | ||
189 | return 0; | 171 | return 0; |
190 | } | 172 | } |
191 | 173 | ||
@@ -194,41 +176,21 @@ static int snd_imx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
194 | struct snd_pcm_runtime *runtime = substream->runtime; | 176 | struct snd_pcm_runtime *runtime = substream->runtime; |
195 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 177 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
196 | 178 | ||
197 | if (iprtd->dma >= 0) { | 179 | if (iprtd->dma_chan) { |
198 | imx_dma_free(iprtd->dma); | 180 | dma_release_channel(iprtd->dma_chan); |
199 | iprtd->dma = -EINVAL; | 181 | iprtd->dma_chan = NULL; |
200 | } | 182 | } |
201 | 183 | ||
202 | kfree(iprtd->sg_list); | ||
203 | iprtd->sg_list = NULL; | ||
204 | |||
205 | return 0; | 184 | return 0; |
206 | } | 185 | } |
207 | 186 | ||
208 | static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) | 187 | static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) |
209 | { | 188 | { |
210 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
211 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 189 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
212 | struct imx_pcm_dma_params *dma_params; | 190 | struct imx_pcm_dma_params *dma_params; |
213 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
214 | int err; | ||
215 | 191 | ||
216 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 192 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
217 | 193 | ||
218 | iprtd->substream = substream; | ||
219 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; | ||
220 | iprtd->period_cnt = 0; | ||
221 | |||
222 | pr_debug("%s: buf: %p period: %d periods: %d\n", | ||
223 | __func__, iprtd->buf, iprtd->period, iprtd->periods); | ||
224 | |||
225 | err = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count, | ||
226 | IMX_DMA_LENGTH_LOOP, dma_params->dma_addr, | ||
227 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | ||
228 | DMA_MODE_WRITE : DMA_MODE_READ); | ||
229 | if (err) | ||
230 | return err; | ||
231 | |||
232 | return 0; | 194 | return 0; |
233 | } | 195 | } |
234 | 196 | ||
@@ -241,14 +203,14 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
241 | case SNDRV_PCM_TRIGGER_START: | 203 | case SNDRV_PCM_TRIGGER_START: |
242 | case SNDRV_PCM_TRIGGER_RESUME: | 204 | case SNDRV_PCM_TRIGGER_RESUME: |
243 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 205 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
244 | imx_dma_enable(iprtd->dma); | 206 | dmaengine_submit(iprtd->desc); |
245 | 207 | ||
246 | break; | 208 | break; |
247 | 209 | ||
248 | case SNDRV_PCM_TRIGGER_STOP: | 210 | case SNDRV_PCM_TRIGGER_STOP: |
249 | case SNDRV_PCM_TRIGGER_SUSPEND: | 211 | case SNDRV_PCM_TRIGGER_SUSPEND: |
250 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 212 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
251 | imx_dma_disable(iprtd->dma); | 213 | dmaengine_terminate_all(iprtd->dma_chan); |
252 | 214 | ||
253 | break; | 215 | break; |
254 | default: | 216 | default: |
@@ -263,6 +225,9 @@ static snd_pcm_uframes_t snd_imx_pcm_pointer(struct snd_pcm_substream *substream | |||
263 | struct snd_pcm_runtime *runtime = substream->runtime; | 225 | struct snd_pcm_runtime *runtime = substream->runtime; |
264 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 226 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
265 | 227 | ||
228 | pr_debug("%s: %ld %ld\n", __func__, iprtd->offset, | ||
229 | bytes_to_frames(substream->runtime, iprtd->offset)); | ||
230 | |||
266 | return bytes_to_frames(substream->runtime, iprtd->offset); | 231 | return bytes_to_frames(substream->runtime, iprtd->offset); |
267 | } | 232 | } |
268 | 233 | ||
@@ -279,7 +244,7 @@ static struct snd_pcm_hardware snd_imx_hardware = { | |||
279 | .channels_max = 2, | 244 | .channels_max = 2, |
280 | .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, | 245 | .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, |
281 | .period_bytes_min = 128, | 246 | .period_bytes_min = 128, |
282 | .period_bytes_max = 16 * 1024, | 247 | .period_bytes_max = 65535, /* Limited by SDMA engine */ |
283 | .periods_min = 2, | 248 | .periods_min = 2, |
284 | .periods_max = 255, | 249 | .periods_max = 255, |
285 | .fifo_size = 0, | 250 | .fifo_size = 0, |
@@ -304,11 +269,23 @@ static int snd_imx_open(struct snd_pcm_substream *substream) | |||
304 | } | 269 | } |
305 | 270 | ||
306 | snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); | 271 | snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); |
272 | |||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | static int snd_imx_close(struct snd_pcm_substream *substream) | ||
277 | { | ||
278 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
279 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
280 | |||
281 | kfree(iprtd); | ||
282 | |||
307 | return 0; | 283 | return 0; |
308 | } | 284 | } |
309 | 285 | ||
310 | static struct snd_pcm_ops imx_pcm_ops = { | 286 | static struct snd_pcm_ops imx_pcm_ops = { |
311 | .open = snd_imx_open, | 287 | .open = snd_imx_open, |
288 | .close = snd_imx_close, | ||
312 | .ioctl = snd_pcm_lib_ioctl, | 289 | .ioctl = snd_pcm_lib_ioctl, |
313 | .hw_params = snd_imx_pcm_hw_params, | 290 | .hw_params = snd_imx_pcm_hw_params, |
314 | .hw_free = snd_imx_pcm_hw_free, | 291 | .hw_free = snd_imx_pcm_hw_free, |
@@ -340,7 +317,6 @@ static struct platform_driver imx_pcm_driver = { | |||
340 | .name = "imx-pcm-audio", | 317 | .name = "imx-pcm-audio", |
341 | .owner = THIS_MODULE, | 318 | .owner = THIS_MODULE, |
342 | }, | 319 | }, |
343 | |||
344 | .probe = imx_soc_platform_probe, | 320 | .probe = imx_soc_platform_probe, |
345 | .remove = __devexit_p(imx_soc_platform_remove), | 321 | .remove = __devexit_p(imx_soc_platform_remove), |
346 | }; | 322 | }; |
@@ -356,4 +332,3 @@ static void __exit snd_imx_pcm_exit(void) | |||
356 | platform_driver_unregister(&imx_pcm_driver); | 332 | platform_driver_unregister(&imx_pcm_driver); |
357 | } | 333 | } |
358 | module_exit(snd_imx_pcm_exit); | 334 | module_exit(snd_imx_pcm_exit); |
359 | |||
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index d4bd345b0a8d..d2d98c75ee8a 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
@@ -439,7 +439,22 @@ void imx_pcm_free(struct snd_pcm *pcm) | |||
439 | } | 439 | } |
440 | EXPORT_SYMBOL_GPL(imx_pcm_free); | 440 | EXPORT_SYMBOL_GPL(imx_pcm_free); |
441 | 441 | ||
442 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | ||
443 | { | ||
444 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
445 | uint32_t val; | ||
446 | |||
447 | snd_soc_dai_set_drvdata(dai, ssi); | ||
448 | |||
449 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
450 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
451 | writel(val, ssi->base + SSI_SFCSR); | ||
452 | |||
453 | return 0; | ||
454 | } | ||
455 | |||
442 | static struct snd_soc_dai_driver imx_ssi_dai = { | 456 | static struct snd_soc_dai_driver imx_ssi_dai = { |
457 | .probe = imx_ssi_dai_probe, | ||
443 | .playback = { | 458 | .playback = { |
444 | .channels_min = 2, | 459 | .channels_min = 2, |
445 | .channels_max = 2, | 460 | .channels_max = 2, |
@@ -455,20 +470,6 @@ static struct snd_soc_dai_driver imx_ssi_dai = { | |||
455 | .ops = &imx_ssi_pcm_dai_ops, | 470 | .ops = &imx_ssi_pcm_dai_ops, |
456 | }; | 471 | }; |
457 | 472 | ||
458 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | ||
459 | { | ||
460 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
461 | uint32_t val; | ||
462 | |||
463 | snd_soc_dai_set_drvdata(dai, ssi); | ||
464 | |||
465 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
466 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
467 | writel(val, ssi->base + SSI_SFCSR); | ||
468 | |||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | static struct snd_soc_dai_driver imx_ac97_dai = { | 473 | static struct snd_soc_dai_driver imx_ac97_dai = { |
473 | .probe = imx_ssi_dai_probe, | 474 | .probe = imx_ssi_dai_probe, |
474 | .ac97_control = 1, | 475 | .ac97_control = 1, |
@@ -677,7 +678,17 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
677 | goto failed_register; | 678 | goto failed_register; |
678 | } | 679 | } |
679 | 680 | ||
680 | ssi->soc_platform_pdev = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); | 681 | ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); |
682 | if (!ssi->soc_platform_pdev_fiq) | ||
683 | goto failed_pdev_fiq_alloc; | ||
684 | platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi); | ||
685 | ret = platform_device_add(ssi->soc_platform_pdev_fiq); | ||
686 | if (ret) { | ||
687 | dev_err(&pdev->dev, "failed to add platform device\n"); | ||
688 | goto failed_pdev_fiq_add; | ||
689 | } | ||
690 | |||
691 | ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id); | ||
681 | if (!ssi->soc_platform_pdev) | 692 | if (!ssi->soc_platform_pdev) |
682 | goto failed_pdev_alloc; | 693 | goto failed_pdev_alloc; |
683 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); | 694 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); |
@@ -692,6 +703,9 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
692 | failed_pdev_add: | 703 | failed_pdev_add: |
693 | platform_device_put(ssi->soc_platform_pdev); | 704 | platform_device_put(ssi->soc_platform_pdev); |
694 | failed_pdev_alloc: | 705 | failed_pdev_alloc: |
706 | failed_pdev_fiq_add: | ||
707 | platform_device_put(ssi->soc_platform_pdev_fiq); | ||
708 | failed_pdev_fiq_alloc: | ||
695 | snd_soc_unregister_dai(&pdev->dev); | 709 | snd_soc_unregister_dai(&pdev->dev); |
696 | failed_register: | 710 | failed_register: |
697 | failed_ac97: | 711 | failed_ac97: |
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h index 53b780d9b2b0..a4406a134892 100644 --- a/sound/soc/imx/imx-ssi.h +++ b/sound/soc/imx/imx-ssi.h | |||
@@ -185,6 +185,9 @@ | |||
185 | 185 | ||
186 | #define DRV_NAME "imx-ssi" | 186 | #define DRV_NAME "imx-ssi" |
187 | 187 | ||
188 | #include <linux/dmaengine.h> | ||
189 | #include <mach/dma.h> | ||
190 | |||
188 | struct imx_pcm_dma_params { | 191 | struct imx_pcm_dma_params { |
189 | int dma; | 192 | int dma; |
190 | unsigned long dma_addr; | 193 | unsigned long dma_addr; |
@@ -212,6 +215,7 @@ struct imx_ssi { | |||
212 | int enabled; | 215 | int enabled; |
213 | 216 | ||
214 | struct platform_device *soc_platform_pdev; | 217 | struct platform_device *soc_platform_pdev; |
218 | struct platform_device *soc_platform_pdev_fiq; | ||
215 | }; | 219 | }; |
216 | 220 | ||
217 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, | 221 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, |
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c index 6a65dd705519..39f23734781a 100644 --- a/sound/soc/imx/phycore-ac97.c +++ b/sound/soc/imx/phycore-ac97.c | |||
@@ -20,9 +20,6 @@ | |||
20 | #include <sound/soc-dapm.h> | 20 | #include <sound/soc-dapm.h> |
21 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
22 | 22 | ||
23 | #include "../codecs/wm9712.h" | ||
24 | #include "imx-ssi.h" | ||
25 | |||
26 | static struct snd_soc_card imx_phycore; | 23 | static struct snd_soc_card imx_phycore; |
27 | 24 | ||
28 | static struct snd_soc_ops imx_phycore_hifi_ops = { | 25 | static struct snd_soc_ops imx_phycore_hifi_ops = { |
@@ -41,7 +38,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = { | |||
41 | }; | 38 | }; |
42 | 39 | ||
43 | static struct snd_soc_card imx_phycore = { | 40 | static struct snd_soc_card imx_phycore = { |
44 | .name = "PhyCORE-audio", | 41 | .name = "PhyCORE-ac97-audio", |
45 | .dai_link = imx_phycore_dai_ac97, | 42 | .dai_link = imx_phycore_dai_ac97, |
46 | .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), | 43 | .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), |
47 | }; | 44 | }; |