aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@slimlogic.co.uk>2010-11-05 09:53:46 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-06 11:28:29 -0400
commitce6120cca2589ede530200c7cfe11ac9f144333c (patch)
tree6ea7c26ce64dd4753e7cf9a3b048e74614b169dc /sound/soc/omap
parent22e2fda5660cdf62513acabdb5c82a5af415f838 (diff)
ASoC: Decouple DAPM from CODECs
Decoupling Dynamic Audio Power Management (DAPM) from codec devices is required when developing ASoC further. Such as for other ASoC components to have DAPM widgets or when extending DAPM to handle cross-device paths. This patch decouples DAPM related variables from struct snd_soc_codec and moves them to new struct snd_soc_dapm_context that is used to encapsulate DAPM context of a device. ASoC core and API of DAPM functions are modified to use DAPM context instead of codec. This patch does not change current functionality and a large part of changes come because of structure and internal API changes. Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some minor core changes, codecs and machine driver conversions from Jarkko Nikula <jhnikula@gmail.com>. Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Manuel Lauss <manuel.lauss@googlemail.com> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> Cc: Ryan Mallon <ryan@bluewatersys.com> Cc: Timur Tabi <timur@freescale.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jassi Brar <jassi.brar@samsung.com> Cc: Daniel Gloeckner <dg@emlix.com> Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/omap')
-rw-r--r--sound/soc/omap/am3517evm.c13
-rw-r--r--sound/soc/omap/ams-delta.c82
-rw-r--r--sound/soc/omap/n810.c42
-rw-r--r--sound/soc/omap/omap3pandora.c44
-rw-r--r--sound/soc/omap/osk5912.c13
-rw-r--r--sound/soc/omap/rx51.c25
-rw-r--r--sound/soc/omap/sdp3430.c43
-rw-r--r--sound/soc/omap/sdp4430.c19
-rw-r--r--sound/soc/omap/zoom2.c35
9 files changed, 166 insertions, 150 deletions
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c
index 979dd508305f..668773def0dc 100644
--- a/sound/soc/omap/am3517evm.c
+++ b/sound/soc/omap/am3517evm.c
@@ -114,20 +114,21 @@ static const struct snd_soc_dapm_route audio_map[] = {
114static int am3517evm_aic23_init(struct snd_soc_pcm_runtime *rtd) 114static int am3517evm_aic23_init(struct snd_soc_pcm_runtime *rtd)
115{ 115{
116 struct snd_soc_codec *codec = rtd->codec; 116 struct snd_soc_codec *codec = rtd->codec;
117 struct snd_soc_dapm_context *dapm = &codec->dapm;
117 118
118 /* Add am3517-evm specific widgets */ 119 /* Add am3517-evm specific widgets */
119 snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, 120 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
120 ARRAY_SIZE(tlv320aic23_dapm_widgets)); 121 ARRAY_SIZE(tlv320aic23_dapm_widgets));
121 122
122 /* Set up davinci-evm specific audio path audio_map */ 123 /* Set up davinci-evm specific audio path audio_map */
123 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 124 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
124 125
125 /* always connected */ 126 /* always connected */
126 snd_soc_dapm_enable_pin(codec, "Line Out"); 127 snd_soc_dapm_enable_pin(dapm, "Line Out");
127 snd_soc_dapm_enable_pin(codec, "Line In"); 128 snd_soc_dapm_enable_pin(dapm, "Line In");
128 snd_soc_dapm_enable_pin(codec, "Mic In"); 129 snd_soc_dapm_enable_pin(dapm, "Mic In");
129 130
130 snd_soc_dapm_sync(codec); 131 snd_soc_dapm_sync(dapm);
131 132
132 return 0; 133 return 0;
133} 134}
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 438146addbb8..2101bdcee21f 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -26,7 +26,7 @@
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/tty.h> 27#include <linux/tty.h>
28 28
29#include <sound/soc-dapm.h> 29#include <sound/soc.h>
30#include <sound/jack.h> 30#include <sound/jack.h>
31 31
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -94,6 +94,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
94 struct snd_ctl_elem_value *ucontrol) 94 struct snd_ctl_elem_value *ucontrol)
95{ 95{
96 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 96 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
97 struct snd_soc_dapm_context *dapm = &codec->dapm;
97 struct soc_enum *control = (struct soc_enum *)kcontrol->private_value; 98 struct soc_enum *control = (struct soc_enum *)kcontrol->private_value;
98 unsigned short pins; 99 unsigned short pins;
99 int pin, changed = 0; 100 int pin, changed = 0;
@@ -112,48 +113,48 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
112 113
113 /* Setup pins after corresponding bits if changed */ 114 /* Setup pins after corresponding bits if changed */
114 pin = !!(pins & (1 << AMS_DELTA_MOUTHPIECE)); 115 pin = !!(pins & (1 << AMS_DELTA_MOUTHPIECE));
115 if (pin != snd_soc_dapm_get_pin_status(codec, "Mouthpiece")) { 116 if (pin != snd_soc_dapm_get_pin_status(dapm, "Mouthpiece")) {
116 changed = 1; 117 changed = 1;
117 if (pin) 118 if (pin)
118 snd_soc_dapm_enable_pin(codec, "Mouthpiece"); 119 snd_soc_dapm_enable_pin(dapm, "Mouthpiece");
119 else 120 else
120 snd_soc_dapm_disable_pin(codec, "Mouthpiece"); 121 snd_soc_dapm_disable_pin(dapm, "Mouthpiece");
121 } 122 }
122 pin = !!(pins & (1 << AMS_DELTA_EARPIECE)); 123 pin = !!(pins & (1 << AMS_DELTA_EARPIECE));
123 if (pin != snd_soc_dapm_get_pin_status(codec, "Earpiece")) { 124 if (pin != snd_soc_dapm_get_pin_status(dapm, "Earpiece")) {
124 changed = 1; 125 changed = 1;
125 if (pin) 126 if (pin)
126 snd_soc_dapm_enable_pin(codec, "Earpiece"); 127 snd_soc_dapm_enable_pin(dapm, "Earpiece");
127 else 128 else
128 snd_soc_dapm_disable_pin(codec, "Earpiece"); 129 snd_soc_dapm_disable_pin(dapm, "Earpiece");
129 } 130 }
130 pin = !!(pins & (1 << AMS_DELTA_MICROPHONE)); 131 pin = !!(pins & (1 << AMS_DELTA_MICROPHONE));
131 if (pin != snd_soc_dapm_get_pin_status(codec, "Microphone")) { 132 if (pin != snd_soc_dapm_get_pin_status(dapm, "Microphone")) {
132 changed = 1; 133 changed = 1;
133 if (pin) 134 if (pin)
134 snd_soc_dapm_enable_pin(codec, "Microphone"); 135 snd_soc_dapm_enable_pin(dapm, "Microphone");
135 else 136 else
136 snd_soc_dapm_disable_pin(codec, "Microphone"); 137 snd_soc_dapm_disable_pin(dapm, "Microphone");
137 } 138 }
138 pin = !!(pins & (1 << AMS_DELTA_SPEAKER)); 139 pin = !!(pins & (1 << AMS_DELTA_SPEAKER));
139 if (pin != snd_soc_dapm_get_pin_status(codec, "Speaker")) { 140 if (pin != snd_soc_dapm_get_pin_status(dapm, "Speaker")) {
140 changed = 1; 141 changed = 1;
141 if (pin) 142 if (pin)
142 snd_soc_dapm_enable_pin(codec, "Speaker"); 143 snd_soc_dapm_enable_pin(dapm, "Speaker");
143 else 144 else
144 snd_soc_dapm_disable_pin(codec, "Speaker"); 145 snd_soc_dapm_disable_pin(dapm, "Speaker");
145 } 146 }
146 pin = !!(pins & (1 << AMS_DELTA_AGC)); 147 pin = !!(pins & (1 << AMS_DELTA_AGC));
147 if (pin != ams_delta_audio_agc) { 148 if (pin != ams_delta_audio_agc) {
148 ams_delta_audio_agc = pin; 149 ams_delta_audio_agc = pin;
149 changed = 1; 150 changed = 1;
150 if (pin) 151 if (pin)
151 snd_soc_dapm_enable_pin(codec, "AGCIN"); 152 snd_soc_dapm_enable_pin(dapm, "AGCIN");
152 else 153 else
153 snd_soc_dapm_disable_pin(codec, "AGCIN"); 154 snd_soc_dapm_disable_pin(dapm, "AGCIN");
154 } 155 }
155 if (changed) 156 if (changed)
156 snd_soc_dapm_sync(codec); 157 snd_soc_dapm_sync(dapm);
157 158
158 mutex_unlock(&codec->mutex); 159 mutex_unlock(&codec->mutex);
159 160
@@ -164,19 +165,20 @@ static int ams_delta_get_audio_mode(struct snd_kcontrol *kcontrol,
164 struct snd_ctl_elem_value *ucontrol) 165 struct snd_ctl_elem_value *ucontrol)
165{ 166{
166 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 167 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
168 struct snd_soc_dapm_context *dapm = &codec->dapm;
167 unsigned short pins, mode; 169 unsigned short pins, mode;
168 170
169 pins = ((snd_soc_dapm_get_pin_status(codec, "Mouthpiece") << 171 pins = ((snd_soc_dapm_get_pin_status(dapm, "Mouthpiece") <<
170 AMS_DELTA_MOUTHPIECE) | 172 AMS_DELTA_MOUTHPIECE) |
171 (snd_soc_dapm_get_pin_status(codec, "Earpiece") << 173 (snd_soc_dapm_get_pin_status(dapm, "Earpiece") <<
172 AMS_DELTA_EARPIECE)); 174 AMS_DELTA_EARPIECE));
173 if (pins) 175 if (pins)
174 pins |= (snd_soc_dapm_get_pin_status(codec, "Microphone") << 176 pins |= (snd_soc_dapm_get_pin_status(dapm, "Microphone") <<
175 AMS_DELTA_MICROPHONE); 177 AMS_DELTA_MICROPHONE);
176 else 178 else
177 pins = ((snd_soc_dapm_get_pin_status(codec, "Microphone") << 179 pins = ((snd_soc_dapm_get_pin_status(dapm, "Microphone") <<
178 AMS_DELTA_MICROPHONE) | 180 AMS_DELTA_MICROPHONE) |
179 (snd_soc_dapm_get_pin_status(codec, "Speaker") << 181 (snd_soc_dapm_get_pin_status(dapm, "Speaker") <<
180 AMS_DELTA_SPEAKER) | 182 AMS_DELTA_SPEAKER) |
181 (ams_delta_audio_agc << AMS_DELTA_AGC)); 183 (ams_delta_audio_agc << AMS_DELTA_AGC));
182 184
@@ -300,6 +302,7 @@ static int cx81801_open(struct tty_struct *tty)
300static void cx81801_close(struct tty_struct *tty) 302static void cx81801_close(struct tty_struct *tty)
301{ 303{
302 struct snd_soc_codec *codec = tty->disc_data; 304 struct snd_soc_codec *codec = tty->disc_data;
305 struct snd_soc_dapm_context *dapm = &codec->dapm;
303 306
304 del_timer_sync(&cx81801_timer); 307 del_timer_sync(&cx81801_timer);
305 308
@@ -312,12 +315,12 @@ static void cx81801_close(struct tty_struct *tty)
312 v253_ops.close(tty); 315 v253_ops.close(tty);
313 316
314 /* Revert back to default audio input/output constellation */ 317 /* Revert back to default audio input/output constellation */
315 snd_soc_dapm_disable_pin(codec, "Mouthpiece"); 318 snd_soc_dapm_disable_pin(dapm, "Mouthpiece");
316 snd_soc_dapm_enable_pin(codec, "Earpiece"); 319 snd_soc_dapm_enable_pin(dapm, "Earpiece");
317 snd_soc_dapm_enable_pin(codec, "Microphone"); 320 snd_soc_dapm_enable_pin(dapm, "Microphone");
318 snd_soc_dapm_disable_pin(codec, "Speaker"); 321 snd_soc_dapm_disable_pin(dapm, "Speaker");
319 snd_soc_dapm_disable_pin(codec, "AGCIN"); 322 snd_soc_dapm_disable_pin(dapm, "AGCIN");
320 snd_soc_dapm_sync(codec); 323 snd_soc_dapm_sync(dapm);
321} 324}
322 325
323/* Line discipline .hangup() */ 326/* Line discipline .hangup() */
@@ -432,16 +435,16 @@ static int ams_delta_set_bias_level(struct snd_soc_card *card,
432 case SND_SOC_BIAS_ON: 435 case SND_SOC_BIAS_ON:
433 case SND_SOC_BIAS_PREPARE: 436 case SND_SOC_BIAS_PREPARE:
434 case SND_SOC_BIAS_STANDBY: 437 case SND_SOC_BIAS_STANDBY:
435 if (codec->bias_level == SND_SOC_BIAS_OFF) 438 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
436 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, 439 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
437 AMS_DELTA_LATCH2_MODEM_NRESET); 440 AMS_DELTA_LATCH2_MODEM_NRESET);
438 break; 441 break;
439 case SND_SOC_BIAS_OFF: 442 case SND_SOC_BIAS_OFF:
440 if (codec->bias_level != SND_SOC_BIAS_OFF) 443 if (codec->dapm.bias_level != SND_SOC_BIAS_OFF)
441 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, 444 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
442 0); 445 0);
443 } 446 }
444 codec->bias_level = level; 447 codec->dapm.bias_level = level;
445 448
446 return 0; 449 return 0;
447} 450}
@@ -492,6 +495,7 @@ static void ams_delta_shutdown(struct snd_pcm_substream *substream)
492static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) 495static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
493{ 496{
494 struct snd_soc_codec *codec = rtd->codec; 497 struct snd_soc_codec *codec = rtd->codec;
498 struct snd_soc_dapm_context *dapm = &codec->dapm;
495 struct snd_soc_dai *codec_dai = rtd->codec_dai; 499 struct snd_soc_dai *codec_dai = rtd->codec_dai;
496 struct snd_soc_card *card = rtd->card; 500 struct snd_soc_card *card = rtd->card;
497 int ret; 501 int ret;
@@ -541,7 +545,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
541 } 545 }
542 546
543 /* Add board specific DAPM widgets and routes */ 547 /* Add board specific DAPM widgets and routes */
544 ret = snd_soc_dapm_new_controls(codec, ams_delta_dapm_widgets, 548 ret = snd_soc_dapm_new_controls(dapm, ams_delta_dapm_widgets,
545 ARRAY_SIZE(ams_delta_dapm_widgets)); 549 ARRAY_SIZE(ams_delta_dapm_widgets));
546 if (ret) { 550 if (ret) {
547 dev_warn(card->dev, 551 dev_warn(card->dev,
@@ -550,7 +554,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
550 return 0; 554 return 0;
551 } 555 }
552 556
553 ret = snd_soc_dapm_add_routes(codec, ams_delta_audio_map, 557 ret = snd_soc_dapm_add_routes(dapm, ams_delta_audio_map,
554 ARRAY_SIZE(ams_delta_audio_map)); 558 ARRAY_SIZE(ams_delta_audio_map));
555 if (ret) { 559 if (ret) {
556 dev_warn(card->dev, 560 dev_warn(card->dev,
@@ -560,13 +564,13 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
560 } 564 }
561 565
562 /* Set up initial pin constellation */ 566 /* Set up initial pin constellation */
563 snd_soc_dapm_disable_pin(codec, "Mouthpiece"); 567 snd_soc_dapm_disable_pin(dapm, "Mouthpiece");
564 snd_soc_dapm_enable_pin(codec, "Earpiece"); 568 snd_soc_dapm_enable_pin(dapm, "Earpiece");
565 snd_soc_dapm_enable_pin(codec, "Microphone"); 569 snd_soc_dapm_enable_pin(dapm, "Microphone");
566 snd_soc_dapm_disable_pin(codec, "Speaker"); 570 snd_soc_dapm_disable_pin(dapm, "Speaker");
567 snd_soc_dapm_disable_pin(codec, "AGCIN"); 571 snd_soc_dapm_disable_pin(dapm, "AGCIN");
568 snd_soc_dapm_disable_pin(codec, "AGCOUT"); 572 snd_soc_dapm_disable_pin(dapm, "AGCOUT");
569 snd_soc_dapm_sync(codec); 573 snd_soc_dapm_sync(dapm);
570 574
571 /* Add virtual switch */ 575 /* Add virtual switch */
572 ret = snd_soc_add_controls(codec, ams_delta_audio_controls, 576 ret = snd_soc_add_controls(codec, ams_delta_audio_controls,
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index a3b6d897ad84..296cd9b7eecb 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -58,6 +58,7 @@ static int n810_dmic_func;
58 58
59static void n810_ext_control(struct snd_soc_codec *codec) 59static void n810_ext_control(struct snd_soc_codec *codec)
60{ 60{
61 struct snd_soc_dapm_context *dapm = &codec->dapm;
61 int hp = 0, line1l = 0; 62 int hp = 0, line1l = 0;
62 63
63 switch (n810_jack_func) { 64 switch (n810_jack_func) {
@@ -72,25 +73,25 @@ static void n810_ext_control(struct snd_soc_codec *codec)
72 } 73 }
73 74
74 if (n810_spk_func) 75 if (n810_spk_func)
75 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 76 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
76 else 77 else
77 snd_soc_dapm_disable_pin(codec, "Ext Spk"); 78 snd_soc_dapm_disable_pin(dapm, "Ext Spk");
78 79
79 if (hp) 80 if (hp)
80 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 81 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
81 else 82 else
82 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 83 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
83 if (line1l) 84 if (line1l)
84 snd_soc_dapm_enable_pin(codec, "LINE1L"); 85 snd_soc_dapm_enable_pin(dapm, "LINE1L");
85 else 86 else
86 snd_soc_dapm_disable_pin(codec, "LINE1L"); 87 snd_soc_dapm_disable_pin(dapm, "LINE1L");
87 88
88 if (n810_dmic_func) 89 if (n810_dmic_func)
89 snd_soc_dapm_enable_pin(codec, "DMic"); 90 snd_soc_dapm_enable_pin(dapm, "DMic");
90 else 91 else
91 snd_soc_dapm_disable_pin(codec, "DMic"); 92 snd_soc_dapm_disable_pin(dapm, "DMic");
92 93
93 snd_soc_dapm_sync(codec); 94 snd_soc_dapm_sync(dapm);
94} 95}
95 96
96static int n810_startup(struct snd_pcm_substream *substream) 97static int n810_startup(struct snd_pcm_substream *substream)
@@ -274,17 +275,18 @@ static const struct snd_kcontrol_new aic33_n810_controls[] = {
274static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd) 275static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)
275{ 276{
276 struct snd_soc_codec *codec = rtd->codec; 277 struct snd_soc_codec *codec = rtd->codec;
278 struct snd_soc_dapm_context *dapm = &codec->dapm;
277 int err; 279 int err;
278 280
279 /* Not connected */ 281 /* Not connected */
280 snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); 282 snd_soc_dapm_nc_pin(dapm, "MONO_LOUT");
281 snd_soc_dapm_nc_pin(codec, "HPLCOM"); 283 snd_soc_dapm_nc_pin(dapm, "HPLCOM");
282 snd_soc_dapm_nc_pin(codec, "HPRCOM"); 284 snd_soc_dapm_nc_pin(dapm, "HPRCOM");
283 snd_soc_dapm_nc_pin(codec, "MIC3L"); 285 snd_soc_dapm_nc_pin(dapm, "MIC3L");
284 snd_soc_dapm_nc_pin(codec, "MIC3R"); 286 snd_soc_dapm_nc_pin(dapm, "MIC3R");
285 snd_soc_dapm_nc_pin(codec, "LINE1R"); 287 snd_soc_dapm_nc_pin(dapm, "LINE1R");
286 snd_soc_dapm_nc_pin(codec, "LINE2L"); 288 snd_soc_dapm_nc_pin(dapm, "LINE2L");
287 snd_soc_dapm_nc_pin(codec, "LINE2R"); 289 snd_soc_dapm_nc_pin(dapm, "LINE2R");
288 290
289 /* Add N810 specific controls */ 291 /* Add N810 specific controls */
290 err = snd_soc_add_controls(codec, aic33_n810_controls, 292 err = snd_soc_add_controls(codec, aic33_n810_controls,
@@ -293,13 +295,13 @@ static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)
293 return err; 295 return err;
294 296
295 /* Add N810 specific widgets */ 297 /* Add N810 specific widgets */
296 snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, 298 snd_soc_dapm_new_controls(dapm, aic33_dapm_widgets,
297 ARRAY_SIZE(aic33_dapm_widgets)); 299 ARRAY_SIZE(aic33_dapm_widgets));
298 300
299 /* Set up N810 specific audio path audio_map */ 301 /* Set up N810 specific audio path audio_map */
300 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 302 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
301 303
302 snd_soc_dapm_sync(codec); 304 snd_soc_dapm_sync(dapm);
303 305
304 return 0; 306 return 0;
305} 307}
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index dbd9d96b5f92..93e83c0f6660 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -170,51 +170,53 @@ static const struct snd_soc_dapm_route omap3pandora_in_map[] = {
170static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) 170static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
171{ 171{
172 struct snd_soc_codec *codec = rtd->codec; 172 struct snd_soc_codec *codec = rtd->codec;
173 struct snd_soc_dapm_context *dapm = &codec->dapm;
173 int ret; 174 int ret;
174 175
175 /* All TWL4030 output pins are floating */ 176 /* All TWL4030 output pins are floating */
176 snd_soc_dapm_nc_pin(codec, "EARPIECE"); 177 snd_soc_dapm_nc_pin(dapm, "EARPIECE");
177 snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); 178 snd_soc_dapm_nc_pin(dapm, "PREDRIVEL");
178 snd_soc_dapm_nc_pin(codec, "PREDRIVER"); 179 snd_soc_dapm_nc_pin(dapm, "PREDRIVER");
179 snd_soc_dapm_nc_pin(codec, "HSOL"); 180 snd_soc_dapm_nc_pin(dapm, "HSOL");
180 snd_soc_dapm_nc_pin(codec, "HSOR"); 181 snd_soc_dapm_nc_pin(dapm, "HSOR");
181 snd_soc_dapm_nc_pin(codec, "CARKITL"); 182 snd_soc_dapm_nc_pin(dapm, "CARKITL");
182 snd_soc_dapm_nc_pin(codec, "CARKITR"); 183 snd_soc_dapm_nc_pin(dapm, "CARKITR");
183 snd_soc_dapm_nc_pin(codec, "HFL"); 184 snd_soc_dapm_nc_pin(dapm, "HFL");
184 snd_soc_dapm_nc_pin(codec, "HFR"); 185 snd_soc_dapm_nc_pin(dapm, "HFR");
185 snd_soc_dapm_nc_pin(codec, "VIBRA"); 186 snd_soc_dapm_nc_pin(dapm, "VIBRA");
186 187
187 ret = snd_soc_dapm_new_controls(codec, omap3pandora_out_dapm_widgets, 188 ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets,
188 ARRAY_SIZE(omap3pandora_out_dapm_widgets)); 189 ARRAY_SIZE(omap3pandora_out_dapm_widgets));
189 if (ret < 0) 190 if (ret < 0)
190 return ret; 191 return ret;
191 192
192 snd_soc_dapm_add_routes(codec, omap3pandora_out_map, 193 snd_soc_dapm_add_routes(dapm, omap3pandora_out_map,
193 ARRAY_SIZE(omap3pandora_out_map)); 194 ARRAY_SIZE(omap3pandora_out_map));
194 195
195 return snd_soc_dapm_sync(codec); 196 return snd_soc_dapm_sync(dapm);
196} 197}
197 198
198static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) 199static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
199{ 200{
200 struct snd_soc_codec *codec = rtd->codec; 201 struct snd_soc_codec *codec = rtd->codec;
202 struct snd_soc_dapm_context *dapm = &codec->dapm;
201 int ret; 203 int ret;
202 204
203 /* Not comnnected */ 205 /* Not comnnected */
204 snd_soc_dapm_nc_pin(codec, "HSMIC"); 206 snd_soc_dapm_nc_pin(dapm, "HSMIC");
205 snd_soc_dapm_nc_pin(codec, "CARKITMIC"); 207 snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
206 snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); 208 snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
207 snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); 209 snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
208 210
209 ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, 211 ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets,
210 ARRAY_SIZE(omap3pandora_in_dapm_widgets)); 212 ARRAY_SIZE(omap3pandora_in_dapm_widgets));
211 if (ret < 0) 213 if (ret < 0)
212 return ret; 214 return ret;
213 215
214 snd_soc_dapm_add_routes(codec, omap3pandora_in_map, 216 snd_soc_dapm_add_routes(dapm, omap3pandora_in_map,
215 ARRAY_SIZE(omap3pandora_in_map)); 217 ARRAY_SIZE(omap3pandora_in_map));
216 218
217 return snd_soc_dapm_sync(codec); 219 return snd_soc_dapm_sync(dapm);
218} 220}
219 221
220static struct snd_soc_ops omap3pandora_ops = { 222static struct snd_soc_ops omap3pandora_ops = {
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index f0e662556428..c2a54204559d 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -116,19 +116,20 @@ static const struct snd_soc_dapm_route audio_map[] = {
116static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) 116static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
117{ 117{
118 struct snd_soc_codec *codec = rtd->codec; 118 struct snd_soc_codec *codec = rtd->codec;
119 struct snd_soc_dapm_context *dapm = &codec->dapm;
119 120
120 /* Add osk5912 specific widgets */ 121 /* Add osk5912 specific widgets */
121 snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, 122 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
122 ARRAY_SIZE(tlv320aic23_dapm_widgets)); 123 ARRAY_SIZE(tlv320aic23_dapm_widgets));
123 124
124 /* Set up osk5912 specific audio path audio_map */ 125 /* Set up osk5912 specific audio path audio_map */
125 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 126 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
126 127
127 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 128 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
128 snd_soc_dapm_enable_pin(codec, "Line In"); 129 snd_soc_dapm_enable_pin(dapm, "Line In");
129 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 130 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
130 131
131 snd_soc_dapm_sync(codec); 132 snd_soc_dapm_sync(dapm);
132 133
133 return 0; 134 return 0;
134} 135}
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 04b5723bf89b..62fc7a4f306b 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -58,19 +58,21 @@ static int rx51_jack_func;
58 58
59static void rx51_ext_control(struct snd_soc_codec *codec) 59static void rx51_ext_control(struct snd_soc_codec *codec)
60{ 60{
61 struct snd_soc_dapm_context *dapm = &codec->dapm;
62
61 if (rx51_spk_func) 63 if (rx51_spk_func)
62 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 64 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
63 else 65 else
64 snd_soc_dapm_disable_pin(codec, "Ext Spk"); 66 snd_soc_dapm_disable_pin(dapm, "Ext Spk");
65 if (rx51_dmic_func) 67 if (rx51_dmic_func)
66 snd_soc_dapm_enable_pin(codec, "DMic"); 68 snd_soc_dapm_enable_pin(dapm, "DMic");
67 else 69 else
68 snd_soc_dapm_disable_pin(codec, "DMic"); 70 snd_soc_dapm_disable_pin(dapm, "DMic");
69 71
70 gpio_set_value(RX51_TVOUT_SEL_GPIO, 72 gpio_set_value(RX51_TVOUT_SEL_GPIO,
71 rx51_jack_func == RX51_JACK_TVOUT); 73 rx51_jack_func == RX51_JACK_TVOUT);
72 74
73 snd_soc_dapm_sync(codec); 75 snd_soc_dapm_sync(dapm);
74} 76}
75 77
76static int rx51_startup(struct snd_pcm_substream *substream) 78static int rx51_startup(struct snd_pcm_substream *substream)
@@ -244,12 +246,13 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = {
244static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) 246static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
245{ 247{
246 struct snd_soc_codec *codec = rtd->codec; 248 struct snd_soc_codec *codec = rtd->codec;
249 struct snd_soc_dapm_context *dapm = &codec->dapm;
247 int err; 250 int err;
248 251
249 /* Set up NC codec pins */ 252 /* Set up NC codec pins */
250 snd_soc_dapm_nc_pin(codec, "MIC3L"); 253 snd_soc_dapm_nc_pin(dapm, "MIC3L");
251 snd_soc_dapm_nc_pin(codec, "MIC3R"); 254 snd_soc_dapm_nc_pin(dapm, "MIC3R");
252 snd_soc_dapm_nc_pin(codec, "LINE1R"); 255 snd_soc_dapm_nc_pin(dapm, "LINE1R");
253 256
254 /* Add RX-51 specific controls */ 257 /* Add RX-51 specific controls */
255 err = snd_soc_add_controls(codec, aic34_rx51_controls, 258 err = snd_soc_add_controls(codec, aic34_rx51_controls,
@@ -258,13 +261,13 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
258 return err; 261 return err;
259 262
260 /* Add RX-51 specific widgets */ 263 /* Add RX-51 specific widgets */
261 snd_soc_dapm_new_controls(codec, aic34_dapm_widgets, 264 snd_soc_dapm_new_controls(dapm, aic34_dapm_widgets,
262 ARRAY_SIZE(aic34_dapm_widgets)); 265 ARRAY_SIZE(aic34_dapm_widgets));
263 266
264 /* Set up RX-51 specific audio path audio_map */ 267 /* Set up RX-51 specific audio path audio_map */
265 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 268 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
266 269
267 snd_soc_dapm_sync(codec); 270 snd_soc_dapm_sync(dapm);
268 271
269 /* AV jack detection */ 272 /* AV jack detection */
270 err = snd_soc_jack_new(codec, "AV Jack", 273 err = snd_soc_jack_new(codec, "AV Jack",
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 07fbcf7d2411..a3dd07a39fec 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -191,39 +191,40 @@ static const struct snd_soc_dapm_route audio_map[] = {
191static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd) 191static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)
192{ 192{
193 struct snd_soc_codec *codec = rtd->codec; 193 struct snd_soc_codec *codec = rtd->codec;
194 struct snd_soc_dapm_context *dapm = &codec->dapm;
194 int ret; 195 int ret;
195 196
196 /* Add SDP3430 specific widgets */ 197 /* Add SDP3430 specific widgets */
197 ret = snd_soc_dapm_new_controls(codec, sdp3430_twl4030_dapm_widgets, 198 ret = snd_soc_dapm_new_controls(dapm, sdp3430_twl4030_dapm_widgets,
198 ARRAY_SIZE(sdp3430_twl4030_dapm_widgets)); 199 ARRAY_SIZE(sdp3430_twl4030_dapm_widgets));
199 if (ret) 200 if (ret)
200 return ret; 201 return ret;
201 202
202 /* Set up SDP3430 specific audio path audio_map */ 203 /* Set up SDP3430 specific audio path audio_map */
203 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 204 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
204 205
205 /* SDP3430 connected pins */ 206 /* SDP3430 connected pins */
206 snd_soc_dapm_enable_pin(codec, "Ext Mic"); 207 snd_soc_dapm_enable_pin(dapm, "Ext Mic");
207 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 208 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
208 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 209 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
209 snd_soc_dapm_disable_pin(codec, "Headset Stereophone"); 210 snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");
210 211
211 /* TWL4030 not connected pins */ 212 /* TWL4030 not connected pins */
212 snd_soc_dapm_nc_pin(codec, "AUXL"); 213 snd_soc_dapm_nc_pin(dapm, "AUXL");
213 snd_soc_dapm_nc_pin(codec, "AUXR"); 214 snd_soc_dapm_nc_pin(dapm, "AUXR");
214 snd_soc_dapm_nc_pin(codec, "CARKITMIC"); 215 snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
215 snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); 216 snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
216 snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); 217 snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
217 218
218 snd_soc_dapm_nc_pin(codec, "OUTL"); 219 snd_soc_dapm_nc_pin(dapm, "OUTL");
219 snd_soc_dapm_nc_pin(codec, "OUTR"); 220 snd_soc_dapm_nc_pin(dapm, "OUTR");
220 snd_soc_dapm_nc_pin(codec, "EARPIECE"); 221 snd_soc_dapm_nc_pin(dapm, "EARPIECE");
221 snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); 222 snd_soc_dapm_nc_pin(dapm, "PREDRIVEL");
222 snd_soc_dapm_nc_pin(codec, "PREDRIVER"); 223 snd_soc_dapm_nc_pin(dapm, "PREDRIVER");
223 snd_soc_dapm_nc_pin(codec, "CARKITL"); 224 snd_soc_dapm_nc_pin(dapm, "CARKITL");
224 snd_soc_dapm_nc_pin(codec, "CARKITR"); 225 snd_soc_dapm_nc_pin(dapm, "CARKITR");
225 226
226 ret = snd_soc_dapm_sync(codec); 227 ret = snd_soc_dapm_sync(dapm);
227 if (ret) 228 if (ret)
228 return ret; 229 return ret;
229 230
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index 4b4463db6ba0..3ce17318a291 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -129,6 +129,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
129static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) 129static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
130{ 130{
131 struct snd_soc_codec *codec = rtd->codec; 131 struct snd_soc_codec *codec = rtd->codec;
132 struct snd_soc_dapm_context *dapm = &codec->dapm;
132 int ret; 133 int ret;
133 134
134 /* Add SDP4430 specific controls */ 135 /* Add SDP4430 specific controls */
@@ -138,25 +139,25 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
138 return ret; 139 return ret;
139 140
140 /* Add SDP4430 specific widgets */ 141 /* Add SDP4430 specific widgets */
141 ret = snd_soc_dapm_new_controls(codec, sdp4430_twl6040_dapm_widgets, 142 ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets,
142 ARRAY_SIZE(sdp4430_twl6040_dapm_widgets)); 143 ARRAY_SIZE(sdp4430_twl6040_dapm_widgets));
143 if (ret) 144 if (ret)
144 return ret; 145 return ret;
145 146
146 /* Set up SDP4430 specific audio path audio_map */ 147 /* Set up SDP4430 specific audio path audio_map */
147 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 148 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
148 149
149 /* SDP4430 connected pins */ 150 /* SDP4430 connected pins */
150 snd_soc_dapm_enable_pin(codec, "Ext Mic"); 151 snd_soc_dapm_enable_pin(dapm, "Ext Mic");
151 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 152 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
152 snd_soc_dapm_enable_pin(codec, "Headset Mic"); 153 snd_soc_dapm_enable_pin(dapm, "Headset Mic");
153 snd_soc_dapm_enable_pin(codec, "Headset Stereophone"); 154 snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
154 155
155 /* TWL6040 not connected pins */ 156 /* TWL6040 not connected pins */
156 snd_soc_dapm_nc_pin(codec, "AFML"); 157 snd_soc_dapm_nc_pin(dapm, "AFML");
157 snd_soc_dapm_nc_pin(codec, "AFMR"); 158 snd_soc_dapm_nc_pin(dapm, "AFMR");
158 159
159 ret = snd_soc_dapm_sync(codec); 160 ret = snd_soc_dapm_sync(dapm);
160 161
161 return ret; 162 return ret;
162} 163}
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
index 718031eeac34..cc5bc523b302 100644
--- a/sound/soc/omap/zoom2.c
+++ b/sound/soc/omap/zoom2.c
@@ -162,35 +162,36 @@ static const struct snd_soc_dapm_route audio_map[] = {
162static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd) 162static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd)
163{ 163{
164 struct snd_soc_codec *codec = rtd->codec; 164 struct snd_soc_codec *codec = rtd->codec;
165 struct snd_soc_dapm_context *dapm = &codec->dapm;
165 int ret; 166 int ret;
166 167
167 /* Add Zoom2 specific widgets */ 168 /* Add Zoom2 specific widgets */
168 ret = snd_soc_dapm_new_controls(codec, zoom2_twl4030_dapm_widgets, 169 ret = snd_soc_dapm_new_controls(dapm, zoom2_twl4030_dapm_widgets,
169 ARRAY_SIZE(zoom2_twl4030_dapm_widgets)); 170 ARRAY_SIZE(zoom2_twl4030_dapm_widgets));
170 if (ret) 171 if (ret)
171 return ret; 172 return ret;
172 173
173 /* Set up Zoom2 specific audio path audio_map */ 174 /* Set up Zoom2 specific audio path audio_map */
174 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 175 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
175 176
176 /* Zoom2 connected pins */ 177 /* Zoom2 connected pins */
177 snd_soc_dapm_enable_pin(codec, "Ext Mic"); 178 snd_soc_dapm_enable_pin(dapm, "Ext Mic");
178 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 179 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
179 snd_soc_dapm_enable_pin(codec, "Headset Mic"); 180 snd_soc_dapm_enable_pin(dapm, "Headset Mic");
180 snd_soc_dapm_enable_pin(codec, "Headset Stereophone"); 181 snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
181 snd_soc_dapm_enable_pin(codec, "Aux In"); 182 snd_soc_dapm_enable_pin(dapm, "Aux In");
182 183
183 /* TWL4030 not connected pins */ 184 /* TWL4030 not connected pins */
184 snd_soc_dapm_nc_pin(codec, "CARKITMIC"); 185 snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
185 snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); 186 snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
186 snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); 187 snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
187 snd_soc_dapm_nc_pin(codec, "EARPIECE"); 188 snd_soc_dapm_nc_pin(dapm, "EARPIECE");
188 snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); 189 snd_soc_dapm_nc_pin(dapm, "PREDRIVEL");
189 snd_soc_dapm_nc_pin(codec, "PREDRIVER"); 190 snd_soc_dapm_nc_pin(dapm, "PREDRIVER");
190 snd_soc_dapm_nc_pin(codec, "CARKITL"); 191 snd_soc_dapm_nc_pin(dapm, "CARKITL");
191 snd_soc_dapm_nc_pin(codec, "CARKITR"); 192 snd_soc_dapm_nc_pin(dapm, "CARKITR");
192 193
193 ret = snd_soc_dapm_sync(codec); 194 ret = snd_soc_dapm_sync(dapm);
194 195
195 return ret; 196 return ret;
196} 197}