aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@slimlogic.co.uk>2010-03-17 16:15:21 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-08-12 09:00:00 -0400
commitf0fba2ad1b6b53d5360125c41953b7afcd6deff0 (patch)
treef6ad50905f8daa616593c978d7ae992e73241180 /sound/soc/davinci
parentbda7d2a862e6b788bca2d02d38a07966a9c92e48 (diff)
ASoC: multi-component - ASoC Multi-Component Support
This patch extends the ASoC API to allow sound cards to have more than one CODEC and more than one platform DMA controller. This is achieved by dividing some current ASoC structures that contain both driver data and device data into structures that only either contain device data or driver data. i.e. struct snd_soc_codec ---> struct snd_soc_codec (device data) +-> struct snd_soc_codec_driver (driver data) struct snd_soc_platform ---> struct snd_soc_platform (device data) +-> struct snd_soc_platform_driver (driver data) struct snd_soc_dai ---> struct snd_soc_dai (device data) +-> struct snd_soc_dai_driver (driver data) struct snd_soc_device ---> deleted This now allows ASoC to be more tightly aligned with the Linux driver model and also means that every ASoC codec, platform and (platform) DAI is a kernel device. ASoC component private data is now stored as device private data. The ASoC sound card struct snd_soc_card has also been updated to store lists of it's components rather than a pointer to a codec and platform. The PCM runtime struct soc_pcm_runtime now has pointers to all its components. This patch adds DAPM support for ASoC multi-component and removes struct snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec or runtime PCM level basis rather than using snd_soc_socdev. Other notable multi-component changes:- * Stream operations now de-reference less structures. * close_delayed work() now runs on a DAI basis rather than looping all DAIs in a card. * PM suspend()/resume() operations can now handle N CODECs and Platforms per sound card. * Added soc_bind_dai_link() to bind the component devices to the sound card. * Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove DAI link components. * sysfs entries can now be registered per component per card. * snd_soc_new_pcms() functionailty rolled into dai_link_probe(). * snd_soc_register_codec() now does all the codec list and mutex init. This patch changes the probe() and remove() of the CODEC drivers as follows:- o Make CODEC driver a platform driver o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core. o Removed all static codec pointers (drivers now support > 1 codec dev) o snd_soc_register_pcms() now done by core. o snd_soc_register_dai() folded into snd_soc_register_codec(). CS4270 portions: Acked-by: Timur Tabi <timur@freescale.com> Some TLV320aic23 and Cirrus platform fixes. Signed-off-by: Ryan Mallon <ryan@bluewatersys.com> TI CODEC and OMAP fixes Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Samsung platform and misc fixes :- Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Jassi Brar <jassi.brar@samsung.com> Signed-off-by: Seungwhan Youn <sw.youn@samsung.com> MPC8610 and PPC fixes. Signed-off-by: Timur Tabi <timur@freescale.com> i.MX fixes and some core fixes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> J4740 platform fixes:- Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> CC: Tony Lindgren <tony@atomide.com> CC: Nicolas Ferre <nicolas.ferre@atmel.com> CC: Kevin Hilman <khilman@deeprootsystems.com> CC: Sascha Hauer <s.hauer@pengutronix.de> CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp> CC: Kuninori Morimoto <morimoto.kuninori@renesas.com> CC: Daniel Gloeckner <dg@emlix.com> CC: Manuel Lauss <mano@roarinelk.homelinux.net> CC: Mike Frysinger <vapier.adi@gmail.com> CC: Arnaud Patard <apatard@mandriva.com> CC: Wan ZongShun <mcuos.com@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-evm.c109
-rw-r--r--sound/soc/davinci/davinci-i2s.c44
-rw-r--r--sound/soc/davinci/davinci-i2s.h2
-rw-r--r--sound/soc/davinci/davinci-mcasp.c32
-rw-r--r--sound/soc/davinci/davinci-mcasp.h2
-rw-r--r--sound/soc/davinci/davinci-pcm.c45
-rw-r--r--sound/soc/davinci/davinci-pcm.h3
-rw-r--r--sound/soc/davinci/davinci-sffsdr.c27
-rw-r--r--sound/soc/davinci/davinci-vcif.c25
-rw-r--r--sound/soc/davinci/davinci-vcif.h28
10 files changed, 128 insertions, 189 deletions
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 97f74d6a33e6..2b07b17a6b2d 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -28,12 +28,9 @@
28#include <mach/mux.h> 28#include <mach/mux.h>
29 29
30#include "../codecs/tlv320aic3x.h" 30#include "../codecs/tlv320aic3x.h"
31#include "../codecs/cq93vc.h"
32#include "../codecs/spdif_transciever.h"
33#include "davinci-pcm.h" 31#include "davinci-pcm.h"
34#include "davinci-i2s.h" 32#include "davinci-i2s.h"
35#include "davinci-mcasp.h" 33#include "davinci-mcasp.h"
36#include "davinci-vcif.h"
37 34
38#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ 35#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \
39 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) 36 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF)
@@ -41,8 +38,8 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
41 struct snd_pcm_hw_params *params) 38 struct snd_pcm_hw_params *params)
42{ 39{
43 struct snd_soc_pcm_runtime *rtd = substream->private_data; 40 struct snd_soc_pcm_runtime *rtd = substream->private_data;
44 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 41 struct snd_soc_dai *codec_dai = rtd->codec_dai;
45 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 42 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
46 int ret = 0; 43 int ret = 0;
47 unsigned sysclk; 44 unsigned sysclk;
48 45
@@ -87,7 +84,7 @@ static int evm_spdif_hw_params(struct snd_pcm_substream *substream,
87 struct snd_pcm_hw_params *params) 84 struct snd_pcm_hw_params *params)
88{ 85{
89 struct snd_soc_pcm_runtime *rtd = substream->private_data; 86 struct snd_soc_pcm_runtime *rtd = substream->private_data;
90 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 87 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
91 88
92 /* set cpu DAI configuration */ 89 /* set cpu DAI configuration */
93 return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); 90 return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT);
@@ -132,8 +129,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
132}; 129};
133 130
134/* Logic for a aic3x as connected on a davinci-evm */ 131/* Logic for a aic3x as connected on a davinci-evm */
135static int evm_aic3x_init(struct snd_soc_codec *codec) 132static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
136{ 133{
134 struct snd_soc_codec *codec = rtd->codec;
135
137 /* Add davinci-evm specific widgets */ 136 /* Add davinci-evm specific widgets */
138 snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, 137 snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets,
139 ARRAY_SIZE(aic3x_dapm_widgets)); 138 ARRAY_SIZE(aic3x_dapm_widgets));
@@ -161,8 +160,10 @@ static int evm_aic3x_init(struct snd_soc_codec *codec)
161static struct snd_soc_dai_link evm_dai = { 160static struct snd_soc_dai_link evm_dai = {
162 .name = "TLV320AIC3X", 161 .name = "TLV320AIC3X",
163 .stream_name = "AIC3X", 162 .stream_name = "AIC3X",
164 .cpu_dai = &davinci_i2s_dai, 163 .cpu_dai_name = "davinci-mcasp.0",
165 .codec_dai = &aic3x_dai, 164 .codec_dai_name = "tlv320aic3x-hifi",
165 .codec_name = "tlv320aic3x-codec.0-001a",
166 .platform_name = "davinci-pcm-audio",
166 .init = evm_aic3x_init, 167 .init = evm_aic3x_init,
167 .ops = &evm_ops, 168 .ops = &evm_ops,
168}; 169};
@@ -171,40 +172,49 @@ static struct snd_soc_dai_link dm365_evm_dai = {
171#ifdef CONFIG_SND_DM365_AIC3X_CODEC 172#ifdef CONFIG_SND_DM365_AIC3X_CODEC
172 .name = "TLV320AIC3X", 173 .name = "TLV320AIC3X",
173 .stream_name = "AIC3X", 174 .stream_name = "AIC3X",
174 .cpu_dai = &davinci_i2s_dai, 175 .cpu_dai_name = "davinci-i2s",
175 .codec_dai = &aic3x_dai, 176 .codec_dai_name = "tlv320aic3x-hifi",
176 .init = evm_aic3x_init, 177 .init = evm_aic3x_init,
178 .codec_name = "tlv320aic3x-codec.0-001a",
177 .ops = &evm_ops, 179 .ops = &evm_ops,
178#elif defined(CONFIG_SND_DM365_VOICE_CODEC) 180#elif defined(CONFIG_SND_DM365_VOICE_CODEC)
179 .name = "Voice Codec - CQ93VC", 181 .name = "Voice Codec - CQ93VC",
180 .stream_name = "CQ93", 182 .stream_name = "CQ93",
181 .cpu_dai = &davinci_vcif_dai, 183 .cpu_dai_name = "davinci-vcif",
182 .codec_dai = &cq93vc_dai, 184 .codec_dai_name = "cq93vc-hifi",
185 .codec_name = "cq93vc-codec",
183#endif 186#endif
187 .platform_name = "davinci-pcm-audio",
184}; 188};
185 189
186static struct snd_soc_dai_link dm6467_evm_dai[] = { 190static struct snd_soc_dai_link dm6467_evm_dai[] = {
187 { 191 {
188 .name = "TLV320AIC3X", 192 .name = "TLV320AIC3X",
189 .stream_name = "AIC3X", 193 .stream_name = "AIC3X",
190 .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI], 194 .cpu_dai_name= "davinci-mcasp.0",
191 .codec_dai = &aic3x_dai, 195 .codec_dai_name = "tlv320aic3x-hifi",
196 .platform_name ="davinci-pcm-audio",
197 .codec_name = "tlv320aic3x-codec.0-001a",
192 .init = evm_aic3x_init, 198 .init = evm_aic3x_init,
193 .ops = &evm_ops, 199 .ops = &evm_ops,
194 }, 200 },
195 { 201 {
196 .name = "McASP", 202 .name = "McASP",
197 .stream_name = "spdif", 203 .stream_name = "spdif",
198 .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_DIT_DAI], 204 .cpu_dai_name= "davinci-mcasp.1",
199 .codec_dai = &dit_stub_dai, 205 .codec_dai_name = "dit-hifi",
206 .codec_name = "spdif_dit",
207 .platform_name = "davinci-pcm-audio",
200 .ops = &evm_spdif_ops, 208 .ops = &evm_spdif_ops,
201 }, 209 },
202}; 210};
203static struct snd_soc_dai_link da8xx_evm_dai = { 211static struct snd_soc_dai_link da8xx_evm_dai = {
204 .name = "TLV320AIC3X", 212 .name = "TLV320AIC3X",
205 .stream_name = "AIC3X", 213 .stream_name = "AIC3X",
206 .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI], 214 .cpu_dai_name= "davinci-mcasp.0",
207 .codec_dai = &aic3x_dai, 215 .codec_dai_name = "tlv320aic3x-hifi",
216 .codec_name = "tlv320aic3x-codec.0-001a",
217 .platform_name = "davinci-pcm-audio",
208 .init = evm_aic3x_init, 218 .init = evm_aic3x_init,
209 .ops = &evm_ops, 219 .ops = &evm_ops,
210}; 220};
@@ -212,7 +222,6 @@ static struct snd_soc_dai_link da8xx_evm_dai = {
212/* davinci dm6446, dm355 evm audio machine driver */ 222/* davinci dm6446, dm355 evm audio machine driver */
213static struct snd_soc_card snd_soc_card_evm = { 223static struct snd_soc_card snd_soc_card_evm = {
214 .name = "DaVinci EVM", 224 .name = "DaVinci EVM",
215 .platform = &davinci_soc_platform,
216 .dai_link = &evm_dai, 225 .dai_link = &evm_dai,
217 .num_links = 1, 226 .num_links = 1,
218}; 227};
@@ -220,16 +229,13 @@ static struct snd_soc_card snd_soc_card_evm = {
220/* davinci dm365 evm audio machine driver */ 229/* davinci dm365 evm audio machine driver */
221static struct snd_soc_card dm365_snd_soc_card_evm = { 230static struct snd_soc_card dm365_snd_soc_card_evm = {
222 .name = "DaVinci DM365 EVM", 231 .name = "DaVinci DM365 EVM",
223 .platform = &davinci_soc_platform,
224 .dai_link = &dm365_evm_dai, 232 .dai_link = &dm365_evm_dai,
225 .num_links = 1, 233 .num_links = 1,
226}; 234};
227 235
228
229/* davinci dm6467 evm audio machine driver */ 236/* davinci dm6467 evm audio machine driver */
230static struct snd_soc_card dm6467_snd_soc_card_evm = { 237static struct snd_soc_card dm6467_snd_soc_card_evm = {
231 .name = "DaVinci DM6467 EVM", 238 .name = "DaVinci DM6467 EVM",
232 .platform = &davinci_soc_platform,
233 .dai_link = dm6467_evm_dai, 239 .dai_link = dm6467_evm_dai,
234 .num_links = ARRAY_SIZE(dm6467_evm_dai), 240 .num_links = ARRAY_SIZE(dm6467_evm_dai),
235}; 241};
@@ -237,82 +243,40 @@ static struct snd_soc_card dm6467_snd_soc_card_evm = {
237static struct snd_soc_card da830_snd_soc_card = { 243static struct snd_soc_card da830_snd_soc_card = {
238 .name = "DA830/OMAP-L137 EVM", 244 .name = "DA830/OMAP-L137 EVM",
239 .dai_link = &da8xx_evm_dai, 245 .dai_link = &da8xx_evm_dai,
240 .platform = &davinci_soc_platform,
241 .num_links = 1, 246 .num_links = 1,
242}; 247};
243 248
244static struct snd_soc_card da850_snd_soc_card = { 249static struct snd_soc_card da850_snd_soc_card = {
245 .name = "DA850/OMAP-L138 EVM", 250 .name = "DA850/OMAP-L138 EVM",
246 .dai_link = &da8xx_evm_dai, 251 .dai_link = &da8xx_evm_dai,
247 .platform = &davinci_soc_platform,
248 .num_links = 1, 252 .num_links = 1,
249}; 253};
250 254
251static struct aic3x_setup_data aic3x_setup;
252
253/* evm audio subsystem */
254static 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 */
261static 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 */
272static 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 */
279static 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
285static 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
291static struct platform_device *evm_snd_device; 255static struct platform_device *evm_snd_device;
292 256
293static int __init evm_init(void) 257static int __init evm_init(void)
294{ 258{
295 struct snd_soc_device *evm_snd_dev_data; 259 struct snd_soc_card *evm_snd_dev_data;
296 int index; 260 int index;
297 int ret; 261 int ret;
298 262
299 if (machine_is_davinci_evm()) { 263 if (machine_is_davinci_evm()) {
300 evm_snd_dev_data = &evm_snd_devdata; 264 evm_snd_dev_data = &snd_soc_card_evm;
301 index = 0; 265 index = 0;
302 } else if (machine_is_davinci_dm355_evm()) { 266 } else if (machine_is_davinci_dm355_evm()) {
303 evm_snd_dev_data = &evm_snd_devdata; 267 evm_snd_dev_data = &snd_soc_card_evm;
304 index = 1; 268 index = 1;
305 } else if (machine_is_davinci_dm365_evm()) { 269 } else if (machine_is_davinci_dm365_evm()) {
306 evm_snd_dev_data = &dm365_evm_snd_devdata; 270 evm_snd_dev_data = &dm365_snd_soc_card_evm;
307 index = 0; 271 index = 0;
308 } else if (machine_is_davinci_dm6467_evm()) { 272 } else if (machine_is_davinci_dm6467_evm()) {
309 evm_snd_dev_data = &dm6467_evm_snd_devdata; 273 evm_snd_dev_data = &dm6467_snd_soc_card_evm;
310 index = 0; 274 index = 0;
311 } else if (machine_is_davinci_da830_evm()) { 275 } else if (machine_is_davinci_da830_evm()) {
312 evm_snd_dev_data = &da830_evm_snd_devdata; 276 evm_snd_dev_data = &da830_snd_soc_card;
313 index = 1; 277 index = 1;
314 } else if (machine_is_davinci_da850_evm()) { 278 } else if (machine_is_davinci_da850_evm()) {
315 evm_snd_dev_data = &da850_evm_snd_devdata; 279 evm_snd_dev_data = &da850_snd_soc_card;
316 index = 0; 280 index = 0;
317 } else 281 } else
318 return -EINVAL; 282 return -EINVAL;
@@ -322,7 +286,6 @@ static int __init evm_init(void)
322 return -ENOMEM; 286 return -ENOMEM;
323 287
324 platform_set_drvdata(evm_snd_device, evm_snd_dev_data); 288 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); 289 ret = platform_device_add(evm_snd_device);
327 if (ret) 290 if (ret)
328 platform_device_put(evm_snd_device); 291 platform_device_put(evm_snd_device);
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 9e8932abf158..9f8b6c556866 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)
263static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, 262static 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,
404static int davinci_i2s_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, 403static 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;
@@ -427,6 +426,9 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
427 snd_pcm_format_t fmt; 426 snd_pcm_format_t fmt;
428 unsigned element_cnt = 1; 427 unsigned element_cnt = 1;
429 428
429 dai->capture_dma_data = dev->dma_params;
430 dai->playback_dma_data = dev->dma_params;
431
430 /* general line settings */ 432 /* general line settings */
431 spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); 433 spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG);
432 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { 434 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
@@ -569,7 +571,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
569static int davinci_i2s_prepare(struct snd_pcm_substream *substream, 571static int davinci_i2s_prepare(struct snd_pcm_substream *substream,
570 struct snd_soc_dai *dai) 572 struct snd_soc_dai *dai)
571{ 573{
572 struct davinci_mcbsp_dev *dev = dai->private_data; 574 struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);
573 int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); 575 int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
574 davinci_mcbsp_stop(dev, playback); 576 davinci_mcbsp_stop(dev, playback);
575 if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0) { 577 if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0) {
@@ -582,7 +584,7 @@ static int davinci_i2s_prepare(struct snd_pcm_substream *substream,
582static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, 584static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
583 struct snd_soc_dai *dai) 585 struct snd_soc_dai *dai)
584{ 586{
585 struct davinci_mcbsp_dev *dev = dai->private_data; 587 struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);
586 int ret = 0; 588 int ret = 0;
587 int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); 589 int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
588 if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0) 590 if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0)
@@ -608,7 +610,7 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
608static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, 610static 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}
@@ -625,9 +627,7 @@ static struct snd_soc_dai_ops davinci_i2s_dai_ops = {
625 627
626}; 628};
627 629
628struct snd_soc_dai davinci_i2s_dai = { 630static struct snd_soc_dai_driver davinci_i2s_dai = {
629 .name = "davinci-i2s",
630 .id = 0,
631 .playback = { 631 .playback = {
632 .channels_min = 2, 632 .channels_min = 2,
633 .channels_max = 2, 633 .channels_max = 2,
@@ -641,7 +641,6 @@ struct snd_soc_dai davinci_i2s_dai = {
641 .ops = &davinci_i2s_dai_ops, 641 .ops = &davinci_i2s_dai_ops,
642 642
643}; 643};
644EXPORT_SYMBOL_GPL(davinci_i2s_dai);
645 644
646static int davinci_i2s_probe(struct platform_device *pdev) 645static int davinci_i2s_probe(struct platform_device *pdev)
647{ 646{
@@ -720,10 +719,9 @@ static int davinci_i2s_probe(struct platform_device *pdev)
720 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; 719 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
721 dev->dev = &pdev->dev; 720 dev->dev = &pdev->dev;
722 721
723 davinci_i2s_dai.private_data = dev; 722 dev_set_drvdata(&pdev->dev, dev);
724 davinci_i2s_dai.capture.dma_data = dev->dma_params; 723
725 davinci_i2s_dai.playback.dma_data = dev->dma_params; 724 ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai);
726 ret = snd_soc_register_dai(&davinci_i2s_dai);
727 if (ret != 0) 725 if (ret != 0)
728 goto err_free_mem; 726 goto err_free_mem;
729 727
@@ -739,10 +737,10 @@ err_release_region:
739 737
740static int davinci_i2s_remove(struct platform_device *pdev) 738static int davinci_i2s_remove(struct platform_device *pdev)
741{ 739{
742 struct davinci_mcbsp_dev *dev = davinci_i2s_dai.private_data; 740 struct davinci_mcbsp_dev *dev = dev_get_drvdata(&pdev->dev);
743 struct resource *mem; 741 struct resource *mem;
744 742
745 snd_soc_unregister_dai(&davinci_i2s_dai); 743 snd_soc_unregister_dai(&pdev->dev);
746 clk_disable(dev->clk); 744 clk_disable(dev->clk);
747 clk_put(dev->clk); 745 clk_put(dev->clk);
748 dev->clk = NULL; 746 dev->clk = NULL;
@@ -757,7 +755,7 @@ static struct platform_driver davinci_mcbsp_driver = {
757 .probe = davinci_i2s_probe, 755 .probe = davinci_i2s_probe,
758 .remove = davinci_i2s_remove, 756 .remove = davinci_i2s_remove,
759 .driver = { 757 .driver = {
760 .name = "davinci-asp", 758 .name = "davinci-i2s",
761 .owner = THIS_MODULE, 759 .owner = THIS_MODULE,
762 }, 760 },
763}; 761};
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
20extern 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..c8e97dcbfff4 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)
422static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, 422static 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) {
@@ -709,12 +709,15 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
709 struct snd_pcm_hw_params *params, 709 struct snd_pcm_hw_params *params,
710 struct snd_soc_dai *cpu_dai) 710 struct snd_soc_dai *cpu_dai)
711{ 711{
712 struct davinci_audio_dev *dev = cpu_dai->private_data; 712 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
713 struct davinci_pcm_dma_params *dma_params = 713 struct davinci_pcm_dma_params *dma_params =
714 &dev->dma_params[substream->stream]; 714 &dev->dma_params[substream->stream];
715 int word_length; 715 int word_length;
716 u8 fifo_level; 716 u8 fifo_level;
717 717
718 cpu_dai->capture_dma_data = dev->dma_params;
719 cpu_dai->playback_dma_data = dev->dma_params;
720
718 davinci_hw_common_param(dev, substream->stream); 721 davinci_hw_common_param(dev, substream->stream);
719 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 722 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
720 fifo_level = dev->txnumevt; 723 fifo_level = dev->txnumevt;
@@ -761,8 +764,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
761static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, 764static int davinci_mcasp_trigger(struct snd_pcm_substream *substream,
762 int cmd, struct snd_soc_dai *cpu_dai) 765 int cmd, struct snd_soc_dai *cpu_dai)
763{ 766{
764 struct snd_soc_pcm_runtime *rtd = substream->private_data; 767 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; 768 int ret = 0;
767 769
768 switch (cmd) { 770 switch (cmd) {
@@ -804,10 +806,9 @@ static struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
804 806
805}; 807};
806 808
807struct snd_soc_dai davinci_mcasp_dai[] = { 809static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
808 { 810 {
809 .name = "davinci-i2s", 811 .name = "davinci-mcasp.0",
810 .id = 0,
811 .playback = { 812 .playback = {
812 .channels_min = 2, 813 .channels_min = 2,
813 .channels_max = 2, 814 .channels_max = 2,
@@ -828,8 +829,7 @@ struct snd_soc_dai davinci_mcasp_dai[] = {
828 829
829 }, 830 },
830 { 831 {
831 .name = "davinci-dit", 832 "davinci-mcasp.1",
832 .id = 1,
833 .playback = { 833 .playback = {
834 .channels_min = 1, 834 .channels_min = 1,
835 .channels_max = 384, 835 .channels_max = 384,
@@ -840,7 +840,6 @@ struct snd_soc_dai davinci_mcasp_dai[] = {
840 }, 840 },
841 841
842}; 842};
843EXPORT_SYMBOL_GPL(davinci_mcasp_dai);
844 843
845static int davinci_mcasp_probe(struct platform_device *pdev) 844static int davinci_mcasp_probe(struct platform_device *pdev)
846{ 845{
@@ -917,11 +916,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
917 } 916 }
918 917
919 dma_data->channel = res->start; 918 dma_data->channel = res->start;
920 davinci_mcasp_dai[pdata->op_mode].private_data = dev; 919 dev_set_drvdata(&pdev->dev, dev);
921 davinci_mcasp_dai[pdata->op_mode].capture.dma_data = dev->dma_params; 920 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 921
926 if (ret != 0) 922 if (ret != 0)
927 goto err_release_region; 923 goto err_release_region;
@@ -937,12 +933,10 @@ err_release_data:
937 933
938static int davinci_mcasp_remove(struct platform_device *pdev) 934static int davinci_mcasp_remove(struct platform_device *pdev)
939{ 935{
940 struct snd_platform_data *pdata = pdev->dev.platform_data; 936 struct davinci_audio_dev *dev = dev_get_drvdata(&pdev->dev);
941 struct davinci_audio_dev *dev;
942 struct resource *mem; 937 struct resource *mem;
943 938
944 snd_soc_unregister_dai(&davinci_mcasp_dai[pdata->op_mode]); 939 snd_soc_unregister_dai(&pdev->dev);
945 dev = davinci_mcasp_dai[pdata->op_mode].private_data;
946 clk_disable(dev->clk); 940 clk_disable(dev->clk);
947 clk_put(dev->clk); 941 clk_put(dev->clk);
948 dev->clk = NULL; 942 dev->clk = NULL;
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
25extern 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
843struct snd_soc_platform davinci_soc_platform = { 843static 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};
849EXPORT_SYMBOL_GPL(davinci_soc_platform);
850 848
851static int __init davinci_soc_platform_init(void) 849static 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}
855module_init(davinci_soc_platform_init);
856 853
857static void __exit davinci_soc_platform_exit(void) 854static 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
860static 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
870static int __init snd_davinci_pcm_init(void)
871{
872 return platform_driver_register(&davinci_pcm_driver);
873}
874module_init(snd_davinci_pcm_init);
875
876static void __exit snd_davinci_pcm_exit(void)
877{
878 platform_driver_unregister(&davinci_pcm_driver);
860} 879}
861module_exit(davinci_soc_platform_exit); 880module_exit(snd_davinci_pcm_exit);
862 881
863MODULE_AUTHOR("Vladimir Barinov"); 882MODULE_AUTHOR("Vladimir Barinov");
864MODULE_DESCRIPTION("TI DAVINCI PCM DMA module"); 883MODULE_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
32extern 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..997c54f3693c 100644
--- a/sound/soc/davinci/davinci-sffsdr.c
+++ b/sound/soc/davinci/davinci-sffsdr.c
@@ -29,7 +29,6 @@
29#include <asm/plat-sffsdr/sffsdr-fpga.h> 29#include <asm/plat-sffsdr/sffsdr-fpga.h>
30#endif 30#endif
31 31
32#include <mach/mcbsp.h>
33#include <mach/edma.h> 32#include <mach/edma.h>
34 33
35#include "../codecs/pcm3008.h" 34#include "../codecs/pcm3008.h"
@@ -48,7 +47,7 @@ static int sffsdr_hw_params(struct snd_pcm_substream *substream,
48 struct snd_pcm_hw_params *params) 47 struct snd_pcm_hw_params *params)
49{ 48{
50 struct snd_soc_pcm_runtime *rtd = substream->private_data; 49 struct snd_soc_pcm_runtime *rtd = substream->private_data;
51 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 50 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
52 int fs; 51 int fs;
53 int ret = 0; 52 int ret = 0;
54 53
@@ -85,15 +84,16 @@ static struct snd_soc_ops sffsdr_ops = {
85static struct snd_soc_dai_link sffsdr_dai = { 84static struct snd_soc_dai_link sffsdr_dai = {
86 .name = "PCM3008", /* Codec name */ 85 .name = "PCM3008", /* Codec name */
87 .stream_name = "PCM3008 HiFi", 86 .stream_name = "PCM3008 HiFi",
88 .cpu_dai = &davinci_i2s_dai, 87 .cpu_dai_name = "davinci-asp.0",
89 .codec_dai = &pcm3008_dai, 88 .codec_dai_name = "pcm3008-hifi",
89 .codec_name = "pcm3008-codec",
90 .platform_name = "davinci-pcm-audio",
90 .ops = &sffsdr_ops, 91 .ops = &sffsdr_ops,
91}; 92};
92 93
93/* davinci-sffsdr audio machine driver */ 94/* davinci-sffsdr audio machine driver */
94static struct snd_soc_card snd_soc_sffsdr = { 95static struct snd_soc_card snd_soc_sffsdr = {
95 .name = "DaVinci SFFSDR", 96 .name = "DaVinci SFFSDR",
96 .platform = &davinci_soc_platform,
97 .dai_link = &sffsdr_dai, 97 .dai_link = &sffsdr_dai,
98 .num_links = 1, 98 .num_links = 1,
99}; 99};
@@ -106,11 +106,12 @@ static struct pcm3008_setup_data sffsdr_pcm3008_setup = {
106 .pdda_pin = GPIO(38), 106 .pdda_pin = GPIO(38),
107}; 107};
108 108
109/* sffsdr audio subsystem */ 109struct platform_device pcm3008_codec = {
110static struct snd_soc_device sffsdr_snd_devdata = { 110 .name = "pcm3008-codec",
111 .card = &snd_soc_sffsdr, 111 .id = 0,
112 .codec_dev = &soc_codec_dev_pcm3008, 112 .dev = {
113 .codec_data = &sffsdr_pcm3008_setup, 113 .platform_data = &sffsdr_pcm3008_setup,
114 },
114}; 115};
115 116
116static struct resource sffsdr_snd_resources[] = { 117static struct resource sffsdr_snd_resources[] = {
@@ -135,14 +136,15 @@ static int __init sffsdr_init(void)
135 if (!machine_is_sffsdr()) 136 if (!machine_is_sffsdr())
136 return -EINVAL; 137 return -EINVAL;
137 138
139 platform_device_register(&pcm3008_codec);
140
138 sffsdr_snd_device = platform_device_alloc("soc-audio", 0); 141 sffsdr_snd_device = platform_device_alloc("soc-audio", 0);
139 if (!sffsdr_snd_device) { 142 if (!sffsdr_snd_device) {
140 printk(KERN_ERR "platform device allocation failed\n"); 143 printk(KERN_ERR "platform device allocation failed\n");
141 return -ENOMEM; 144 return -ENOMEM;
142 } 145 }
143 146
144 platform_set_drvdata(sffsdr_snd_device, &sffsdr_snd_devdata); 147 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, 148 platform_device_add_data(sffsdr_snd_device, &sffsdr_snd_data,
147 sizeof(sffsdr_snd_data)); 149 sizeof(sffsdr_snd_data));
148 150
@@ -168,6 +170,7 @@ error:
168static void __exit sffsdr_exit(void) 170static void __exit sffsdr_exit(void)
169{ 171{
170 platform_device_unregister(sffsdr_snd_device); 172 platform_device_unregister(sffsdr_snd_device);
173 platform_device_unregister(&pcm3008_codec);
171} 174}
172 175
173module_init(sffsdr_init); 176module_init(sffsdr_init);
diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c
index 48678533da7a..ea232f6a2c21 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,12 +91,15 @@ 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];
99 u32 w; 98 u32 w;
100 99
100 dai->capture_dma_data = davinci_vcif_dev->dma_params;
101 dai->playback_dma_data = davinci_vcif_dev->dma_params;
102
101 /* Restart the codec before setup */ 103 /* Restart the codec before setup */
102 davinci_vcif_stop(substream); 104 davinci_vcif_stop(substream);
103 davinci_vcif_start(substream); 105 davinci_vcif_start(substream);
@@ -179,8 +181,7 @@ static struct snd_soc_dai_ops davinci_vcif_dai_ops = {
179 .hw_params = davinci_vcif_hw_params, 181 .hw_params = davinci_vcif_hw_params,
180}; 182};
181 183
182struct snd_soc_dai davinci_vcif_dai = { 184static struct snd_soc_dai_driver davinci_vcif_dai = {
183 .name = "davinci-vcif",
184 .playback = { 185 .playback = {
185 .channels_min = 1, 186 .channels_min = 1,
186 .channels_max = 2, 187 .channels_max = 2,
@@ -194,7 +195,6 @@ struct snd_soc_dai davinci_vcif_dai = {
194 .ops = &davinci_vcif_dai_ops, 195 .ops = &davinci_vcif_dai_ops,
195 196
196}; 197};
197EXPORT_SYMBOL_GPL(davinci_vcif_dai);
198 198
199static int davinci_vcif_probe(struct platform_device *pdev) 199static int davinci_vcif_probe(struct platform_device *pdev)
200{ 200{
@@ -222,12 +222,9 @@ static int davinci_vcif_probe(struct platform_device *pdev)
222 davinci_vcif_dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = 222 davinci_vcif_dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr =
223 davinci_vc->davinci_vcif.dma_rx_addr; 223 davinci_vc->davinci_vcif.dma_rx_addr;
224 224
225 davinci_vcif_dai.dev = &pdev->dev; 225 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 226
230 ret = snd_soc_register_dai(&davinci_vcif_dai); 227 ret = snd_soc_register_dai(&pdev->dev, &davinci_vcif_dai);
231 if (ret != 0) { 228 if (ret != 0) {
232 dev_err(&pdev->dev, "could not register dai\n"); 229 dev_err(&pdev->dev, "could not register dai\n");
233 goto fail; 230 goto fail;
@@ -243,7 +240,7 @@ fail:
243 240
244static int davinci_vcif_remove(struct platform_device *pdev) 241static int davinci_vcif_remove(struct platform_device *pdev)
245{ 242{
246 snd_soc_unregister_dai(&davinci_vcif_dai); 243 snd_soc_unregister_dai(&pdev->dev);
247 244
248 return 0; 245 return 0;
249} 246}
@@ -252,7 +249,7 @@ static struct platform_driver davinci_vcif_driver = {
252 .probe = davinci_vcif_probe, 249 .probe = davinci_vcif_probe,
253 .remove = davinci_vcif_remove, 250 .remove = davinci_vcif_remove,
254 .driver = { 251 .driver = {
255 .name = "davinci_vcif", 252 .name = "davinci-vcif",
256 .owner = THIS_MODULE, 253 .owner = THIS_MODULE,
257 }, 254 },
258}; 255};
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
26extern struct snd_soc_dai davinci_vcif_dai;
27
28#endif