diff options
author | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-03-17 16:15:21 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-08-12 09:00:00 -0400 |
commit | f0fba2ad1b6b53d5360125c41953b7afcd6deff0 (patch) | |
tree | f6ad50905f8daa616593c978d7ae992e73241180 /sound/soc/omap | |
parent | bda7d2a862e6b788bca2d02d38a07966a9c92e48 (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/omap')
-rw-r--r-- | sound/soc/omap/am3517evm.c | 25 | ||||
-rw-r--r-- | sound/soc/omap/ams-delta.c | 98 | ||||
-rw-r--r-- | sound/soc/omap/igep0020.c | 22 | ||||
-rw-r--r-- | sound/soc/omap/mcpdm.c | 19 | ||||
-rw-r--r-- | sound/soc/omap/mcpdm.h | 2 | ||||
-rw-r--r-- | sound/soc/omap/n810.c | 42 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 123 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.h | 2 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcpdm.c | 71 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcpdm.h | 29 | ||||
-rw-r--r-- | sound/soc/omap/omap-pcm.c | 47 | ||||
-rw-r--r-- | sound/soc/omap/omap-pcm.h | 2 | ||||
-rw-r--r-- | sound/soc/omap/omap2evm.c | 25 | ||||
-rw-r--r-- | sound/soc/omap/omap3beagle.c | 23 | ||||
-rw-r--r-- | sound/soc/omap/omap3evm.c | 30 | ||||
-rw-r--r-- | sound/soc/omap/omap3pandora.c | 36 | ||||
-rw-r--r-- | sound/soc/omap/osk5912.c | 24 | ||||
-rw-r--r-- | sound/soc/omap/overo.c | 22 | ||||
-rw-r--r-- | sound/soc/omap/rx51.c | 37 | ||||
-rw-r--r-- | sound/soc/omap/sdp3430.c | 56 | ||||
-rw-r--r-- | sound/soc/omap/sdp4430.c | 23 | ||||
-rw-r--r-- | sound/soc/omap/zoom2.c | 64 |
22 files changed, 349 insertions, 473 deletions
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c index 135901b2ea11..68bd902ccd4e 100644 --- a/sound/soc/omap/am3517evm.c +++ b/sound/soc/omap/am3517evm.c | |||
@@ -40,8 +40,8 @@ static int am3517evm_hw_params(struct snd_pcm_substream *substream, | |||
40 | struct snd_pcm_hw_params *params) | 40 | struct snd_pcm_hw_params *params) |
41 | { | 41 | { |
42 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 42 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
43 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 43 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
44 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 44 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
45 | int ret; | 45 | int ret; |
46 | 46 | ||
47 | /* Set codec DAI configuration */ | 47 | /* Set codec DAI configuration */ |
@@ -111,8 +111,10 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
111 | {"MICIN", NULL, "Mic In"}, | 111 | {"MICIN", NULL, "Mic In"}, |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static int am3517evm_aic23_init(struct snd_soc_codec *codec) | 114 | static int am3517evm_aic23_init(struct snd_soc_pcm_runtime *rtd) |
115 | { | 115 | { |
116 | struct snd_soc_codec *codec = rtd->codec; | ||
117 | |||
116 | /* Add am3517-evm specific widgets */ | 118 | /* Add am3517-evm specific widgets */ |
117 | snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, | 119 | snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, |
118 | ARRAY_SIZE(tlv320aic23_dapm_widgets)); | 120 | ARRAY_SIZE(tlv320aic23_dapm_widgets)); |
@@ -134,8 +136,10 @@ static int am3517evm_aic23_init(struct snd_soc_codec *codec) | |||
134 | static struct snd_soc_dai_link am3517evm_dai = { | 136 | static struct snd_soc_dai_link am3517evm_dai = { |
135 | .name = "TLV320AIC23", | 137 | .name = "TLV320AIC23", |
136 | .stream_name = "AIC23", | 138 | .stream_name = "AIC23", |
137 | .cpu_dai = &omap_mcbsp_dai[0], | 139 | .cpu_dai_name ="omap-mcbsp-dai.0", |
138 | .codec_dai = &tlv320aic23_dai, | 140 | .codec_dai_name = "tlv320aic23-hifi", |
141 | .platform_name = "omap-pcm-audio", | ||
142 | .codec_name = "tlv320aic23-codec", | ||
139 | .init = am3517evm_aic23_init, | 143 | .init = am3517evm_aic23_init, |
140 | .ops = &am3517evm_ops, | 144 | .ops = &am3517evm_ops, |
141 | }; | 145 | }; |
@@ -143,17 +147,10 @@ static struct snd_soc_dai_link am3517evm_dai = { | |||
143 | /* Audio machine driver */ | 147 | /* Audio machine driver */ |
144 | static struct snd_soc_card snd_soc_am3517evm = { | 148 | static struct snd_soc_card snd_soc_am3517evm = { |
145 | .name = "am3517evm", | 149 | .name = "am3517evm", |
146 | .platform = &omap_soc_platform, | ||
147 | .dai_link = &am3517evm_dai, | 150 | .dai_link = &am3517evm_dai, |
148 | .num_links = 1, | 151 | .num_links = 1, |
149 | }; | 152 | }; |
150 | 153 | ||
151 | /* Audio subsystem */ | ||
152 | static struct snd_soc_device am3517evm_snd_devdata = { | ||
153 | .card = &snd_soc_am3517evm, | ||
154 | .codec_dev = &soc_codec_dev_tlv320aic23, | ||
155 | }; | ||
156 | |||
157 | static struct platform_device *am3517evm_snd_device; | 154 | static struct platform_device *am3517evm_snd_device; |
158 | 155 | ||
159 | static int __init am3517evm_soc_init(void) | 156 | static int __init am3517evm_soc_init(void) |
@@ -172,9 +169,7 @@ static int __init am3517evm_soc_init(void) | |||
172 | return -ENOMEM; | 169 | return -ENOMEM; |
173 | } | 170 | } |
174 | 171 | ||
175 | platform_set_drvdata(am3517evm_snd_device, &am3517evm_snd_devdata); | 172 | platform_set_drvdata(am3517evm_snd_device, &snd_soc_am3517evm); |
176 | am3517evm_snd_devdata.dev = &am3517evm_snd_device->dev; | ||
177 | *(unsigned int *)am3517evm_dai.cpu_dai->private_data = 0; /* McBSP1 */ | ||
178 | 173 | ||
179 | ret = platform_device_add(am3517evm_snd_device); | 174 | ret = platform_device_add(am3517evm_snd_device); |
180 | if (ret) | 175 | if (ret) |
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index b0f618e44840..9d88efa06e3c 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c | |||
@@ -99,7 +99,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, | |||
99 | int pin, changed = 0; | 99 | int pin, changed = 0; |
100 | 100 | ||
101 | /* Refuse any mode changes if we are not able to control the codec. */ | 101 | /* Refuse any mode changes if we are not able to control the codec. */ |
102 | if (!codec->control_data) | 102 | if (!codec->hw_write) |
103 | return -EUNATCH; | 103 | return -EUNATCH; |
104 | 104 | ||
105 | if (ucontrol->value.enumerated.item[0] >= control->max) | 105 | if (ucontrol->value.enumerated.item[0] >= control->max) |
@@ -268,10 +268,32 @@ static void cx81801_timeout(unsigned long data) | |||
268 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0); | 268 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0); |
269 | } | 269 | } |
270 | 270 | ||
271 | /* | ||
272 | * Used for passing a codec structure pointer | ||
273 | * from the board initialization code to the tty line discipline. | ||
274 | */ | ||
275 | static struct snd_soc_codec *cx20442_codec; | ||
276 | |||
271 | /* Line discipline .open() */ | 277 | /* Line discipline .open() */ |
272 | static int cx81801_open(struct tty_struct *tty) | 278 | static int cx81801_open(struct tty_struct *tty) |
273 | { | 279 | { |
274 | return v253_ops.open(tty); | 280 | int ret; |
281 | |||
282 | if (!cx20442_codec) | ||
283 | return -ENODEV; | ||
284 | |||
285 | /* | ||
286 | * Pass the codec structure pointer for use by other ldisc callbacks, | ||
287 | * both the card and the codec specific parts. | ||
288 | */ | ||
289 | tty->disc_data = cx20442_codec; | ||
290 | |||
291 | ret = v253_ops.open(tty); | ||
292 | |||
293 | if (ret < 0) | ||
294 | tty->disc_data = NULL; | ||
295 | |||
296 | return ret; | ||
275 | } | 297 | } |
276 | 298 | ||
277 | /* Line discipline .close() */ | 299 | /* Line discipline .close() */ |
@@ -281,11 +303,14 @@ static void cx81801_close(struct tty_struct *tty) | |||
281 | 303 | ||
282 | del_timer_sync(&cx81801_timer); | 304 | del_timer_sync(&cx81801_timer); |
283 | 305 | ||
284 | v253_ops.close(tty); | ||
285 | |||
286 | /* Prevent the hook switch from further changing the DAPM pins */ | 306 | /* Prevent the hook switch from further changing the DAPM pins */ |
287 | INIT_LIST_HEAD(&ams_delta_hook_switch.pins); | 307 | INIT_LIST_HEAD(&ams_delta_hook_switch.pins); |
288 | 308 | ||
309 | if (!codec) | ||
310 | return; | ||
311 | |||
312 | v253_ops.close(tty); | ||
313 | |||
289 | /* Revert back to default audio input/output constellation */ | 314 | /* Revert back to default audio input/output constellation */ |
290 | snd_soc_dapm_disable_pin(codec, "Mouthpiece"); | 315 | snd_soc_dapm_disable_pin(codec, "Mouthpiece"); |
291 | snd_soc_dapm_enable_pin(codec, "Earpiece"); | 316 | snd_soc_dapm_enable_pin(codec, "Earpiece"); |
@@ -310,7 +335,10 @@ static void cx81801_receive(struct tty_struct *tty, | |||
310 | const unsigned char *c; | 335 | const unsigned char *c; |
311 | int apply, ret; | 336 | int apply, ret; |
312 | 337 | ||
313 | if (!codec->control_data) { | 338 | if (!codec) |
339 | return; | ||
340 | |||
341 | if (!codec->hw_write) { | ||
314 | /* First modem response, complete setup procedure */ | 342 | /* First modem response, complete setup procedure */ |
315 | 343 | ||
316 | /* Initialize timer used for config pulse generation */ | 344 | /* Initialize timer used for config pulse generation */ |
@@ -323,7 +351,7 @@ static void cx81801_receive(struct tty_struct *tty, | |||
323 | ARRAY_SIZE(ams_delta_hook_switch_pins), | 351 | ARRAY_SIZE(ams_delta_hook_switch_pins), |
324 | ams_delta_hook_switch_pins); | 352 | ams_delta_hook_switch_pins); |
325 | if (ret) | 353 | if (ret) |
326 | dev_warn(codec->socdev->card->dev, | 354 | dev_warn(codec->dev, |
327 | "Failed to link hook switch to DAPM pins, " | 355 | "Failed to link hook switch to DAPM pins, " |
328 | "will continue with hook switch unlinked.\n"); | 356 | "will continue with hook switch unlinked.\n"); |
329 | 357 | ||
@@ -383,7 +411,7 @@ static int ams_delta_hw_params(struct snd_pcm_substream *substream, | |||
383 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 411 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
384 | 412 | ||
385 | /* Set cpu DAI configuration */ | 413 | /* Set cpu DAI configuration */ |
386 | return snd_soc_dai_set_fmt(rtd->dai->cpu_dai, | 414 | return snd_soc_dai_set_fmt(rtd->cpu_dai, |
387 | SND_SOC_DAIFMT_DSP_A | | 415 | SND_SOC_DAIFMT_DSP_A | |
388 | SND_SOC_DAIFMT_NB_NF | | 416 | SND_SOC_DAIFMT_NB_NF | |
389 | SND_SOC_DAIFMT_CBM_CFM); | 417 | SND_SOC_DAIFMT_CBM_CFM); |
@@ -398,7 +426,7 @@ static struct snd_soc_ops ams_delta_ops = { | |||
398 | static int ams_delta_set_bias_level(struct snd_soc_card *card, | 426 | static int ams_delta_set_bias_level(struct snd_soc_card *card, |
399 | enum snd_soc_bias_level level) | 427 | enum snd_soc_bias_level level) |
400 | { | 428 | { |
401 | struct snd_soc_codec *codec = card->codec; | 429 | struct snd_soc_codec *codec = card->rtd->codec; |
402 | 430 | ||
403 | switch (level) { | 431 | switch (level) { |
404 | case SND_SOC_BIAS_ON: | 432 | case SND_SOC_BIAS_ON: |
@@ -461,18 +489,22 @@ static void ams_delta_shutdown(struct snd_pcm_substream *substream) | |||
461 | * Card initialization | 489 | * Card initialization |
462 | */ | 490 | */ |
463 | 491 | ||
464 | static int ams_delta_cx20442_init(struct snd_soc_codec *codec) | 492 | static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) |
465 | { | 493 | { |
466 | struct snd_soc_dai *codec_dai = codec->dai; | 494 | struct snd_soc_codec *codec = rtd->codec; |
467 | struct snd_soc_card *card = codec->socdev->card; | 495 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
496 | struct snd_soc_card *card = rtd->card; | ||
468 | int ret; | 497 | int ret; |
469 | /* Codec is ready, now add/activate board specific controls */ | 498 | /* Codec is ready, now add/activate board specific controls */ |
470 | 499 | ||
500 | /* Store a pointer to the codec structure for tty ldisc use */ | ||
501 | cx20442_codec = codec; | ||
502 | |||
471 | /* Set up digital mute if not provided by the codec */ | 503 | /* Set up digital mute if not provided by the codec */ |
472 | if (!codec_dai->ops) { | 504 | if (!codec_dai->driver->ops) { |
473 | codec_dai->ops = &ams_delta_dai_ops; | 505 | codec_dai->driver->ops = &ams_delta_dai_ops; |
474 | } else if (!codec_dai->ops->digital_mute) { | 506 | } else if (!codec_dai->driver->ops->digital_mute) { |
475 | codec_dai->ops->digital_mute = ams_delta_digital_mute; | 507 | codec_dai->driver->ops->digital_mute = ams_delta_digital_mute; |
476 | } else { | 508 | } else { |
477 | ams_delta_ops.startup = ams_delta_startup; | 509 | ams_delta_ops.startup = ams_delta_startup; |
478 | ams_delta_ops.shutdown = ams_delta_shutdown; | 510 | ams_delta_ops.shutdown = ams_delta_shutdown; |
@@ -483,7 +515,7 @@ static int ams_delta_cx20442_init(struct snd_soc_codec *codec) | |||
483 | 515 | ||
484 | /* Add hook switch - can be used to control the codec from userspace | 516 | /* Add hook switch - can be used to control the codec from userspace |
485 | * even if line discipline fails */ | 517 | * even if line discipline fails */ |
486 | ret = snd_soc_jack_new(card, "hook_switch", | 518 | ret = snd_soc_jack_new(rtd->codec, "hook_switch", |
487 | SND_JACK_HEADSET, &ams_delta_hook_switch); | 519 | SND_JACK_HEADSET, &ams_delta_hook_switch); |
488 | if (ret) | 520 | if (ret) |
489 | dev_warn(card->dev, | 521 | dev_warn(card->dev, |
@@ -551,27 +583,22 @@ static int ams_delta_cx20442_init(struct snd_soc_codec *codec) | |||
551 | static struct snd_soc_dai_link ams_delta_dai_link = { | 583 | static struct snd_soc_dai_link ams_delta_dai_link = { |
552 | .name = "CX20442", | 584 | .name = "CX20442", |
553 | .stream_name = "CX20442", | 585 | .stream_name = "CX20442", |
554 | .cpu_dai = &omap_mcbsp_dai[0], | 586 | .cpu_dai_name ="omap-mcbsp-dai.0", |
555 | .codec_dai = &cx20442_dai, | 587 | .codec_dai_name = "cx20442-hifi", |
556 | .init = ams_delta_cx20442_init, | 588 | .init = ams_delta_cx20442_init, |
589 | .platform_name = "omap-pcm-audio", | ||
590 | .codec_name = "cx20442-codec", | ||
557 | .ops = &ams_delta_ops, | 591 | .ops = &ams_delta_ops, |
558 | }; | 592 | }; |
559 | 593 | ||
560 | /* Audio card driver */ | 594 | /* Audio card driver */ |
561 | static struct snd_soc_card ams_delta_audio_card = { | 595 | static struct snd_soc_card ams_delta_audio_card = { |
562 | .name = "AMS_DELTA", | 596 | .name = "AMS_DELTA", |
563 | .platform = &omap_soc_platform, | ||
564 | .dai_link = &ams_delta_dai_link, | 597 | .dai_link = &ams_delta_dai_link, |
565 | .num_links = 1, | 598 | .num_links = 1, |
566 | .set_bias_level = ams_delta_set_bias_level, | 599 | .set_bias_level = ams_delta_set_bias_level, |
567 | }; | 600 | }; |
568 | 601 | ||
569 | /* Audio subsystem */ | ||
570 | static struct snd_soc_device ams_delta_snd_soc_device = { | ||
571 | .card = &ams_delta_audio_card, | ||
572 | .codec_dev = &cx20442_codec_dev, | ||
573 | }; | ||
574 | |||
575 | /* Module init/exit */ | 602 | /* Module init/exit */ |
576 | static struct platform_device *ams_delta_audio_platform_device; | 603 | static struct platform_device *ams_delta_audio_platform_device; |
577 | static struct platform_device *cx20442_platform_device; | 604 | static struct platform_device *cx20442_platform_device; |
@@ -589,9 +616,7 @@ static int __init ams_delta_module_init(void) | |||
589 | return -ENOMEM; | 616 | return -ENOMEM; |
590 | 617 | ||
591 | platform_set_drvdata(ams_delta_audio_platform_device, | 618 | platform_set_drvdata(ams_delta_audio_platform_device, |
592 | &ams_delta_snd_soc_device); | 619 | &ams_delta_audio_card); |
593 | ams_delta_snd_soc_device.dev = &ams_delta_audio_platform_device->dev; | ||
594 | *(unsigned int *)ams_delta_dai_link.cpu_dai->private_data = OMAP_MCBSP1; | ||
595 | 620 | ||
596 | ret = platform_device_add(ams_delta_audio_platform_device); | 621 | ret = platform_device_add(ams_delta_audio_platform_device); |
597 | if (ret) | 622 | if (ret) |
@@ -601,8 +626,8 @@ static int __init ams_delta_module_init(void) | |||
601 | * Codec platform device could be registered from elsewhere (board?), | 626 | * Codec platform device could be registered from elsewhere (board?), |
602 | * but I do it here as it makes sense only if used with the card. | 627 | * but I do it here as it makes sense only if used with the card. |
603 | */ | 628 | */ |
604 | cx20442_platform_device = platform_device_register_simple("cx20442", | 629 | cx20442_platform_device = |
605 | -1, NULL, 0); | 630 | platform_device_register_simple("cx20442-codec", -1, NULL, 0); |
606 | return 0; | 631 | return 0; |
607 | err: | 632 | err: |
608 | platform_device_put(ams_delta_audio_platform_device); | 633 | platform_device_put(ams_delta_audio_platform_device); |
@@ -612,19 +637,6 @@ module_init(ams_delta_module_init); | |||
612 | 637 | ||
613 | static void __exit ams_delta_module_exit(void) | 638 | static void __exit ams_delta_module_exit(void) |
614 | { | 639 | { |
615 | struct snd_soc_codec *codec; | ||
616 | struct tty_struct *tty; | ||
617 | |||
618 | if (ams_delta_audio_card.codec) { | ||
619 | codec = ams_delta_audio_card.codec; | ||
620 | |||
621 | if (codec->control_data) { | ||
622 | tty = codec->control_data; | ||
623 | |||
624 | tty_hangup(tty); | ||
625 | } | ||
626 | } | ||
627 | |||
628 | if (tty_unregister_ldisc(N_V253) != 0) | 640 | if (tty_unregister_ldisc(N_V253) != 0) |
629 | dev_warn(&ams_delta_audio_platform_device->dev, | 641 | dev_warn(&ams_delta_audio_platform_device->dev, |
630 | "failed to unregister V253 line discipline\n"); | 642 | "failed to unregister V253 line discipline\n"); |
diff --git a/sound/soc/omap/igep0020.c b/sound/soc/omap/igep0020.c index 3583c429f9be..d296cfcc672e 100644 --- a/sound/soc/omap/igep0020.c +++ b/sound/soc/omap/igep0020.c | |||
@@ -33,14 +33,13 @@ | |||
33 | 33 | ||
34 | #include "omap-mcbsp.h" | 34 | #include "omap-mcbsp.h" |
35 | #include "omap-pcm.h" | 35 | #include "omap-pcm.h" |
36 | #include "../codecs/twl4030.h" | ||
37 | 36 | ||
38 | static int igep2_hw_params(struct snd_pcm_substream *substream, | 37 | static int igep2_hw_params(struct snd_pcm_substream *substream, |
39 | struct snd_pcm_hw_params *params) | 38 | struct snd_pcm_hw_params *params) |
40 | { | 39 | { |
41 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 40 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
42 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 41 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
43 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 42 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
44 | int ret; | 43 | int ret; |
45 | 44 | ||
46 | /* Set codec DAI configuration */ | 45 | /* Set codec DAI configuration */ |
@@ -82,25 +81,20 @@ static struct snd_soc_ops igep2_ops = { | |||
82 | static struct snd_soc_dai_link igep2_dai = { | 81 | static struct snd_soc_dai_link igep2_dai = { |
83 | .name = "TWL4030", | 82 | .name = "TWL4030", |
84 | .stream_name = "TWL4030", | 83 | .stream_name = "TWL4030", |
85 | .cpu_dai = &omap_mcbsp_dai[0], | 84 | .cpu_dai_name = "omap-mcbsp-dai.1", |
86 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 85 | .codec_dai_name = "twl4030-hifi", |
86 | .platform_name = "omap-pcm-audio", | ||
87 | .codec_name = "twl4030-codec", | ||
87 | .ops = &igep2_ops, | 88 | .ops = &igep2_ops, |
88 | }; | 89 | }; |
89 | 90 | ||
90 | /* Audio machine driver */ | 91 | /* Audio machine driver */ |
91 | static struct snd_soc_card snd_soc_card_igep2 = { | 92 | static struct snd_soc_card snd_soc_card_igep2 = { |
92 | .name = "igep2", | 93 | .name = "igep2", |
93 | .platform = &omap_soc_platform, | ||
94 | .dai_link = &igep2_dai, | 94 | .dai_link = &igep2_dai, |
95 | .num_links = 1, | 95 | .num_links = 1, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /* Audio subsystem */ | ||
99 | static struct snd_soc_device igep2_snd_devdata = { | ||
100 | .card = &snd_soc_card_igep2, | ||
101 | .codec_dev = &soc_codec_dev_twl4030, | ||
102 | }; | ||
103 | |||
104 | static struct platform_device *igep2_snd_device; | 98 | static struct platform_device *igep2_snd_device; |
105 | 99 | ||
106 | static int __init igep2_soc_init(void) | 100 | static int __init igep2_soc_init(void) |
@@ -119,9 +113,7 @@ static int __init igep2_soc_init(void) | |||
119 | return -ENOMEM; | 113 | return -ENOMEM; |
120 | } | 114 | } |
121 | 115 | ||
122 | platform_set_drvdata(igep2_snd_device, &igep2_snd_devdata); | 116 | platform_set_drvdata(igep2_snd_device, &snd_soc_card_igep2); |
123 | igep2_snd_devdata.dev = &igep2_snd_device->dev; | ||
124 | *(unsigned int *)igep2_dai.cpu_dai->private_data = 1; /* McBSP2 */ | ||
125 | 117 | ||
126 | ret = platform_device_add(igep2_snd_device); | 118 | ret = platform_device_add(igep2_snd_device); |
127 | if (ret) | 119 | if (ret) |
diff --git a/sound/soc/omap/mcpdm.c b/sound/soc/omap/mcpdm.c index 90b8bf71c893..928f03707451 100644 --- a/sound/soc/omap/mcpdm.c +++ b/sound/soc/omap/mcpdm.c | |||
@@ -402,7 +402,7 @@ int omap_mcpdm_set_offset(int offset1, int offset2) | |||
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | 404 | ||
405 | static int __devinit omap_mcpdm_probe(struct platform_device *pdev) | 405 | int __devinit omap_mcpdm_probe(struct platform_device *pdev) |
406 | { | 406 | { |
407 | struct resource *res; | 407 | struct resource *res; |
408 | int ret = 0; | 408 | int ret = 0; |
@@ -449,7 +449,7 @@ exit: | |||
449 | return ret; | 449 | return ret; |
450 | } | 450 | } |
451 | 451 | ||
452 | static int __devexit omap_mcpdm_remove(struct platform_device *pdev) | 452 | int __devexit omap_mcpdm_remove(struct platform_device *pdev) |
453 | { | 453 | { |
454 | struct omap_mcpdm *mcpdm_ptr = platform_get_drvdata(pdev); | 454 | struct omap_mcpdm *mcpdm_ptr = platform_get_drvdata(pdev); |
455 | 455 | ||
@@ -468,18 +468,3 @@ static int __devexit omap_mcpdm_remove(struct platform_device *pdev) | |||
468 | return 0; | 468 | return 0; |
469 | } | 469 | } |
470 | 470 | ||
471 | static struct platform_driver omap_mcpdm_driver = { | ||
472 | .probe = omap_mcpdm_probe, | ||
473 | .remove = __devexit_p(omap_mcpdm_remove), | ||
474 | .driver = { | ||
475 | .name = "omap-mcpdm", | ||
476 | }, | ||
477 | }; | ||
478 | |||
479 | static struct platform_device *omap_mcpdm_device; | ||
480 | |||
481 | static int __init omap_mcpdm_init(void) | ||
482 | { | ||
483 | return platform_driver_register(&omap_mcpdm_driver); | ||
484 | } | ||
485 | arch_initcall(omap_mcpdm_init); | ||
diff --git a/sound/soc/omap/mcpdm.h b/sound/soc/omap/mcpdm.h index 7bb326ef0886..df3e16fb51f3 100644 --- a/sound/soc/omap/mcpdm.h +++ b/sound/soc/omap/mcpdm.h | |||
@@ -149,3 +149,5 @@ extern int omap_mcpdm_playback_close(struct omap_mcpdm_link *downlink); | |||
149 | extern int omap_mcpdm_request(void); | 149 | extern int omap_mcpdm_request(void); |
150 | extern void omap_mcpdm_free(void); | 150 | extern void omap_mcpdm_free(void); |
151 | extern int omap_mcpdm_set_offset(int offset1, int offset2); | 151 | extern int omap_mcpdm_set_offset(int offset1, int offset2); |
152 | int __devinit omap_mcpdm_probe(struct platform_device *pdev); | ||
153 | int __devexit omap_mcpdm_remove(struct platform_device *pdev); | ||
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 08e09d72790f..a3b6d897ad84 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -97,7 +97,7 @@ static int n810_startup(struct snd_pcm_substream *substream) | |||
97 | { | 97 | { |
98 | struct snd_pcm_runtime *runtime = substream->runtime; | 98 | struct snd_pcm_runtime *runtime = substream->runtime; |
99 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 99 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
100 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 100 | struct snd_soc_codec *codec = rtd->codec; |
101 | 101 | ||
102 | snd_pcm_hw_constraint_minmax(runtime, | 102 | snd_pcm_hw_constraint_minmax(runtime, |
103 | SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); | 103 | SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); |
@@ -115,8 +115,8 @@ static int n810_hw_params(struct snd_pcm_substream *substream, | |||
115 | struct snd_pcm_hw_params *params) | 115 | struct snd_pcm_hw_params *params) |
116 | { | 116 | { |
117 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 117 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
118 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 118 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
119 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 119 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
120 | int err; | 120 | int err; |
121 | 121 | ||
122 | /* Set codec DAI configuration */ | 122 | /* Set codec DAI configuration */ |
@@ -271,8 +271,9 @@ static const struct snd_kcontrol_new aic33_n810_controls[] = { | |||
271 | n810_get_input, n810_set_input), | 271 | n810_get_input, n810_set_input), |
272 | }; | 272 | }; |
273 | 273 | ||
274 | static int n810_aic33_init(struct snd_soc_codec *codec) | 274 | static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd) |
275 | { | 275 | { |
276 | struct snd_soc_codec *codec = rtd->codec; | ||
276 | int err; | 277 | int err; |
277 | 278 | ||
278 | /* Not connected */ | 279 | /* Not connected */ |
@@ -307,8 +308,10 @@ static int n810_aic33_init(struct snd_soc_codec *codec) | |||
307 | static struct snd_soc_dai_link n810_dai = { | 308 | static struct snd_soc_dai_link n810_dai = { |
308 | .name = "TLV320AIC33", | 309 | .name = "TLV320AIC33", |
309 | .stream_name = "AIC33", | 310 | .stream_name = "AIC33", |
310 | .cpu_dai = &omap_mcbsp_dai[0], | 311 | .cpu_dai_name = "omap-mcbsp-dai.1", |
311 | .codec_dai = &aic3x_dai, | 312 | .platform_name = "omap-pcm-audio", |
313 | .codec_name = "tlv320aic3x-codec.2-0018", | ||
314 | .codec_dai_name = "tlv320aic3x-hifi", | ||
312 | .init = n810_aic33_init, | 315 | .init = n810_aic33_init, |
313 | .ops = &n810_ops, | 316 | .ops = &n810_ops, |
314 | }; | 317 | }; |
@@ -316,33 +319,12 @@ static struct snd_soc_dai_link n810_dai = { | |||
316 | /* Audio machine driver */ | 319 | /* Audio machine driver */ |
317 | static struct snd_soc_card snd_soc_n810 = { | 320 | static struct snd_soc_card snd_soc_n810 = { |
318 | .name = "N810", | 321 | .name = "N810", |
319 | .platform = &omap_soc_platform, | ||
320 | .dai_link = &n810_dai, | 322 | .dai_link = &n810_dai, |
321 | .num_links = 1, | 323 | .num_links = 1, |
322 | }; | 324 | }; |
323 | 325 | ||
324 | /* Audio private data */ | ||
325 | static struct aic3x_setup_data n810_aic33_setup = { | ||
326 | .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED, | ||
327 | .gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT, | ||
328 | }; | ||
329 | |||
330 | /* Audio subsystem */ | ||
331 | static struct snd_soc_device n810_snd_devdata = { | ||
332 | .card = &snd_soc_n810, | ||
333 | .codec_dev = &soc_codec_dev_aic3x, | ||
334 | .codec_data = &n810_aic33_setup, | ||
335 | }; | ||
336 | |||
337 | static struct platform_device *n810_snd_device; | 326 | static struct platform_device *n810_snd_device; |
338 | 327 | ||
339 | /* temporary i2c device creation until this can be moved into the machine | ||
340 | * support file. | ||
341 | */ | ||
342 | static struct i2c_board_info i2c_device[] = { | ||
343 | { I2C_BOARD_INFO("tlv320aic3x", 0x1b), } | ||
344 | }; | ||
345 | |||
346 | static int __init n810_soc_init(void) | 328 | static int __init n810_soc_init(void) |
347 | { | 329 | { |
348 | int err; | 330 | int err; |
@@ -351,15 +333,11 @@ static int __init n810_soc_init(void) | |||
351 | if (!(machine_is_nokia_n810() || machine_is_nokia_n810_wimax())) | 333 | if (!(machine_is_nokia_n810() || machine_is_nokia_n810_wimax())) |
352 | return -ENODEV; | 334 | return -ENODEV; |
353 | 335 | ||
354 | i2c_register_board_info(1, i2c_device, ARRAY_SIZE(i2c_device)); | ||
355 | |||
356 | n810_snd_device = platform_device_alloc("soc-audio", -1); | 336 | n810_snd_device = platform_device_alloc("soc-audio", -1); |
357 | if (!n810_snd_device) | 337 | if (!n810_snd_device) |
358 | return -ENOMEM; | 338 | return -ENOMEM; |
359 | 339 | ||
360 | platform_set_drvdata(n810_snd_device, &n810_snd_devdata); | 340 | platform_set_drvdata(n810_snd_device, &snd_soc_n810); |
361 | n810_snd_devdata.dev = &n810_snd_device->dev; | ||
362 | *(unsigned int *)n810_dai.cpu_dai->private_data = 1; /* McBSP2 */ | ||
363 | err = platform_device_add(n810_snd_device); | 341 | err = platform_device_add(n810_snd_device); |
364 | if (err) | 342 | if (err) |
365 | goto err1; | 343 | goto err1; |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 86f213905e2c..7ba5690118f8 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -62,8 +62,6 @@ struct omap_mcbsp_data { | |||
62 | int wlen; | 62 | int wlen; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | #define to_mcbsp(priv) container_of((priv), struct omap_mcbsp_data, bus_id) | ||
66 | |||
67 | static struct omap_mcbsp_data mcbsp_data[NUM_LINKS]; | 65 | static struct omap_mcbsp_data mcbsp_data[NUM_LINKS]; |
68 | 66 | ||
69 | /* | 67 | /* |
@@ -153,13 +151,13 @@ static const unsigned long omap34xx_mcbsp_port[][2] = {}; | |||
153 | static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) | 151 | static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) |
154 | { | 152 | { |
155 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 153 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
156 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 154 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
157 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 155 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
158 | struct omap_pcm_dma_data *dma_data; | 156 | struct omap_pcm_dma_data *dma_data; |
159 | int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id); | 157 | int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id); |
160 | int words; | 158 | int words; |
161 | 159 | ||
162 | dma_data = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 160 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
163 | 161 | ||
164 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ | 162 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ |
165 | if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) | 163 | if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) |
@@ -203,11 +201,9 @@ static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params, | |||
203 | } | 201 | } |
204 | 202 | ||
205 | static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | 203 | static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, |
206 | struct snd_soc_dai *dai) | 204 | struct snd_soc_dai *cpu_dai) |
207 | { | 205 | { |
208 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 206 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
209 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
210 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | ||
211 | int bus_id = mcbsp_data->bus_id; | 207 | int bus_id = mcbsp_data->bus_id; |
212 | int err = 0; | 208 | int err = 0; |
213 | 209 | ||
@@ -249,11 +245,9 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | |||
249 | } | 245 | } |
250 | 246 | ||
251 | static void omap_mcbsp_dai_shutdown(struct snd_pcm_substream *substream, | 247 | static void omap_mcbsp_dai_shutdown(struct snd_pcm_substream *substream, |
252 | struct snd_soc_dai *dai) | 248 | struct snd_soc_dai *cpu_dai) |
253 | { | 249 | { |
254 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 250 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
255 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
256 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | ||
257 | 251 | ||
258 | if (!cpu_dai->active) { | 252 | if (!cpu_dai->active) { |
259 | omap_mcbsp_free(mcbsp_data->bus_id); | 253 | omap_mcbsp_free(mcbsp_data->bus_id); |
@@ -262,11 +256,9 @@ static void omap_mcbsp_dai_shutdown(struct snd_pcm_substream *substream, | |||
262 | } | 256 | } |
263 | 257 | ||
264 | static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, | 258 | static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, |
265 | struct snd_soc_dai *dai) | 259 | struct snd_soc_dai *cpu_dai) |
266 | { | 260 | { |
267 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 261 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
268 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
269 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | ||
270 | int err = 0, play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 262 | int err = 0, play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
271 | 263 | ||
272 | switch (cmd) { | 264 | switch (cmd) { |
@@ -295,8 +287,8 @@ static snd_pcm_sframes_t omap_mcbsp_dai_delay( | |||
295 | struct snd_soc_dai *dai) | 287 | struct snd_soc_dai *dai) |
296 | { | 288 | { |
297 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 289 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
298 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 290 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
299 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 291 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
300 | u16 fifo_use; | 292 | u16 fifo_use; |
301 | snd_pcm_sframes_t delay; | 293 | snd_pcm_sframes_t delay; |
302 | 294 | ||
@@ -317,11 +309,9 @@ static snd_pcm_sframes_t omap_mcbsp_dai_delay( | |||
317 | 309 | ||
318 | static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | 310 | static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, |
319 | struct snd_pcm_hw_params *params, | 311 | struct snd_pcm_hw_params *params, |
320 | struct snd_soc_dai *dai) | 312 | struct snd_soc_dai *cpu_dai) |
321 | { | 313 | { |
322 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 314 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
323 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
324 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | ||
325 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 315 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
326 | struct omap_pcm_dma_data *dma_data; | 316 | struct omap_pcm_dma_data *dma_data; |
327 | int dma, bus_id = mcbsp_data->bus_id; | 317 | int dma, bus_id = mcbsp_data->bus_id; |
@@ -496,7 +486,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
496 | static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 486 | static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
497 | unsigned int fmt) | 487 | unsigned int fmt) |
498 | { | 488 | { |
499 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 489 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
500 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 490 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
501 | unsigned int temp_fmt = fmt; | 491 | unsigned int temp_fmt = fmt; |
502 | 492 | ||
@@ -596,7 +586,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
596 | static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, | 586 | static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, |
597 | int div_id, int div) | 587 | int div_id, int div) |
598 | { | 588 | { |
599 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 589 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
600 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 590 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
601 | 591 | ||
602 | if (div_id != OMAP_MCBSP_CLKGDV) | 592 | if (div_id != OMAP_MCBSP_CLKGDV) |
@@ -699,7 +689,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
699 | int clk_id, unsigned int freq, | 689 | int clk_id, unsigned int freq, |
700 | int dir) | 690 | int dir) |
701 | { | 691 | { |
702 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 692 | struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); |
703 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 693 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
704 | int err = 0; | 694 | int err = 0; |
705 | 695 | ||
@@ -733,7 +723,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
733 | return err; | 723 | return err; |
734 | } | 724 | } |
735 | 725 | ||
736 | static struct snd_soc_dai_ops omap_mcbsp_dai_ops = { | 726 | static struct snd_soc_dai_ops mcbsp_dai_ops = { |
737 | .startup = omap_mcbsp_dai_startup, | 727 | .startup = omap_mcbsp_dai_startup, |
738 | .shutdown = omap_mcbsp_dai_shutdown, | 728 | .shutdown = omap_mcbsp_dai_shutdown, |
739 | .trigger = omap_mcbsp_dai_trigger, | 729 | .trigger = omap_mcbsp_dai_trigger, |
@@ -744,42 +734,31 @@ static struct snd_soc_dai_ops omap_mcbsp_dai_ops = { | |||
744 | .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, | 734 | .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, |
745 | }; | 735 | }; |
746 | 736 | ||
747 | #define OMAP_MCBSP_DAI_BUILDER(link_id) \ | 737 | static int mcbsp_dai_probe(struct snd_soc_dai *dai) |
748 | { \ | 738 | { |
749 | .name = "omap-mcbsp-dai-"#link_id, \ | 739 | mcbsp_data[dai->id].bus_id = dai->id; |
750 | .id = (link_id), \ | 740 | snd_soc_dai_set_drvdata(dai, &mcbsp_data[dai->id].bus_id); |
751 | .playback = { \ | 741 | return 0; |
752 | .channels_min = 1, \ | ||
753 | .channels_max = 16, \ | ||
754 | .rates = OMAP_MCBSP_RATES, \ | ||
755 | .formats = SNDRV_PCM_FMTBIT_S16_LE | \ | ||
756 | SNDRV_PCM_FMTBIT_S32_LE, \ | ||
757 | }, \ | ||
758 | .capture = { \ | ||
759 | .channels_min = 1, \ | ||
760 | .channels_max = 16, \ | ||
761 | .rates = OMAP_MCBSP_RATES, \ | ||
762 | .formats = SNDRV_PCM_FMTBIT_S16_LE | \ | ||
763 | SNDRV_PCM_FMTBIT_S32_LE, \ | ||
764 | }, \ | ||
765 | .ops = &omap_mcbsp_dai_ops, \ | ||
766 | .private_data = &mcbsp_data[(link_id)].bus_id, \ | ||
767 | } | 742 | } |
768 | 743 | ||
769 | struct snd_soc_dai omap_mcbsp_dai[] = { | 744 | static struct snd_soc_dai_driver omap_mcbsp_dai = |
770 | OMAP_MCBSP_DAI_BUILDER(0), | 745 | { |
771 | OMAP_MCBSP_DAI_BUILDER(1), | 746 | .probe = mcbsp_dai_probe, |
772 | #if NUM_LINKS >= 3 | 747 | .playback = { |
773 | OMAP_MCBSP_DAI_BUILDER(2), | 748 | .channels_min = 1, |
774 | #endif | 749 | .channels_max = 16, |
775 | #if NUM_LINKS == 5 | 750 | .rates = OMAP_MCBSP_RATES, |
776 | OMAP_MCBSP_DAI_BUILDER(3), | 751 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, |
777 | OMAP_MCBSP_DAI_BUILDER(4), | 752 | }, |
778 | #endif | 753 | .capture = { |
754 | .channels_min = 1, | ||
755 | .channels_max = 16, | ||
756 | .rates = OMAP_MCBSP_RATES, | ||
757 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, | ||
758 | }, | ||
759 | .ops = &mcbsp_dai_ops, | ||
779 | }; | 760 | }; |
780 | 761 | ||
781 | EXPORT_SYMBOL_GPL(omap_mcbsp_dai); | ||
782 | |||
783 | int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol, | 762 | int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol, |
784 | struct snd_ctl_elem_info *uinfo) | 763 | struct snd_ctl_elem_info *uinfo) |
785 | { | 764 | { |
@@ -910,16 +889,36 @@ int omap_mcbsp_st_add_controls(struct snd_soc_codec *codec, int mcbsp_id) | |||
910 | } | 889 | } |
911 | EXPORT_SYMBOL_GPL(omap_mcbsp_st_add_controls); | 890 | EXPORT_SYMBOL_GPL(omap_mcbsp_st_add_controls); |
912 | 891 | ||
892 | static __devinit int asoc_mcbsp_probe(struct platform_device *pdev) | ||
893 | { | ||
894 | return snd_soc_register_dai(&pdev->dev, &omap_mcbsp_dai); | ||
895 | } | ||
896 | |||
897 | static int __devexit asoc_mcbsp_remove(struct platform_device *pdev) | ||
898 | { | ||
899 | snd_soc_unregister_dai(&pdev->dev); | ||
900 | return 0; | ||
901 | } | ||
902 | |||
903 | static struct platform_driver asoc_mcbsp_driver = { | ||
904 | .driver = { | ||
905 | .name = "omap-mcbsp-dai", | ||
906 | .owner = THIS_MODULE, | ||
907 | }, | ||
908 | |||
909 | .probe = asoc_mcbsp_probe, | ||
910 | .remove = __devexit_p(asoc_mcbsp_remove), | ||
911 | }; | ||
912 | |||
913 | static int __init snd_omap_mcbsp_init(void) | 913 | static int __init snd_omap_mcbsp_init(void) |
914 | { | 914 | { |
915 | return snd_soc_register_dais(omap_mcbsp_dai, | 915 | return platform_driver_register(&asoc_mcbsp_driver); |
916 | ARRAY_SIZE(omap_mcbsp_dai)); | ||
917 | } | 916 | } |
918 | module_init(snd_omap_mcbsp_init); | 917 | module_init(snd_omap_mcbsp_init); |
919 | 918 | ||
920 | static void __exit snd_omap_mcbsp_exit(void) | 919 | static void __exit snd_omap_mcbsp_exit(void) |
921 | { | 920 | { |
922 | snd_soc_unregister_dais(omap_mcbsp_dai, ARRAY_SIZE(omap_mcbsp_dai)); | 921 | platform_driver_unregister(&asoc_mcbsp_driver); |
923 | } | 922 | } |
924 | module_exit(snd_omap_mcbsp_exit); | 923 | module_exit(snd_omap_mcbsp_exit); |
925 | 924 | ||
diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h index 6c363e5f4387..ffdcc5abb7b9 100644 --- a/sound/soc/omap/omap-mcbsp.h +++ b/sound/soc/omap/omap-mcbsp.h | |||
@@ -55,8 +55,6 @@ enum omap_mcbsp_div { | |||
55 | #define NUM_LINKS 5 | 55 | #define NUM_LINKS 5 |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | extern struct snd_soc_dai omap_mcbsp_dai[NUM_LINKS]; | ||
59 | |||
60 | int omap_mcbsp_st_add_controls(struct snd_soc_codec *codec, int mcbsp_id); | 58 | int omap_mcbsp_st_add_controls(struct snd_soc_codec *codec, int mcbsp_id); |
61 | 59 | ||
62 | #endif | 60 | #endif |
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index b7f4f7e015f3..f161c2f5ed36 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <plat/dma.h> | 36 | #include <plat/dma.h> |
37 | #include <plat/mcbsp.h> | 37 | #include <plat/mcbsp.h> |
38 | #include "mcpdm.h" | 38 | #include "mcpdm.h" |
39 | #include "omap-mcpdm.h" | ||
40 | #include "omap-pcm.h" | 39 | #include "omap-pcm.h" |
41 | 40 | ||
42 | struct omap_mcpdm_data { | 41 | struct omap_mcpdm_data { |
@@ -89,11 +88,9 @@ static struct omap_pcm_dma_data omap_mcpdm_dai_dma_params[] = { | |||
89 | static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream, | 88 | static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream, |
90 | struct snd_soc_dai *dai) | 89 | struct snd_soc_dai *dai) |
91 | { | 90 | { |
92 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
93 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
94 | int err = 0; | 91 | int err = 0; |
95 | 92 | ||
96 | if (!cpu_dai->active) | 93 | if (!dai->active) |
97 | err = omap_mcpdm_request(); | 94 | err = omap_mcpdm_request(); |
98 | 95 | ||
99 | return err; | 96 | return err; |
@@ -102,19 +99,14 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream, | |||
102 | static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream, | 99 | static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream, |
103 | struct snd_soc_dai *dai) | 100 | struct snd_soc_dai *dai) |
104 | { | 101 | { |
105 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 102 | if (!dai->active) |
106 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
107 | |||
108 | if (!cpu_dai->active) | ||
109 | omap_mcpdm_free(); | 103 | omap_mcpdm_free(); |
110 | } | 104 | } |
111 | 105 | ||
112 | static int omap_mcpdm_dai_trigger(struct snd_pcm_substream *substream, int cmd, | 106 | static int omap_mcpdm_dai_trigger(struct snd_pcm_substream *substream, int cmd, |
113 | struct snd_soc_dai *dai) | 107 | struct snd_soc_dai *dai) |
114 | { | 108 | { |
115 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 109 | struct omap_mcpdm_data *mcpdm_priv = snd_soc_dai_get_drvdata(dai); |
116 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
117 | struct omap_mcpdm_data *mcpdm_priv = cpu_dai->private_data; | ||
118 | int stream = substream->stream; | 110 | int stream = substream->stream; |
119 | int err = 0; | 111 | int err = 0; |
120 | 112 | ||
@@ -143,14 +135,12 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, | |||
143 | struct snd_pcm_hw_params *params, | 135 | struct snd_pcm_hw_params *params, |
144 | struct snd_soc_dai *dai) | 136 | struct snd_soc_dai *dai) |
145 | { | 137 | { |
146 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 138 | struct omap_mcpdm_data *mcpdm_priv = snd_soc_dai_get_drvdata(dai); |
147 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
148 | struct omap_mcpdm_data *mcpdm_priv = cpu_dai->private_data; | ||
149 | struct omap_mcpdm_link *mcpdm_links = mcpdm_priv->links; | 139 | struct omap_mcpdm_link *mcpdm_links = mcpdm_priv->links; |
150 | int stream = substream->stream; | 140 | int stream = substream->stream; |
151 | int channels, err, link_mask = 0; | 141 | int channels, err, link_mask = 0; |
152 | 142 | ||
153 | snd_soc_dai_set_dma_data(cpu_dai, substream, | 143 | snd_soc_dai_set_dma_data(dai, substream, |
154 | &omap_mcpdm_dai_dma_params[stream]); | 144 | &omap_mcpdm_dai_dma_params[stream]); |
155 | 145 | ||
156 | channels = params_channels(params); | 146 | channels = params_channels(params); |
@@ -189,9 +179,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, | |||
189 | static int omap_mcpdm_dai_hw_free(struct snd_pcm_substream *substream, | 179 | static int omap_mcpdm_dai_hw_free(struct snd_pcm_substream *substream, |
190 | struct snd_soc_dai *dai) | 180 | struct snd_soc_dai *dai) |
191 | { | 181 | { |
192 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 182 | struct omap_mcpdm_data *mcpdm_priv = snd_soc_dai_get_drvdata(dai); |
193 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
194 | struct omap_mcpdm_data *mcpdm_priv = cpu_dai->private_data; | ||
195 | struct omap_mcpdm_link *mcpdm_links = mcpdm_priv->links; | 183 | struct omap_mcpdm_link *mcpdm_links = mcpdm_priv->links; |
196 | int stream = substream->stream; | 184 | int stream = substream->stream; |
197 | int err; | 185 | int err; |
@@ -215,9 +203,14 @@ static struct snd_soc_dai_ops omap_mcpdm_dai_ops = { | |||
215 | #define OMAP_MCPDM_RATES (SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) | 203 | #define OMAP_MCPDM_RATES (SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) |
216 | #define OMAP_MCPDM_FORMATS (SNDRV_PCM_FMTBIT_S32_LE) | 204 | #define OMAP_MCPDM_FORMATS (SNDRV_PCM_FMTBIT_S32_LE) |
217 | 205 | ||
218 | struct snd_soc_dai omap_mcpdm_dai = { | 206 | static int omap_mcpdm_dai_probe(struct snd_soc_dai *dai) |
219 | .name = "omap-mcpdm", | 207 | { |
220 | .id = -1, | 208 | snd_soc_dai_set_drvdata(dai, &mcpdm_data); |
209 | return 0; | ||
210 | } | ||
211 | |||
212 | static struct snd_soc_dai_driver omap_mcpdm_dai = { | ||
213 | .probe = omap_mcpdm_dai_probe, | ||
221 | .playback = { | 214 | .playback = { |
222 | .channels_min = 1, | 215 | .channels_min = 1, |
223 | .channels_max = 4, | 216 | .channels_max = 4, |
@@ -231,19 +224,47 @@ struct snd_soc_dai omap_mcpdm_dai = { | |||
231 | .formats = OMAP_MCPDM_FORMATS, | 224 | .formats = OMAP_MCPDM_FORMATS, |
232 | }, | 225 | }, |
233 | .ops = &omap_mcpdm_dai_ops, | 226 | .ops = &omap_mcpdm_dai_ops, |
234 | .private_data = &mcpdm_data, | ||
235 | }; | 227 | }; |
236 | EXPORT_SYMBOL_GPL(omap_mcpdm_dai); | 228 | |
229 | static __devinit int asoc_mcpdm_probe(struct platform_device *pdev) | ||
230 | { | ||
231 | int ret; | ||
232 | |||
233 | ret = omap_mcpdm_probe(pdev); | ||
234 | if (ret < 0) | ||
235 | return ret; | ||
236 | ret = snd_soc_register_dai(&pdev->dev, &omap_mcpdm_dai); | ||
237 | if (ret < 0) | ||
238 | omap_mcpdm_remove(pdev); | ||
239 | return ret; | ||
240 | } | ||
241 | |||
242 | static int __devexit asoc_mcpdm_remove(struct platform_device *pdev) | ||
243 | { | ||
244 | snd_soc_unregister_dai(&pdev->dev); | ||
245 | omap_mcpdm_remove(pdev); | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static struct platform_driver asoc_mcpdm_driver = { | ||
250 | .driver = { | ||
251 | .name = "omap-mcpdm-dai", | ||
252 | .owner = THIS_MODULE, | ||
253 | }, | ||
254 | |||
255 | .probe = asoc_mcpdm_probe, | ||
256 | .remove = __devexit_p(asoc_mcpdm_remove), | ||
257 | }; | ||
237 | 258 | ||
238 | static int __init snd_omap_mcpdm_init(void) | 259 | static int __init snd_omap_mcpdm_init(void) |
239 | { | 260 | { |
240 | return snd_soc_register_dai(&omap_mcpdm_dai); | 261 | return platform_driver_register(&asoc_mcpdm_driver); |
241 | } | 262 | } |
242 | module_init(snd_omap_mcpdm_init); | 263 | module_init(snd_omap_mcpdm_init); |
243 | 264 | ||
244 | static void __exit snd_omap_mcpdm_exit(void) | 265 | static void __exit snd_omap_mcpdm_exit(void) |
245 | { | 266 | { |
246 | snd_soc_unregister_dai(&omap_mcpdm_dai); | 267 | platform_driver_unregister(&asoc_mcpdm_driver); |
247 | } | 268 | } |
248 | module_exit(snd_omap_mcpdm_exit); | 269 | module_exit(snd_omap_mcpdm_exit); |
249 | 270 | ||
diff --git a/sound/soc/omap/omap-mcpdm.h b/sound/soc/omap/omap-mcpdm.h deleted file mode 100644 index 73b80d559345..000000000000 --- a/sound/soc/omap/omap-mcpdm.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* | ||
2 | * omap-mcpdm.h | ||
3 | * | ||
4 | * Copyright (C) 2009 Texas Instruments | ||
5 | * | ||
6 | * Contact: Misael Lopez Cruz <x0052729@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef __OMAP_MCPDM_H__ | ||
25 | #define __OMAP_MCPDM_H__ | ||
26 | |||
27 | extern struct snd_soc_dai omap_mcpdm_dai; | ||
28 | |||
29 | #endif /* End of __OMAP_MCPDM_H__ */ | ||
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index 1e521904ea64..8caeb8d305c3 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
@@ -101,9 +101,10 @@ static int omap_pcm_hw_params(struct snd_pcm_substream *substream, | |||
101 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 101 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
102 | struct omap_runtime_data *prtd = runtime->private_data; | 102 | struct omap_runtime_data *prtd = runtime->private_data; |
103 | struct omap_pcm_dma_data *dma_data; | 103 | struct omap_pcm_dma_data *dma_data; |
104 | |||
104 | int err = 0; | 105 | int err = 0; |
105 | 106 | ||
106 | dma_data = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 107 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
107 | 108 | ||
108 | /* return if this is a bufferless transfer e.g. | 109 | /* return if this is a bufferless transfer e.g. |
109 | * codec <--> BT codec or GSM modem -- lg FIXME */ | 110 | * codec <--> BT codec or GSM modem -- lg FIXME */ |
@@ -374,14 +375,14 @@ static int omap_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
374 | if (!card->dev->coherent_dma_mask) | 375 | if (!card->dev->coherent_dma_mask) |
375 | card->dev->coherent_dma_mask = DMA_BIT_MASK(64); | 376 | card->dev->coherent_dma_mask = DMA_BIT_MASK(64); |
376 | 377 | ||
377 | if (dai->playback.channels_min) { | 378 | if (dai->driver->playback.channels_min) { |
378 | ret = omap_pcm_preallocate_dma_buffer(pcm, | 379 | ret = omap_pcm_preallocate_dma_buffer(pcm, |
379 | SNDRV_PCM_STREAM_PLAYBACK); | 380 | SNDRV_PCM_STREAM_PLAYBACK); |
380 | if (ret) | 381 | if (ret) |
381 | goto out; | 382 | goto out; |
382 | } | 383 | } |
383 | 384 | ||
384 | if (dai->capture.channels_min) { | 385 | if (dai->driver->capture.channels_min) { |
385 | ret = omap_pcm_preallocate_dma_buffer(pcm, | 386 | ret = omap_pcm_preallocate_dma_buffer(pcm, |
386 | SNDRV_PCM_STREAM_CAPTURE); | 387 | SNDRV_PCM_STREAM_CAPTURE); |
387 | if (ret) | 388 | if (ret) |
@@ -392,25 +393,45 @@ out: | |||
392 | return ret; | 393 | return ret; |
393 | } | 394 | } |
394 | 395 | ||
395 | struct snd_soc_platform omap_soc_platform = { | 396 | static struct snd_soc_platform_driver omap_soc_platform = { |
396 | .name = "omap-pcm-audio", | 397 | .ops = &omap_pcm_ops, |
397 | .pcm_ops = &omap_pcm_ops, | ||
398 | .pcm_new = omap_pcm_new, | 398 | .pcm_new = omap_pcm_new, |
399 | .pcm_free = omap_pcm_free_dma_buffers, | 399 | .pcm_free = omap_pcm_free_dma_buffers, |
400 | }; | 400 | }; |
401 | EXPORT_SYMBOL_GPL(omap_soc_platform); | ||
402 | 401 | ||
403 | static int __init omap_soc_platform_init(void) | 402 | static __devinit int omap_pcm_probe(struct platform_device *pdev) |
403 | { | ||
404 | return snd_soc_register_platform(&pdev->dev, | ||
405 | &omap_soc_platform); | ||
406 | } | ||
407 | |||
408 | static int __devexit omap_pcm_remove(struct platform_device *pdev) | ||
409 | { | ||
410 | snd_soc_unregister_platform(&pdev->dev); | ||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static struct platform_driver omap_pcm_driver = { | ||
415 | .driver = { | ||
416 | .name = "omap-pcm-audio", | ||
417 | .owner = THIS_MODULE, | ||
418 | }, | ||
419 | |||
420 | .probe = omap_pcm_probe, | ||
421 | .remove = __devexit_p(omap_pcm_remove), | ||
422 | }; | ||
423 | |||
424 | static int __init snd_omap_pcm_init(void) | ||
404 | { | 425 | { |
405 | return snd_soc_register_platform(&omap_soc_platform); | 426 | return platform_driver_register(&omap_pcm_driver); |
406 | } | 427 | } |
407 | module_init(omap_soc_platform_init); | 428 | module_init(snd_omap_pcm_init); |
408 | 429 | ||
409 | static void __exit omap_soc_platform_exit(void) | 430 | static void __exit snd_omap_pcm_exit(void) |
410 | { | 431 | { |
411 | snd_soc_unregister_platform(&omap_soc_platform); | 432 | platform_driver_unregister(&omap_pcm_driver); |
412 | } | 433 | } |
413 | module_exit(omap_soc_platform_exit); | 434 | module_exit(snd_omap_pcm_exit); |
414 | 435 | ||
415 | MODULE_AUTHOR("Jarkko Nikula <jhnikula@gmail.com>"); | 436 | MODULE_AUTHOR("Jarkko Nikula <jhnikula@gmail.com>"); |
416 | MODULE_DESCRIPTION("OMAP PCM DMA module"); | 437 | MODULE_DESCRIPTION("OMAP PCM DMA module"); |
diff --git a/sound/soc/omap/omap-pcm.h b/sound/soc/omap/omap-pcm.h index b19975d26907..fea0515331fb 100644 --- a/sound/soc/omap/omap-pcm.h +++ b/sound/soc/omap/omap-pcm.h | |||
@@ -35,6 +35,4 @@ struct omap_pcm_dma_data { | |||
35 | int packet_size; /* packet size only in PACKET mode */ | 35 | int packet_size; /* packet size only in PACKET mode */ |
36 | }; | 36 | }; |
37 | 37 | ||
38 | extern struct snd_soc_platform omap_soc_platform; | ||
39 | |||
40 | #endif | 38 | #endif |
diff --git a/sound/soc/omap/omap2evm.c b/sound/soc/omap/omap2evm.c index c7adea38274c..38cd1894623e 100644 --- a/sound/soc/omap/omap2evm.c +++ b/sound/soc/omap/omap2evm.c | |||
@@ -35,15 +35,13 @@ | |||
35 | 35 | ||
36 | #include "omap-mcbsp.h" | 36 | #include "omap-mcbsp.h" |
37 | #include "omap-pcm.h" | 37 | #include "omap-pcm.h" |
38 | #include "../codecs/twl4030.h" | ||
39 | 38 | ||
40 | static int omap2evm_hw_params(struct snd_pcm_substream *substream, | 39 | static int omap2evm_hw_params(struct snd_pcm_substream *substream, |
41 | struct snd_pcm_hw_params *params, | 40 | struct snd_pcm_hw_params *params) |
42 | struct snd_soc_dai *dai) | ||
43 | { | 41 | { |
44 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 42 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
45 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 43 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
46 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 44 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
47 | int ret; | 45 | int ret; |
48 | 46 | ||
49 | /* Set codec DAI configuration */ | 47 | /* Set codec DAI configuration */ |
@@ -85,25 +83,20 @@ static struct snd_soc_ops omap2evm_ops = { | |||
85 | static struct snd_soc_dai_link omap2evm_dai = { | 83 | static struct snd_soc_dai_link omap2evm_dai = { |
86 | .name = "TWL4030", | 84 | .name = "TWL4030", |
87 | .stream_name = "TWL4030", | 85 | .stream_name = "TWL4030", |
88 | .cpu_dai = &omap_mcbsp_dai[0], | 86 | .cpu_dai_name = "omap-mcbsp-dai.1", |
89 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 87 | .codec_dai_name = "twl4030-hifi", |
88 | .platform_name = "omap-pcm-audio", | ||
89 | .codec_name = "twl4030-codec", | ||
90 | .ops = &omap2evm_ops, | 90 | .ops = &omap2evm_ops, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | /* Audio machine driver */ | 93 | /* Audio machine driver */ |
94 | static struct snd_soc_card snd_soc_omap2evm = { | 94 | static struct snd_soc_card snd_soc_omap2evm = { |
95 | .name = "omap2evm", | 95 | .name = "omap2evm", |
96 | .platform = &omap_soc_platform, | ||
97 | .dai_link = &omap2evm_dai, | 96 | .dai_link = &omap2evm_dai, |
98 | .num_links = 1, | 97 | .num_links = 1, |
99 | }; | 98 | }; |
100 | 99 | ||
101 | /* Audio subsystem */ | ||
102 | static struct snd_soc_device omap2evm_snd_devdata = { | ||
103 | .card = &snd_soc_omap2evm, | ||
104 | .codec_dev = &soc_codec_dev_twl4030, | ||
105 | }; | ||
106 | |||
107 | static struct platform_device *omap2evm_snd_device; | 100 | static struct platform_device *omap2evm_snd_device; |
108 | 101 | ||
109 | static int __init omap2evm_soc_init(void) | 102 | static int __init omap2evm_soc_init(void) |
@@ -122,9 +115,7 @@ static int __init omap2evm_soc_init(void) | |||
122 | return -ENOMEM; | 115 | return -ENOMEM; |
123 | } | 116 | } |
124 | 117 | ||
125 | platform_set_drvdata(omap2evm_snd_device, &omap2evm_snd_devdata); | 118 | platform_set_drvdata(omap2evm_snd_device, &snd_soc_omap2evm); |
126 | omap2evm_snd_devdata.dev = &omap2evm_snd_device->dev; | ||
127 | *(unsigned int *)omap2evm_dai.cpu_dai->private_data = 1; /* McBSP2 */ | ||
128 | 119 | ||
129 | ret = platform_device_add(omap2evm_snd_device); | 120 | ret = platform_device_add(omap2evm_snd_device); |
130 | if (ret) | 121 | if (ret) |
diff --git a/sound/soc/omap/omap3beagle.c b/sound/soc/omap/omap3beagle.c index 240e0975dd6a..7c11e1afe9e6 100644 --- a/sound/soc/omap/omap3beagle.c +++ b/sound/soc/omap/omap3beagle.c | |||
@@ -33,14 +33,13 @@ | |||
33 | 33 | ||
34 | #include "omap-mcbsp.h" | 34 | #include "omap-mcbsp.h" |
35 | #include "omap-pcm.h" | 35 | #include "omap-pcm.h" |
36 | #include "../codecs/twl4030.h" | ||
37 | 36 | ||
38 | static int omap3beagle_hw_params(struct snd_pcm_substream *substream, | 37 | static int omap3beagle_hw_params(struct snd_pcm_substream *substream, |
39 | struct snd_pcm_hw_params *params) | 38 | struct snd_pcm_hw_params *params) |
40 | { | 39 | { |
41 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 40 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
42 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 41 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
43 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 42 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
44 | unsigned int fmt; | 43 | unsigned int fmt; |
45 | int ret; | 44 | int ret; |
46 | 45 | ||
@@ -92,25 +91,21 @@ static struct snd_soc_ops omap3beagle_ops = { | |||
92 | static struct snd_soc_dai_link omap3beagle_dai = { | 91 | static struct snd_soc_dai_link omap3beagle_dai = { |
93 | .name = "TWL4030", | 92 | .name = "TWL4030", |
94 | .stream_name = "TWL4030", | 93 | .stream_name = "TWL4030", |
95 | .cpu_dai = &omap_mcbsp_dai[0], | 94 | .cpu_dai_name = "omap-mcbsp-dai.1", |
96 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 95 | .platform_name = "omap-pcm-audio", |
96 | .codec_dai_name = "twl4030-hifi", | ||
97 | .codec_name = "twl4030-codec", | ||
97 | .ops = &omap3beagle_ops, | 98 | .ops = &omap3beagle_ops, |
98 | }; | 99 | }; |
99 | 100 | ||
100 | /* Audio machine driver */ | 101 | /* Audio machine driver */ |
101 | static struct snd_soc_card snd_soc_omap3beagle = { | 102 | static struct snd_soc_card snd_soc_omap3beagle = { |
102 | .name = "omap3beagle", | 103 | .name = "omap3beagle", |
103 | .platform = &omap_soc_platform, | 104 | .owner = THIS_MODULE, |
104 | .dai_link = &omap3beagle_dai, | 105 | .dai_link = &omap3beagle_dai, |
105 | .num_links = 1, | 106 | .num_links = 1, |
106 | }; | 107 | }; |
107 | 108 | ||
108 | /* Audio subsystem */ | ||
109 | static struct snd_soc_device omap3beagle_snd_devdata = { | ||
110 | .card = &snd_soc_omap3beagle, | ||
111 | .codec_dev = &soc_codec_dev_twl4030, | ||
112 | }; | ||
113 | |||
114 | static struct platform_device *omap3beagle_snd_device; | 109 | static struct platform_device *omap3beagle_snd_device; |
115 | 110 | ||
116 | static int __init omap3beagle_soc_init(void) | 111 | static int __init omap3beagle_soc_init(void) |
@@ -129,9 +124,7 @@ static int __init omap3beagle_soc_init(void) | |||
129 | return -ENOMEM; | 124 | return -ENOMEM; |
130 | } | 125 | } |
131 | 126 | ||
132 | platform_set_drvdata(omap3beagle_snd_device, &omap3beagle_snd_devdata); | 127 | platform_set_drvdata(omap3beagle_snd_device, &snd_soc_omap3beagle); |
133 | omap3beagle_snd_devdata.dev = &omap3beagle_snd_device->dev; | ||
134 | *(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 1; /* McBSP2 */ | ||
135 | 128 | ||
136 | ret = platform_device_add(omap3beagle_snd_device); | 129 | ret = platform_device_add(omap3beagle_snd_device); |
137 | if (ret) | 130 | if (ret) |
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c index dfcb344092e4..1ac5babef00d 100644 --- a/sound/soc/omap/omap3evm.c +++ b/sound/soc/omap/omap3evm.c | |||
@@ -31,14 +31,13 @@ | |||
31 | 31 | ||
32 | #include "omap-mcbsp.h" | 32 | #include "omap-mcbsp.h" |
33 | #include "omap-pcm.h" | 33 | #include "omap-pcm.h" |
34 | #include "../codecs/twl4030.h" | ||
35 | 34 | ||
36 | static int omap3evm_hw_params(struct snd_pcm_substream *substream, | 35 | static int omap3evm_hw_params(struct snd_pcm_substream *substream, |
37 | struct snd_pcm_hw_params *params) | 36 | struct snd_pcm_hw_params *params) |
38 | { | 37 | { |
39 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 38 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
40 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 39 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
41 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 40 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
42 | int ret; | 41 | int ret; |
43 | 42 | ||
44 | /* Set codec DAI configuration */ | 43 | /* Set codec DAI configuration */ |
@@ -80,32 +79,20 @@ static struct snd_soc_ops omap3evm_ops = { | |||
80 | static struct snd_soc_dai_link omap3evm_dai = { | 79 | static struct snd_soc_dai_link omap3evm_dai = { |
81 | .name = "TWL4030", | 80 | .name = "TWL4030", |
82 | .stream_name = "TWL4030", | 81 | .stream_name = "TWL4030", |
83 | .cpu_dai = &omap_mcbsp_dai[0], | 82 | .cpu_dai_name = "omap-mcbsp-dai.1", |
84 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 83 | .codec_dai_name = "twl4030-hifi", |
84 | .platform_name = "omap-pcm-audio", | ||
85 | .codec_name = "twl4030-codec", | ||
85 | .ops = &omap3evm_ops, | 86 | .ops = &omap3evm_ops, |
86 | }; | 87 | }; |
87 | 88 | ||
88 | /* Audio machine driver */ | 89 | /* Audio machine driver */ |
89 | static struct snd_soc_card snd_soc_omap3evm = { | 90 | static struct snd_soc_card snd_soc_omap3evm = { |
90 | .name = "omap3evm", | 91 | .name = "omap3evm", |
91 | .platform = &omap_soc_platform, | ||
92 | .dai_link = &omap3evm_dai, | 92 | .dai_link = &omap3evm_dai, |
93 | .num_links = 1, | 93 | .num_links = 1, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | /* twl4030 setup */ | ||
97 | static struct twl4030_setup_data twl4030_setup = { | ||
98 | .ramp_delay_value = 4, | ||
99 | .sysclk = 26000, | ||
100 | }; | ||
101 | |||
102 | /* Audio subsystem */ | ||
103 | static struct snd_soc_device omap3evm_snd_devdata = { | ||
104 | .card = &snd_soc_omap3evm, | ||
105 | .codec_dev = &soc_codec_dev_twl4030, | ||
106 | .codec_data = &twl4030_setup, | ||
107 | }; | ||
108 | |||
109 | static struct platform_device *omap3evm_snd_device; | 96 | static struct platform_device *omap3evm_snd_device; |
110 | 97 | ||
111 | static int __init omap3evm_soc_init(void) | 98 | static int __init omap3evm_soc_init(void) |
@@ -124,10 +111,7 @@ static int __init omap3evm_soc_init(void) | |||
124 | return -ENOMEM; | 111 | return -ENOMEM; |
125 | } | 112 | } |
126 | 113 | ||
127 | platform_set_drvdata(omap3evm_snd_device, &omap3evm_snd_devdata); | 114 | platform_set_drvdata(omap3evm_snd_device, &snd_soc_omap3evm); |
128 | omap3evm_snd_devdata.dev = &omap3evm_snd_device->dev; | ||
129 | *(unsigned int *)omap3evm_dai.cpu_dai->private_data = 1; | ||
130 | |||
131 | ret = platform_device_add(omap3evm_snd_device); | 115 | ret = platform_device_add(omap3evm_snd_device); |
132 | if (ret) | 116 | if (ret) |
133 | goto err1; | 117 | goto err1; |
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c index 9eecac135bbb..dbd9d96b5f92 100644 --- a/sound/soc/omap/omap3pandora.c +++ b/sound/soc/omap/omap3pandora.c | |||
@@ -31,10 +31,10 @@ | |||
31 | #include <sound/soc-dapm.h> | 31 | #include <sound/soc-dapm.h> |
32 | 32 | ||
33 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
34 | #include <plat/mcbsp.h> | ||
34 | 35 | ||
35 | #include "omap-mcbsp.h" | 36 | #include "omap-mcbsp.h" |
36 | #include "omap-pcm.h" | 37 | #include "omap-pcm.h" |
37 | #include "../codecs/twl4030.h" | ||
38 | 38 | ||
39 | #define OMAP3_PANDORA_DAC_POWER_GPIO 118 | 39 | #define OMAP3_PANDORA_DAC_POWER_GPIO 118 |
40 | #define OMAP3_PANDORA_AMP_POWER_GPIO 14 | 40 | #define OMAP3_PANDORA_AMP_POWER_GPIO 14 |
@@ -47,8 +47,8 @@ static int omap3pandora_hw_params(struct snd_pcm_substream *substream, | |||
47 | struct snd_pcm_hw_params *params) | 47 | struct snd_pcm_hw_params *params) |
48 | { | 48 | { |
49 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 49 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
50 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 50 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
51 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 51 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
52 | int fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 52 | int fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
53 | SND_SOC_DAIFMT_CBS_CFS; | 53 | SND_SOC_DAIFMT_CBS_CFS; |
54 | int ret; | 54 | int ret; |
@@ -167,8 +167,9 @@ static const struct snd_soc_dapm_route omap3pandora_in_map[] = { | |||
167 | {"Mic Bias 2", NULL, "Mic (external)"}, | 167 | {"Mic Bias 2", NULL, "Mic (external)"}, |
168 | }; | 168 | }; |
169 | 169 | ||
170 | static int omap3pandora_out_init(struct snd_soc_codec *codec) | 170 | static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) |
171 | { | 171 | { |
172 | struct snd_soc_codec *codec = rtd->codec; | ||
172 | int ret; | 173 | int ret; |
173 | 174 | ||
174 | /* All TWL4030 output pins are floating */ | 175 | /* All TWL4030 output pins are floating */ |
@@ -194,8 +195,9 @@ static int omap3pandora_out_init(struct snd_soc_codec *codec) | |||
194 | return snd_soc_dapm_sync(codec); | 195 | return snd_soc_dapm_sync(codec); |
195 | } | 196 | } |
196 | 197 | ||
197 | static int omap3pandora_in_init(struct snd_soc_codec *codec) | 198 | static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) |
198 | { | 199 | { |
200 | struct snd_soc_codec *codec = rtd->codec; | ||
199 | int ret; | 201 | int ret; |
200 | 202 | ||
201 | /* Not comnnected */ | 203 | /* Not comnnected */ |
@@ -224,15 +226,19 @@ static struct snd_soc_dai_link omap3pandora_dai[] = { | |||
224 | { | 226 | { |
225 | .name = "PCM1773", | 227 | .name = "PCM1773", |
226 | .stream_name = "HiFi Out", | 228 | .stream_name = "HiFi Out", |
227 | .cpu_dai = &omap_mcbsp_dai[0], | 229 | .cpu_dai_name = "omap-mcbsp-dai.1", |
228 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 230 | .codec_dai_name = "twl4030-hifi", |
231 | .platform_name = "omap-pcm-audio", | ||
232 | .codec_name = "twl4030-codec", | ||
229 | .ops = &omap3pandora_ops, | 233 | .ops = &omap3pandora_ops, |
230 | .init = omap3pandora_out_init, | 234 | .init = omap3pandora_out_init, |
231 | }, { | 235 | }, { |
232 | .name = "TWL4030", | 236 | .name = "TWL4030", |
233 | .stream_name = "Line/Mic In", | 237 | .stream_name = "Line/Mic In", |
234 | .cpu_dai = &omap_mcbsp_dai[1], | 238 | .cpu_dai_name = "omap-mcbsp-dai.3", |
235 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 239 | .codec_dai_name = "twl4030-hifi", |
240 | .platform_name = "omap-pcm-audio", | ||
241 | .codec_name = "twl4030-codec", | ||
236 | .ops = &omap3pandora_ops, | 242 | .ops = &omap3pandora_ops, |
237 | .init = omap3pandora_in_init, | 243 | .init = omap3pandora_in_init, |
238 | } | 244 | } |
@@ -241,17 +247,10 @@ static struct snd_soc_dai_link omap3pandora_dai[] = { | |||
241 | /* SoC card */ | 247 | /* SoC card */ |
242 | static struct snd_soc_card snd_soc_card_omap3pandora = { | 248 | static struct snd_soc_card snd_soc_card_omap3pandora = { |
243 | .name = "omap3pandora", | 249 | .name = "omap3pandora", |
244 | .platform = &omap_soc_platform, | ||
245 | .dai_link = omap3pandora_dai, | 250 | .dai_link = omap3pandora_dai, |
246 | .num_links = ARRAY_SIZE(omap3pandora_dai), | 251 | .num_links = ARRAY_SIZE(omap3pandora_dai), |
247 | }; | 252 | }; |
248 | 253 | ||
249 | /* Audio subsystem */ | ||
250 | static struct snd_soc_device omap3pandora_snd_data = { | ||
251 | .card = &snd_soc_card_omap3pandora, | ||
252 | .codec_dev = &soc_codec_dev_twl4030, | ||
253 | }; | ||
254 | |||
255 | static struct platform_device *omap3pandora_snd_device; | 254 | static struct platform_device *omap3pandora_snd_device; |
256 | 255 | ||
257 | static int __init omap3pandora_soc_init(void) | 256 | static int __init omap3pandora_soc_init(void) |
@@ -294,10 +293,7 @@ static int __init omap3pandora_soc_init(void) | |||
294 | goto fail1; | 293 | goto fail1; |
295 | } | 294 | } |
296 | 295 | ||
297 | platform_set_drvdata(omap3pandora_snd_device, &omap3pandora_snd_data); | 296 | platform_set_drvdata(omap3pandora_snd_device, &snd_soc_card_omap3pandora); |
298 | omap3pandora_snd_data.dev = &omap3pandora_snd_device->dev; | ||
299 | *(unsigned int *)omap_mcbsp_dai[0].private_data = 1; /* McBSP2 */ | ||
300 | *(unsigned int *)omap_mcbsp_dai[1].private_data = 3; /* McBSP4 */ | ||
301 | 297 | ||
302 | ret = platform_device_add(omap3pandora_snd_device); | 298 | ret = platform_device_add(omap3pandora_snd_device); |
303 | if (ret) { | 299 | if (ret) { |
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c index 498ca2e03519..f0e662556428 100644 --- a/sound/soc/omap/osk5912.c +++ b/sound/soc/omap/osk5912.c | |||
@@ -55,8 +55,8 @@ static int osk_hw_params(struct snd_pcm_substream *substream, | |||
55 | struct snd_pcm_hw_params *params) | 55 | struct snd_pcm_hw_params *params) |
56 | { | 56 | { |
57 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 57 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
58 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 58 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
59 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 59 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
60 | int err; | 60 | int err; |
61 | 61 | ||
62 | /* Set codec DAI configuration */ | 62 | /* Set codec DAI configuration */ |
@@ -113,8 +113,9 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
113 | {"MICIN", NULL, "Mic Jack"}, | 113 | {"MICIN", NULL, "Mic Jack"}, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | static int osk_tlv320aic23_init(struct snd_soc_codec *codec) | 116 | static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) |
117 | { | 117 | { |
118 | struct snd_soc_codec *codec = rtd->codec; | ||
118 | 119 | ||
119 | /* Add osk5912 specific widgets */ | 120 | /* Add osk5912 specific widgets */ |
120 | snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, | 121 | snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, |
@@ -136,8 +137,10 @@ static int osk_tlv320aic23_init(struct snd_soc_codec *codec) | |||
136 | static struct snd_soc_dai_link osk_dai = { | 137 | static struct snd_soc_dai_link osk_dai = { |
137 | .name = "TLV320AIC23", | 138 | .name = "TLV320AIC23", |
138 | .stream_name = "AIC23", | 139 | .stream_name = "AIC23", |
139 | .cpu_dai = &omap_mcbsp_dai[0], | 140 | .cpu_dai_name = "omap-mcbsp-dai.0", |
140 | .codec_dai = &tlv320aic23_dai, | 141 | .codec_dai_name = "tlv320aic23-hifi", |
142 | .platform_name = "omap-pcm-audio", | ||
143 | .codec_name = "tlv320aic23-codec", | ||
141 | .init = osk_tlv320aic23_init, | 144 | .init = osk_tlv320aic23_init, |
142 | .ops = &osk_ops, | 145 | .ops = &osk_ops, |
143 | }; | 146 | }; |
@@ -145,17 +148,10 @@ static struct snd_soc_dai_link osk_dai = { | |||
145 | /* Audio machine driver */ | 148 | /* Audio machine driver */ |
146 | static struct snd_soc_card snd_soc_card_osk = { | 149 | static struct snd_soc_card snd_soc_card_osk = { |
147 | .name = "OSK5912", | 150 | .name = "OSK5912", |
148 | .platform = &omap_soc_platform, | ||
149 | .dai_link = &osk_dai, | 151 | .dai_link = &osk_dai, |
150 | .num_links = 1, | 152 | .num_links = 1, |
151 | }; | 153 | }; |
152 | 154 | ||
153 | /* Audio subsystem */ | ||
154 | static struct snd_soc_device osk_snd_devdata = { | ||
155 | .card = &snd_soc_card_osk, | ||
156 | .codec_dev = &soc_codec_dev_tlv320aic23, | ||
157 | }; | ||
158 | |||
159 | static struct platform_device *osk_snd_device; | 155 | static struct platform_device *osk_snd_device; |
160 | 156 | ||
161 | static int __init osk_soc_init(void) | 157 | static int __init osk_soc_init(void) |
@@ -171,9 +167,7 @@ static int __init osk_soc_init(void) | |||
171 | if (!osk_snd_device) | 167 | if (!osk_snd_device) |
172 | return -ENOMEM; | 168 | return -ENOMEM; |
173 | 169 | ||
174 | platform_set_drvdata(osk_snd_device, &osk_snd_devdata); | 170 | platform_set_drvdata(osk_snd_device, &snd_soc_card_osk); |
175 | osk_snd_devdata.dev = &osk_snd_device->dev; | ||
176 | *(unsigned int *)osk_dai.cpu_dai->private_data = 0; /* McBSP1 */ | ||
177 | err = platform_device_add(osk_snd_device); | 171 | err = platform_device_add(osk_snd_device); |
178 | if (err) | 172 | if (err) |
179 | goto err1; | 173 | goto err1; |
diff --git a/sound/soc/omap/overo.c b/sound/soc/omap/overo.c index c25f5276ad6f..e95a607937de 100644 --- a/sound/soc/omap/overo.c +++ b/sound/soc/omap/overo.c | |||
@@ -33,14 +33,13 @@ | |||
33 | 33 | ||
34 | #include "omap-mcbsp.h" | 34 | #include "omap-mcbsp.h" |
35 | #include "omap-pcm.h" | 35 | #include "omap-pcm.h" |
36 | #include "../codecs/twl4030.h" | ||
37 | 36 | ||
38 | static int overo_hw_params(struct snd_pcm_substream *substream, | 37 | static int overo_hw_params(struct snd_pcm_substream *substream, |
39 | struct snd_pcm_hw_params *params) | 38 | struct snd_pcm_hw_params *params) |
40 | { | 39 | { |
41 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 40 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
42 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 41 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
43 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 42 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
44 | int ret; | 43 | int ret; |
45 | 44 | ||
46 | /* Set codec DAI configuration */ | 45 | /* Set codec DAI configuration */ |
@@ -82,25 +81,20 @@ static struct snd_soc_ops overo_ops = { | |||
82 | static struct snd_soc_dai_link overo_dai = { | 81 | static struct snd_soc_dai_link overo_dai = { |
83 | .name = "TWL4030", | 82 | .name = "TWL4030", |
84 | .stream_name = "TWL4030", | 83 | .stream_name = "TWL4030", |
85 | .cpu_dai = &omap_mcbsp_dai[0], | 84 | .cpu_dai_name = "omap-mcbsp-dai.1", |
86 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 85 | .codec_dai_name = "twl4030-hifi", |
86 | .platform_name = "omap-pcm-audio", | ||
87 | .codec_name = "twl4030-codec", | ||
87 | .ops = &overo_ops, | 88 | .ops = &overo_ops, |
88 | }; | 89 | }; |
89 | 90 | ||
90 | /* Audio machine driver */ | 91 | /* Audio machine driver */ |
91 | static struct snd_soc_card snd_soc_card_overo = { | 92 | static struct snd_soc_card snd_soc_card_overo = { |
92 | .name = "overo", | 93 | .name = "overo", |
93 | .platform = &omap_soc_platform, | ||
94 | .dai_link = &overo_dai, | 94 | .dai_link = &overo_dai, |
95 | .num_links = 1, | 95 | .num_links = 1, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /* Audio subsystem */ | ||
99 | static struct snd_soc_device overo_snd_devdata = { | ||
100 | .card = &snd_soc_card_overo, | ||
101 | .codec_dev = &soc_codec_dev_twl4030, | ||
102 | }; | ||
103 | |||
104 | static struct platform_device *overo_snd_device; | 98 | static struct platform_device *overo_snd_device; |
105 | 99 | ||
106 | static int __init overo_soc_init(void) | 100 | static int __init overo_soc_init(void) |
@@ -119,9 +113,7 @@ static int __init overo_soc_init(void) | |||
119 | return -ENOMEM; | 113 | return -ENOMEM; |
120 | } | 114 | } |
121 | 115 | ||
122 | platform_set_drvdata(overo_snd_device, &overo_snd_devdata); | 116 | platform_set_drvdata(overo_snd_device, &snd_soc_card_overo); |
123 | overo_snd_devdata.dev = &overo_snd_device->dev; | ||
124 | *(unsigned int *)overo_dai.cpu_dai->private_data = 1; /* McBSP2 */ | ||
125 | 117 | ||
126 | ret = platform_device_add(overo_snd_device); | 118 | ret = platform_device_add(overo_snd_device); |
127 | if (ret) | 119 | if (ret) |
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index 88052d29617f..d1d8098923ce 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <sound/pcm.h> | 31 | #include <sound/pcm.h> |
32 | #include <sound/soc.h> | 32 | #include <sound/soc.h> |
33 | #include <sound/soc-dapm.h> | 33 | #include <sound/soc-dapm.h> |
34 | #include <plat/mcbsp.h> | ||
34 | 35 | ||
35 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
36 | 37 | ||
@@ -76,7 +77,7 @@ static int rx51_startup(struct snd_pcm_substream *substream) | |||
76 | { | 77 | { |
77 | struct snd_pcm_runtime *runtime = substream->runtime; | 78 | struct snd_pcm_runtime *runtime = substream->runtime; |
78 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 79 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
79 | struct snd_soc_codec *codec = rtd->socdev->card->codec; | 80 | struct snd_soc_codec *codec = rtd->codec; |
80 | 81 | ||
81 | snd_pcm_hw_constraint_minmax(runtime, | 82 | snd_pcm_hw_constraint_minmax(runtime, |
82 | SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); | 83 | SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); |
@@ -89,8 +90,8 @@ static int rx51_hw_params(struct snd_pcm_substream *substream, | |||
89 | struct snd_pcm_hw_params *params) | 90 | struct snd_pcm_hw_params *params) |
90 | { | 91 | { |
91 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 92 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
92 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 93 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
93 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 94 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
94 | int err; | 95 | int err; |
95 | 96 | ||
96 | /* Set codec DAI configuration */ | 97 | /* Set codec DAI configuration */ |
@@ -240,9 +241,9 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = { | |||
240 | rx51_get_jack, rx51_set_jack), | 241 | rx51_get_jack, rx51_set_jack), |
241 | }; | 242 | }; |
242 | 243 | ||
243 | static int rx51_aic34_init(struct snd_soc_codec *codec) | 244 | static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) |
244 | { | 245 | { |
245 | struct snd_soc_card *card = codec->socdev->card; | 246 | struct snd_soc_codec *codec = rtd->codec; |
246 | int err; | 247 | int err; |
247 | 248 | ||
248 | /* Set up NC codec pins */ | 249 | /* Set up NC codec pins */ |
@@ -266,7 +267,7 @@ static int rx51_aic34_init(struct snd_soc_codec *codec) | |||
266 | snd_soc_dapm_sync(codec); | 267 | snd_soc_dapm_sync(codec); |
267 | 268 | ||
268 | /* AV jack detection */ | 269 | /* AV jack detection */ |
269 | err = snd_soc_jack_new(card, "AV Jack", | 270 | err = snd_soc_jack_new(codec, "AV Jack", |
270 | SND_JACK_VIDEOOUT, &rx51_av_jack); | 271 | SND_JACK_VIDEOOUT, &rx51_av_jack); |
271 | if (err) | 272 | if (err) |
272 | return err; | 273 | return err; |
@@ -282,32 +283,20 @@ static struct snd_soc_dai_link rx51_dai[] = { | |||
282 | { | 283 | { |
283 | .name = "TLV320AIC34", | 284 | .name = "TLV320AIC34", |
284 | .stream_name = "AIC34", | 285 | .stream_name = "AIC34", |
285 | .cpu_dai = &omap_mcbsp_dai[0], | 286 | .cpu_dai_name = "omap-mcbsp-dai.1", |
286 | .codec_dai = &aic3x_dai, | 287 | .codec_dai_name = "tlv320aic3x-hifi", |
288 | .platform_name = "omap-pcm-audio", | ||
289 | .codec_name = "tlv320aic3x-codec.2-0018", | ||
287 | .init = rx51_aic34_init, | 290 | .init = rx51_aic34_init, |
288 | .ops = &rx51_ops, | 291 | .ops = &rx51_ops, |
289 | }, | 292 | }, |
290 | }; | 293 | }; |
291 | 294 | ||
292 | /* Audio private data */ | ||
293 | static struct aic3x_setup_data rx51_aic34_setup = { | ||
294 | .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED, | ||
295 | .gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT, | ||
296 | }; | ||
297 | |||
298 | /* Audio card */ | 295 | /* Audio card */ |
299 | static struct snd_soc_card rx51_sound_card = { | 296 | static struct snd_soc_card rx51_sound_card = { |
300 | .name = "RX-51", | 297 | .name = "RX-51", |
301 | .dai_link = rx51_dai, | 298 | .dai_link = rx51_dai, |
302 | .num_links = ARRAY_SIZE(rx51_dai), | 299 | .num_links = ARRAY_SIZE(rx51_dai), |
303 | .platform = &omap_soc_platform, | ||
304 | }; | ||
305 | |||
306 | /* Audio subsystem */ | ||
307 | static struct snd_soc_device rx51_snd_devdata = { | ||
308 | .card = &rx51_sound_card, | ||
309 | .codec_dev = &soc_codec_dev_aic3x, | ||
310 | .codec_data = &rx51_aic34_setup, | ||
311 | }; | 300 | }; |
312 | 301 | ||
313 | static struct platform_device *rx51_snd_device; | 302 | static struct platform_device *rx51_snd_device; |
@@ -330,9 +319,7 @@ static int __init rx51_soc_init(void) | |||
330 | goto err1; | 319 | goto err1; |
331 | } | 320 | } |
332 | 321 | ||
333 | platform_set_drvdata(rx51_snd_device, &rx51_snd_devdata); | 322 | platform_set_drvdata(rx51_snd_device, &rx51_sound_card); |
334 | rx51_snd_devdata.dev = &rx51_snd_device->dev; | ||
335 | *(unsigned int *)rx51_dai[0].cpu_dai->private_data = 1; /* McBSP2 */ | ||
336 | 323 | ||
337 | err = platform_device_add(rx51_snd_device); | 324 | err = platform_device_add(rx51_snd_device); |
338 | if (err) | 325 | if (err) |
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c index 3c85c0f92823..76ce77b91844 100644 --- a/sound/soc/omap/sdp3430.c +++ b/sound/soc/omap/sdp3430.c | |||
@@ -36,9 +36,11 @@ | |||
36 | #include <mach/gpio.h> | 36 | #include <mach/gpio.h> |
37 | #include <plat/mcbsp.h> | 37 | #include <plat/mcbsp.h> |
38 | 38 | ||
39 | /* Register descriptions for twl4030 codec part */ | ||
40 | #include <linux/mfd/twl4030-codec.h> | ||
41 | |||
39 | #include "omap-mcbsp.h" | 42 | #include "omap-mcbsp.h" |
40 | #include "omap-pcm.h" | 43 | #include "omap-pcm.h" |
41 | #include "../codecs/twl4030.h" | ||
42 | 44 | ||
43 | /* TWL4030 PMBR1 Register */ | 45 | /* TWL4030 PMBR1 Register */ |
44 | #define TWL4030_INTBR_PMBR1 0x0D | 46 | #define TWL4030_INTBR_PMBR1 0x0D |
@@ -51,8 +53,8 @@ static int sdp3430_hw_params(struct snd_pcm_substream *substream, | |||
51 | struct snd_pcm_hw_params *params) | 53 | struct snd_pcm_hw_params *params) |
52 | { | 54 | { |
53 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 55 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
54 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 56 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
55 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 57 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
56 | int ret; | 58 | int ret; |
57 | 59 | ||
58 | /* Set codec DAI configuration */ | 60 | /* Set codec DAI configuration */ |
@@ -94,8 +96,8 @@ static int sdp3430_hw_voice_params(struct snd_pcm_substream *substream, | |||
94 | struct snd_pcm_hw_params *params) | 96 | struct snd_pcm_hw_params *params) |
95 | { | 97 | { |
96 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 98 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
97 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 99 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
98 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 100 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
99 | int ret; | 101 | int ret; |
100 | 102 | ||
101 | /* Set codec DAI configuration */ | 103 | /* Set codec DAI configuration */ |
@@ -186,8 +188,9 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
186 | {"Headset Stereophone", NULL, "HSOR"}, | 188 | {"Headset Stereophone", NULL, "HSOR"}, |
187 | }; | 189 | }; |
188 | 190 | ||
189 | static int sdp3430_twl4030_init(struct snd_soc_codec *codec) | 191 | static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd) |
190 | { | 192 | { |
193 | struct snd_soc_codec *codec = rtd->codec; | ||
191 | int ret; | 194 | int ret; |
192 | 195 | ||
193 | /* Add SDP3430 specific widgets */ | 196 | /* Add SDP3430 specific widgets */ |
@@ -225,7 +228,7 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec) | |||
225 | return ret; | 228 | return ret; |
226 | 229 | ||
227 | /* Headset jack detection */ | 230 | /* Headset jack detection */ |
228 | ret = snd_soc_jack_new(&snd_soc_sdp3430, "Headset Jack", | 231 | ret = snd_soc_jack_new(codec, "Headset Jack", |
229 | SND_JACK_HEADSET, &hs_jack); | 232 | SND_JACK_HEADSET, &hs_jack); |
230 | if (ret) | 233 | if (ret) |
231 | return ret; | 234 | return ret; |
@@ -241,14 +244,15 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec) | |||
241 | return ret; | 244 | return ret; |
242 | } | 245 | } |
243 | 246 | ||
244 | static int sdp3430_twl4030_voice_init(struct snd_soc_codec *codec) | 247 | static int sdp3430_twl4030_voice_init(struct snd_soc_pcm_runtime *rtd) |
245 | { | 248 | { |
249 | struct snd_soc_codec *codec = rtd->codec; | ||
246 | unsigned short reg; | 250 | unsigned short reg; |
247 | 251 | ||
248 | /* Enable voice interface */ | 252 | /* Enable voice interface */ |
249 | reg = codec->read(codec, TWL4030_REG_VOICE_IF); | 253 | reg = codec->driver->read(codec, TWL4030_REG_VOICE_IF); |
250 | reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN; | 254 | reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN; |
251 | codec->write(codec, TWL4030_REG_VOICE_IF, reg); | 255 | codec->driver->write(codec, TWL4030_REG_VOICE_IF, reg); |
252 | 256 | ||
253 | return 0; | 257 | return 0; |
254 | } | 258 | } |
@@ -259,16 +263,20 @@ static struct snd_soc_dai_link sdp3430_dai[] = { | |||
259 | { | 263 | { |
260 | .name = "TWL4030 I2S", | 264 | .name = "TWL4030 I2S", |
261 | .stream_name = "TWL4030 Audio", | 265 | .stream_name = "TWL4030 Audio", |
262 | .cpu_dai = &omap_mcbsp_dai[0], | 266 | .cpu_dai_name = "omap-mcbsp-dai.1", |
263 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 267 | .codec_dai_name = "twl4030-hifi", |
268 | .platform_name = "omap-pcm-audio", | ||
269 | .codec_name = "twl4030-codec", | ||
264 | .init = sdp3430_twl4030_init, | 270 | .init = sdp3430_twl4030_init, |
265 | .ops = &sdp3430_ops, | 271 | .ops = &sdp3430_ops, |
266 | }, | 272 | }, |
267 | { | 273 | { |
268 | .name = "TWL4030 PCM", | 274 | .name = "TWL4030 PCM", |
269 | .stream_name = "TWL4030 Voice", | 275 | .stream_name = "TWL4030 Voice", |
270 | .cpu_dai = &omap_mcbsp_dai[1], | 276 | .cpu_dai_name = "omap-mcbsp-dai.2", |
271 | .codec_dai = &twl4030_dai[TWL4030_DAI_VOICE], | 277 | .codec_dai_name = "twl4030-voice", |
278 | .platform_name = "omap-pcm-audio", | ||
279 | .codec_name = "twl4030-codec", | ||
272 | .init = sdp3430_twl4030_voice_init, | 280 | .init = sdp3430_twl4030_voice_init, |
273 | .ops = &sdp3430_voice_ops, | 281 | .ops = &sdp3430_voice_ops, |
274 | }, | 282 | }, |
@@ -277,25 +285,10 @@ static struct snd_soc_dai_link sdp3430_dai[] = { | |||
277 | /* Audio machine driver */ | 285 | /* Audio machine driver */ |
278 | static struct snd_soc_card snd_soc_sdp3430 = { | 286 | static struct snd_soc_card snd_soc_sdp3430 = { |
279 | .name = "SDP3430", | 287 | .name = "SDP3430", |
280 | .platform = &omap_soc_platform, | ||
281 | .dai_link = sdp3430_dai, | 288 | .dai_link = sdp3430_dai, |
282 | .num_links = ARRAY_SIZE(sdp3430_dai), | 289 | .num_links = ARRAY_SIZE(sdp3430_dai), |
283 | }; | 290 | }; |
284 | 291 | ||
285 | /* twl4030 setup */ | ||
286 | static struct twl4030_setup_data twl4030_setup = { | ||
287 | .ramp_delay_value = 3, | ||
288 | .sysclk = 26000, | ||
289 | .hs_extmute = 1, | ||
290 | }; | ||
291 | |||
292 | /* Audio subsystem */ | ||
293 | static struct snd_soc_device sdp3430_snd_devdata = { | ||
294 | .card = &snd_soc_sdp3430, | ||
295 | .codec_dev = &soc_codec_dev_twl4030, | ||
296 | .codec_data = &twl4030_setup, | ||
297 | }; | ||
298 | |||
299 | static struct platform_device *sdp3430_snd_device; | 292 | static struct platform_device *sdp3430_snd_device; |
300 | 293 | ||
301 | static int __init sdp3430_soc_init(void) | 294 | static int __init sdp3430_soc_init(void) |
@@ -315,10 +308,7 @@ static int __init sdp3430_soc_init(void) | |||
315 | return -ENOMEM; | 308 | return -ENOMEM; |
316 | } | 309 | } |
317 | 310 | ||
318 | platform_set_drvdata(sdp3430_snd_device, &sdp3430_snd_devdata); | 311 | platform_set_drvdata(sdp3430_snd_device, &snd_soc_sdp3430); |
319 | sdp3430_snd_devdata.dev = &sdp3430_snd_device->dev; | ||
320 | *(unsigned int *)sdp3430_dai[0].cpu_dai->private_data = 1; /* McBSP2 */ | ||
321 | *(unsigned int *)sdp3430_dai[1].cpu_dai->private_data = 2; /* McBSP3 */ | ||
322 | 312 | ||
323 | /* Set TWL4030 GPIO6 as EXTMUTE signal */ | 313 | /* Set TWL4030 GPIO6 as EXTMUTE signal */ |
324 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux, | 314 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux, |
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 4ebbde6b565f..62f6a622d791 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <plat/mux.h> | 31 | #include <plat/mux.h> |
32 | 32 | ||
33 | #include "mcpdm.h" | 33 | #include "mcpdm.h" |
34 | #include "omap-mcpdm.h" | ||
35 | #include "omap-pcm.h" | 34 | #include "omap-pcm.h" |
36 | #include "../codecs/twl6040.h" | 35 | #include "../codecs/twl6040.h" |
37 | 36 | ||
@@ -41,7 +40,7 @@ static int sdp4430_hw_params(struct snd_pcm_substream *substream, | |||
41 | struct snd_pcm_hw_params *params) | 40 | struct snd_pcm_hw_params *params) |
42 | { | 41 | { |
43 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 42 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
44 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 43 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
45 | int clk_id, freq; | 44 | int clk_id, freq; |
46 | int ret; | 45 | int ret; |
47 | 46 | ||
@@ -60,6 +59,7 @@ static int sdp4430_hw_params(struct snd_pcm_substream *substream, | |||
60 | printk(KERN_ERR "can't set codec system clock\n"); | 59 | printk(KERN_ERR "can't set codec system clock\n"); |
61 | return ret; | 60 | return ret; |
62 | } | 61 | } |
62 | return ret; | ||
63 | } | 63 | } |
64 | 64 | ||
65 | static struct snd_soc_ops sdp4430_ops = { | 65 | static struct snd_soc_ops sdp4430_ops = { |
@@ -126,8 +126,9 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
126 | {"Earphone Spk", NULL, "EP"}, | 126 | {"Earphone Spk", NULL, "EP"}, |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static int sdp4430_twl6040_init(struct snd_soc_codec *codec) | 129 | static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) |
130 | { | 130 | { |
131 | struct snd_soc_codec *codec = rtd->codec; | ||
131 | int ret; | 132 | int ret; |
132 | 133 | ||
133 | /* Add SDP4430 specific controls */ | 134 | /* Add SDP4430 specific controls */ |
@@ -164,8 +165,10 @@ static int sdp4430_twl6040_init(struct snd_soc_codec *codec) | |||
164 | static struct snd_soc_dai_link sdp4430_dai = { | 165 | static struct snd_soc_dai_link sdp4430_dai = { |
165 | .name = "TWL6040", | 166 | .name = "TWL6040", |
166 | .stream_name = "TWL6040", | 167 | .stream_name = "TWL6040", |
167 | .cpu_dai = &omap_mcpdm_dai, | 168 | .cpu_dai_name ="omap-mcpdm-dai", |
168 | .codec_dai = &twl6040_dai, | 169 | .codec_dai_name = "twl6040-hifi", |
170 | .platform_name = "omap-pcm-audio", | ||
171 | .codec_name = "twl6040-codec", | ||
169 | .init = sdp4430_twl6040_init, | 172 | .init = sdp4430_twl6040_init, |
170 | .ops = &sdp4430_ops, | 173 | .ops = &sdp4430_ops, |
171 | }; | 174 | }; |
@@ -173,17 +176,10 @@ static struct snd_soc_dai_link sdp4430_dai = { | |||
173 | /* Audio machine driver */ | 176 | /* Audio machine driver */ |
174 | static struct snd_soc_card snd_soc_sdp4430 = { | 177 | static struct snd_soc_card snd_soc_sdp4430 = { |
175 | .name = "SDP4430", | 178 | .name = "SDP4430", |
176 | .platform = &omap_soc_platform, | ||
177 | .dai_link = &sdp4430_dai, | 179 | .dai_link = &sdp4430_dai, |
178 | .num_links = 1, | 180 | .num_links = 1, |
179 | }; | 181 | }; |
180 | 182 | ||
181 | /* Audio subsystem */ | ||
182 | static struct snd_soc_device sdp4430_snd_devdata = { | ||
183 | .card = &snd_soc_sdp4430, | ||
184 | .codec_dev = &soc_codec_dev_twl6040, | ||
185 | }; | ||
186 | |||
187 | static struct platform_device *sdp4430_snd_device; | 183 | static struct platform_device *sdp4430_snd_device; |
188 | 184 | ||
189 | static int __init sdp4430_soc_init(void) | 185 | static int __init sdp4430_soc_init(void) |
@@ -202,8 +198,7 @@ static int __init sdp4430_soc_init(void) | |||
202 | return -ENOMEM; | 198 | return -ENOMEM; |
203 | } | 199 | } |
204 | 200 | ||
205 | platform_set_drvdata(sdp4430_snd_device, &sdp4430_snd_devdata); | 201 | platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); |
206 | sdp4430_snd_devdata.dev = &sdp4430_snd_device->dev; | ||
207 | 202 | ||
208 | ret = platform_device_add(sdp4430_snd_device); | 203 | ret = platform_device_add(sdp4430_snd_device); |
209 | if (ret) | 204 | if (ret) |
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c index 50a94ee76ecc..338dc9552bd6 100644 --- a/sound/soc/omap/zoom2.c +++ b/sound/soc/omap/zoom2.c | |||
@@ -29,21 +29,23 @@ | |||
29 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
31 | #include <mach/gpio.h> | 31 | #include <mach/gpio.h> |
32 | #include <mach/board-zoom.h> | ||
32 | #include <plat/mcbsp.h> | 33 | #include <plat/mcbsp.h> |
33 | 34 | ||
35 | /* Register descriptions for twl4030 codec part */ | ||
36 | #include <linux/mfd/twl4030-codec.h> | ||
37 | |||
34 | #include "omap-mcbsp.h" | 38 | #include "omap-mcbsp.h" |
35 | #include "omap-pcm.h" | 39 | #include "omap-pcm.h" |
36 | #include "../codecs/twl4030.h" | ||
37 | 40 | ||
38 | #define ZOOM2_HEADSET_MUX_GPIO (OMAP_MAX_GPIO_LINES + 15) | 41 | #define ZOOM2_HEADSET_MUX_GPIO (OMAP_MAX_GPIO_LINES + 15) |
39 | #define ZOOM2_HEADSET_EXTMUTE_GPIO 153 | ||
40 | 42 | ||
41 | static int zoom2_hw_params(struct snd_pcm_substream *substream, | 43 | static int zoom2_hw_params(struct snd_pcm_substream *substream, |
42 | struct snd_pcm_hw_params *params) | 44 | struct snd_pcm_hw_params *params) |
43 | { | 45 | { |
44 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 46 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
45 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 47 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
46 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 48 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
47 | int ret; | 49 | int ret; |
48 | 50 | ||
49 | /* Set codec DAI configuration */ | 51 | /* Set codec DAI configuration */ |
@@ -85,8 +87,8 @@ static int zoom2_hw_voice_params(struct snd_pcm_substream *substream, | |||
85 | struct snd_pcm_hw_params *params) | 87 | struct snd_pcm_hw_params *params) |
86 | { | 88 | { |
87 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 89 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
88 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 90 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
89 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 91 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
90 | int ret; | 92 | int ret; |
91 | 93 | ||
92 | /* Set codec DAI configuration */ | 94 | /* Set codec DAI configuration */ |
@@ -157,8 +159,9 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
157 | {"Aux In", NULL, "AUXR"}, | 159 | {"Aux In", NULL, "AUXR"}, |
158 | }; | 160 | }; |
159 | 161 | ||
160 | static int zoom2_twl4030_init(struct snd_soc_codec *codec) | 162 | static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd) |
161 | { | 163 | { |
164 | struct snd_soc_codec *codec = rtd->codec; | ||
162 | int ret; | 165 | int ret; |
163 | 166 | ||
164 | /* Add Zoom2 specific widgets */ | 167 | /* Add Zoom2 specific widgets */ |
@@ -192,14 +195,15 @@ static int zoom2_twl4030_init(struct snd_soc_codec *codec) | |||
192 | return ret; | 195 | return ret; |
193 | } | 196 | } |
194 | 197 | ||
195 | static int zoom2_twl4030_voice_init(struct snd_soc_codec *codec) | 198 | static int zoom2_twl4030_voice_init(struct snd_soc_pcm_runtime *rtd) |
196 | { | 199 | { |
200 | struct snd_soc_codec *codec = rtd->codec; | ||
197 | unsigned short reg; | 201 | unsigned short reg; |
198 | 202 | ||
199 | /* Enable voice interface */ | 203 | /* Enable voice interface */ |
200 | reg = codec->read(codec, TWL4030_REG_VOICE_IF); | 204 | reg = codec->driver->read(codec, TWL4030_REG_VOICE_IF); |
201 | reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN; | 205 | reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN; |
202 | codec->write(codec, TWL4030_REG_VOICE_IF, reg); | 206 | codec->driver->write(codec, TWL4030_REG_VOICE_IF, reg); |
203 | 207 | ||
204 | return 0; | 208 | return 0; |
205 | } | 209 | } |
@@ -209,16 +213,20 @@ static struct snd_soc_dai_link zoom2_dai[] = { | |||
209 | { | 213 | { |
210 | .name = "TWL4030 I2S", | 214 | .name = "TWL4030 I2S", |
211 | .stream_name = "TWL4030 Audio", | 215 | .stream_name = "TWL4030 Audio", |
212 | .cpu_dai = &omap_mcbsp_dai[0], | 216 | .cpu_dai_name = "omap-mcbsp-dai.1", |
213 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 217 | .codec_dai_name = "twl4030-hifi", |
218 | .platform_name = "omap-pcm-audio", | ||
219 | .codec_name = "twl4030-codec", | ||
214 | .init = zoom2_twl4030_init, | 220 | .init = zoom2_twl4030_init, |
215 | .ops = &zoom2_ops, | 221 | .ops = &zoom2_ops, |
216 | }, | 222 | }, |
217 | { | 223 | { |
218 | .name = "TWL4030 PCM", | 224 | .name = "TWL4030 PCM", |
219 | .stream_name = "TWL4030 Voice", | 225 | .stream_name = "TWL4030 Voice", |
220 | .cpu_dai = &omap_mcbsp_dai[1], | 226 | .cpu_dai_name = "omap-mcbsp-dai.2", |
221 | .codec_dai = &twl4030_dai[TWL4030_DAI_VOICE], | 227 | .codec_dai_name = "twl4030-voice", |
228 | .platform_name = "omap-pcm-audio", | ||
229 | .codec_name = "twl4030-codec", | ||
222 | .init = zoom2_twl4030_voice_init, | 230 | .init = zoom2_twl4030_voice_init, |
223 | .ops = &zoom2_voice_ops, | 231 | .ops = &zoom2_voice_ops, |
224 | }, | 232 | }, |
@@ -227,32 +235,10 @@ static struct snd_soc_dai_link zoom2_dai[] = { | |||
227 | /* Audio machine driver */ | 235 | /* Audio machine driver */ |
228 | static struct snd_soc_card snd_soc_zoom2 = { | 236 | static struct snd_soc_card snd_soc_zoom2 = { |
229 | .name = "Zoom2", | 237 | .name = "Zoom2", |
230 | .platform = &omap_soc_platform, | ||
231 | .dai_link = zoom2_dai, | 238 | .dai_link = zoom2_dai, |
232 | .num_links = ARRAY_SIZE(zoom2_dai), | 239 | .num_links = ARRAY_SIZE(zoom2_dai), |
233 | }; | 240 | }; |
234 | 241 | ||
235 | /* EXTMUTE callback function */ | ||
236 | void zoom2_set_hs_extmute(int mute) | ||
237 | { | ||
238 | gpio_set_value(ZOOM2_HEADSET_EXTMUTE_GPIO, mute); | ||
239 | } | ||
240 | |||
241 | /* twl4030 setup */ | ||
242 | static struct twl4030_setup_data twl4030_setup = { | ||
243 | .ramp_delay_value = 3, /* 161 ms */ | ||
244 | .sysclk = 26000, | ||
245 | .hs_extmute = 1, | ||
246 | .set_hs_extmute = zoom2_set_hs_extmute, | ||
247 | }; | ||
248 | |||
249 | /* Audio subsystem */ | ||
250 | static struct snd_soc_device zoom2_snd_devdata = { | ||
251 | .card = &snd_soc_zoom2, | ||
252 | .codec_dev = &soc_codec_dev_twl4030, | ||
253 | .codec_data = &twl4030_setup, | ||
254 | }; | ||
255 | |||
256 | static struct platform_device *zoom2_snd_device; | 242 | static struct platform_device *zoom2_snd_device; |
257 | 243 | ||
258 | static int __init zoom2_soc_init(void) | 244 | static int __init zoom2_soc_init(void) |
@@ -271,11 +257,7 @@ static int __init zoom2_soc_init(void) | |||
271 | return -ENOMEM; | 257 | return -ENOMEM; |
272 | } | 258 | } |
273 | 259 | ||
274 | platform_set_drvdata(zoom2_snd_device, &zoom2_snd_devdata); | 260 | platform_set_drvdata(zoom2_snd_device, &snd_soc_zoom2); |
275 | zoom2_snd_devdata.dev = &zoom2_snd_device->dev; | ||
276 | *(unsigned int *)zoom2_dai[0].cpu_dai->private_data = 1; /* McBSP2 */ | ||
277 | *(unsigned int *)zoom2_dai[1].cpu_dai->private_data = 2; /* McBSP3 */ | ||
278 | |||
279 | ret = platform_device_add(zoom2_snd_device); | 261 | ret = platform_device_add(zoom2_snd_device); |
280 | if (ret) | 262 | if (ret) |
281 | goto err1; | 263 | goto err1; |