diff options
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r-- | sound/soc/davinci/davinci-evm.c | 178 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-i2s.c | 85 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-i2s.h | 2 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 91 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.h | 2 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-pcm.c | 45 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-pcm.h | 3 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-sffsdr.c | 30 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-vcif.c | 37 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-vcif.h | 28 |
10 files changed, 258 insertions, 243 deletions
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 97f74d6a33e6..fe7984221eb9 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <sound/core.h> | 18 | #include <sound/core.h> |
19 | #include <sound/pcm.h> | 19 | #include <sound/pcm.h> |
20 | #include <sound/soc.h> | 20 | #include <sound/soc.h> |
21 | #include <sound/soc-dapm.h> | ||
22 | 21 | ||
23 | #include <asm/dma.h> | 22 | #include <asm/dma.h> |
24 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
@@ -27,13 +26,9 @@ | |||
27 | #include <mach/edma.h> | 26 | #include <mach/edma.h> |
28 | #include <mach/mux.h> | 27 | #include <mach/mux.h> |
29 | 28 | ||
30 | #include "../codecs/tlv320aic3x.h" | ||
31 | #include "../codecs/cq93vc.h" | ||
32 | #include "../codecs/spdif_transciever.h" | ||
33 | #include "davinci-pcm.h" | 29 | #include "davinci-pcm.h" |
34 | #include "davinci-i2s.h" | 30 | #include "davinci-i2s.h" |
35 | #include "davinci-mcasp.h" | 31 | #include "davinci-mcasp.h" |
36 | #include "davinci-vcif.h" | ||
37 | 32 | ||
38 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ | 33 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ |
39 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) | 34 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) |
@@ -41,8 +36,8 @@ static int evm_hw_params(struct snd_pcm_substream *substream, | |||
41 | struct snd_pcm_hw_params *params) | 36 | struct snd_pcm_hw_params *params) |
42 | { | 37 | { |
43 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 38 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
44 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 39 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
45 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 40 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
46 | int ret = 0; | 41 | int ret = 0; |
47 | unsigned sysclk; | 42 | unsigned sysclk; |
48 | 43 | ||
@@ -87,7 +82,7 @@ static int evm_spdif_hw_params(struct snd_pcm_substream *substream, | |||
87 | struct snd_pcm_hw_params *params) | 82 | struct snd_pcm_hw_params *params) |
88 | { | 83 | { |
89 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 84 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
90 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 85 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
91 | 86 | ||
92 | /* set cpu DAI configuration */ | 87 | /* set cpu DAI configuration */ |
93 | return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); | 88 | return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); |
@@ -132,37 +127,53 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
132 | }; | 127 | }; |
133 | 128 | ||
134 | /* Logic for a aic3x as connected on a davinci-evm */ | 129 | /* Logic for a aic3x as connected on a davinci-evm */ |
135 | static int evm_aic3x_init(struct snd_soc_codec *codec) | 130 | static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) |
136 | { | 131 | { |
132 | struct snd_soc_codec *codec = rtd->codec; | ||
133 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
134 | |||
137 | /* Add davinci-evm specific widgets */ | 135 | /* Add davinci-evm specific widgets */ |
138 | snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, | 136 | snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, |
139 | ARRAY_SIZE(aic3x_dapm_widgets)); | 137 | ARRAY_SIZE(aic3x_dapm_widgets)); |
140 | 138 | ||
141 | /* Set up davinci-evm specific audio path audio_map */ | 139 | /* Set up davinci-evm specific audio path audio_map */ |
142 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 140 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
143 | 141 | ||
144 | /* not connected */ | 142 | /* not connected */ |
145 | snd_soc_dapm_disable_pin(codec, "MONO_LOUT"); | 143 | snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); |
146 | snd_soc_dapm_disable_pin(codec, "HPLCOM"); | 144 | snd_soc_dapm_disable_pin(dapm, "HPLCOM"); |
147 | snd_soc_dapm_disable_pin(codec, "HPRCOM"); | 145 | snd_soc_dapm_disable_pin(dapm, "HPRCOM"); |
148 | 146 | ||
149 | /* always connected */ | 147 | /* always connected */ |
150 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | 148 | snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); |
151 | snd_soc_dapm_enable_pin(codec, "Line Out"); | 149 | snd_soc_dapm_enable_pin(dapm, "Line Out"); |
152 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 150 | snd_soc_dapm_enable_pin(dapm, "Mic Jack"); |
153 | snd_soc_dapm_enable_pin(codec, "Line In"); | 151 | snd_soc_dapm_enable_pin(dapm, "Line In"); |
154 | 152 | ||
155 | snd_soc_dapm_sync(codec); | 153 | snd_soc_dapm_sync(dapm); |
156 | 154 | ||
157 | return 0; | 155 | return 0; |
158 | } | 156 | } |
159 | 157 | ||
160 | /* davinci-evm digital audio interface glue - connects codec <--> CPU */ | 158 | /* davinci-evm digital audio interface glue - connects codec <--> CPU */ |
161 | static struct snd_soc_dai_link evm_dai = { | 159 | static struct snd_soc_dai_link dm6446_evm_dai = { |
160 | .name = "TLV320AIC3X", | ||
161 | .stream_name = "AIC3X", | ||
162 | .cpu_dai_name = "davinci-mcbsp", | ||
163 | .codec_dai_name = "tlv320aic3x-hifi", | ||
164 | .codec_name = "tlv320aic3x-codec.1-001b", | ||
165 | .platform_name = "davinci-pcm-audio", | ||
166 | .init = evm_aic3x_init, | ||
167 | .ops = &evm_ops, | ||
168 | }; | ||
169 | |||
170 | static struct snd_soc_dai_link dm355_evm_dai = { | ||
162 | .name = "TLV320AIC3X", | 171 | .name = "TLV320AIC3X", |
163 | .stream_name = "AIC3X", | 172 | .stream_name = "AIC3X", |
164 | .cpu_dai = &davinci_i2s_dai, | 173 | .cpu_dai_name = "davinci-mcbsp.1", |
165 | .codec_dai = &aic3x_dai, | 174 | .codec_dai_name = "tlv320aic3x-hifi", |
175 | .codec_name = "tlv320aic3x-codec.1-001b", | ||
176 | .platform_name = "davinci-pcm-audio", | ||
166 | .init = evm_aic3x_init, | 177 | .init = evm_aic3x_init, |
167 | .ops = &evm_ops, | 178 | .ops = &evm_ops, |
168 | }; | 179 | }; |
@@ -171,148 +182,130 @@ static struct snd_soc_dai_link dm365_evm_dai = { | |||
171 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC | 182 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC |
172 | .name = "TLV320AIC3X", | 183 | .name = "TLV320AIC3X", |
173 | .stream_name = "AIC3X", | 184 | .stream_name = "AIC3X", |
174 | .cpu_dai = &davinci_i2s_dai, | 185 | .cpu_dai_name = "davinci-mcbsp", |
175 | .codec_dai = &aic3x_dai, | 186 | .codec_dai_name = "tlv320aic3x-hifi", |
176 | .init = evm_aic3x_init, | 187 | .init = evm_aic3x_init, |
188 | .codec_name = "tlv320aic3x-codec.1-0018", | ||
177 | .ops = &evm_ops, | 189 | .ops = &evm_ops, |
178 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) | 190 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) |
179 | .name = "Voice Codec - CQ93VC", | 191 | .name = "Voice Codec - CQ93VC", |
180 | .stream_name = "CQ93", | 192 | .stream_name = "CQ93", |
181 | .cpu_dai = &davinci_vcif_dai, | 193 | .cpu_dai_name = "davinci-vcif", |
182 | .codec_dai = &cq93vc_dai, | 194 | .codec_dai_name = "cq93vc-hifi", |
195 | .codec_name = "cq93vc-codec", | ||
183 | #endif | 196 | #endif |
197 | .platform_name = "davinci-pcm-audio", | ||
184 | }; | 198 | }; |
185 | 199 | ||
186 | static struct snd_soc_dai_link dm6467_evm_dai[] = { | 200 | static struct snd_soc_dai_link dm6467_evm_dai[] = { |
187 | { | 201 | { |
188 | .name = "TLV320AIC3X", | 202 | .name = "TLV320AIC3X", |
189 | .stream_name = "AIC3X", | 203 | .stream_name = "AIC3X", |
190 | .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI], | 204 | .cpu_dai_name= "davinci-mcasp.0", |
191 | .codec_dai = &aic3x_dai, | 205 | .codec_dai_name = "tlv320aic3x-hifi", |
206 | .platform_name ="davinci-pcm-audio", | ||
207 | .codec_name = "tlv320aic3x-codec.0-001a", | ||
192 | .init = evm_aic3x_init, | 208 | .init = evm_aic3x_init, |
193 | .ops = &evm_ops, | 209 | .ops = &evm_ops, |
194 | }, | 210 | }, |
195 | { | 211 | { |
196 | .name = "McASP", | 212 | .name = "McASP", |
197 | .stream_name = "spdif", | 213 | .stream_name = "spdif", |
198 | .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_DIT_DAI], | 214 | .cpu_dai_name= "davinci-mcasp.1", |
199 | .codec_dai = &dit_stub_dai, | 215 | .codec_dai_name = "dit-hifi", |
216 | .codec_name = "spdif_dit", | ||
217 | .platform_name = "davinci-pcm-audio", | ||
200 | .ops = &evm_spdif_ops, | 218 | .ops = &evm_spdif_ops, |
201 | }, | 219 | }, |
202 | }; | 220 | }; |
203 | static struct snd_soc_dai_link da8xx_evm_dai = { | 221 | |
222 | static struct snd_soc_dai_link da830_evm_dai = { | ||
223 | .name = "TLV320AIC3X", | ||
224 | .stream_name = "AIC3X", | ||
225 | .cpu_dai_name = "davinci-mcasp.1", | ||
226 | .codec_dai_name = "tlv320aic3x-hifi", | ||
227 | .codec_name = "tlv320aic3x-codec.1-0018", | ||
228 | .platform_name = "davinci-pcm-audio", | ||
229 | .init = evm_aic3x_init, | ||
230 | .ops = &evm_ops, | ||
231 | }; | ||
232 | |||
233 | static struct snd_soc_dai_link da850_evm_dai = { | ||
204 | .name = "TLV320AIC3X", | 234 | .name = "TLV320AIC3X", |
205 | .stream_name = "AIC3X", | 235 | .stream_name = "AIC3X", |
206 | .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI], | 236 | .cpu_dai_name= "davinci-mcasp.0", |
207 | .codec_dai = &aic3x_dai, | 237 | .codec_dai_name = "tlv320aic3x-hifi", |
238 | .codec_name = "tlv320aic3x-codec.1-0018", | ||
239 | .platform_name = "davinci-pcm-audio", | ||
208 | .init = evm_aic3x_init, | 240 | .init = evm_aic3x_init, |
209 | .ops = &evm_ops, | 241 | .ops = &evm_ops, |
210 | }; | 242 | }; |
211 | 243 | ||
212 | /* davinci dm6446, dm355 evm audio machine driver */ | 244 | /* davinci dm6446 evm audio machine driver */ |
213 | static struct snd_soc_card snd_soc_card_evm = { | 245 | static struct snd_soc_card dm6446_snd_soc_card_evm = { |
214 | .name = "DaVinci EVM", | 246 | .name = "DaVinci DM6446 EVM", |
215 | .platform = &davinci_soc_platform, | 247 | .dai_link = &dm6446_evm_dai, |
216 | .dai_link = &evm_dai, | 248 | .num_links = 1, |
249 | }; | ||
250 | |||
251 | /* davinci dm355 evm audio machine driver */ | ||
252 | static struct snd_soc_card dm355_snd_soc_card_evm = { | ||
253 | .name = "DaVinci DM355 EVM", | ||
254 | .dai_link = &dm355_evm_dai, | ||
217 | .num_links = 1, | 255 | .num_links = 1, |
218 | }; | 256 | }; |
219 | 257 | ||
220 | /* davinci dm365 evm audio machine driver */ | 258 | /* davinci dm365 evm audio machine driver */ |
221 | static struct snd_soc_card dm365_snd_soc_card_evm = { | 259 | static struct snd_soc_card dm365_snd_soc_card_evm = { |
222 | .name = "DaVinci DM365 EVM", | 260 | .name = "DaVinci DM365 EVM", |
223 | .platform = &davinci_soc_platform, | ||
224 | .dai_link = &dm365_evm_dai, | 261 | .dai_link = &dm365_evm_dai, |
225 | .num_links = 1, | 262 | .num_links = 1, |
226 | }; | 263 | }; |
227 | 264 | ||
228 | |||
229 | /* davinci dm6467 evm audio machine driver */ | 265 | /* davinci dm6467 evm audio machine driver */ |
230 | static struct snd_soc_card dm6467_snd_soc_card_evm = { | 266 | static struct snd_soc_card dm6467_snd_soc_card_evm = { |
231 | .name = "DaVinci DM6467 EVM", | 267 | .name = "DaVinci DM6467 EVM", |
232 | .platform = &davinci_soc_platform, | ||
233 | .dai_link = dm6467_evm_dai, | 268 | .dai_link = dm6467_evm_dai, |
234 | .num_links = ARRAY_SIZE(dm6467_evm_dai), | 269 | .num_links = ARRAY_SIZE(dm6467_evm_dai), |
235 | }; | 270 | }; |
236 | 271 | ||
237 | static struct snd_soc_card da830_snd_soc_card = { | 272 | static struct snd_soc_card da830_snd_soc_card = { |
238 | .name = "DA830/OMAP-L137 EVM", | 273 | .name = "DA830/OMAP-L137 EVM", |
239 | .dai_link = &da8xx_evm_dai, | 274 | .dai_link = &da830_evm_dai, |
240 | .platform = &davinci_soc_platform, | ||
241 | .num_links = 1, | 275 | .num_links = 1, |
242 | }; | 276 | }; |
243 | 277 | ||
244 | static struct snd_soc_card da850_snd_soc_card = { | 278 | static struct snd_soc_card da850_snd_soc_card = { |
245 | .name = "DA850/OMAP-L138 EVM", | 279 | .name = "DA850/OMAP-L138 EVM", |
246 | .dai_link = &da8xx_evm_dai, | 280 | .dai_link = &da850_evm_dai, |
247 | .platform = &davinci_soc_platform, | ||
248 | .num_links = 1, | 281 | .num_links = 1, |
249 | }; | 282 | }; |
250 | 283 | ||
251 | static struct aic3x_setup_data aic3x_setup; | ||
252 | |||
253 | /* evm audio subsystem */ | ||
254 | static struct snd_soc_device evm_snd_devdata = { | ||
255 | .card = &snd_soc_card_evm, | ||
256 | .codec_dev = &soc_codec_dev_aic3x, | ||
257 | .codec_data = &aic3x_setup, | ||
258 | }; | ||
259 | |||
260 | /* evm audio subsystem */ | ||
261 | static struct snd_soc_device dm365_evm_snd_devdata = { | ||
262 | .card = &dm365_snd_soc_card_evm, | ||
263 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC | ||
264 | .codec_dev = &soc_codec_dev_aic3x, | ||
265 | .codec_data = &aic3x_setup, | ||
266 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) | ||
267 | .codec_dev = &soc_codec_dev_cq93vc, | ||
268 | #endif | ||
269 | }; | ||
270 | |||
271 | /* evm audio subsystem */ | ||
272 | static struct snd_soc_device dm6467_evm_snd_devdata = { | ||
273 | .card = &dm6467_snd_soc_card_evm, | ||
274 | .codec_dev = &soc_codec_dev_aic3x, | ||
275 | .codec_data = &aic3x_setup, | ||
276 | }; | ||
277 | |||
278 | /* evm audio subsystem */ | ||
279 | static struct snd_soc_device da830_evm_snd_devdata = { | ||
280 | .card = &da830_snd_soc_card, | ||
281 | .codec_dev = &soc_codec_dev_aic3x, | ||
282 | .codec_data = &aic3x_setup, | ||
283 | }; | ||
284 | |||
285 | static struct snd_soc_device da850_evm_snd_devdata = { | ||
286 | .card = &da850_snd_soc_card, | ||
287 | .codec_dev = &soc_codec_dev_aic3x, | ||
288 | .codec_data = &aic3x_setup, | ||
289 | }; | ||
290 | |||
291 | static struct platform_device *evm_snd_device; | 284 | static struct platform_device *evm_snd_device; |
292 | 285 | ||
293 | static int __init evm_init(void) | 286 | static int __init evm_init(void) |
294 | { | 287 | { |
295 | struct snd_soc_device *evm_snd_dev_data; | 288 | struct snd_soc_card *evm_snd_dev_data; |
296 | int index; | 289 | int index; |
297 | int ret; | 290 | int ret; |
298 | 291 | ||
299 | if (machine_is_davinci_evm()) { | 292 | if (machine_is_davinci_evm()) { |
300 | evm_snd_dev_data = &evm_snd_devdata; | 293 | evm_snd_dev_data = &dm6446_snd_soc_card_evm; |
301 | index = 0; | 294 | index = 0; |
302 | } else if (machine_is_davinci_dm355_evm()) { | 295 | } else if (machine_is_davinci_dm355_evm()) { |
303 | evm_snd_dev_data = &evm_snd_devdata; | 296 | evm_snd_dev_data = &dm355_snd_soc_card_evm; |
304 | index = 1; | 297 | index = 1; |
305 | } else if (machine_is_davinci_dm365_evm()) { | 298 | } else if (machine_is_davinci_dm365_evm()) { |
306 | evm_snd_dev_data = &dm365_evm_snd_devdata; | 299 | evm_snd_dev_data = &dm365_snd_soc_card_evm; |
307 | index = 0; | 300 | index = 0; |
308 | } else if (machine_is_davinci_dm6467_evm()) { | 301 | } else if (machine_is_davinci_dm6467_evm()) { |
309 | evm_snd_dev_data = &dm6467_evm_snd_devdata; | 302 | evm_snd_dev_data = &dm6467_snd_soc_card_evm; |
310 | index = 0; | 303 | index = 0; |
311 | } else if (machine_is_davinci_da830_evm()) { | 304 | } else if (machine_is_davinci_da830_evm()) { |
312 | evm_snd_dev_data = &da830_evm_snd_devdata; | 305 | evm_snd_dev_data = &da830_snd_soc_card; |
313 | index = 1; | 306 | index = 1; |
314 | } else if (machine_is_davinci_da850_evm()) { | 307 | } else if (machine_is_davinci_da850_evm()) { |
315 | evm_snd_dev_data = &da850_evm_snd_devdata; | 308 | evm_snd_dev_data = &da850_snd_soc_card; |
316 | index = 0; | 309 | index = 0; |
317 | } else | 310 | } else |
318 | return -EINVAL; | 311 | return -EINVAL; |
@@ -322,7 +315,6 @@ static int __init evm_init(void) | |||
322 | return -ENOMEM; | 315 | return -ENOMEM; |
323 | 316 | ||
324 | platform_set_drvdata(evm_snd_device, evm_snd_dev_data); | 317 | platform_set_drvdata(evm_snd_device, evm_snd_dev_data); |
325 | evm_snd_dev_data->dev = &evm_snd_device->dev; | ||
326 | ret = platform_device_add(evm_snd_device); | 318 | ret = platform_device_add(evm_snd_device); |
327 | if (ret) | 319 | if (ret) |
328 | platform_device_put(evm_snd_device); | 320 | platform_device_put(evm_snd_device); |
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 9e8932abf158..d0d60b8a54d4 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -183,8 +183,7 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
183 | struct snd_pcm_substream *substream) | 183 | struct snd_pcm_substream *substream) |
184 | { | 184 | { |
185 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 185 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
186 | struct snd_soc_device *socdev = rtd->socdev; | 186 | struct snd_soc_platform *platform = rtd->platform; |
187 | struct snd_soc_platform *platform = socdev->card->platform; | ||
188 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 187 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
189 | u32 spcr; | 188 | u32 spcr; |
190 | u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST; | 189 | u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST; |
@@ -205,8 +204,8 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
205 | if (playback) { | 204 | if (playback) { |
206 | /* Stop the DMA to avoid data loss */ | 205 | /* Stop the DMA to avoid data loss */ |
207 | /* while the transmitter is out of reset to handle XSYNCERR */ | 206 | /* while the transmitter is out of reset to handle XSYNCERR */ |
208 | if (platform->pcm_ops->trigger) { | 207 | if (platform->driver->ops->trigger) { |
209 | int ret = platform->pcm_ops->trigger(substream, | 208 | int ret = platform->driver->ops->trigger(substream, |
210 | SNDRV_PCM_TRIGGER_STOP); | 209 | SNDRV_PCM_TRIGGER_STOP); |
211 | if (ret < 0) | 210 | if (ret < 0) |
212 | printk(KERN_DEBUG "Playback DMA stop failed\n"); | 211 | printk(KERN_DEBUG "Playback DMA stop failed\n"); |
@@ -227,8 +226,8 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
227 | toggle_clock(dev, playback); | 226 | toggle_clock(dev, playback); |
228 | 227 | ||
229 | /* Restart the DMA */ | 228 | /* Restart the DMA */ |
230 | if (platform->pcm_ops->trigger) { | 229 | if (platform->driver->ops->trigger) { |
231 | int ret = platform->pcm_ops->trigger(substream, | 230 | int ret = platform->driver->ops->trigger(substream, |
232 | SNDRV_PCM_TRIGGER_START); | 231 | SNDRV_PCM_TRIGGER_START); |
233 | if (ret < 0) | 232 | if (ret < 0) |
234 | printk(KERN_DEBUG "Playback DMA start failed\n"); | 233 | printk(KERN_DEBUG "Playback DMA start failed\n"); |
@@ -263,7 +262,7 @@ static void davinci_mcbsp_stop(struct davinci_mcbsp_dev *dev, int playback) | |||
263 | static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 262 | static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
264 | unsigned int fmt) | 263 | unsigned int fmt) |
265 | { | 264 | { |
266 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; | 265 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); |
267 | unsigned int pcr; | 266 | unsigned int pcr; |
268 | unsigned int srgr; | 267 | unsigned int srgr; |
269 | /* Attention srgr is updated by hw_params! */ | 268 | /* Attention srgr is updated by hw_params! */ |
@@ -404,7 +403,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
404 | static int davinci_i2s_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, | 403 | static int davinci_i2s_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, |
405 | int div_id, int div) | 404 | int div_id, int div) |
406 | { | 405 | { |
407 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; | 406 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); |
408 | 407 | ||
409 | if (div_id != DAVINCI_MCBSP_CLKGDV) | 408 | if (div_id != DAVINCI_MCBSP_CLKGDV) |
410 | return -ENODEV; | 409 | return -ENODEV; |
@@ -417,7 +416,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
417 | struct snd_pcm_hw_params *params, | 416 | struct snd_pcm_hw_params *params, |
418 | struct snd_soc_dai *dai) | 417 | struct snd_soc_dai *dai) |
419 | { | 418 | { |
420 | struct davinci_mcbsp_dev *dev = dai->private_data; | 419 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); |
421 | struct davinci_pcm_dma_params *dma_params = | 420 | struct davinci_pcm_dma_params *dma_params = |
422 | &dev->dma_params[substream->stream]; | 421 | &dev->dma_params[substream->stream]; |
423 | struct snd_interval *i = NULL; | 422 | struct snd_interval *i = NULL; |
@@ -569,24 +568,18 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
569 | static int davinci_i2s_prepare(struct snd_pcm_substream *substream, | 568 | static int davinci_i2s_prepare(struct snd_pcm_substream *substream, |
570 | struct snd_soc_dai *dai) | 569 | struct snd_soc_dai *dai) |
571 | { | 570 | { |
572 | struct davinci_mcbsp_dev *dev = dai->private_data; | 571 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); |
573 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 572 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
574 | davinci_mcbsp_stop(dev, playback); | 573 | davinci_mcbsp_stop(dev, playback); |
575 | if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0) { | ||
576 | /* codec is master */ | ||
577 | davinci_mcbsp_start(dev, substream); | ||
578 | } | ||
579 | return 0; | 574 | return 0; |
580 | } | 575 | } |
581 | 576 | ||
582 | static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | 577 | static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, |
583 | struct snd_soc_dai *dai) | 578 | struct snd_soc_dai *dai) |
584 | { | 579 | { |
585 | struct davinci_mcbsp_dev *dev = dai->private_data; | 580 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); |
586 | int ret = 0; | 581 | int ret = 0; |
587 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 582 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
588 | if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0) | ||
589 | return 0; /* return if codec is master */ | ||
590 | 583 | ||
591 | switch (cmd) { | 584 | switch (cmd) { |
592 | case SNDRV_PCM_TRIGGER_START: | 585 | case SNDRV_PCM_TRIGGER_START: |
@@ -605,10 +598,19 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
605 | return ret; | 598 | return ret; |
606 | } | 599 | } |
607 | 600 | ||
601 | static int davinci_i2s_startup(struct snd_pcm_substream *substream, | ||
602 | struct snd_soc_dai *dai) | ||
603 | { | ||
604 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
605 | |||
606 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
607 | return 0; | ||
608 | } | ||
609 | |||
608 | static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, | 610 | static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, |
609 | struct snd_soc_dai *dai) | 611 | struct snd_soc_dai *dai) |
610 | { | 612 | { |
611 | struct davinci_mcbsp_dev *dev = dai->private_data; | 613 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); |
612 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 614 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
613 | davinci_mcbsp_stop(dev, playback); | 615 | davinci_mcbsp_stop(dev, playback); |
614 | } | 616 | } |
@@ -616,6 +618,7 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, | |||
616 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 | 618 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 |
617 | 619 | ||
618 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { | 620 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { |
621 | .startup = davinci_i2s_startup, | ||
619 | .shutdown = davinci_i2s_shutdown, | 622 | .shutdown = davinci_i2s_shutdown, |
620 | .prepare = davinci_i2s_prepare, | 623 | .prepare = davinci_i2s_prepare, |
621 | .trigger = davinci_i2s_trigger, | 624 | .trigger = davinci_i2s_trigger, |
@@ -625,9 +628,7 @@ static struct snd_soc_dai_ops davinci_i2s_dai_ops = { | |||
625 | 628 | ||
626 | }; | 629 | }; |
627 | 630 | ||
628 | struct snd_soc_dai davinci_i2s_dai = { | 631 | static struct snd_soc_dai_driver davinci_i2s_dai = { |
629 | .name = "davinci-i2s", | ||
630 | .id = 0, | ||
631 | .playback = { | 632 | .playback = { |
632 | .channels_min = 2, | 633 | .channels_min = 2, |
633 | .channels_max = 2, | 634 | .channels_max = 2, |
@@ -641,7 +642,6 @@ struct snd_soc_dai davinci_i2s_dai = { | |||
641 | .ops = &davinci_i2s_dai_ops, | 642 | .ops = &davinci_i2s_dai_ops, |
642 | 643 | ||
643 | }; | 644 | }; |
644 | EXPORT_SYMBOL_GPL(davinci_i2s_dai); | ||
645 | 645 | ||
646 | static int davinci_i2s_probe(struct platform_device *pdev) | 646 | static int davinci_i2s_probe(struct platform_device *pdev) |
647 | { | 647 | { |
@@ -658,7 +658,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
658 | return -ENODEV; | 658 | return -ENODEV; |
659 | } | 659 | } |
660 | 660 | ||
661 | ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1, | 661 | ioarea = request_mem_region(mem->start, resource_size(mem), |
662 | pdev->name); | 662 | pdev->name); |
663 | if (!ioarea) { | 663 | if (!ioarea) { |
664 | dev_err(&pdev->dev, "McBSP region already claimed\n"); | 664 | dev_err(&pdev->dev, "McBSP region already claimed\n"); |
@@ -694,20 +694,25 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
694 | } | 694 | } |
695 | clk_enable(dev->clk); | 695 | clk_enable(dev->clk); |
696 | 696 | ||
697 | dev->base = (void __iomem *)IO_ADDRESS(mem->start); | 697 | dev->base = ioremap(mem->start, resource_size(mem)); |
698 | if (!dev->base) { | ||
699 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
700 | ret = -ENOMEM; | ||
701 | goto err_release_clk; | ||
702 | } | ||
698 | 703 | ||
699 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr = | 704 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr = |
700 | (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG); | 705 | (dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG); |
701 | 706 | ||
702 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = | 707 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = |
703 | (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG); | 708 | (dma_addr_t)(mem->start + DAVINCI_MCBSP_DRR_REG); |
704 | 709 | ||
705 | /* first TX, then RX */ | 710 | /* first TX, then RX */ |
706 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 711 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
707 | if (!res) { | 712 | if (!res) { |
708 | dev_err(&pdev->dev, "no DMA resource\n"); | 713 | dev_err(&pdev->dev, "no DMA resource\n"); |
709 | ret = -ENXIO; | 714 | ret = -ENXIO; |
710 | goto err_free_mem; | 715 | goto err_iounmap; |
711 | } | 716 | } |
712 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start; | 717 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start; |
713 | 718 | ||
@@ -715,40 +720,44 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
715 | if (!res) { | 720 | if (!res) { |
716 | dev_err(&pdev->dev, "no DMA resource\n"); | 721 | dev_err(&pdev->dev, "no DMA resource\n"); |
717 | ret = -ENXIO; | 722 | ret = -ENXIO; |
718 | goto err_free_mem; | 723 | goto err_iounmap; |
719 | } | 724 | } |
720 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; | 725 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; |
721 | dev->dev = &pdev->dev; | 726 | dev->dev = &pdev->dev; |
722 | 727 | ||
723 | davinci_i2s_dai.private_data = dev; | 728 | dev_set_drvdata(&pdev->dev, dev); |
724 | davinci_i2s_dai.capture.dma_data = dev->dma_params; | 729 | |
725 | davinci_i2s_dai.playback.dma_data = dev->dma_params; | 730 | ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai); |
726 | ret = snd_soc_register_dai(&davinci_i2s_dai); | ||
727 | if (ret != 0) | 731 | if (ret != 0) |
728 | goto err_free_mem; | 732 | goto err_iounmap; |
729 | 733 | ||
730 | return 0; | 734 | return 0; |
731 | 735 | ||
736 | err_iounmap: | ||
737 | iounmap(dev->base); | ||
738 | err_release_clk: | ||
739 | clk_disable(dev->clk); | ||
740 | clk_put(dev->clk); | ||
732 | err_free_mem: | 741 | err_free_mem: |
733 | kfree(dev); | 742 | kfree(dev); |
734 | err_release_region: | 743 | err_release_region: |
735 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 744 | release_mem_region(mem->start, resource_size(mem)); |
736 | 745 | ||
737 | return ret; | 746 | return ret; |
738 | } | 747 | } |
739 | 748 | ||
740 | static int davinci_i2s_remove(struct platform_device *pdev) | 749 | static int davinci_i2s_remove(struct platform_device *pdev) |
741 | { | 750 | { |
742 | struct davinci_mcbsp_dev *dev = davinci_i2s_dai.private_data; | 751 | struct davinci_mcbsp_dev *dev = dev_get_drvdata(&pdev->dev); |
743 | struct resource *mem; | 752 | struct resource *mem; |
744 | 753 | ||
745 | snd_soc_unregister_dai(&davinci_i2s_dai); | 754 | snd_soc_unregister_dai(&pdev->dev); |
746 | clk_disable(dev->clk); | 755 | clk_disable(dev->clk); |
747 | clk_put(dev->clk); | 756 | clk_put(dev->clk); |
748 | dev->clk = NULL; | 757 | dev->clk = NULL; |
749 | kfree(dev); | 758 | kfree(dev); |
750 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 759 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
751 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 760 | release_mem_region(mem->start, resource_size(mem)); |
752 | 761 | ||
753 | return 0; | 762 | return 0; |
754 | } | 763 | } |
@@ -757,7 +766,7 @@ static struct platform_driver davinci_mcbsp_driver = { | |||
757 | .probe = davinci_i2s_probe, | 766 | .probe = davinci_i2s_probe, |
758 | .remove = davinci_i2s_remove, | 767 | .remove = davinci_i2s_remove, |
759 | .driver = { | 768 | .driver = { |
760 | .name = "davinci-asp", | 769 | .name = "davinci-mcbsp", |
761 | .owner = THIS_MODULE, | 770 | .owner = THIS_MODULE, |
762 | }, | 771 | }, |
763 | }; | 772 | }; |
diff --git a/sound/soc/davinci/davinci-i2s.h b/sound/soc/davinci/davinci-i2s.h index 0b1e77b8c279..48dac3e2521a 100644 --- a/sound/soc/davinci/davinci-i2s.h +++ b/sound/soc/davinci/davinci-i2s.h | |||
@@ -17,6 +17,4 @@ enum davinci_mcbsp_div { | |||
17 | DAVINCI_MCBSP_CLKGDV, /* Sample rate generator divider */ | 17 | DAVINCI_MCBSP_CLKGDV, /* Sample rate generator divider */ |
18 | }; | 18 | }; |
19 | 19 | ||
20 | extern struct snd_soc_dai davinci_i2s_dai; | ||
21 | |||
22 | #endif | 20 | #endif |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index b24720894af6..8566238db2a5 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -422,7 +422,7 @@ static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream) | |||
422 | static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 422 | static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
423 | unsigned int fmt) | 423 | unsigned int fmt) |
424 | { | 424 | { |
425 | struct davinci_audio_dev *dev = cpu_dai->private_data; | 425 | struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); |
426 | void __iomem *base = dev->base; | 426 | void __iomem *base = dev->base; |
427 | 427 | ||
428 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 428 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
@@ -434,17 +434,21 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
434 | mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); | 434 | mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); |
435 | mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); | 435 | mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); |
436 | 436 | ||
437 | mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, (0x7 << 26)); | 437 | mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, |
438 | ACLKX | AHCLKX | AFSX); | ||
438 | break; | 439 | break; |
439 | case SND_SOC_DAIFMT_CBM_CFS: | 440 | case SND_SOC_DAIFMT_CBM_CFS: |
440 | /* codec is clock master and frame slave */ | 441 | /* codec is clock master and frame slave */ |
441 | mcasp_set_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE); | 442 | mcasp_clr_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE); |
442 | mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE); | 443 | mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE); |
443 | 444 | ||
444 | mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); | 445 | mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); |
445 | mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); | 446 | mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); |
446 | 447 | ||
447 | mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, (0x2d << 26)); | 448 | mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, |
449 | ACLKX | ACLKR); | ||
450 | mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, | ||
451 | AFSX | AFSR); | ||
448 | break; | 452 | break; |
449 | case SND_SOC_DAIFMT_CBM_CFM: | 453 | case SND_SOC_DAIFMT_CBM_CFM: |
450 | /* codec is clock and frame master */ | 454 | /* codec is clock and frame master */ |
@@ -454,7 +458,8 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
454 | mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); | 458 | mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); |
455 | mcasp_clr_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); | 459 | mcasp_clr_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); |
456 | 460 | ||
457 | mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, (0x3f << 26)); | 461 | mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, |
462 | ACLKX | AHCLKX | AFSX | ACLKR | AHCLKR | AFSR); | ||
458 | break; | 463 | break; |
459 | 464 | ||
460 | default: | 465 | default: |
@@ -644,7 +649,7 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream) | |||
644 | mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask); | 649 | mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask); |
645 | mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD); | 650 | mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD); |
646 | 651 | ||
647 | if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32)) | 652 | if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32)) |
648 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, | 653 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, |
649 | FSXMOD(dev->tdm_slots), FSXMOD(0x1FF)); | 654 | FSXMOD(dev->tdm_slots), FSXMOD(0x1FF)); |
650 | else | 655 | else |
@@ -660,7 +665,7 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream) | |||
660 | AHCLKRE); | 665 | AHCLKRE); |
661 | mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask); | 666 | mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask); |
662 | 667 | ||
663 | if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32)) | 668 | if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32)) |
664 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, | 669 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, |
665 | FSRMOD(dev->tdm_slots), FSRMOD(0x1FF)); | 670 | FSRMOD(dev->tdm_slots), FSRMOD(0x1FF)); |
666 | else | 671 | else |
@@ -709,7 +714,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
709 | struct snd_pcm_hw_params *params, | 714 | struct snd_pcm_hw_params *params, |
710 | struct snd_soc_dai *cpu_dai) | 715 | struct snd_soc_dai *cpu_dai) |
711 | { | 716 | { |
712 | struct davinci_audio_dev *dev = cpu_dai->private_data; | 717 | struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); |
713 | struct davinci_pcm_dma_params *dma_params = | 718 | struct davinci_pcm_dma_params *dma_params = |
714 | &dev->dma_params[substream->stream]; | 719 | &dev->dma_params[substream->stream]; |
715 | int word_length; | 720 | int word_length; |
@@ -761,8 +766,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
761 | static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, | 766 | static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, |
762 | int cmd, struct snd_soc_dai *cpu_dai) | 767 | int cmd, struct snd_soc_dai *cpu_dai) |
763 | { | 768 | { |
764 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 769 | struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); |
765 | struct davinci_audio_dev *dev = rtd->dai->cpu_dai->private_data; | ||
766 | int ret = 0; | 770 | int ret = 0; |
767 | 771 | ||
768 | switch (cmd) { | 772 | switch (cmd) { |
@@ -797,17 +801,26 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, | |||
797 | return ret; | 801 | return ret; |
798 | } | 802 | } |
799 | 803 | ||
804 | static int davinci_mcasp_startup(struct snd_pcm_substream *substream, | ||
805 | struct snd_soc_dai *dai) | ||
806 | { | ||
807 | struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
808 | |||
809 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
810 | return 0; | ||
811 | } | ||
812 | |||
800 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { | 813 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { |
814 | .startup = davinci_mcasp_startup, | ||
801 | .trigger = davinci_mcasp_trigger, | 815 | .trigger = davinci_mcasp_trigger, |
802 | .hw_params = davinci_mcasp_hw_params, | 816 | .hw_params = davinci_mcasp_hw_params, |
803 | .set_fmt = davinci_mcasp_set_dai_fmt, | 817 | .set_fmt = davinci_mcasp_set_dai_fmt, |
804 | 818 | ||
805 | }; | 819 | }; |
806 | 820 | ||
807 | struct snd_soc_dai davinci_mcasp_dai[] = { | 821 | static struct snd_soc_dai_driver davinci_mcasp_dai[] = { |
808 | { | 822 | { |
809 | .name = "davinci-i2s", | 823 | .name = "davinci-mcasp.0", |
810 | .id = 0, | ||
811 | .playback = { | 824 | .playback = { |
812 | .channels_min = 2, | 825 | .channels_min = 2, |
813 | .channels_max = 2, | 826 | .channels_max = 2, |
@@ -828,8 +841,7 @@ struct snd_soc_dai davinci_mcasp_dai[] = { | |||
828 | 841 | ||
829 | }, | 842 | }, |
830 | { | 843 | { |
831 | .name = "davinci-dit", | 844 | "davinci-mcasp.1", |
832 | .id = 1, | ||
833 | .playback = { | 845 | .playback = { |
834 | .channels_min = 1, | 846 | .channels_min = 1, |
835 | .channels_max = 384, | 847 | .channels_max = 384, |
@@ -840,7 +852,6 @@ struct snd_soc_dai davinci_mcasp_dai[] = { | |||
840 | }, | 852 | }, |
841 | 853 | ||
842 | }; | 854 | }; |
843 | EXPORT_SYMBOL_GPL(davinci_mcasp_dai); | ||
844 | 855 | ||
845 | static int davinci_mcasp_probe(struct platform_device *pdev) | 856 | static int davinci_mcasp_probe(struct platform_device *pdev) |
846 | { | 857 | { |
@@ -862,7 +873,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
862 | } | 873 | } |
863 | 874 | ||
864 | ioarea = request_mem_region(mem->start, | 875 | ioarea = request_mem_region(mem->start, |
865 | (mem->end - mem->start) + 1, pdev->name); | 876 | resource_size(mem), pdev->name); |
866 | if (!ioarea) { | 877 | if (!ioarea) { |
867 | dev_err(&pdev->dev, "Audio region already claimed\n"); | 878 | dev_err(&pdev->dev, "Audio region already claimed\n"); |
868 | ret = -EBUSY; | 879 | ret = -EBUSY; |
@@ -879,7 +890,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
879 | clk_enable(dev->clk); | 890 | clk_enable(dev->clk); |
880 | dev->clk_active = 1; | 891 | dev->clk_active = 1; |
881 | 892 | ||
882 | dev->base = (void __iomem *)IO_ADDRESS(mem->start); | 893 | dev->base = ioremap(mem->start, resource_size(mem)); |
894 | if (!dev->base) { | ||
895 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
896 | ret = -ENOMEM; | ||
897 | goto err_release_clk; | ||
898 | } | ||
899 | |||
883 | dev->op_mode = pdata->op_mode; | 900 | dev->op_mode = pdata->op_mode; |
884 | dev->tdm_slots = pdata->tdm_slots; | 901 | dev->tdm_slots = pdata->tdm_slots; |
885 | dev->num_serializer = pdata->num_serializer; | 902 | dev->num_serializer = pdata->num_serializer; |
@@ -892,14 +909,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
892 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; | 909 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; |
893 | dma_data->asp_chan_q = pdata->asp_chan_q; | 910 | dma_data->asp_chan_q = pdata->asp_chan_q; |
894 | dma_data->ram_chan_q = pdata->ram_chan_q; | 911 | dma_data->ram_chan_q = pdata->ram_chan_q; |
912 | dma_data->sram_size = pdata->sram_size_playback; | ||
895 | dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + | 913 | dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + |
896 | io_v2p(dev->base)); | 914 | mem->start); |
897 | 915 | ||
898 | /* first TX, then RX */ | 916 | /* first TX, then RX */ |
899 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 917 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
900 | if (!res) { | 918 | if (!res) { |
901 | dev_err(&pdev->dev, "no DMA resource\n"); | 919 | dev_err(&pdev->dev, "no DMA resource\n"); |
902 | goto err_release_region; | 920 | ret = -ENODEV; |
921 | goto err_iounmap; | ||
903 | } | 922 | } |
904 | 923 | ||
905 | dma_data->channel = res->start; | 924 | dma_data->channel = res->start; |
@@ -907,28 +926,32 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
907 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; | 926 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; |
908 | dma_data->asp_chan_q = pdata->asp_chan_q; | 927 | dma_data->asp_chan_q = pdata->asp_chan_q; |
909 | dma_data->ram_chan_q = pdata->ram_chan_q; | 928 | dma_data->ram_chan_q = pdata->ram_chan_q; |
929 | dma_data->sram_size = pdata->sram_size_capture; | ||
910 | dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + | 930 | dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + |
911 | io_v2p(dev->base)); | 931 | mem->start); |
912 | 932 | ||
913 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); | 933 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
914 | if (!res) { | 934 | if (!res) { |
915 | dev_err(&pdev->dev, "no DMA resource\n"); | 935 | dev_err(&pdev->dev, "no DMA resource\n"); |
916 | goto err_release_region; | 936 | ret = -ENODEV; |
937 | goto err_iounmap; | ||
917 | } | 938 | } |
918 | 939 | ||
919 | dma_data->channel = res->start; | 940 | dma_data->channel = res->start; |
920 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; | 941 | dev_set_drvdata(&pdev->dev, dev); |
921 | davinci_mcasp_dai[pdata->op_mode].capture.dma_data = dev->dma_params; | 942 | ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]); |
922 | davinci_mcasp_dai[pdata->op_mode].playback.dma_data = dev->dma_params; | ||
923 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; | ||
924 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); | ||
925 | 943 | ||
926 | if (ret != 0) | 944 | if (ret != 0) |
927 | goto err_release_region; | 945 | goto err_iounmap; |
928 | return 0; | 946 | return 0; |
929 | 947 | ||
948 | err_iounmap: | ||
949 | iounmap(dev->base); | ||
950 | err_release_clk: | ||
951 | clk_disable(dev->clk); | ||
952 | clk_put(dev->clk); | ||
930 | err_release_region: | 953 | err_release_region: |
931 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 954 | release_mem_region(mem->start, resource_size(mem)); |
932 | err_release_data: | 955 | err_release_data: |
933 | kfree(dev); | 956 | kfree(dev); |
934 | 957 | ||
@@ -937,18 +960,16 @@ err_release_data: | |||
937 | 960 | ||
938 | static int davinci_mcasp_remove(struct platform_device *pdev) | 961 | static int davinci_mcasp_remove(struct platform_device *pdev) |
939 | { | 962 | { |
940 | struct snd_platform_data *pdata = pdev->dev.platform_data; | 963 | struct davinci_audio_dev *dev = dev_get_drvdata(&pdev->dev); |
941 | struct davinci_audio_dev *dev; | ||
942 | struct resource *mem; | 964 | struct resource *mem; |
943 | 965 | ||
944 | snd_soc_unregister_dai(&davinci_mcasp_dai[pdata->op_mode]); | 966 | snd_soc_unregister_dai(&pdev->dev); |
945 | dev = davinci_mcasp_dai[pdata->op_mode].private_data; | ||
946 | clk_disable(dev->clk); | 967 | clk_disable(dev->clk); |
947 | clk_put(dev->clk); | 968 | clk_put(dev->clk); |
948 | dev->clk = NULL; | 969 | dev->clk = NULL; |
949 | 970 | ||
950 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 971 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
951 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 972 | release_mem_region(mem->start, resource_size(mem)); |
952 | 973 | ||
953 | kfree(dev); | 974 | kfree(dev); |
954 | 975 | ||
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h index e755b5121ec7..4681acc63606 100644 --- a/sound/soc/davinci/davinci-mcasp.h +++ b/sound/soc/davinci/davinci-mcasp.h | |||
@@ -22,8 +22,6 @@ | |||
22 | #include <mach/asp.h> | 22 | #include <mach/asp.h> |
23 | #include "davinci-pcm.h" | 23 | #include "davinci-pcm.h" |
24 | 24 | ||
25 | extern struct snd_soc_dai davinci_mcasp_dai[]; | ||
26 | |||
27 | #define DAVINCI_MCASP_RATES SNDRV_PCM_RATE_8000_96000 | 25 | #define DAVINCI_MCASP_RATES SNDRV_PCM_RATE_8000_96000 |
28 | #define DAVINCI_MCASP_I2S_DAI 0 | 26 | #define DAVINCI_MCASP_I2S_DAI 0 |
29 | #define DAVINCI_MCASP_DIT_DAI 1 | 27 | #define DAVINCI_MCASP_DIT_DAI 1 |
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index a7124116d2e0..9d35b8c1a624 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c | |||
@@ -653,7 +653,7 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) | |||
653 | struct davinci_pcm_dma_params *pa; | 653 | struct davinci_pcm_dma_params *pa; |
654 | struct davinci_pcm_dma_params *params; | 654 | struct davinci_pcm_dma_params *params; |
655 | 655 | ||
656 | pa = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 656 | pa = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
657 | if (!pa) | 657 | if (!pa) |
658 | return -ENODEV; | 658 | return -ENODEV; |
659 | params = &pa[substream->stream]; | 659 | params = &pa[substream->stream]; |
@@ -821,7 +821,7 @@ static int davinci_pcm_new(struct snd_card *card, | |||
821 | if (!card->dev->coherent_dma_mask) | 821 | if (!card->dev->coherent_dma_mask) |
822 | card->dev->coherent_dma_mask = 0xffffffff; | 822 | card->dev->coherent_dma_mask = 0xffffffff; |
823 | 823 | ||
824 | if (dai->playback.channels_min) { | 824 | if (dai->driver->playback.channels_min) { |
825 | ret = davinci_pcm_preallocate_dma_buffer(pcm, | 825 | ret = davinci_pcm_preallocate_dma_buffer(pcm, |
826 | SNDRV_PCM_STREAM_PLAYBACK, | 826 | SNDRV_PCM_STREAM_PLAYBACK, |
827 | pcm_hardware_playback.buffer_bytes_max); | 827 | pcm_hardware_playback.buffer_bytes_max); |
@@ -829,7 +829,7 @@ static int davinci_pcm_new(struct snd_card *card, | |||
829 | return ret; | 829 | return ret; |
830 | } | 830 | } |
831 | 831 | ||
832 | if (dai->capture.channels_min) { | 832 | if (dai->driver->capture.channels_min) { |
833 | ret = davinci_pcm_preallocate_dma_buffer(pcm, | 833 | ret = davinci_pcm_preallocate_dma_buffer(pcm, |
834 | SNDRV_PCM_STREAM_CAPTURE, | 834 | SNDRV_PCM_STREAM_CAPTURE, |
835 | pcm_hardware_capture.buffer_bytes_max); | 835 | pcm_hardware_capture.buffer_bytes_max); |
@@ -840,25 +840,44 @@ static int davinci_pcm_new(struct snd_card *card, | |||
840 | return 0; | 840 | return 0; |
841 | } | 841 | } |
842 | 842 | ||
843 | struct snd_soc_platform davinci_soc_platform = { | 843 | static struct snd_soc_platform_driver davinci_soc_platform = { |
844 | .name = "davinci-audio", | 844 | .ops = &davinci_pcm_ops, |
845 | .pcm_ops = &davinci_pcm_ops, | ||
846 | .pcm_new = davinci_pcm_new, | 845 | .pcm_new = davinci_pcm_new, |
847 | .pcm_free = davinci_pcm_free, | 846 | .pcm_free = davinci_pcm_free, |
848 | }; | 847 | }; |
849 | EXPORT_SYMBOL_GPL(davinci_soc_platform); | ||
850 | 848 | ||
851 | static int __init davinci_soc_platform_init(void) | 849 | static int __devinit davinci_soc_platform_probe(struct platform_device *pdev) |
852 | { | 850 | { |
853 | return snd_soc_register_platform(&davinci_soc_platform); | 851 | return snd_soc_register_platform(&pdev->dev, &davinci_soc_platform); |
854 | } | 852 | } |
855 | module_init(davinci_soc_platform_init); | ||
856 | 853 | ||
857 | static void __exit davinci_soc_platform_exit(void) | 854 | static int __devexit davinci_soc_platform_remove(struct platform_device *pdev) |
858 | { | 855 | { |
859 | snd_soc_unregister_platform(&davinci_soc_platform); | 856 | snd_soc_unregister_platform(&pdev->dev); |
857 | return 0; | ||
858 | } | ||
859 | |||
860 | static struct platform_driver davinci_pcm_driver = { | ||
861 | .driver = { | ||
862 | .name = "davinci-pcm-audio", | ||
863 | .owner = THIS_MODULE, | ||
864 | }, | ||
865 | |||
866 | .probe = davinci_soc_platform_probe, | ||
867 | .remove = __devexit_p(davinci_soc_platform_remove), | ||
868 | }; | ||
869 | |||
870 | static int __init snd_davinci_pcm_init(void) | ||
871 | { | ||
872 | return platform_driver_register(&davinci_pcm_driver); | ||
873 | } | ||
874 | module_init(snd_davinci_pcm_init); | ||
875 | |||
876 | static void __exit snd_davinci_pcm_exit(void) | ||
877 | { | ||
878 | platform_driver_unregister(&davinci_pcm_driver); | ||
860 | } | 879 | } |
861 | module_exit(davinci_soc_platform_exit); | 880 | module_exit(snd_davinci_pcm_exit); |
862 | 881 | ||
863 | MODULE_AUTHOR("Vladimir Barinov"); | 882 | MODULE_AUTHOR("Vladimir Barinov"); |
864 | MODULE_DESCRIPTION("TI DAVINCI PCM DMA module"); | 883 | MODULE_DESCRIPTION("TI DAVINCI PCM DMA module"); |
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h index b799a02333d8..c0d6c9be4b4d 100644 --- a/sound/soc/davinci/davinci-pcm.h +++ b/sound/soc/davinci/davinci-pcm.h | |||
@@ -28,7 +28,4 @@ struct davinci_pcm_dma_params { | |||
28 | unsigned int fifo_level; | 28 | unsigned int fifo_level; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | |||
32 | extern struct snd_soc_platform davinci_soc_platform; | ||
33 | |||
34 | #endif | 31 | #endif |
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c index 40eccfe9e358..0fe558c65145 100644 --- a/sound/soc/davinci/davinci-sffsdr.c +++ b/sound/soc/davinci/davinci-sffsdr.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <sound/core.h> | 21 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
23 | #include <sound/soc.h> | 23 | #include <sound/soc.h> |
24 | #include <sound/soc-dapm.h> | ||
25 | 24 | ||
26 | #include <asm/dma.h> | 25 | #include <asm/dma.h> |
27 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
@@ -29,7 +28,6 @@ | |||
29 | #include <asm/plat-sffsdr/sffsdr-fpga.h> | 28 | #include <asm/plat-sffsdr/sffsdr-fpga.h> |
30 | #endif | 29 | #endif |
31 | 30 | ||
32 | #include <mach/mcbsp.h> | ||
33 | #include <mach/edma.h> | 31 | #include <mach/edma.h> |
34 | 32 | ||
35 | #include "../codecs/pcm3008.h" | 33 | #include "../codecs/pcm3008.h" |
@@ -48,7 +46,7 @@ static int sffsdr_hw_params(struct snd_pcm_substream *substream, | |||
48 | struct snd_pcm_hw_params *params) | 46 | struct snd_pcm_hw_params *params) |
49 | { | 47 | { |
50 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 48 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
51 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 49 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
52 | int fs; | 50 | int fs; |
53 | int ret = 0; | 51 | int ret = 0; |
54 | 52 | ||
@@ -85,15 +83,16 @@ static struct snd_soc_ops sffsdr_ops = { | |||
85 | static struct snd_soc_dai_link sffsdr_dai = { | 83 | static struct snd_soc_dai_link sffsdr_dai = { |
86 | .name = "PCM3008", /* Codec name */ | 84 | .name = "PCM3008", /* Codec name */ |
87 | .stream_name = "PCM3008 HiFi", | 85 | .stream_name = "PCM3008 HiFi", |
88 | .cpu_dai = &davinci_i2s_dai, | 86 | .cpu_dai_name = "davinci-mcbsp", |
89 | .codec_dai = &pcm3008_dai, | 87 | .codec_dai_name = "pcm3008-hifi", |
88 | .codec_name = "pcm3008-codec", | ||
89 | .platform_name = "davinci-pcm-audio", | ||
90 | .ops = &sffsdr_ops, | 90 | .ops = &sffsdr_ops, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | /* davinci-sffsdr audio machine driver */ | 93 | /* davinci-sffsdr audio machine driver */ |
94 | static struct snd_soc_card snd_soc_sffsdr = { | 94 | static struct snd_soc_card snd_soc_sffsdr = { |
95 | .name = "DaVinci SFFSDR", | 95 | .name = "DaVinci SFFSDR", |
96 | .platform = &davinci_soc_platform, | ||
97 | .dai_link = &sffsdr_dai, | 96 | .dai_link = &sffsdr_dai, |
98 | .num_links = 1, | 97 | .num_links = 1, |
99 | }; | 98 | }; |
@@ -106,11 +105,12 @@ static struct pcm3008_setup_data sffsdr_pcm3008_setup = { | |||
106 | .pdda_pin = GPIO(38), | 105 | .pdda_pin = GPIO(38), |
107 | }; | 106 | }; |
108 | 107 | ||
109 | /* sffsdr audio subsystem */ | 108 | struct platform_device pcm3008_codec = { |
110 | static struct snd_soc_device sffsdr_snd_devdata = { | 109 | .name = "pcm3008-codec", |
111 | .card = &snd_soc_sffsdr, | 110 | .id = 0, |
112 | .codec_dev = &soc_codec_dev_pcm3008, | 111 | .dev = { |
113 | .codec_data = &sffsdr_pcm3008_setup, | 112 | .platform_data = &sffsdr_pcm3008_setup, |
113 | }, | ||
114 | }; | 114 | }; |
115 | 115 | ||
116 | static struct resource sffsdr_snd_resources[] = { | 116 | static struct resource sffsdr_snd_resources[] = { |
@@ -135,14 +135,15 @@ static int __init sffsdr_init(void) | |||
135 | if (!machine_is_sffsdr()) | 135 | if (!machine_is_sffsdr()) |
136 | return -EINVAL; | 136 | return -EINVAL; |
137 | 137 | ||
138 | platform_device_register(&pcm3008_codec); | ||
139 | |||
138 | sffsdr_snd_device = platform_device_alloc("soc-audio", 0); | 140 | sffsdr_snd_device = platform_device_alloc("soc-audio", 0); |
139 | if (!sffsdr_snd_device) { | 141 | if (!sffsdr_snd_device) { |
140 | printk(KERN_ERR "platform device allocation failed\n"); | 142 | printk(KERN_ERR "platform device allocation failed\n"); |
141 | return -ENOMEM; | 143 | return -ENOMEM; |
142 | } | 144 | } |
143 | 145 | ||
144 | platform_set_drvdata(sffsdr_snd_device, &sffsdr_snd_devdata); | 146 | platform_set_drvdata(sffsdr_snd_device, &snd_soc_sffsdr); |
145 | sffsdr_snd_devdata.dev = &sffsdr_snd_device->dev; | ||
146 | platform_device_add_data(sffsdr_snd_device, &sffsdr_snd_data, | 147 | platform_device_add_data(sffsdr_snd_device, &sffsdr_snd_data, |
147 | sizeof(sffsdr_snd_data)); | 148 | sizeof(sffsdr_snd_data)); |
148 | 149 | ||
@@ -150,7 +151,7 @@ static int __init sffsdr_init(void) | |||
150 | sffsdr_snd_resources, | 151 | sffsdr_snd_resources, |
151 | ARRAY_SIZE(sffsdr_snd_resources)); | 152 | ARRAY_SIZE(sffsdr_snd_resources)); |
152 | if (ret) { | 153 | if (ret) { |
153 | printk(KERN_ERR "platform device add ressources failed\n"); | 154 | printk(KERN_ERR "platform device add resources failed\n"); |
154 | goto error; | 155 | goto error; |
155 | } | 156 | } |
156 | 157 | ||
@@ -168,6 +169,7 @@ error: | |||
168 | static void __exit sffsdr_exit(void) | 169 | static void __exit sffsdr_exit(void) |
169 | { | 170 | { |
170 | platform_device_unregister(sffsdr_snd_device); | 171 | platform_device_unregister(sffsdr_snd_device); |
172 | platform_device_unregister(&pcm3008_codec); | ||
171 | } | 173 | } |
172 | 174 | ||
173 | module_init(sffsdr_init); | 175 | module_init(sffsdr_init); |
diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c index 48678533da7a..9259f1f34899 100644 --- a/sound/soc/davinci/davinci-vcif.c +++ b/sound/soc/davinci/davinci-vcif.c | |||
@@ -36,7 +36,6 @@ | |||
36 | 36 | ||
37 | #include "davinci-pcm.h" | 37 | #include "davinci-pcm.h" |
38 | #include "davinci-i2s.h" | 38 | #include "davinci-i2s.h" |
39 | #include "davinci-vcif.h" | ||
40 | 39 | ||
41 | #define MOD_REG_BIT(val, mask, set) do { \ | 40 | #define MOD_REG_BIT(val, mask, set) do { \ |
42 | if (set) { \ | 41 | if (set) { \ |
@@ -55,7 +54,7 @@ static void davinci_vcif_start(struct snd_pcm_substream *substream) | |||
55 | { | 54 | { |
56 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 55 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
57 | struct davinci_vcif_dev *davinci_vcif_dev = | 56 | struct davinci_vcif_dev *davinci_vcif_dev = |
58 | rtd->dai->cpu_dai->private_data; | 57 | snd_soc_dai_get_drvdata(rtd->cpu_dai); |
59 | struct davinci_vc *davinci_vc = davinci_vcif_dev->davinci_vc; | 58 | struct davinci_vc *davinci_vc = davinci_vcif_dev->davinci_vc; |
60 | u32 w; | 59 | u32 w; |
61 | 60 | ||
@@ -74,7 +73,7 @@ static void davinci_vcif_stop(struct snd_pcm_substream *substream) | |||
74 | { | 73 | { |
75 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 74 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
76 | struct davinci_vcif_dev *davinci_vcif_dev = | 75 | struct davinci_vcif_dev *davinci_vcif_dev = |
77 | rtd->dai->cpu_dai->private_data; | 76 | snd_soc_dai_get_drvdata(rtd->cpu_dai); |
78 | struct davinci_vc *davinci_vc = davinci_vcif_dev->davinci_vc; | 77 | struct davinci_vc *davinci_vc = davinci_vcif_dev->davinci_vc; |
79 | u32 w; | 78 | u32 w; |
80 | 79 | ||
@@ -92,7 +91,7 @@ static int davinci_vcif_hw_params(struct snd_pcm_substream *substream, | |||
92 | struct snd_pcm_hw_params *params, | 91 | struct snd_pcm_hw_params *params, |
93 | struct snd_soc_dai *dai) | 92 | struct snd_soc_dai *dai) |
94 | { | 93 | { |
95 | struct davinci_vcif_dev *davinci_vcif_dev = dai->private_data; | 94 | struct davinci_vcif_dev *davinci_vcif_dev = snd_soc_dai_get_drvdata(dai); |
96 | struct davinci_vc *davinci_vc = davinci_vcif_dev->davinci_vc; | 95 | struct davinci_vc *davinci_vc = davinci_vcif_dev->davinci_vc; |
97 | struct davinci_pcm_dma_params *dma_params = | 96 | struct davinci_pcm_dma_params *dma_params = |
98 | &davinci_vcif_dev->dma_params[substream->stream]; | 97 | &davinci_vcif_dev->dma_params[substream->stream]; |
@@ -172,15 +171,24 @@ static int davinci_vcif_trigger(struct snd_pcm_substream *substream, int cmd, | |||
172 | return ret; | 171 | return ret; |
173 | } | 172 | } |
174 | 173 | ||
174 | static int davinci_vcif_startup(struct snd_pcm_substream *substream, | ||
175 | struct snd_soc_dai *dai) | ||
176 | { | ||
177 | struct davinci_vcif_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
178 | |||
179 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
180 | return 0; | ||
181 | } | ||
182 | |||
175 | #define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 | 183 | #define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 |
176 | 184 | ||
177 | static struct snd_soc_dai_ops davinci_vcif_dai_ops = { | 185 | static struct snd_soc_dai_ops davinci_vcif_dai_ops = { |
186 | .startup = davinci_vcif_startup, | ||
178 | .trigger = davinci_vcif_trigger, | 187 | .trigger = davinci_vcif_trigger, |
179 | .hw_params = davinci_vcif_hw_params, | 188 | .hw_params = davinci_vcif_hw_params, |
180 | }; | 189 | }; |
181 | 190 | ||
182 | struct snd_soc_dai davinci_vcif_dai = { | 191 | static struct snd_soc_dai_driver davinci_vcif_dai = { |
183 | .name = "davinci-vcif", | ||
184 | .playback = { | 192 | .playback = { |
185 | .channels_min = 1, | 193 | .channels_min = 1, |
186 | .channels_max = 2, | 194 | .channels_max = 2, |
@@ -194,11 +202,10 @@ struct snd_soc_dai davinci_vcif_dai = { | |||
194 | .ops = &davinci_vcif_dai_ops, | 202 | .ops = &davinci_vcif_dai_ops, |
195 | 203 | ||
196 | }; | 204 | }; |
197 | EXPORT_SYMBOL_GPL(davinci_vcif_dai); | ||
198 | 205 | ||
199 | static int davinci_vcif_probe(struct platform_device *pdev) | 206 | static int davinci_vcif_probe(struct platform_device *pdev) |
200 | { | 207 | { |
201 | struct davinci_vc *davinci_vc = platform_get_drvdata(pdev); | 208 | struct davinci_vc *davinci_vc = pdev->dev.platform_data; |
202 | struct davinci_vcif_dev *davinci_vcif_dev; | 209 | struct davinci_vcif_dev *davinci_vcif_dev; |
203 | int ret; | 210 | int ret; |
204 | 211 | ||
@@ -222,12 +229,9 @@ static int davinci_vcif_probe(struct platform_device *pdev) | |||
222 | davinci_vcif_dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = | 229 | davinci_vcif_dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = |
223 | davinci_vc->davinci_vcif.dma_rx_addr; | 230 | davinci_vc->davinci_vcif.dma_rx_addr; |
224 | 231 | ||
225 | davinci_vcif_dai.dev = &pdev->dev; | 232 | dev_set_drvdata(&pdev->dev, davinci_vcif_dev); |
226 | davinci_vcif_dai.capture.dma_data = davinci_vcif_dev->dma_params; | ||
227 | davinci_vcif_dai.playback.dma_data = davinci_vcif_dev->dma_params; | ||
228 | davinci_vcif_dai.private_data = davinci_vcif_dev; | ||
229 | 233 | ||
230 | ret = snd_soc_register_dai(&davinci_vcif_dai); | 234 | ret = snd_soc_register_dai(&pdev->dev, &davinci_vcif_dai); |
231 | if (ret != 0) { | 235 | if (ret != 0) { |
232 | dev_err(&pdev->dev, "could not register dai\n"); | 236 | dev_err(&pdev->dev, "could not register dai\n"); |
233 | goto fail; | 237 | goto fail; |
@@ -243,7 +247,10 @@ fail: | |||
243 | 247 | ||
244 | static int davinci_vcif_remove(struct platform_device *pdev) | 248 | static int davinci_vcif_remove(struct platform_device *pdev) |
245 | { | 249 | { |
246 | snd_soc_unregister_dai(&davinci_vcif_dai); | 250 | struct davinci_vcif_dev *davinci_vcif_dev = dev_get_drvdata(&pdev->dev); |
251 | |||
252 | snd_soc_unregister_dai(&pdev->dev); | ||
253 | kfree(davinci_vcif_dev); | ||
247 | 254 | ||
248 | return 0; | 255 | return 0; |
249 | } | 256 | } |
@@ -252,7 +259,7 @@ static struct platform_driver davinci_vcif_driver = { | |||
252 | .probe = davinci_vcif_probe, | 259 | .probe = davinci_vcif_probe, |
253 | .remove = davinci_vcif_remove, | 260 | .remove = davinci_vcif_remove, |
254 | .driver = { | 261 | .driver = { |
255 | .name = "davinci_vcif", | 262 | .name = "davinci-vcif", |
256 | .owner = THIS_MODULE, | 263 | .owner = THIS_MODULE, |
257 | }, | 264 | }, |
258 | }; | 265 | }; |
diff --git a/sound/soc/davinci/davinci-vcif.h b/sound/soc/davinci/davinci-vcif.h deleted file mode 100644 index 571c9948724f..000000000000 --- a/sound/soc/davinci/davinci-vcif.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * ALSA SoC Voice Codec Interface for TI DAVINCI processor | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments. | ||
5 | * | ||
6 | * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef _DAVINCI_VCIF_H | ||
24 | #define _DAVINCI_VCIF_H | ||
25 | |||
26 | extern struct snd_soc_dai davinci_vcif_dai; | ||
27 | |||
28 | #endif | ||