aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
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
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')
-rw-r--r--sound/soc/atmel/playpaq_wm8510.c11
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c17
-rw-r--r--sound/soc/atmel/snd-soc-afeb9260.c13
-rw-r--r--sound/soc/codecs/88pm860x-codec.c9
-rw-r--r--sound/soc/codecs/ad1836.c5
-rw-r--r--sound/soc/codecs/ad193x.c5
-rw-r--r--sound/soc/codecs/ak4535.c9
-rw-r--r--sound/soc/codecs/ak4642.c2
-rw-r--r--sound/soc/codecs/ak4671.c9
-rw-r--r--sound/soc/codecs/alc5623.c23
-rw-r--r--sound/soc/codecs/cq93vc.c2
-rw-r--r--sound/soc/codecs/cs42l51.c5
-rw-r--r--sound/soc/codecs/cx20442.c15
-rw-r--r--sound/soc/codecs/da7210.c2
-rw-r--r--sound/soc/codecs/jz4740.c10
-rw-r--r--sound/soc/codecs/max98088.c12
-rw-r--r--sound/soc/codecs/ssm2602.c9
-rw-r--r--sound/soc/codecs/stac9766.c3
-rw-r--r--sound/soc/codecs/tlv320aic23.c9
-rw-r--r--sound/soc/codecs/tlv320aic3x.c22
-rw-r--r--sound/soc/codecs/tlv320dac33.c15
-rw-r--r--sound/soc/codecs/tpa6130a2.c5
-rw-r--r--sound/soc/codecs/twl4030.c13
-rw-r--r--sound/soc/codecs/twl6040.c12
-rw-r--r--sound/soc/codecs/uda134x.c2
-rw-r--r--sound/soc/codecs/uda1380.c13
-rw-r--r--sound/soc/codecs/wm2000.c5
-rw-r--r--sound/soc/codecs/wm8350.c28
-rw-r--r--sound/soc/codecs/wm8400.c11
-rw-r--r--sound/soc/codecs/wm8510.c11
-rw-r--r--sound/soc/codecs/wm8523.c11
-rw-r--r--sound/soc/codecs/wm8580.c11
-rw-r--r--sound/soc/codecs/wm8711.c9
-rw-r--r--sound/soc/codecs/wm8728.c11
-rw-r--r--sound/soc/codecs/wm8731.c13
-rw-r--r--sound/soc/codecs/wm8741.c7
-rw-r--r--sound/soc/codecs/wm8750.c11
-rw-r--r--sound/soc/codecs/wm8753.c29
-rw-r--r--sound/soc/codecs/wm8776.c9
-rw-r--r--sound/soc/codecs/wm8804.c6
-rw-r--r--sound/soc/codecs/wm8900.c11
-rw-r--r--sound/soc/codecs/wm8903.c11
-rw-r--r--sound/soc/codecs/wm8904.c33
-rw-r--r--sound/soc/codecs/wm8940.c5
-rw-r--r--sound/soc/codecs/wm8955.c11
-rw-r--r--sound/soc/codecs/wm8960.c25
-rw-r--r--sound/soc/codecs/wm8961.c11
-rw-r--r--sound/soc/codecs/wm8962.c30
-rw-r--r--sound/soc/codecs/wm8971.c29
-rw-r--r--sound/soc/codecs/wm8974.c11
-rw-r--r--sound/soc/codecs/wm8978.c11
-rw-r--r--sound/soc/codecs/wm8985.c11
-rw-r--r--sound/soc/codecs/wm8988.c9
-rw-r--r--sound/soc/codecs/wm8990.c11
-rw-r--r--sound/soc/codecs/wm8993.c9
-rw-r--r--sound/soc/codecs/wm8994.c13
-rw-r--r--sound/soc/codecs/wm9081.c9
-rw-r--r--sound/soc/codecs/wm9090.c17
-rw-r--r--sound/soc/codecs/wm9705.c6
-rw-r--r--sound/soc/codecs/wm9712.c9
-rw-r--r--sound/soc/codecs/wm9713.c8
-rw-r--r--sound/soc/codecs/wm_hubs.c18
-rw-r--r--sound/soc/davinci/davinci-evm.c21
-rw-r--r--sound/soc/ep93xx/snappercl15.c5
-rw-r--r--sound/soc/imx/wm1133-ev1.c7
-rw-r--r--sound/soc/jz4740/qi_lb60.c13
-rw-r--r--sound/soc/kirkwood/kirkwood-t5325.c13
-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
-rw-r--r--sound/soc/pxa/corgi.c51
-rw-r--r--sound/soc/pxa/e740_wm9705.c29
-rw-r--r--sound/soc/pxa/e750_wm9705.c29
-rw-r--r--sound/soc/pxa/e800_wm9712.c7
-rw-r--r--sound/soc/pxa/magician.c35
-rw-r--r--sound/soc/pxa/mioa701_wm9713.c17
-rw-r--r--sound/soc/pxa/palm27x.c33
-rw-r--r--sound/soc/pxa/poodle.c25
-rw-r--r--sound/soc/pxa/saarb.c17
-rw-r--r--sound/soc/pxa/spitz.c69
-rw-r--r--sound/soc/pxa/tavorevb3.c17
-rw-r--r--sound/soc/pxa/tosa.c37
-rw-r--r--sound/soc/pxa/z2.c15
-rw-r--r--sound/soc/pxa/zylonite.c11
-rw-r--r--sound/soc/s3c24xx/aquila_wm8994.c25
-rw-r--r--sound/soc/s3c24xx/goni_wm8994.c21
-rw-r--r--sound/soc/s3c24xx/jive_wm8750.c19
-rw-r--r--sound/soc/s3c24xx/neo1973_gta02_wm8753.c41
-rw-r--r--sound/soc/s3c24xx/neo1973_wm8753.c123
-rw-r--r--sound/soc/s3c24xx/rx1950_uda1380.c11
-rw-r--r--sound/soc/s3c24xx/s3c24xx_simtec_hermes.c15
-rw-r--r--sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c15
-rw-r--r--sound/soc/s3c24xx/smartq_wm8987.c21
-rw-r--r--sound/soc/s3c24xx/smdk64xx_wm8580.c16
-rw-r--r--sound/soc/s6000/s6105-ipcam.c40
-rw-r--r--sound/soc/sh/migor.c5
-rw-r--r--sound/soc/sh/sh7760-ac97.c2
-rw-r--r--sound/soc/soc-core.c29
-rw-r--r--sound/soc/soc-dapm.c355
-rw-r--r--sound/soc/soc-jack.c8
106 files changed, 1201 insertions, 1044 deletions
diff --git a/sound/soc/atmel/playpaq_wm8510.c b/sound/soc/atmel/playpaq_wm8510.c
index 5f4e59f4461c..aede7e74ec34 100644
--- a/sound/soc/atmel/playpaq_wm8510.c
+++ b/sound/soc/atmel/playpaq_wm8510.c
@@ -318,27 +318,28 @@ static const struct snd_soc_dapm_route intercon[] = {
318static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd) 318static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd)
319{ 319{
320 struct snd_soc_codec *codec = rtd->codec; 320 struct snd_soc_codec *codec = rtd->codec;
321 struct snd_soc_dapm_context *dapm = &codec->dapm;
321 int i; 322 int i;
322 323
323 /* 324 /*
324 * Add DAPM widgets 325 * Add DAPM widgets
325 */ 326 */
326 for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++) 327 for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++)
327 snd_soc_dapm_new_control(codec, &playpaq_dapm_widgets[i]); 328 snd_soc_dapm_new_control(dapm, &playpaq_dapm_widgets[i]);
328 329
329 330
330 331
331 /* 332 /*
332 * Setup audio path interconnects 333 * Setup audio path interconnects
333 */ 334 */
334 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 335 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
335 336
336 337
337 338
338 /* always connected pins */ 339 /* always connected pins */
339 snd_soc_dapm_enable_pin(codec, "Int Mic"); 340 snd_soc_dapm_enable_pin(dapm, "Int Mic");
340 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 341 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
341 snd_soc_dapm_sync(codec); 342 snd_soc_dapm_sync(dapm);
342 343
343 344
344 345
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 293569dfd0ed..da9c3037496f 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -140,6 +140,7 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
140{ 140{
141 struct snd_soc_codec *codec = rtd->codec; 141 struct snd_soc_codec *codec = rtd->codec;
142 struct snd_soc_dai *codec_dai = rtd->codec_dai; 142 struct snd_soc_dai *codec_dai = rtd->codec_dai;
143 struct snd_soc_dapm_context *dapm = &codec->dapm;
143 int ret; 144 int ret;
144 145
145 printk(KERN_DEBUG 146 printk(KERN_DEBUG
@@ -154,25 +155,25 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
154 } 155 }
155 156
156 /* Add specific widgets */ 157 /* Add specific widgets */
157 snd_soc_dapm_new_controls(codec, at91sam9g20ek_dapm_widgets, 158 snd_soc_dapm_new_controls(dapm, at91sam9g20ek_dapm_widgets,
158 ARRAY_SIZE(at91sam9g20ek_dapm_widgets)); 159 ARRAY_SIZE(at91sam9g20ek_dapm_widgets));
159 /* Set up specific audio path interconnects */ 160 /* Set up specific audio path interconnects */
160 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 161 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
161 162
162 /* not connected */ 163 /* not connected */
163 snd_soc_dapm_nc_pin(codec, "RLINEIN"); 164 snd_soc_dapm_nc_pin(dapm, "RLINEIN");
164 snd_soc_dapm_nc_pin(codec, "LLINEIN"); 165 snd_soc_dapm_nc_pin(dapm, "LLINEIN");
165 166
166#ifdef ENABLE_MIC_INPUT 167#ifdef ENABLE_MIC_INPUT
167 snd_soc_dapm_enable_pin(codec, "Int Mic"); 168 snd_soc_dapm_enable_pin(dapm, "Int Mic");
168#else 169#else
169 snd_soc_dapm_nc_pin(codec, "Int Mic"); 170 snd_soc_dapm_nc_pin(dapm, "Int Mic");
170#endif 171#endif
171 172
172 /* always connected */ 173 /* always connected */
173 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 174 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
174 175
175 snd_soc_dapm_sync(codec); 176 snd_soc_dapm_sync(dapm);
176 177
177 return 0; 178 return 0;
178} 179}
diff --git a/sound/soc/atmel/snd-soc-afeb9260.c b/sound/soc/atmel/snd-soc-afeb9260.c
index e3d283561c19..92c709ed0965 100644
--- a/sound/soc/atmel/snd-soc-afeb9260.c
+++ b/sound/soc/atmel/snd-soc-afeb9260.c
@@ -105,19 +105,20 @@ static const struct snd_soc_dapm_route audio_map[] = {
105static int afeb9260_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) 105static int afeb9260_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
106{ 106{
107 struct snd_soc_codec *codec = rtd->codec; 107 struct snd_soc_codec *codec = rtd->codec;
108 struct snd_soc_dapm_context *dapm = &codec->dapm;
108 109
109 /* Add afeb9260 specific widgets */ 110 /* Add afeb9260 specific widgets */
110 snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, 111 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
111 ARRAY_SIZE(tlv320aic23_dapm_widgets)); 112 ARRAY_SIZE(tlv320aic23_dapm_widgets));
112 113
113 /* Set up afeb9260 specific audio path audio_map */ 114 /* Set up afeb9260 specific audio path audio_map */
114 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 115 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
115 116
116 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 117 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
117 snd_soc_dapm_enable_pin(codec, "Line In"); 118 snd_soc_dapm_enable_pin(dapm, "Line In");
118 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 119 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
119 120
120 snd_soc_dapm_sync(codec); 121 snd_soc_dapm_sync(dapm);
121 122
122 return 0; 123 return 0;
123} 124}
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index 01d19e9f53f9..a15a3e974f0d 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -1172,7 +1172,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
1172 break; 1172 break;
1173 1173
1174 case SND_SOC_BIAS_STANDBY: 1174 case SND_SOC_BIAS_STANDBY:
1175 if (codec->bias_level == SND_SOC_BIAS_OFF) { 1175 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
1176 /* Enable Audio PLL & Audio section */ 1176 /* Enable Audio PLL & Audio section */
1177 data = AUDIO_PLL | AUDIO_SECTION_RESET 1177 data = AUDIO_PLL | AUDIO_SECTION_RESET
1178 | AUDIO_SECTION_ON; 1178 | AUDIO_SECTION_ON;
@@ -1185,7 +1185,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
1185 pm860x_set_bits(codec->control_data, REG_MISC2, data, 0); 1185 pm860x_set_bits(codec->control_data, REG_MISC2, data, 0);
1186 break; 1186 break;
1187 } 1187 }
1188 codec->bias_level = level; 1188 codec->dapm.bias_level = level;
1189 return 0; 1189 return 0;
1190} 1190}
1191 1191
@@ -1346,6 +1346,7 @@ EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect);
1346static int pm860x_probe(struct snd_soc_codec *codec) 1346static int pm860x_probe(struct snd_soc_codec *codec)
1347{ 1347{
1348 struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec); 1348 struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
1349 struct snd_soc_dapm_context *dapm = &codec->dapm;
1349 int i, ret; 1350 int i, ret;
1350 1351
1351 pm860x->codec = codec; 1352 pm860x->codec = codec;
@@ -1374,9 +1375,9 @@ static int pm860x_probe(struct snd_soc_codec *codec)
1374 1375
1375 snd_soc_add_controls(codec, pm860x_snd_controls, 1376 snd_soc_add_controls(codec, pm860x_snd_controls,
1376 ARRAY_SIZE(pm860x_snd_controls)); 1377 ARRAY_SIZE(pm860x_snd_controls));
1377 snd_soc_dapm_new_controls(codec, pm860x_dapm_widgets, 1378 snd_soc_dapm_new_controls(dapm, pm860x_dapm_widgets,
1378 ARRAY_SIZE(pm860x_dapm_widgets)); 1379 ARRAY_SIZE(pm860x_dapm_widgets));
1379 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 1380 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
1380 return 0; 1381 return 0;
1381 1382
1382out_codec: 1383out_codec:
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
index d272534c8f84..c71b05ddd752 100644
--- a/sound/soc/codecs/ad1836.c
+++ b/sound/soc/codecs/ad1836.c
@@ -220,6 +220,7 @@ static struct snd_soc_dai_driver ad1836_dai = {
220static int ad1836_probe(struct snd_soc_codec *codec) 220static int ad1836_probe(struct snd_soc_codec *codec)
221{ 221{
222 struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec); 222 struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec);
223 struct snd_soc_dapm_context *dapm = &codec->dapm;
223 int ret = 0; 224 int ret = 0;
224 225
225 codec->control_data = ad1836->control_data; 226 codec->control_data = ad1836->control_data;
@@ -252,9 +253,9 @@ static int ad1836_probe(struct snd_soc_codec *codec)
252 253
253 snd_soc_add_controls(codec, ad1836_snd_controls, 254 snd_soc_add_controls(codec, ad1836_snd_controls,
254 ARRAY_SIZE(ad1836_snd_controls)); 255 ARRAY_SIZE(ad1836_snd_controls));
255 snd_soc_dapm_new_controls(codec, ad1836_dapm_widgets, 256 snd_soc_dapm_new_controls(dapm, ad1836_dapm_widgets,
256 ARRAY_SIZE(ad1836_dapm_widgets)); 257 ARRAY_SIZE(ad1836_dapm_widgets));
257 snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); 258 snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
258 259
259 return ret; 260 return ret;
260} 261}
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c
index fa2834c91b9f..dc105d8aaa0f 100644
--- a/sound/soc/codecs/ad193x.c
+++ b/sound/soc/codecs/ad193x.c
@@ -353,6 +353,7 @@ static struct snd_soc_dai_driver ad193x_dai = {
353static int ad193x_probe(struct snd_soc_codec *codec) 353static int ad193x_probe(struct snd_soc_codec *codec)
354{ 354{
355 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec); 355 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
356 struct snd_soc_dapm_context *dapm = &codec->dapm;
356 int ret; 357 int ret;
357 358
358 codec->control_data = ad193x->control_data; 359 codec->control_data = ad193x->control_data;
@@ -385,9 +386,9 @@ static int ad193x_probe(struct snd_soc_codec *codec)
385 386
386 snd_soc_add_controls(codec, ad193x_snd_controls, 387 snd_soc_add_controls(codec, ad193x_snd_controls,
387 ARRAY_SIZE(ad193x_snd_controls)); 388 ARRAY_SIZE(ad193x_snd_controls));
388 snd_soc_dapm_new_controls(codec, ad193x_dapm_widgets, 389 snd_soc_dapm_new_controls(dapm, ad193x_dapm_widgets,
389 ARRAY_SIZE(ad193x_dapm_widgets)); 390 ARRAY_SIZE(ad193x_dapm_widgets));
390 snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); 391 snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
391 392
392 return ret; 393 return ret;
393} 394}
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index cd88c8f32a38..52abb93a7dce 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -290,10 +290,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
290 290
291static int ak4535_add_widgets(struct snd_soc_codec *codec) 291static int ak4535_add_widgets(struct snd_soc_codec *codec)
292{ 292{
293 snd_soc_dapm_new_controls(codec, ak4535_dapm_widgets, 293 struct snd_soc_dapm_context *dapm = &codec->dapm;
294 ARRAY_SIZE(ak4535_dapm_widgets));
295 294
296 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 295 snd_soc_dapm_new_controls(dapm, ak4535_dapm_widgets,
296 ARRAY_SIZE(ak4535_dapm_widgets));
297 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
297 298
298 return 0; 299 return 0;
299} 300}
@@ -399,7 +400,7 @@ static int ak4535_set_bias_level(struct snd_soc_codec *codec,
399 ak4535_write(codec, AK4535_PM1, i & (~0x80)); 400 ak4535_write(codec, AK4535_PM1, i & (~0x80));
400 break; 401 break;
401 } 402 }
402 codec->bias_level = level; 403 codec->dapm.bias_level = level;
403 return 0; 404 return 0;
404} 405}
405 406
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 90c90b7f4a2e..f00eba313dfd 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -26,7 +26,7 @@
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <sound/soc-dapm.h> 29#include <sound/soc.h>
30#include <sound/initval.h> 30#include <sound/initval.h>
31#include <sound/tlv.h> 31#include <sound/tlv.h>
32 32
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c
index 24f5f49bb9d2..1d6573c38af4 100644
--- a/sound/soc/codecs/ak4671.c
+++ b/sound/soc/codecs/ak4671.c
@@ -437,10 +437,11 @@ static const struct snd_soc_dapm_route intercon[] = {
437 437
438static int ak4671_add_widgets(struct snd_soc_codec *codec) 438static int ak4671_add_widgets(struct snd_soc_codec *codec)
439{ 439{
440 snd_soc_dapm_new_controls(codec, ak4671_dapm_widgets, 440 struct snd_soc_dapm_context *dapm = &codec->dapm;
441 ARRAY_SIZE(ak4671_dapm_widgets));
442 441
443 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 442 snd_soc_dapm_new_controls(dapm, ak4671_dapm_widgets,
443 ARRAY_SIZE(ak4671_dapm_widgets));
444 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
444 445
445 return 0; 446 return 0;
446} 447}
@@ -602,7 +603,7 @@ static int ak4671_set_bias_level(struct snd_soc_codec *codec,
602 snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00); 603 snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00);
603 break; 604 break;
604 } 605 }
605 codec->bias_level = level; 606 codec->dapm.bias_level = level;
606 return 0; 607 return 0;
607} 608}
608 609
diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c
index fac61744f8c7..5a45067b43ba 100644
--- a/sound/soc/codecs/alc5623.c
+++ b/sound/soc/codecs/alc5623.c
@@ -832,7 +832,7 @@ static int alc5623_set_bias_level(struct snd_soc_codec *codec,
832 snd_soc_write(codec, ALC5623_PWR_MANAG_ADD1, 0); 832 snd_soc_write(codec, ALC5623_PWR_MANAG_ADD1, 0);
833 break; 833 break;
834 } 834 }
835 codec->bias_level = level; 835 codec->dapm.bias_level = level;
836 return 0; 836 return 0;
837} 837}
838 838
@@ -888,10 +888,10 @@ static int alc5623_resume(struct snd_soc_codec *codec)
888 alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 888 alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
889 889
890 /* charge alc5623 caps */ 890 /* charge alc5623 caps */
891 if (codec->suspend_bias_level == SND_SOC_BIAS_ON) { 891 if (codec->dapm.suspend_bias_level == SND_SOC_BIAS_ON) {
892 alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 892 alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
893 codec->bias_level = SND_SOC_BIAS_ON; 893 codec->dapm.bias_level = SND_SOC_BIAS_ON;
894 alc5623_set_bias_level(codec, codec->bias_level); 894 alc5623_set_bias_level(codec, codec->dapm.bias_level);
895 } 895 }
896 896
897 return 0; 897 return 0;
@@ -900,6 +900,7 @@ static int alc5623_resume(struct snd_soc_codec *codec)
900static int alc5623_probe(struct snd_soc_codec *codec) 900static int alc5623_probe(struct snd_soc_codec *codec)
901{ 901{
902 struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec); 902 struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec);
903 struct snd_soc_dapm_context *dapm = &codec->dapm;
903 int ret; 904 int ret;
904 905
905 ret = snd_soc_codec_set_cache_io(codec, 8, 16, alc5623->control_type); 906 ret = snd_soc_codec_set_cache_io(codec, 8, 16, alc5623->control_type);
@@ -943,24 +944,24 @@ static int alc5623_probe(struct snd_soc_codec *codec)
943 snd_soc_add_controls(codec, alc5623_snd_controls, 944 snd_soc_add_controls(codec, alc5623_snd_controls,
944 ARRAY_SIZE(alc5623_snd_controls)); 945 ARRAY_SIZE(alc5623_snd_controls));
945 946
946 snd_soc_dapm_new_controls(codec, alc5623_dapm_widgets, 947 snd_soc_dapm_new_controls(dapm, alc5623_dapm_widgets,
947 ARRAY_SIZE(alc5623_dapm_widgets)); 948 ARRAY_SIZE(alc5623_dapm_widgets));
948 949
949 /* set up audio path interconnects */ 950 /* set up audio path interconnects */
950 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 951 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
951 952
952 switch (alc5623->id) { 953 switch (alc5623->id) {
953 default: 954 default:
954 case 0x21: 955 case 0x21:
955 case 0x22: 956 case 0x22:
956 snd_soc_dapm_new_controls(codec, alc5623_dapm_amp_widgets, 957 snd_soc_dapm_new_controls(dapm, alc5623_dapm_amp_widgets,
957 ARRAY_SIZE(alc5623_dapm_amp_widgets)); 958 ARRAY_SIZE(alc5623_dapm_amp_widgets));
958 snd_soc_dapm_add_routes(codec, intercon_amp_spk, 959 snd_soc_dapm_add_routes(dapm, intercon_amp_spk,
959 ARRAY_SIZE(intercon_amp_spk)); 960 ARRAY_SIZE(intercon_amp_spk));
960 break; 961 break;
961 case 0x23: 962 case 0x23:
962 snd_soc_dapm_add_routes(codec, intercon_spk, 963 snd_soc_dapm_add_routes(dapm, intercon_spk,
963 ARRAY_SIZE(intercon_spk)); 964 ARRAY_SIZE(intercon_spk));
964 break; 965 break;
965 } 966 }
966 967
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c
index 823643932dde..98b9e5294cbe 100644
--- a/sound/soc/codecs/cq93vc.c
+++ b/sound/soc/codecs/cq93vc.c
@@ -116,7 +116,7 @@ static int cq93vc_set_bias_level(struct snd_soc_codec *codec,
116 DAVINCI_VC_REG12_POWER_ALL_OFF); 116 DAVINCI_VC_REG12_POWER_ALL_OFF);
117 break; 117 break;
118 } 118 }
119 codec->bias_level = level; 119 codec->dapm.bias_level = level;
120 120
121 return 0; 121 return 0;
122} 122}
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index cb086eaf4e07..a7fdca36b490 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -519,6 +519,7 @@ static struct snd_soc_dai_driver cs42l51_dai = {
519static int cs42l51_probe(struct snd_soc_codec *codec) 519static int cs42l51_probe(struct snd_soc_codec *codec)
520{ 520{
521 struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); 521 struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
522 struct snd_soc_dapm_context *dapm = &codec->dapm;
522 int ret, reg; 523 int ret, reg;
523 524
524 codec->control_data = cs42l51->control_data; 525 codec->control_data = cs42l51->control_data;
@@ -550,9 +551,9 @@ static int cs42l51_probe(struct snd_soc_codec *codec)
550 551
551 snd_soc_add_controls(codec, cs42l51_snd_controls, 552 snd_soc_add_controls(codec, cs42l51_snd_controls,
552 ARRAY_SIZE(cs42l51_snd_controls)); 553 ARRAY_SIZE(cs42l51_snd_controls));
553 snd_soc_dapm_new_controls(codec, cs42l51_dapm_widgets, 554 snd_soc_dapm_new_controls(dapm, cs42l51_dapm_widgets,
554 ARRAY_SIZE(cs42l51_dapm_widgets)); 555 ARRAY_SIZE(cs42l51_dapm_widgets));
555 snd_soc_dapm_add_routes(codec, cs42l51_routes, 556 snd_soc_dapm_add_routes(dapm, cs42l51_routes,
556 ARRAY_SIZE(cs42l51_routes)); 557 ARRAY_SIZE(cs42l51_routes));
557 558
558 return 0; 559 return 0;
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index e8d27c8f9ba3..11beb1a77c4e 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -18,7 +18,7 @@
18 18
19#include <sound/core.h> 19#include <sound/core.h>
20#include <sound/initval.h> 20#include <sound/initval.h>
21#include <sound/soc-dapm.h> 21#include <sound/soc.h>
22 22
23#include "cx20442.h" 23#include "cx20442.h"
24 24
@@ -89,10 +89,11 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = {
89 89
90static int cx20442_add_widgets(struct snd_soc_codec *codec) 90static int cx20442_add_widgets(struct snd_soc_codec *codec)
91{ 91{
92 snd_soc_dapm_new_controls(codec, cx20442_dapm_widgets, 92 struct snd_soc_dapm_context *dapm = &codec->dapm;
93 ARRAY_SIZE(cx20442_dapm_widgets));
94 93
95 snd_soc_dapm_add_routes(codec, cx20442_audio_map, 94 snd_soc_dapm_new_controls(dapm, cx20442_dapm_widgets,
95 ARRAY_SIZE(cx20442_dapm_widgets));
96 snd_soc_dapm_add_routes(dapm, cx20442_audio_map,
96 ARRAY_SIZE(cx20442_audio_map)); 97 ARRAY_SIZE(cx20442_audio_map));
97 98
98 return 0; 99 return 0;
@@ -263,7 +264,7 @@ static void v253_close(struct tty_struct *tty)
263 /* Prevent the codec driver from further accessing the modem */ 264 /* Prevent the codec driver from further accessing the modem */
264 codec->hw_write = NULL; 265 codec->hw_write = NULL;
265 cx20442->control_data = NULL; 266 cx20442->control_data = NULL;
266 codec->pop_time = 0; 267 codec->dapm.pop_time = 0;
267} 268}
268 269
269/* Line discipline .hangup() */ 270/* Line discipline .hangup() */
@@ -291,7 +292,7 @@ static void v253_receive(struct tty_struct *tty,
291 /* Set up codec driver access to modem controls */ 292 /* Set up codec driver access to modem controls */
292 cx20442->control_data = tty; 293 cx20442->control_data = tty;
293 codec->hw_write = (hw_write_t)tty->ops->write; 294 codec->hw_write = (hw_write_t)tty->ops->write;
294 codec->pop_time = 1; 295 codec->dapm.pop_time = 1;
295 } 296 }
296} 297}
297 298
@@ -348,7 +349,7 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
348 349
349 cx20442->control_data = NULL; 350 cx20442->control_data = NULL;
350 codec->hw_write = NULL; 351 codec->hw_write = NULL;
351 codec->pop_time = 0; 352 codec->dapm.pop_time = 0;
352 353
353 return 0; 354 return 0;
354} 355}
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index 58bb9b994811..92fd9d7a9221 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -21,7 +21,7 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <sound/pcm.h> 22#include <sound/pcm.h>
23#include <sound/pcm_params.h> 23#include <sound/pcm_params.h>
24#include <sound/soc-dapm.h> 24#include <sound/soc.h>
25#include <sound/initval.h> 25#include <sound/initval.h>
26#include <sound/tlv.h> 26#include <sound/tlv.h>
27 27
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c
index 16253ec9b022..8a45562a96d4 100644
--- a/sound/soc/codecs/jz4740.c
+++ b/sound/soc/codecs/jz4740.c
@@ -266,7 +266,7 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
266 break; 266 break;
267 case SND_SOC_BIAS_STANDBY: 267 case SND_SOC_BIAS_STANDBY:
268 /* The only way to clear the suspend flag is to reset the codec */ 268 /* The only way to clear the suspend flag is to reset the codec */
269 if (codec->bias_level == SND_SOC_BIAS_OFF) 269 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
270 jz4740_codec_wakeup(codec); 270 jz4740_codec_wakeup(codec);
271 271
272 mask = JZ4740_CODEC_1_VREF_DISABLE | 272 mask = JZ4740_CODEC_1_VREF_DISABLE |
@@ -288,23 +288,25 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
288 break; 288 break;
289 } 289 }
290 290
291 codec->bias_level = level; 291 codec->dapm.bias_level = level;
292 292
293 return 0; 293 return 0;
294} 294}
295 295
296static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) 296static int jz4740_codec_dev_probe(struct snd_soc_codec *codec)
297{ 297{
298 struct snd_soc_dapm_context *dapm = &codec->dapm;
299
298 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, 300 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1,
299 JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); 301 JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE);
300 302
301 snd_soc_add_controls(codec, jz4740_codec_controls, 303 snd_soc_add_controls(codec, jz4740_codec_controls,
302 ARRAY_SIZE(jz4740_codec_controls)); 304 ARRAY_SIZE(jz4740_codec_controls));
303 305
304 snd_soc_dapm_new_controls(codec, jz4740_codec_dapm_widgets, 306 snd_soc_dapm_new_controls(dapm, jz4740_codec_dapm_widgets,
305 ARRAY_SIZE(jz4740_codec_dapm_widgets)); 307 ARRAY_SIZE(jz4740_codec_dapm_widgets));
306 308
307 snd_soc_dapm_add_routes(codec, jz4740_codec_dapm_routes, 309 snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes,
308 ARRAY_SIZE(jz4740_codec_dapm_routes)); 310 ARRAY_SIZE(jz4740_codec_dapm_routes));
309 311
310 snd_soc_dapm_new_widgets(codec); 312 snd_soc_dapm_new_widgets(codec);
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index bc22ee93a75d..ef06007d8895 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1224,15 +1224,17 @@ static const struct snd_soc_dapm_route audio_map[] = {
1224 1224
1225static int max98088_add_widgets(struct snd_soc_codec *codec) 1225static int max98088_add_widgets(struct snd_soc_codec *codec)
1226{ 1226{
1227 snd_soc_dapm_new_controls(codec, max98088_dapm_widgets, 1227 struct snd_soc_dapm_context *dapm = &codec->dapm;
1228
1229 snd_soc_dapm_new_controls(dapm, max98088_dapm_widgets,
1228 ARRAY_SIZE(max98088_dapm_widgets)); 1230 ARRAY_SIZE(max98088_dapm_widgets));
1229 1231
1230 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 1232 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
1231 1233
1232 snd_soc_add_controls(codec, max98088_snd_controls, 1234 snd_soc_add_controls(codec, max98088_snd_controls,
1233 ARRAY_SIZE(max98088_snd_controls)); 1235 ARRAY_SIZE(max98088_snd_controls));
1234 1236
1235 snd_soc_dapm_new_widgets(codec); 1237 snd_soc_dapm_new_widgets(dapm);
1236 return 0; 1238 return 0;
1237} 1239}
1238 1240
@@ -1617,7 +1619,7 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec,
1617 break; 1619 break;
1618 1620
1619 case SND_SOC_BIAS_STANDBY: 1621 case SND_SOC_BIAS_STANDBY:
1620 if (codec->bias_level == SND_SOC_BIAS_OFF) 1622 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
1621 max98088_sync_cache(codec); 1623 max98088_sync_cache(codec);
1622 1624
1623 snd_soc_update_bits(codec, M98088_REG_4C_PWR_EN_IN, 1625 snd_soc_update_bits(codec, M98088_REG_4C_PWR_EN_IN,
@@ -1630,7 +1632,7 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec,
1630 codec->cache_sync = 1; 1632 codec->cache_sync = 1;
1631 break; 1633 break;
1632 } 1634 }
1633 codec->bias_level = level; 1635 codec->dapm.bias_level = level;
1634 return 0; 1636 return 0;
1635} 1637}
1636 1638
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 6f38d619bf8a..adbc3e8dafc8 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -207,10 +207,11 @@ static const struct snd_soc_dapm_route audio_conn[] = {
207 207
208static int ssm2602_add_widgets(struct snd_soc_codec *codec) 208static int ssm2602_add_widgets(struct snd_soc_codec *codec)
209{ 209{
210 snd_soc_dapm_new_controls(codec, ssm2602_dapm_widgets, 210 struct snd_soc_dapm_context *dapm = &codec->dapm;
211 ARRAY_SIZE(ssm2602_dapm_widgets));
212 211
213 snd_soc_dapm_add_routes(codec, audio_conn, ARRAY_SIZE(audio_conn)); 212 snd_soc_dapm_new_controls(dapm, ssm2602_dapm_widgets,
213 ARRAY_SIZE(ssm2602_dapm_widgets));
214 snd_soc_dapm_add_routes(dapm, audio_conn, ARRAY_SIZE(audio_conn));
214 215
215 return 0; 216 return 0;
216} 217}
@@ -493,7 +494,7 @@ static int ssm2602_set_bias_level(struct snd_soc_codec *codec,
493 break; 494 break;
494 495
495 } 496 }
496 codec->bias_level = level; 497 codec->dapm.bias_level = level;
497 return 0; 498 return 0;
498} 499}
499 500
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 00d67cc8e206..8aad3a2c4f3d 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -24,6 +24,7 @@
24#include <sound/initval.h> 24#include <sound/initval.h>
25#include <sound/pcm_params.h> 25#include <sound/pcm_params.h>
26#include <sound/soc.h> 26#include <sound/soc.h>
27#include <sound/soc-dapm.h>
27#include <sound/tlv.h> 28#include <sound/tlv.h>
28 29
29#include "stac9766.h" 30#include "stac9766.h"
@@ -236,7 +237,7 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec,
236 stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff); 237 stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff);
237 break; 238 break;
238 } 239 }
239 codec->bias_level = level; 240 codec->dapm.bias_level = level;
240 return 0; 241 return 0;
241} 242}
242 243
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index e8652b1ae326..d9d8e844d63f 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -391,11 +391,12 @@ static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk,
391 391
392static int tlv320aic23_add_widgets(struct snd_soc_codec *codec) 392static int tlv320aic23_add_widgets(struct snd_soc_codec *codec)
393{ 393{
394 snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, 394 struct snd_soc_dapm_context *dapm = &codec->dapm;
395 ARRAY_SIZE(tlv320aic23_dapm_widgets));
396 395
396 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
397 ARRAY_SIZE(tlv320aic23_dapm_widgets));
397 /* set up audio path interconnects */ 398 /* set up audio path interconnects */
398 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 399 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
399 400
400 return 0; 401 return 0;
401} 402}
@@ -574,7 +575,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
574 tlv320aic23_write(codec, TLV320AIC23_PWR, 0xffff); 575 tlv320aic23_write(codec, TLV320AIC23_PWR, 0xffff);
575 break; 576 break;
576 } 577 }
577 codec->bias_level = level; 578 codec->dapm.bias_level = level;
578 return 0; 579 return 0;
579} 580}
580 581
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index fc687790188b..6173c2b4c364 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -183,7 +183,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
183 183
184 if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) { 184 if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) {
185 /* find dapm widget path assoc with kcontrol */ 185 /* find dapm widget path assoc with kcontrol */
186 list_for_each_entry(path, &widget->codec->dapm_paths, list) { 186 list_for_each_entry(path, &widget->dapm->paths, list) {
187 if (path->kcontrol != kcontrol) 187 if (path->kcontrol != kcontrol)
188 continue; 188 continue;
189 189
@@ -199,7 +199,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
199 } 199 }
200 200
201 if (found) 201 if (found)
202 snd_soc_dapm_sync(widget->codec); 202 snd_soc_dapm_sync(widget->dapm);
203 } 203 }
204 204
205 ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); 205 ret = snd_soc_update_bits(widget->codec, reg, val_mask, val);
@@ -788,17 +788,19 @@ static const struct snd_soc_dapm_route intercon_3007[] = {
788static int aic3x_add_widgets(struct snd_soc_codec *codec) 788static int aic3x_add_widgets(struct snd_soc_codec *codec)
789{ 789{
790 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); 790 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
791 struct snd_soc_dapm_context *dapm = &codec->dapm;
791 792
792 snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, 793 snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
793 ARRAY_SIZE(aic3x_dapm_widgets)); 794 ARRAY_SIZE(aic3x_dapm_widgets));
794 795
795 /* set up audio path interconnects */ 796 /* set up audio path interconnects */
796 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 797 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
797 798
798 if (aic3x->model == AIC3X_MODEL_3007) { 799 if (aic3x->model == AIC3X_MODEL_3007) {
799 snd_soc_dapm_new_controls(codec, aic3007_dapm_widgets, 800 snd_soc_dapm_new_controls(dapm, aic3007_dapm_widgets,
800 ARRAY_SIZE(aic3007_dapm_widgets)); 801 ARRAY_SIZE(aic3007_dapm_widgets));
801 snd_soc_dapm_add_routes(codec, intercon_3007, ARRAY_SIZE(intercon_3007)); 802 snd_soc_dapm_add_routes(dapm, intercon_3007,
803 ARRAY_SIZE(intercon_3007));
802 } 804 }
803 805
804 return 0; 806 return 0;
@@ -1135,7 +1137,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1135 case SND_SOC_BIAS_ON: 1137 case SND_SOC_BIAS_ON:
1136 break; 1138 break;
1137 case SND_SOC_BIAS_PREPARE: 1139 case SND_SOC_BIAS_PREPARE:
1138 if (codec->bias_level == SND_SOC_BIAS_STANDBY && 1140 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY &&
1139 aic3x->master) { 1141 aic3x->master) {
1140 /* enable pll */ 1142 /* enable pll */
1141 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 1143 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
@@ -1146,7 +1148,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1146 case SND_SOC_BIAS_STANDBY: 1148 case SND_SOC_BIAS_STANDBY:
1147 if (!aic3x->power) 1149 if (!aic3x->power)
1148 aic3x_set_power(codec, 1); 1150 aic3x_set_power(codec, 1);
1149 if (codec->bias_level == SND_SOC_BIAS_PREPARE && 1151 if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE &&
1150 aic3x->master) { 1152 aic3x->master) {
1151 /* disable pll */ 1153 /* disable pll */
1152 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 1154 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
@@ -1159,7 +1161,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1159 aic3x_set_power(codec, 0); 1161 aic3x_set_power(codec, 0);
1160 break; 1162 break;
1161 } 1163 }
1162 codec->bias_level = level; 1164 codec->dapm.bias_level = level;
1163 1165
1164 return 0; 1166 return 0;
1165} 1167}
@@ -1351,7 +1353,7 @@ static int aic3x_probe(struct snd_soc_codec *codec)
1351 1353
1352 codec->control_data = aic3x->control_data; 1354 codec->control_data = aic3x->control_data;
1353 aic3x->codec = codec; 1355 aic3x->codec = codec;
1354 codec->idle_bias_off = 1; 1356 codec->dapm.idle_bias_off = 1;
1355 1357
1356 ret = snd_soc_codec_set_cache_io(codec, 8, 8, aic3x->control_type); 1358 ret = snd_soc_codec_set_cache_io(codec, 8, 8, aic3x->control_type);
1357 if (ret != 0) { 1359 if (ret != 0) {
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index c5ab8c805771..7149c14b289e 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -628,11 +628,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
628 628
629static int dac33_add_widgets(struct snd_soc_codec *codec) 629static int dac33_add_widgets(struct snd_soc_codec *codec)
630{ 630{
631 snd_soc_dapm_new_controls(codec, dac33_dapm_widgets, 631 struct snd_soc_dapm_context *dapm = &codec->dapm;
632 ARRAY_SIZE(dac33_dapm_widgets));
633 632
633 snd_soc_dapm_new_controls(dapm, dac33_dapm_widgets,
634 ARRAY_SIZE(dac33_dapm_widgets));
634 /* set up audio path interconnects */ 635 /* set up audio path interconnects */
635 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 636 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
636 637
637 return 0; 638 return 0;
638} 639}
@@ -649,7 +650,7 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec,
649 case SND_SOC_BIAS_PREPARE: 650 case SND_SOC_BIAS_PREPARE:
650 break; 651 break;
651 case SND_SOC_BIAS_STANDBY: 652 case SND_SOC_BIAS_STANDBY:
652 if (codec->bias_level == SND_SOC_BIAS_OFF) { 653 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
653 /* Coming from OFF, switch on the codec */ 654 /* Coming from OFF, switch on the codec */
654 ret = dac33_hard_power(codec, 1); 655 ret = dac33_hard_power(codec, 1);
655 if (ret != 0) 656 if (ret != 0)
@@ -660,14 +661,14 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec,
660 break; 661 break;
661 case SND_SOC_BIAS_OFF: 662 case SND_SOC_BIAS_OFF:
662 /* Do not power off, when the codec is already off */ 663 /* Do not power off, when the codec is already off */
663 if (codec->bias_level == SND_SOC_BIAS_OFF) 664 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
664 return 0; 665 return 0;
665 ret = dac33_hard_power(codec, 0); 666 ret = dac33_hard_power(codec, 0);
666 if (ret != 0) 667 if (ret != 0)
667 return ret; 668 return ret;
668 break; 669 break;
669 } 670 }
670 codec->bias_level = level; 671 codec->dapm.bias_level = level;
671 672
672 return 0; 673 return 0;
673} 674}
@@ -1415,7 +1416,7 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
1415 1416
1416 codec->control_data = dac33->control_data; 1417 codec->control_data = dac33->control_data;
1417 codec->hw_write = (hw_write_t) i2c_master_send; 1418 codec->hw_write = (hw_write_t) i2c_master_send;
1418 codec->idle_bias_off = 1; 1419 codec->dapm.idle_bias_off = 1;
1419 dac33->codec = codec; 1420 dac33->codec = codec;
1420 1421
1421 /* Read the tlv320dac33 ID registers */ 1422 /* Read the tlv320dac33 ID registers */
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index ee4fb201de60..f9a92ea6b50a 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -388,16 +388,17 @@ static const struct snd_soc_dapm_route audio_map[] = {
388int tpa6130a2_add_controls(struct snd_soc_codec *codec) 388int tpa6130a2_add_controls(struct snd_soc_codec *codec)
389{ 389{
390 struct tpa6130a2_data *data; 390 struct tpa6130a2_data *data;
391 struct snd_soc_dapm_context *dapm = &codec->dapm;
391 392
392 if (tpa6130a2_client == NULL) 393 if (tpa6130a2_client == NULL)
393 return -ENODEV; 394 return -ENODEV;
394 395
395 data = i2c_get_clientdata(tpa6130a2_client); 396 data = i2c_get_clientdata(tpa6130a2_client);
396 397
397 snd_soc_dapm_new_controls(codec, tpa6130a2_dapm_widgets, 398 snd_soc_dapm_new_controls(dapm, tpa6130a2_dapm_widgets,
398 ARRAY_SIZE(tpa6130a2_dapm_widgets)); 399 ARRAY_SIZE(tpa6130a2_dapm_widgets));
399 400
400 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 401 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
401 402
402 if (data->id == TPA6140A2) 403 if (data->id == TPA6140A2)
403 return snd_soc_add_controls(codec, tpa6140a2_controls, 404 return snd_soc_add_controls(codec, tpa6140a2_controls,
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index cbebec6ba1ba..f4602e8b67cc 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1621,10 +1621,11 @@ static const struct snd_soc_dapm_route intercon[] = {
1621 1621
1622static int twl4030_add_widgets(struct snd_soc_codec *codec) 1622static int twl4030_add_widgets(struct snd_soc_codec *codec)
1623{ 1623{
1624 snd_soc_dapm_new_controls(codec, twl4030_dapm_widgets, 1624 struct snd_soc_dapm_context *dapm = &codec->dapm;
1625 ARRAY_SIZE(twl4030_dapm_widgets));
1626 1625
1627 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 1626 snd_soc_dapm_new_controls(dapm, twl4030_dapm_widgets,
1627 ARRAY_SIZE(twl4030_dapm_widgets));
1628 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
1628 1629
1629 return 0; 1630 return 0;
1630} 1631}
@@ -1638,14 +1639,14 @@ static int twl4030_set_bias_level(struct snd_soc_codec *codec,
1638 case SND_SOC_BIAS_PREPARE: 1639 case SND_SOC_BIAS_PREPARE:
1639 break; 1640 break;
1640 case SND_SOC_BIAS_STANDBY: 1641 case SND_SOC_BIAS_STANDBY:
1641 if (codec->bias_level == SND_SOC_BIAS_OFF) 1642 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
1642 twl4030_codec_enable(codec, 1); 1643 twl4030_codec_enable(codec, 1);
1643 break; 1644 break;
1644 case SND_SOC_BIAS_OFF: 1645 case SND_SOC_BIAS_OFF:
1645 twl4030_codec_enable(codec, 0); 1646 twl4030_codec_enable(codec, 0);
1646 break; 1647 break;
1647 } 1648 }
1648 codec->bias_level = level; 1649 codec->dapm.bias_level = level;
1649 1650
1650 return 0; 1651 return 0;
1651} 1652}
@@ -2245,7 +2246,7 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec)
2245 snd_soc_codec_set_drvdata(codec, twl4030); 2246 snd_soc_codec_set_drvdata(codec, twl4030);
2246 /* Set the defaults, and power up the codec */ 2247 /* Set the defaults, and power up the codec */
2247 twl4030->sysclk = twl4030_codec_get_mclk() / 1000; 2248 twl4030->sysclk = twl4030_codec_get_mclk() / 1000;
2248 codec->idle_bias_off = 1; 2249 codec->dapm.idle_bias_off = 1;
2249 2250
2250 twl4030_init_chip(codec); 2251 twl4030_init_chip(codec);
2251 2252
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 10f6e5214511..0dd2d5397264 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -641,12 +641,12 @@ static const struct snd_soc_dapm_route intercon[] = {
641 641
642static int twl6040_add_widgets(struct snd_soc_codec *codec) 642static int twl6040_add_widgets(struct snd_soc_codec *codec)
643{ 643{
644 snd_soc_dapm_new_controls(codec, twl6040_dapm_widgets, 644 struct snd_soc_dapm_context *dapm = &codec->dapm;
645 ARRAY_SIZE(twl6040_dapm_widgets));
646
647 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon));
648 645
649 snd_soc_dapm_new_widgets(codec); 646 snd_soc_dapm_new_controls(dapm, twl6040_dapm_widgets,
647 ARRAY_SIZE(twl6040_dapm_widgets));
648 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
649 snd_soc_dapm_new_widgets(dapm);
650 650
651 return 0; 651 return 0;
652} 652}
@@ -739,7 +739,7 @@ static int twl6040_set_bias_level(struct snd_soc_codec *codec,
739 break; 739 break;
740 } 740 }
741 741
742 codec->bias_level = level; 742 codec->dapm.bias_level = level;
743 743
744 return 0; 744 return 0;
745} 745}
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index 7540a509a6f5..8ea81d48124a 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -389,7 +389,7 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec,
389 pd->power(0); 389 pd->power(0);
390 break; 390 break;
391 } 391 }
392 codec->bias_level = level; 392 codec->dapm.bias_level = level;
393 return 0; 393 return 0;
394} 394}
395 395
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 0c6c725736c6..cd6dd19fa1aa 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -414,10 +414,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
414 414
415static int uda1380_add_widgets(struct snd_soc_codec *codec) 415static int uda1380_add_widgets(struct snd_soc_codec *codec)
416{ 416{
417 snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, 417 struct snd_soc_dapm_context *dapm = &codec->dapm;
418 ARRAY_SIZE(uda1380_dapm_widgets));
419 418
420 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 419 snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
420 ARRAY_SIZE(uda1380_dapm_widgets));
421 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
421 422
422 return 0; 423 return 0;
423} 424}
@@ -603,7 +604,7 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec,
603 int reg; 604 int reg;
604 struct uda1380_platform_data *pdata = codec->dev->platform_data; 605 struct uda1380_platform_data *pdata = codec->dev->platform_data;
605 606
606 if (codec->bias_level == level) 607 if (codec->dapm.bias_level == level)
607 return 0; 608 return 0;
608 609
609 switch (level) { 610 switch (level) {
@@ -613,7 +614,7 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec,
613 uda1380_write(codec, UDA1380_PM, R02_PON_BIAS | pm); 614 uda1380_write(codec, UDA1380_PM, R02_PON_BIAS | pm);
614 break; 615 break;
615 case SND_SOC_BIAS_STANDBY: 616 case SND_SOC_BIAS_STANDBY:
616 if (codec->bias_level == SND_SOC_BIAS_OFF) { 617 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
617 if (gpio_is_valid(pdata->gpio_power)) { 618 if (gpio_is_valid(pdata->gpio_power)) {
618 gpio_set_value(pdata->gpio_power, 1); 619 gpio_set_value(pdata->gpio_power, 1);
619 mdelay(1); 620 mdelay(1);
@@ -636,7 +637,7 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec,
636 for (reg = UDA1380_MVOL; reg < UDA1380_CACHEREGNUM; reg++) 637 for (reg = UDA1380_MVOL; reg < UDA1380_CACHEREGNUM; reg++)
637 set_bit(reg - 0x10, &uda1380_cache_dirty); 638 set_bit(reg - 0x10, &uda1380_cache_dirty);
638 } 639 }
639 codec->bias_level = level; 640 codec->dapm.bias_level = level;
640 return 0; 641 return 0;
641} 642}
642 643
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index 4bcd168794e1..9277d8d7474e 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -705,6 +705,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
705/* Called from the machine driver */ 705/* Called from the machine driver */
706int wm2000_add_controls(struct snd_soc_codec *codec) 706int wm2000_add_controls(struct snd_soc_codec *codec)
707{ 707{
708 struct snd_soc_dapm_context *dapm = &codec->dapm;
708 int ret; 709 int ret;
709 710
710 if (!wm2000_i2c) { 711 if (!wm2000_i2c) {
@@ -712,12 +713,12 @@ int wm2000_add_controls(struct snd_soc_codec *codec)
712 return -ENODEV; 713 return -ENODEV;
713 } 714 }
714 715
715 ret = snd_soc_dapm_new_controls(codec, wm2000_dapm_widgets, 716 ret = snd_soc_dapm_new_controls(dapm, wm2000_dapm_widgets,
716 ARRAY_SIZE(wm2000_dapm_widgets)); 717 ARRAY_SIZE(wm2000_dapm_widgets));
717 if (ret < 0) 718 if (ret < 0)
718 return ret; 719 return ret;
719 720
720 ret = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 721 ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
721 if (ret < 0) 722 if (ret < 0)
722 return ret; 723 return ret;
723 724
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index f4f1fba38eb9..4c6c81e11544 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -230,8 +230,9 @@ static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec)
230 */ 230 */
231static void wm8350_pga_work(struct work_struct *work) 231static void wm8350_pga_work(struct work_struct *work)
232{ 232{
233 struct snd_soc_codec *codec = 233 struct snd_soc_dapm_context *dapm =
234 container_of(work, struct snd_soc_codec, delayed_work.work); 234 container_of(work, struct snd_soc_dapm_context, delayed_work.work);
235 struct snd_soc_codec *codec = dapm->codec;
235 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); 236 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
236 struct wm8350_output *out1 = &wm8350_data->out1, 237 struct wm8350_output *out1 = &wm8350_data->out1,
237 *out2 = &wm8350_data->out2; 238 *out2 = &wm8350_data->out2;
@@ -302,8 +303,8 @@ static int pga_event(struct snd_soc_dapm_widget *w,
302 out->ramp = WM8350_RAMP_UP; 303 out->ramp = WM8350_RAMP_UP;
303 out->active = 1; 304 out->active = 1;
304 305
305 if (!delayed_work_pending(&codec->delayed_work)) 306 if (!delayed_work_pending(&codec->dapm.delayed_work))
306 schedule_delayed_work(&codec->delayed_work, 307 schedule_delayed_work(&codec->dapm.delayed_work,
307 msecs_to_jiffies(1)); 308 msecs_to_jiffies(1));
308 break; 309 break;
309 310
@@ -311,8 +312,8 @@ static int pga_event(struct snd_soc_dapm_widget *w,
311 out->ramp = WM8350_RAMP_DOWN; 312 out->ramp = WM8350_RAMP_DOWN;
312 out->active = 0; 313 out->active = 0;
313 314
314 if (!delayed_work_pending(&codec->delayed_work)) 315 if (!delayed_work_pending(&codec->dapm.delayed_work))
315 schedule_delayed_work(&codec->delayed_work, 316 schedule_delayed_work(&codec->dapm.delayed_work,
316 msecs_to_jiffies(1)); 317 msecs_to_jiffies(1));
317 break; 318 break;
318 } 319 }
@@ -786,9 +787,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
786 787
787static int wm8350_add_widgets(struct snd_soc_codec *codec) 788static int wm8350_add_widgets(struct snd_soc_codec *codec)
788{ 789{
790 struct snd_soc_dapm_context *dapm = &codec->dapm;
789 int ret; 791 int ret;
790 792
791 ret = snd_soc_dapm_new_controls(codec, 793 ret = snd_soc_dapm_new_controls(dapm,
792 wm8350_dapm_widgets, 794 wm8350_dapm_widgets,
793 ARRAY_SIZE(wm8350_dapm_widgets)); 795 ARRAY_SIZE(wm8350_dapm_widgets));
794 if (ret != 0) { 796 if (ret != 0) {
@@ -797,7 +799,7 @@ static int wm8350_add_widgets(struct snd_soc_codec *codec)
797 } 799 }
798 800
799 /* set up audio paths */ 801 /* set up audio paths */
800 ret = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 802 ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
801 if (ret != 0) { 803 if (ret != 0) {
802 dev_err(codec->dev, "DAPM route register failed\n"); 804 dev_err(codec->dev, "DAPM route register failed\n");
803 return ret; 805 return ret;
@@ -1184,7 +1186,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
1184 break; 1186 break;
1185 1187
1186 case SND_SOC_BIAS_STANDBY: 1188 case SND_SOC_BIAS_STANDBY:
1187 if (codec->bias_level == SND_SOC_BIAS_OFF) { 1189 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
1188 ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), 1190 ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies),
1189 priv->supplies); 1191 priv->supplies);
1190 if (ret != 0) 1192 if (ret != 0)
@@ -1317,7 +1319,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
1317 priv->supplies); 1319 priv->supplies);
1318 break; 1320 break;
1319 } 1321 }
1320 codec->bias_level = level; 1322 codec->dapm.bias_level = level;
1321 return 0; 1323 return 0;
1322} 1324}
1323 1325
@@ -1550,7 +1552,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1550 /* Put the codec into reset if it wasn't already */ 1552 /* Put the codec into reset if it wasn't already */
1551 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1553 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
1552 1554
1553 INIT_DELAYED_WORK(&codec->delayed_work, wm8350_pga_work); 1555 INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8350_pga_work);
1554 1556
1555 /* Enable the codec */ 1557 /* Enable the codec */
1556 wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1558 wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
@@ -1635,12 +1637,12 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
1635 priv->mic.jack = NULL; 1637 priv->mic.jack = NULL;
1636 1638
1637 /* cancel any work waiting to be queued. */ 1639 /* cancel any work waiting to be queued. */
1638 ret = cancel_delayed_work(&codec->delayed_work); 1640 ret = cancel_delayed_work(&codec->dapm.delayed_work);
1639 1641
1640 /* if there was any work waiting then we run it now and 1642 /* if there was any work waiting then we run it now and
1641 * wait for its completion */ 1643 * wait for its completion */
1642 if (ret) { 1644 if (ret) {
1643 schedule_delayed_work(&codec->delayed_work, 0); 1645 schedule_delayed_work(&codec->dapm.delayed_work, 0);
1644 flush_scheduled_work(); 1646 flush_scheduled_work();
1645 } 1647 }
1646 1648
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 850299786e02..96927a457a34 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -911,10 +911,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
911 911
912static int wm8400_add_widgets(struct snd_soc_codec *codec) 912static int wm8400_add_widgets(struct snd_soc_codec *codec)
913{ 913{
914 snd_soc_dapm_new_controls(codec, wm8400_dapm_widgets, 914 struct snd_soc_dapm_context *dapm = &codec->dapm;
915 ARRAY_SIZE(wm8400_dapm_widgets));
916 915
917 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 916 snd_soc_dapm_new_controls(dapm, wm8400_dapm_widgets,
917 ARRAY_SIZE(wm8400_dapm_widgets));
918 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
918 919
919 return 0; 920 return 0;
920} 921}
@@ -1219,7 +1220,7 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec,
1219 break; 1220 break;
1220 1221
1221 case SND_SOC_BIAS_STANDBY: 1222 case SND_SOC_BIAS_STANDBY:
1222 if (codec->bias_level == SND_SOC_BIAS_OFF) { 1223 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
1223 ret = regulator_bulk_enable(ARRAY_SIZE(power), 1224 ret = regulator_bulk_enable(ARRAY_SIZE(power),
1224 &power[0]); 1225 &power[0]);
1225 if (ret != 0) { 1226 if (ret != 0) {
@@ -1306,7 +1307,7 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec,
1306 break; 1307 break;
1307 } 1308 }
1308 1309
1309 codec->bias_level = level; 1310 codec->dapm.bias_level = level;
1310 return 0; 1311 return 0;
1311} 1312}
1312 1313
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 8f107095760e..6b3833c7bdf3 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -216,10 +216,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
216 216
217static int wm8510_add_widgets(struct snd_soc_codec *codec) 217static int wm8510_add_widgets(struct snd_soc_codec *codec)
218{ 218{
219 snd_soc_dapm_new_controls(codec, wm8510_dapm_widgets, 219 struct snd_soc_dapm_context *dapm = &codec->dapm;
220 ARRAY_SIZE(wm8510_dapm_widgets));
221 220
222 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 221 snd_soc_dapm_new_controls(dapm, wm8510_dapm_widgets,
222 ARRAY_SIZE(wm8510_dapm_widgets));
223 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
223 224
224 return 0; 225 return 0;
225} 226}
@@ -478,7 +479,7 @@ static int wm8510_set_bias_level(struct snd_soc_codec *codec,
478 case SND_SOC_BIAS_STANDBY: 479 case SND_SOC_BIAS_STANDBY:
479 power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN; 480 power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN;
480 481
481 if (codec->bias_level == SND_SOC_BIAS_OFF) { 482 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
482 /* Initial cap charge at VMID 5k */ 483 /* Initial cap charge at VMID 5k */
483 snd_soc_write(codec, WM8510_POWER1, power1 | 0x3); 484 snd_soc_write(codec, WM8510_POWER1, power1 | 0x3);
484 mdelay(100); 485 mdelay(100);
@@ -495,7 +496,7 @@ static int wm8510_set_bias_level(struct snd_soc_codec *codec,
495 break; 496 break;
496 } 497 }
497 498
498 codec->bias_level = level; 499 codec->dapm.bias_level = level;
499 return 0; 500 return 0;
500} 501}
501 502
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index 712ef7c76f90..d3318886f43e 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -110,10 +110,11 @@ static const struct snd_soc_dapm_route intercon[] = {
110 110
111static int wm8523_add_widgets(struct snd_soc_codec *codec) 111static int wm8523_add_widgets(struct snd_soc_codec *codec)
112{ 112{
113 snd_soc_dapm_new_controls(codec, wm8523_dapm_widgets, 113 struct snd_soc_dapm_context *dapm = &codec->dapm;
114 ARRAY_SIZE(wm8523_dapm_widgets));
115 114
116 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 115 snd_soc_dapm_new_controls(dapm, wm8523_dapm_widgets,
116 ARRAY_SIZE(wm8523_dapm_widgets));
117 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
117 118
118 return 0; 119 return 0;
119} 120}
@@ -328,7 +329,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
328 break; 329 break;
329 330
330 case SND_SOC_BIAS_STANDBY: 331 case SND_SOC_BIAS_STANDBY:
331 if (codec->bias_level == SND_SOC_BIAS_OFF) { 332 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
332 ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies), 333 ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies),
333 wm8523->supplies); 334 wm8523->supplies);
334 if (ret != 0) { 335 if (ret != 0) {
@@ -367,7 +368,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
367 wm8523->supplies); 368 wm8523->supplies);
368 break; 369 break;
369 } 370 }
370 codec->bias_level = level; 371 codec->dapm.bias_level = level;
371 return 0; 372 return 0;
372} 373}
373 374
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index a2e0ed59b376..dfd1dbd71f1d 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -302,10 +302,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
302 302
303static int wm8580_add_widgets(struct snd_soc_codec *codec) 303static int wm8580_add_widgets(struct snd_soc_codec *codec)
304{ 304{
305 snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets, 305 struct snd_soc_dapm_context *dapm = &codec->dapm;
306 ARRAY_SIZE(wm8580_dapm_widgets));
307 306
308 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 307 snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets,
308 ARRAY_SIZE(wm8580_dapm_widgets));
309 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
309 310
310 return 0; 311 return 0;
311} 312}
@@ -767,7 +768,7 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec,
767 break; 768 break;
768 769
769 case SND_SOC_BIAS_STANDBY: 770 case SND_SOC_BIAS_STANDBY:
770 if (codec->bias_level == SND_SOC_BIAS_OFF) { 771 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
771 /* Power up and get individual control of the DACs */ 772 /* Power up and get individual control of the DACs */
772 reg = snd_soc_read(codec, WM8580_PWRDN1); 773 reg = snd_soc_read(codec, WM8580_PWRDN1);
773 reg &= ~(WM8580_PWRDN1_PWDN | WM8580_PWRDN1_ALLDACPD); 774 reg &= ~(WM8580_PWRDN1_PWDN | WM8580_PWRDN1_ALLDACPD);
@@ -785,7 +786,7 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec,
785 snd_soc_write(codec, WM8580_PWRDN1, reg | WM8580_PWRDN1_PWDN); 786 snd_soc_write(codec, WM8580_PWRDN1, reg | WM8580_PWRDN1_PWDN);
786 break; 787 break;
787 } 788 }
788 codec->bias_level = level; 789 codec->dapm.bias_level = level;
789 return 0; 790 return 0;
790} 791}
791 792
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c
index 54fbd76c8bca..ea2daf4da57c 100644
--- a/sound/soc/codecs/wm8711.c
+++ b/sound/soc/codecs/wm8711.c
@@ -93,10 +93,11 @@ static const struct snd_soc_dapm_route intercon[] = {
93 93
94static int wm8711_add_widgets(struct snd_soc_codec *codec) 94static int wm8711_add_widgets(struct snd_soc_codec *codec)
95{ 95{
96 snd_soc_dapm_new_controls(codec, wm8711_dapm_widgets, 96 struct snd_soc_dapm_context *dapm = &codec->dapm;
97 ARRAY_SIZE(wm8711_dapm_widgets));
98 97
99 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 98 snd_soc_dapm_new_controls(dapm, wm8711_dapm_widgets,
99 ARRAY_SIZE(wm8711_dapm_widgets));
100 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
100 101
101 return 0; 102 return 0;
102} 103}
@@ -318,7 +319,7 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec,
318 snd_soc_write(codec, WM8711_PWR, 0xffff); 319 snd_soc_write(codec, WM8711_PWR, 0xffff);
319 break; 320 break;
320 } 321 }
321 codec->bias_level = level; 322 codec->dapm.bias_level = level;
322 return 0; 323 return 0;
323} 324}
324 325
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c
index 075f35e4f4cb..23939976c3cc 100644
--- a/sound/soc/codecs/wm8728.c
+++ b/sound/soc/codecs/wm8728.c
@@ -73,10 +73,11 @@ static const struct snd_soc_dapm_route intercon[] = {
73 73
74static int wm8728_add_widgets(struct snd_soc_codec *codec) 74static int wm8728_add_widgets(struct snd_soc_codec *codec)
75{ 75{
76 snd_soc_dapm_new_controls(codec, wm8728_dapm_widgets, 76 struct snd_soc_dapm_context *dapm = &codec->dapm;
77 ARRAY_SIZE(wm8728_dapm_widgets));
78 77
79 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 78 snd_soc_dapm_new_controls(dapm, wm8728_dapm_widgets,
79 ARRAY_SIZE(wm8728_dapm_widgets));
80 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
80 81
81 return 0; 82 return 0;
82} 83}
@@ -180,7 +181,7 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec,
180 case SND_SOC_BIAS_ON: 181 case SND_SOC_BIAS_ON:
181 case SND_SOC_BIAS_PREPARE: 182 case SND_SOC_BIAS_PREPARE:
182 case SND_SOC_BIAS_STANDBY: 183 case SND_SOC_BIAS_STANDBY:
183 if (codec->bias_level == SND_SOC_BIAS_OFF) { 184 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
184 /* Power everything up... */ 185 /* Power everything up... */
185 reg = snd_soc_read(codec, WM8728_DACCTL); 186 reg = snd_soc_read(codec, WM8728_DACCTL);
186 snd_soc_write(codec, WM8728_DACCTL, reg & ~0x4); 187 snd_soc_write(codec, WM8728_DACCTL, reg & ~0x4);
@@ -197,7 +198,7 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec,
197 snd_soc_write(codec, WM8728_DACCTL, reg | 0x4); 198 snd_soc_write(codec, WM8728_DACCTL, reg | 0x4);
198 break; 199 break;
199 } 200 }
200 codec->bias_level = level; 201 codec->dapm.bias_level = level;
201 return 0; 202 return 0;
202} 203}
203 204
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 631385802eb4..95ade3245056 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -165,10 +165,11 @@ static const struct snd_soc_dapm_route intercon[] = {
165 165
166static int wm8731_add_widgets(struct snd_soc_codec *codec) 166static int wm8731_add_widgets(struct snd_soc_codec *codec)
167{ 167{
168 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, 168 struct snd_soc_dapm_context *dapm = &codec->dapm;
169 ARRAY_SIZE(wm8731_dapm_widgets));
170 169
171 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 170 snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
171 ARRAY_SIZE(wm8731_dapm_widgets));
172 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
172 173
173 return 0; 174 return 0;
174} 175}
@@ -319,7 +320,7 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
319 return -EINVAL; 320 return -EINVAL;
320 } 321 }
321 322
322 snd_soc_dapm_sync(codec); 323 snd_soc_dapm_sync(&codec->dapm);
323 324
324 return 0; 325 return 0;
325} 326}
@@ -399,7 +400,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
399 case SND_SOC_BIAS_PREPARE: 400 case SND_SOC_BIAS_PREPARE:
400 break; 401 break;
401 case SND_SOC_BIAS_STANDBY: 402 case SND_SOC_BIAS_STANDBY:
402 if (codec->bias_level == SND_SOC_BIAS_OFF) { 403 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
403 ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies), 404 ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies),
404 wm8731->supplies); 405 wm8731->supplies);
405 if (ret != 0) 406 if (ret != 0)
@@ -428,7 +429,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
428 wm8731->supplies); 429 wm8731->supplies);
429 break; 430 break;
430 } 431 }
431 codec->bias_level = level; 432 codec->dapm.bias_level = level;
432 return 0; 433 return 0;
433} 434}
434 435
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index 90e31e9aa6f7..43c49dfc9928 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -95,10 +95,11 @@ static const struct snd_soc_dapm_route intercon[] = {
95 95
96static int wm8741_add_widgets(struct snd_soc_codec *codec) 96static int wm8741_add_widgets(struct snd_soc_codec *codec)
97{ 97{
98 snd_soc_dapm_new_controls(codec, wm8741_dapm_widgets, 98 struct snd_soc_dapm_context *dapm = &codec->dapm;
99 ARRAY_SIZE(wm8741_dapm_widgets));
100 99
101 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 100 snd_soc_dapm_new_controls(dapm, wm8741_dapm_widgets,
101 ARRAY_SIZE(wm8741_dapm_widgets));
102 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
102 103
103 return 0; 104 return 0;
104} 105}
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 6c924cd2cfd4..178b967af73f 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -399,10 +399,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
399 399
400static int wm8750_add_widgets(struct snd_soc_codec *codec) 400static int wm8750_add_widgets(struct snd_soc_codec *codec)
401{ 401{
402 snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, 402 struct snd_soc_dapm_context *dapm = &codec->dapm;
403 ARRAY_SIZE(wm8750_dapm_widgets));
404 403
405 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 404 snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
405 ARRAY_SIZE(wm8750_dapm_widgets));
406 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
406 407
407 return 0; 408 return 0;
408} 409}
@@ -615,7 +616,7 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec,
615 case SND_SOC_BIAS_PREPARE: 616 case SND_SOC_BIAS_PREPARE:
616 break; 617 break;
617 case SND_SOC_BIAS_STANDBY: 618 case SND_SOC_BIAS_STANDBY:
618 if (codec->bias_level == SND_SOC_BIAS_OFF) { 619 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
619 /* Set VMID to 5k */ 620 /* Set VMID to 5k */
620 snd_soc_write(codec, WM8750_PWR1, pwr_reg | 0x01c1); 621 snd_soc_write(codec, WM8750_PWR1, pwr_reg | 0x01c1);
621 622
@@ -630,7 +631,7 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec,
630 snd_soc_write(codec, WM8750_PWR1, 0x0001); 631 snd_soc_write(codec, WM8750_PWR1, 0x0001);
631 break; 632 break;
632 } 633 }
633 codec->bias_level = level; 634 codec->dapm.bias_level = level;
634 return 0; 635 return 0;
635} 636}
636 637
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 8f679a13f2bc..26096b47a493 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -670,10 +670,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
670 670
671static int wm8753_add_widgets(struct snd_soc_codec *codec) 671static int wm8753_add_widgets(struct snd_soc_codec *codec)
672{ 672{
673 snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, 673 struct snd_soc_dapm_context *dapm = &codec->dapm;
674 ARRAY_SIZE(wm8753_dapm_widgets));
675 674
676 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 675 snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets,
676 ARRAY_SIZE(wm8753_dapm_widgets));
677 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
677 678
678 return 0; 679 return 0;
679} 680}
@@ -1292,7 +1293,7 @@ static int wm8753_set_bias_level(struct snd_soc_codec *codec,
1292 wm8753_write(codec, WM8753_PWR1, 0x0001); 1293 wm8753_write(codec, WM8753_PWR1, 0x0001);
1293 break; 1294 break;
1294 } 1295 }
1295 codec->bias_level = level; 1296 codec->dapm.bias_level = level;
1296 return 0; 1297 return 0;
1297} 1298}
1298 1299
@@ -1482,9 +1483,11 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec,
1482 1483
1483static void wm8753_work(struct work_struct *work) 1484static void wm8753_work(struct work_struct *work)
1484{ 1485{
1485 struct snd_soc_codec *codec = 1486 struct snd_soc_dapm_context *dapm =
1486 container_of(work, struct snd_soc_codec, delayed_work.work); 1487 container_of(work, struct snd_soc_dapm_context,
1487 wm8753_set_bias_level(codec, codec->bias_level); 1488 delayed_work.work);
1489 struct snd_soc_codec *codec = dapm->codec;
1490 wm8753_set_bias_level(codec, dapm->bias_level);
1488} 1491}
1489 1492
1490static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state) 1493static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state)
@@ -1516,10 +1519,10 @@ static int wm8753_resume(struct snd_soc_codec *codec)
1516 wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1519 wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1517 1520
1518 /* charge wm8753 caps */ 1521 /* charge wm8753 caps */
1519 if (codec->suspend_bias_level == SND_SOC_BIAS_ON) { 1522 if (codec->dapm.suspend_bias_level == SND_SOC_BIAS_ON) {
1520 wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE); 1523 wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
1521 codec->bias_level = SND_SOC_BIAS_ON; 1524 codec->dapm.bias_level = SND_SOC_BIAS_ON;
1522 schedule_delayed_work(&codec->delayed_work, 1525 schedule_delayed_work(&codec->dapm.delayed_work,
1523 msecs_to_jiffies(caps_charge)); 1526 msecs_to_jiffies(caps_charge));
1524 } 1527 }
1525 1528
@@ -1550,7 +1553,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
1550 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); 1553 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1551 int ret = 0, reg; 1554 int ret = 0, reg;
1552 1555
1553 INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); 1556 INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8753_work);
1554 1557
1555 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8753->control_type); 1558 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8753->control_type);
1556 if (ret < 0) { 1559 if (ret < 0) {
@@ -1569,7 +1572,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
1569 1572
1570 /* charge output caps */ 1573 /* charge output caps */
1571 wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE); 1574 wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
1572 schedule_delayed_work(&codec->delayed_work, 1575 schedule_delayed_work(&codec->dapm.delayed_work,
1573 msecs_to_jiffies(caps_charge)); 1576 msecs_to_jiffies(caps_charge));
1574 1577
1575 /* set the update bits */ 1578 /* set the update bits */
@@ -1604,7 +1607,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
1604/* power down chip */ 1607/* power down chip */
1605static int wm8753_remove(struct snd_soc_codec *codec) 1608static int wm8753_remove(struct snd_soc_codec *codec)
1606{ 1609{
1607 run_delayed_work(&codec->delayed_work); 1610 run_delayed_work(&codec->dapm.delayed_work);
1608 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); 1611 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
1609 1612
1610 return 0; 1613 return 0;
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index 04182c464e35..96474a40da8d 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -307,7 +307,7 @@ static int wm8776_set_bias_level(struct snd_soc_codec *codec,
307 case SND_SOC_BIAS_PREPARE: 307 case SND_SOC_BIAS_PREPARE:
308 break; 308 break;
309 case SND_SOC_BIAS_STANDBY: 309 case SND_SOC_BIAS_STANDBY:
310 if (codec->bias_level == SND_SOC_BIAS_OFF) { 310 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
311 /* Disable the global powerdown; DAPM does the rest */ 311 /* Disable the global powerdown; DAPM does the rest */
312 snd_soc_update_bits(codec, WM8776_PWRDOWN, 1, 0); 312 snd_soc_update_bits(codec, WM8776_PWRDOWN, 1, 0);
313 } 313 }
@@ -318,7 +318,7 @@ static int wm8776_set_bias_level(struct snd_soc_codec *codec,
318 break; 318 break;
319 } 319 }
320 320
321 codec->bias_level = level; 321 codec->dapm.bias_level = level;
322 return 0; 322 return 0;
323} 323}
324 324
@@ -405,6 +405,7 @@ static int wm8776_resume(struct snd_soc_codec *codec)
405static int wm8776_probe(struct snd_soc_codec *codec) 405static int wm8776_probe(struct snd_soc_codec *codec)
406{ 406{
407 struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec); 407 struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec);
408 struct snd_soc_dapm_context *dapm = &codec->dapm;
408 int ret = 0; 409 int ret = 0;
409 410
410 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8776->control_type); 411 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8776->control_type);
@@ -428,9 +429,9 @@ static int wm8776_probe(struct snd_soc_codec *codec)
428 429
429 snd_soc_add_controls(codec, wm8776_snd_controls, 430 snd_soc_add_controls(codec, wm8776_snd_controls,
430 ARRAY_SIZE(wm8776_snd_controls)); 431 ARRAY_SIZE(wm8776_snd_controls));
431 snd_soc_dapm_new_controls(codec, wm8776_dapm_widgets, 432 snd_soc_dapm_new_controls(dapm, wm8776_dapm_widgets,
432 ARRAY_SIZE(wm8776_dapm_widgets)); 433 ARRAY_SIZE(wm8776_dapm_widgets));
433 snd_soc_dapm_add_routes(codec, routes, ARRAY_SIZE(routes)); 434 snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
434 435
435 return ret; 436 return ret;
436} 437}
diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 4599e8e95aa2..031a0d421108 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -515,7 +515,7 @@ static int wm8804_set_bias_level(struct snd_soc_codec *codec,
515 snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); 515 snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0);
516 break; 516 break;
517 case SND_SOC_BIAS_STANDBY: 517 case SND_SOC_BIAS_STANDBY:
518 if (codec->bias_level == SND_SOC_BIAS_OFF) { 518 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
519 ret = regulator_bulk_enable(ARRAY_SIZE(wm8804->supplies), 519 ret = regulator_bulk_enable(ARRAY_SIZE(wm8804->supplies),
520 wm8804->supplies); 520 wm8804->supplies);
521 if (ret) { 521 if (ret) {
@@ -537,7 +537,7 @@ static int wm8804_set_bias_level(struct snd_soc_codec *codec,
537 break; 537 break;
538 } 538 }
539 539
540 codec->bias_level = level; 540 codec->dapm.bias_level = level;
541 return 0; 541 return 0;
542} 542}
543 543
@@ -581,7 +581,7 @@ static int wm8804_probe(struct snd_soc_codec *codec)
581 wm8804 = snd_soc_codec_get_drvdata(codec); 581 wm8804 = snd_soc_codec_get_drvdata(codec);
582 wm8804->codec = codec; 582 wm8804->codec = codec;
583 583
584 codec->idle_bias_off = 1; 584 codec->dapm.idle_bias_off = 1;
585 585
586 ret = snd_soc_codec_set_cache_io(codec, 8, 8, wm8804->control_type); 586 ret = snd_soc_codec_set_cache_io(codec, 8, 8, wm8804->control_type);
587 if (ret < 0) { 587 if (ret < 0) {
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index aca4b1ea10bb..06ea9c0f863b 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -611,10 +611,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
611 611
612static int wm8900_add_widgets(struct snd_soc_codec *codec) 612static int wm8900_add_widgets(struct snd_soc_codec *codec)
613{ 613{
614 snd_soc_dapm_new_controls(codec, wm8900_dapm_widgets, 614 struct snd_soc_dapm_context *dapm = &codec->dapm;
615 ARRAY_SIZE(wm8900_dapm_widgets));
616 615
617 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 616 snd_soc_dapm_new_controls(dapm, wm8900_dapm_widgets,
617 ARRAY_SIZE(wm8900_dapm_widgets));
618 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
618 619
619 return 0; 620 return 0;
620} 621}
@@ -1051,7 +1052,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec,
1051 1052
1052 case SND_SOC_BIAS_STANDBY: 1053 case SND_SOC_BIAS_STANDBY:
1053 /* Charge capacitors if initial power up */ 1054 /* Charge capacitors if initial power up */
1054 if (codec->bias_level == SND_SOC_BIAS_OFF) { 1055 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
1055 /* STARTUP_BIAS_ENA on */ 1056 /* STARTUP_BIAS_ENA on */
1056 snd_soc_write(codec, WM8900_REG_POWER1, 1057 snd_soc_write(codec, WM8900_REG_POWER1,
1057 WM8900_REG_POWER1_STARTUP_BIAS_ENA); 1058 WM8900_REG_POWER1_STARTUP_BIAS_ENA);
@@ -1119,7 +1120,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec,
1119 WM8900_REG_POWER2_SYSCLK_ENA); 1120 WM8900_REG_POWER2_SYSCLK_ENA);
1120 break; 1121 break;
1121 } 1122 }
1122 codec->bias_level = level; 1123 codec->dapm.bias_level = level;
1123 return 0; 1124 return 0;
1124} 1125}
1125 1126
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 622b60238a82..4a6df4b69a04 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -923,10 +923,11 @@ static const struct snd_soc_dapm_route intercon[] = {
923 923
924static int wm8903_add_widgets(struct snd_soc_codec *codec) 924static int wm8903_add_widgets(struct snd_soc_codec *codec)
925{ 925{
926 snd_soc_dapm_new_controls(codec, wm8903_dapm_widgets, 926 struct snd_soc_dapm_context *dapm = &codec->dapm;
927 ARRAY_SIZE(wm8903_dapm_widgets));
928 927
929 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 928 snd_soc_dapm_new_controls(dapm, wm8903_dapm_widgets,
929 ARRAY_SIZE(wm8903_dapm_widgets));
930 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
930 931
931 return 0; 932 return 0;
932} 933}
@@ -946,7 +947,7 @@ static int wm8903_set_bias_level(struct snd_soc_codec *codec,
946 break; 947 break;
947 948
948 case SND_SOC_BIAS_STANDBY: 949 case SND_SOC_BIAS_STANDBY:
949 if (codec->bias_level == SND_SOC_BIAS_OFF) { 950 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
950 snd_soc_write(codec, WM8903_CLOCK_RATES_2, 951 snd_soc_write(codec, WM8903_CLOCK_RATES_2,
951 WM8903_CLK_SYS_ENA); 952 WM8903_CLK_SYS_ENA);
952 953
@@ -991,7 +992,7 @@ static int wm8903_set_bias_level(struct snd_soc_codec *codec,
991 break; 992 break;
992 } 993 }
993 994
994 codec->bias_level = level; 995 codec->dapm.bias_level = level;
995 996
996 return 0; 997 return 0;
997} 998}
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 33be84e506ea..be90399c1cb4 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -1428,10 +1428,11 @@ static const struct snd_soc_dapm_route wm8912_intercon[] = {
1428static int wm8904_add_widgets(struct snd_soc_codec *codec) 1428static int wm8904_add_widgets(struct snd_soc_codec *codec)
1429{ 1429{
1430 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); 1430 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1431 struct snd_soc_dapm_context *dapm = &codec->dapm;
1431 1432
1432 snd_soc_dapm_new_controls(codec, wm8904_core_dapm_widgets, 1433 snd_soc_dapm_new_controls(dapm, wm8904_core_dapm_widgets,
1433 ARRAY_SIZE(wm8904_core_dapm_widgets)); 1434 ARRAY_SIZE(wm8904_core_dapm_widgets));
1434 snd_soc_dapm_add_routes(codec, core_intercon, 1435 snd_soc_dapm_add_routes(dapm, core_intercon,
1435 ARRAY_SIZE(core_intercon)); 1436 ARRAY_SIZE(core_intercon));
1436 1437
1437 switch (wm8904->devtype) { 1438 switch (wm8904->devtype) {
@@ -1443,20 +1444,20 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec)
1443 snd_soc_add_controls(codec, wm8904_snd_controls, 1444 snd_soc_add_controls(codec, wm8904_snd_controls,
1444 ARRAY_SIZE(wm8904_snd_controls)); 1445 ARRAY_SIZE(wm8904_snd_controls));
1445 1446
1446 snd_soc_dapm_new_controls(codec, wm8904_adc_dapm_widgets, 1447 snd_soc_dapm_new_controls(dapm, wm8904_adc_dapm_widgets,
1447 ARRAY_SIZE(wm8904_adc_dapm_widgets)); 1448 ARRAY_SIZE(wm8904_adc_dapm_widgets));
1448 snd_soc_dapm_new_controls(codec, wm8904_dac_dapm_widgets, 1449 snd_soc_dapm_new_controls(dapm, wm8904_dac_dapm_widgets,
1449 ARRAY_SIZE(wm8904_dac_dapm_widgets)); 1450 ARRAY_SIZE(wm8904_dac_dapm_widgets));
1450 snd_soc_dapm_new_controls(codec, wm8904_dapm_widgets, 1451 snd_soc_dapm_new_controls(dapm, wm8904_dapm_widgets,
1451 ARRAY_SIZE(wm8904_dapm_widgets)); 1452 ARRAY_SIZE(wm8904_dapm_widgets));
1452 1453
1453 snd_soc_dapm_add_routes(codec, core_intercon, 1454 snd_soc_dapm_add_routes(dapm, core_intercon,
1454 ARRAY_SIZE(core_intercon)); 1455 ARRAY_SIZE(core_intercon));
1455 snd_soc_dapm_add_routes(codec, adc_intercon, 1456 snd_soc_dapm_add_routes(dapm, adc_intercon,
1456 ARRAY_SIZE(adc_intercon)); 1457 ARRAY_SIZE(adc_intercon));
1457 snd_soc_dapm_add_routes(codec, dac_intercon, 1458 snd_soc_dapm_add_routes(dapm, dac_intercon,
1458 ARRAY_SIZE(dac_intercon)); 1459 ARRAY_SIZE(dac_intercon));
1459 snd_soc_dapm_add_routes(codec, wm8904_intercon, 1460 snd_soc_dapm_add_routes(dapm, wm8904_intercon,
1460 ARRAY_SIZE(wm8904_intercon)); 1461 ARRAY_SIZE(wm8904_intercon));
1461 break; 1462 break;
1462 1463
@@ -1464,17 +1465,17 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec)
1464 snd_soc_add_controls(codec, wm8904_dac_snd_controls, 1465 snd_soc_add_controls(codec, wm8904_dac_snd_controls,
1465 ARRAY_SIZE(wm8904_dac_snd_controls)); 1466 ARRAY_SIZE(wm8904_dac_snd_controls));
1466 1467
1467 snd_soc_dapm_new_controls(codec, wm8904_dac_dapm_widgets, 1468 snd_soc_dapm_new_controls(dapm, wm8904_dac_dapm_widgets,
1468 ARRAY_SIZE(wm8904_dac_dapm_widgets)); 1469 ARRAY_SIZE(wm8904_dac_dapm_widgets));
1469 1470
1470 snd_soc_dapm_add_routes(codec, dac_intercon, 1471 snd_soc_dapm_add_routes(dapm, dac_intercon,
1471 ARRAY_SIZE(dac_intercon)); 1472 ARRAY_SIZE(dac_intercon));
1472 snd_soc_dapm_add_routes(codec, wm8912_intercon, 1473 snd_soc_dapm_add_routes(dapm, wm8912_intercon,
1473 ARRAY_SIZE(wm8912_intercon)); 1474 ARRAY_SIZE(wm8912_intercon));
1474 break; 1475 break;
1475 } 1476 }
1476 1477
1477 snd_soc_dapm_new_widgets(codec); 1478 snd_soc_dapm_new_widgets(dapm);
1478 return 0; 1479 return 0;
1479} 1480}
1480 1481
@@ -2139,7 +2140,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
2139 break; 2140 break;
2140 2141
2141 case SND_SOC_BIAS_STANDBY: 2142 case SND_SOC_BIAS_STANDBY:
2142 if (codec->bias_level == SND_SOC_BIAS_OFF) { 2143 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
2143 ret = regulator_bulk_enable(ARRAY_SIZE(wm8904->supplies), 2144 ret = regulator_bulk_enable(ARRAY_SIZE(wm8904->supplies),
2144 wm8904->supplies); 2145 wm8904->supplies);
2145 if (ret != 0) { 2146 if (ret != 0) {
@@ -2198,7 +2199,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
2198 wm8904->supplies); 2199 wm8904->supplies);
2199 break; 2200 break;
2200 } 2201 }
2201 codec->bias_level = level; 2202 codec->dapm.bias_level = level;
2202 return 0; 2203 return 0;
2203} 2204}
2204 2205
@@ -2373,7 +2374,7 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2373 int ret, i; 2374 int ret, i;
2374 2375
2375 codec->cache_sync = 1; 2376 codec->cache_sync = 1;
2376 codec->idle_bias_off = 1; 2377 codec->dapm.idle_bias_off = 1;
2377 2378
2378 switch (wm8904->devtype) { 2379 switch (wm8904->devtype) {
2379 case WM8904: 2380 case WM8904:
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 2cb16f895c46..c2def1b01ae0 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -291,13 +291,14 @@ static const struct snd_soc_dapm_route audio_map[] = {
291 291
292static int wm8940_add_widgets(struct snd_soc_codec *codec) 292static int wm8940_add_widgets(struct snd_soc_codec *codec)
293{ 293{
294 struct snd_soc_dapm_context *dapm = &codec->dapm;
294 int ret; 295 int ret;
295 296
296 ret = snd_soc_dapm_new_controls(codec, wm8940_dapm_widgets, 297 ret = snd_soc_dapm_new_controls(dapm, wm8940_dapm_widgets,
297 ARRAY_SIZE(wm8940_dapm_widgets)); 298 ARRAY_SIZE(wm8940_dapm_widgets));
298 if (ret) 299 if (ret)
299 goto error_ret; 300 goto error_ret;
300 ret = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 301 ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
301 if (ret) 302 if (ret)
302 goto error_ret; 303 goto error_ret;
303 304
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index f89ad6c9a80b..df1940fdbf69 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -577,13 +577,14 @@ static const struct snd_soc_dapm_route wm8955_intercon[] = {
577 577
578static int wm8955_add_widgets(struct snd_soc_codec *codec) 578static int wm8955_add_widgets(struct snd_soc_codec *codec)
579{ 579{
580 struct snd_soc_dapm_context *dapm = &codec->dapm;
581
580 snd_soc_add_controls(codec, wm8955_snd_controls, 582 snd_soc_add_controls(codec, wm8955_snd_controls,
581 ARRAY_SIZE(wm8955_snd_controls)); 583 ARRAY_SIZE(wm8955_snd_controls));
582 584
583 snd_soc_dapm_new_controls(codec, wm8955_dapm_widgets, 585 snd_soc_dapm_new_controls(dapm, wm8955_dapm_widgets,
584 ARRAY_SIZE(wm8955_dapm_widgets)); 586 ARRAY_SIZE(wm8955_dapm_widgets));
585 587 snd_soc_dapm_add_routes(dapm, wm8955_intercon,
586 snd_soc_dapm_add_routes(codec, wm8955_intercon,
587 ARRAY_SIZE(wm8955_intercon)); 588 ARRAY_SIZE(wm8955_intercon));
588 589
589 return 0; 590 return 0;
@@ -786,7 +787,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
786 break; 787 break;
787 788
788 case SND_SOC_BIAS_STANDBY: 789 case SND_SOC_BIAS_STANDBY:
789 if (codec->bias_level == SND_SOC_BIAS_OFF) { 790 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
790 ret = regulator_bulk_enable(ARRAY_SIZE(wm8955->supplies), 791 ret = regulator_bulk_enable(ARRAY_SIZE(wm8955->supplies),
791 wm8955->supplies); 792 wm8955->supplies);
792 if (ret != 0) { 793 if (ret != 0) {
@@ -850,7 +851,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
850 wm8955->supplies); 851 wm8955->supplies);
851 break; 852 break;
852 } 853 }
853 codec->bias_level = level; 854 codec->dapm.bias_level = level;
854 return 0; 855 return 0;
855} 856}
856 857
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 8d5efb333c33..0ea578815003 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -388,27 +388,28 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec)
388{ 388{
389 struct wm8960_data *pdata = codec->dev->platform_data; 389 struct wm8960_data *pdata = codec->dev->platform_data;
390 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); 390 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
391 struct snd_soc_dapm_context *dapm = &codec->dapm;
391 struct snd_soc_dapm_widget *w; 392 struct snd_soc_dapm_widget *w;
392 393
393 snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets, 394 snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets,
394 ARRAY_SIZE(wm8960_dapm_widgets)); 395 ARRAY_SIZE(wm8960_dapm_widgets));
395 396
396 snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); 397 snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
397 398
398 /* In capless mode OUT3 is used to provide VMID for the 399 /* In capless mode OUT3 is used to provide VMID for the
399 * headphone outputs, otherwise it is used as a mono mixer. 400 * headphone outputs, otherwise it is used as a mono mixer.
400 */ 401 */
401 if (pdata && pdata->capless) { 402 if (pdata && pdata->capless) {
402 snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets_capless, 403 snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets_capless,
403 ARRAY_SIZE(wm8960_dapm_widgets_capless)); 404 ARRAY_SIZE(wm8960_dapm_widgets_capless));
404 405
405 snd_soc_dapm_add_routes(codec, audio_paths_capless, 406 snd_soc_dapm_add_routes(dapm, audio_paths_capless,
406 ARRAY_SIZE(audio_paths_capless)); 407 ARRAY_SIZE(audio_paths_capless));
407 } else { 408 } else {
408 snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets_out3, 409 snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets_out3,
409 ARRAY_SIZE(wm8960_dapm_widgets_out3)); 410 ARRAY_SIZE(wm8960_dapm_widgets_out3));
410 411
411 snd_soc_dapm_add_routes(codec, audio_paths_out3, 412 snd_soc_dapm_add_routes(dapm, audio_paths_out3,
412 ARRAY_SIZE(audio_paths_out3)); 413 ARRAY_SIZE(audio_paths_out3));
413 } 414 }
414 415
@@ -417,7 +418,7 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec)
417 * list each time to find the desired power state do so now 418 * list each time to find the desired power state do so now
418 * and save the result. 419 * and save the result.
419 */ 420 */
420 list_for_each_entry(w, &codec->dapm_widgets, list) { 421 list_for_each_entry(w, &codec->dapm.widgets, list) {
421 if (strcmp(w->name, "LOUT1 PGA") == 0) 422 if (strcmp(w->name, "LOUT1 PGA") == 0)
422 wm8960->lout1 = w; 423 wm8960->lout1 = w;
423 if (strcmp(w->name, "ROUT1 PGA") == 0) 424 if (strcmp(w->name, "ROUT1 PGA") == 0)
@@ -572,7 +573,7 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec,
572 break; 573 break;
573 574
574 case SND_SOC_BIAS_STANDBY: 575 case SND_SOC_BIAS_STANDBY:
575 if (codec->bias_level == SND_SOC_BIAS_OFF) { 576 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
576 /* Enable anti-pop features */ 577 /* Enable anti-pop features */
577 snd_soc_write(codec, WM8960_APOP1, 578 snd_soc_write(codec, WM8960_APOP1,
578 WM8960_POBCTRL | WM8960_SOFT_ST | 579 WM8960_POBCTRL | WM8960_SOFT_ST |
@@ -610,7 +611,7 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec,
610 break; 611 break;
611 } 612 }
612 613
613 codec->bias_level = level; 614 codec->dapm.bias_level = level;
614 615
615 return 0; 616 return 0;
616} 617}
@@ -626,7 +627,7 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec,
626 break; 627 break;
627 628
628 case SND_SOC_BIAS_PREPARE: 629 case SND_SOC_BIAS_PREPARE:
629 switch (codec->bias_level) { 630 switch (codec->dapm.bias_level) {
630 case SND_SOC_BIAS_STANDBY: 631 case SND_SOC_BIAS_STANDBY:
631 /* Enable anti pop mode */ 632 /* Enable anti pop mode */
632 snd_soc_update_bits(codec, WM8960_APOP1, 633 snd_soc_update_bits(codec, WM8960_APOP1,
@@ -681,7 +682,7 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec,
681 break; 682 break;
682 683
683 case SND_SOC_BIAS_STANDBY: 684 case SND_SOC_BIAS_STANDBY:
684 switch (codec->bias_level) { 685 switch (codec->dapm.bias_level) {
685 case SND_SOC_BIAS_PREPARE: 686 case SND_SOC_BIAS_PREPARE:
686 /* Disable HP discharge */ 687 /* Disable HP discharge */
687 snd_soc_update_bits(codec, WM8960_APOP2, 688 snd_soc_update_bits(codec, WM8960_APOP2,
@@ -705,7 +706,7 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec,
705 break; 706 break;
706 } 707 }
707 708
708 codec->bias_level = level; 709 codec->dapm.bias_level = level;
709 710
710 return 0; 711 return 0;
711} 712}
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index 4f326f604104..79b650945bb2 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -882,7 +882,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec,
882 break; 882 break;
883 883
884 case SND_SOC_BIAS_PREPARE: 884 case SND_SOC_BIAS_PREPARE:
885 if (codec->bias_level == SND_SOC_BIAS_STANDBY) { 885 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
886 /* Enable bias generation */ 886 /* Enable bias generation */
887 reg = snd_soc_read(codec, WM8961_ANTI_POP); 887 reg = snd_soc_read(codec, WM8961_ANTI_POP);
888 reg |= WM8961_BUFIOEN | WM8961_BUFDCOPEN; 888 reg |= WM8961_BUFIOEN | WM8961_BUFDCOPEN;
@@ -897,7 +897,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec,
897 break; 897 break;
898 898
899 case SND_SOC_BIAS_STANDBY: 899 case SND_SOC_BIAS_STANDBY:
900 if (codec->bias_level == SND_SOC_BIAS_PREPARE) { 900 if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) {
901 /* VREF off */ 901 /* VREF off */
902 reg = snd_soc_read(codec, WM8961_PWR_MGMT_1); 902 reg = snd_soc_read(codec, WM8961_PWR_MGMT_1);
903 reg &= ~WM8961_VREF; 903 reg &= ~WM8961_VREF;
@@ -919,7 +919,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec,
919 break; 919 break;
920 } 920 }
921 921
922 codec->bias_level = level; 922 codec->dapm.bias_level = level;
923 923
924 return 0; 924 return 0;
925} 925}
@@ -959,6 +959,7 @@ static struct snd_soc_dai_driver wm8961_dai = {
959 959
960static int wm8961_probe(struct snd_soc_codec *codec) 960static int wm8961_probe(struct snd_soc_codec *codec)
961{ 961{
962 struct snd_soc_dapm_context *dapm = &codec->dapm;
962 int ret = 0; 963 int ret = 0;
963 u16 reg; 964 u16 reg;
964 965
@@ -1024,9 +1025,9 @@ static int wm8961_probe(struct snd_soc_codec *codec)
1024 1025
1025 snd_soc_add_controls(codec, wm8961_snd_controls, 1026 snd_soc_add_controls(codec, wm8961_snd_controls,
1026 ARRAY_SIZE(wm8961_snd_controls)); 1027 ARRAY_SIZE(wm8961_snd_controls));
1027 snd_soc_dapm_new_controls(codec, wm8961_dapm_widgets, 1028 snd_soc_dapm_new_controls(dapm, wm8961_dapm_widgets,
1028 ARRAY_SIZE(wm8961_dapm_widgets)); 1029 ARRAY_SIZE(wm8961_dapm_widgets));
1029 snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); 1030 snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
1030 1031
1031 return 0; 1032 return 0;
1032} 1033}
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 3fc63b43c6a1..80986105f52e 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2682,6 +2682,7 @@ static const struct snd_soc_dapm_route wm8962_spk_stereo_intercon[] = {
2682static int wm8962_add_widgets(struct snd_soc_codec *codec) 2682static int wm8962_add_widgets(struct snd_soc_codec *codec)
2683{ 2683{
2684 struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); 2684 struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
2685 struct snd_soc_dapm_context *dapm = &codec->dapm;
2685 2686
2686 snd_soc_add_controls(codec, wm8962_snd_controls, 2687 snd_soc_add_controls(codec, wm8962_snd_controls,
2687 ARRAY_SIZE(wm8962_snd_controls)); 2688 ARRAY_SIZE(wm8962_snd_controls));
@@ -2693,26 +2694,26 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec)
2693 ARRAY_SIZE(wm8962_spk_stereo_controls)); 2694 ARRAY_SIZE(wm8962_spk_stereo_controls));
2694 2695
2695 2696
2696 snd_soc_dapm_new_controls(codec, wm8962_dapm_widgets, 2697 snd_soc_dapm_new_controls(dapm, wm8962_dapm_widgets,
2697 ARRAY_SIZE(wm8962_dapm_widgets)); 2698 ARRAY_SIZE(wm8962_dapm_widgets));
2698 if (pdata && pdata->spk_mono) 2699 if (pdata && pdata->spk_mono)
2699 snd_soc_dapm_new_controls(codec, wm8962_dapm_spk_mono_widgets, 2700 snd_soc_dapm_new_controls(dapm, wm8962_dapm_spk_mono_widgets,
2700 ARRAY_SIZE(wm8962_dapm_spk_mono_widgets)); 2701 ARRAY_SIZE(wm8962_dapm_spk_mono_widgets));
2701 else 2702 else
2702 snd_soc_dapm_new_controls(codec, wm8962_dapm_spk_stereo_widgets, 2703 snd_soc_dapm_new_controls(dapm, wm8962_dapm_spk_stereo_widgets,
2703 ARRAY_SIZE(wm8962_dapm_spk_stereo_widgets)); 2704 ARRAY_SIZE(wm8962_dapm_spk_stereo_widgets));
2704 2705
2705 snd_soc_dapm_add_routes(codec, wm8962_intercon, 2706 snd_soc_dapm_add_routes(dapm, wm8962_intercon,
2706 ARRAY_SIZE(wm8962_intercon)); 2707 ARRAY_SIZE(wm8962_intercon));
2707 if (pdata && pdata->spk_mono) 2708 if (pdata && pdata->spk_mono)
2708 snd_soc_dapm_add_routes(codec, wm8962_spk_mono_intercon, 2709 snd_soc_dapm_add_routes(dapm, wm8962_spk_mono_intercon,
2709 ARRAY_SIZE(wm8962_spk_mono_intercon)); 2710 ARRAY_SIZE(wm8962_spk_mono_intercon));
2710 else 2711 else
2711 snd_soc_dapm_add_routes(codec, wm8962_spk_stereo_intercon, 2712 snd_soc_dapm_add_routes(dapm, wm8962_spk_stereo_intercon,
2712 ARRAY_SIZE(wm8962_spk_stereo_intercon)); 2713 ARRAY_SIZE(wm8962_spk_stereo_intercon));
2713 2714
2714 2715
2715 snd_soc_dapm_disable_pin(codec, "Beep"); 2716 snd_soc_dapm_disable_pin(dapm, "Beep");
2716 2717
2717 return 0; 2718 return 0;
2718} 2719}
@@ -2819,7 +2820,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
2819 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); 2820 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
2820 int ret; 2821 int ret;
2821 2822
2822 if (level == codec->bias_level) 2823 if (level == codec->dapm.bias_level)
2823 return 0; 2824 return 0;
2824 2825
2825 switch (level) { 2826 switch (level) {
@@ -2833,7 +2834,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
2833 break; 2834 break;
2834 2835
2835 case SND_SOC_BIAS_STANDBY: 2836 case SND_SOC_BIAS_STANDBY:
2836 if (codec->bias_level == SND_SOC_BIAS_OFF) { 2837 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
2837 ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies), 2838 ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies),
2838 wm8962->supplies); 2839 wm8962->supplies);
2839 if (ret != 0) { 2840 if (ret != 0) {
@@ -2883,7 +2884,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
2883 wm8962->supplies); 2884 wm8962->supplies);
2884 break; 2885 break;
2885 } 2886 }
2886 codec->bias_level = level; 2887 codec->dapm.bias_level = level;
2887 return 0; 2888 return 0;
2888} 2889}
2889 2890
@@ -3441,6 +3442,7 @@ static void wm8962_beep_work(struct work_struct *work)
3441 struct wm8962_priv *wm8962 = 3442 struct wm8962_priv *wm8962 =
3442 container_of(work, struct wm8962_priv, beep_work); 3443 container_of(work, struct wm8962_priv, beep_work);
3443 struct snd_soc_codec *codec = wm8962->codec; 3444 struct snd_soc_codec *codec = wm8962->codec;
3445 struct snd_soc_dapm_context *dapm = &codec->dapm;
3444 int i; 3446 int i;
3445 int reg = 0; 3447 int reg = 0;
3446 int best = 0; 3448 int best = 0;
@@ -3457,16 +3459,16 @@ static void wm8962_beep_work(struct work_struct *work)
3457 3459
3458 reg = WM8962_BEEP_ENA | (best << WM8962_BEEP_RATE_SHIFT); 3460 reg = WM8962_BEEP_ENA | (best << WM8962_BEEP_RATE_SHIFT);
3459 3461
3460 snd_soc_dapm_enable_pin(codec, "Beep"); 3462 snd_soc_dapm_enable_pin(dapm, "Beep");
3461 } else { 3463 } else {
3462 dev_dbg(codec->dev, "Disabling beep\n"); 3464 dev_dbg(codec->dev, "Disabling beep\n");
3463 snd_soc_dapm_disable_pin(codec, "Beep"); 3465 snd_soc_dapm_disable_pin(dapm, "Beep");
3464 } 3466 }
3465 3467
3466 snd_soc_update_bits(codec, WM8962_BEEP_GENERATOR_1, 3468 snd_soc_update_bits(codec, WM8962_BEEP_GENERATOR_1,
3467 WM8962_BEEP_ENA | WM8962_BEEP_RATE_MASK, reg); 3469 WM8962_BEEP_ENA | WM8962_BEEP_RATE_MASK, reg);
3468 3470
3469 snd_soc_dapm_sync(codec); 3471 snd_soc_dapm_sync(dapm);
3470} 3472}
3471 3473
3472/* For usability define a way of injecting beep events for the device - 3474/* For usability define a way of injecting beep events for the device -
@@ -3713,7 +3715,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3713 INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); 3715 INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work);
3714 3716
3715 codec->cache_sync = 1; 3717 codec->cache_sync = 1;
3716 codec->idle_bias_off = 1; 3718 codec->dapm.idle_bias_off = 1;
3717 3719
3718 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C); 3720 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C);
3719 if (ret != 0) { 3721 if (ret != 0) {
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index 63f6dbf5d070..84b2dcb18aea 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -333,10 +333,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
333 333
334static int wm8971_add_widgets(struct snd_soc_codec *codec) 334static int wm8971_add_widgets(struct snd_soc_codec *codec)
335{ 335{
336 snd_soc_dapm_new_controls(codec, wm8971_dapm_widgets, 336 struct snd_soc_dapm_context *dapm = &codec->dapm;
337 ARRAY_SIZE(wm8971_dapm_widgets));
338 337
339 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 338 snd_soc_dapm_new_controls(dapm, wm8971_dapm_widgets,
339 ARRAY_SIZE(wm8971_dapm_widgets));
340 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
340 341
341 return 0; 342 return 0;
342} 343}
@@ -553,7 +554,7 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec,
553 snd_soc_write(codec, WM8971_PWR1, 0x0001); 554 snd_soc_write(codec, WM8971_PWR1, 0x0001);
554 break; 555 break;
555 } 556 }
556 codec->bias_level = level; 557 codec->dapm.bias_level = level;
557 return 0; 558 return 0;
558} 559}
559 560
@@ -590,9 +591,11 @@ static struct snd_soc_dai_driver wm8971_dai = {
590 591
591static void wm8971_work(struct work_struct *work) 592static void wm8971_work(struct work_struct *work)
592{ 593{
593 struct snd_soc_codec *codec = 594 struct snd_soc_dapm_context *dapm =
594 container_of(work, struct snd_soc_codec, delayed_work.work); 595 container_of(work, struct snd_soc_dapm_context,
595 wm8971_set_bias_level(codec, codec->bias_level); 596 delayed_work.work);
597 struct snd_soc_codec *codec = dapm->codec;
598 wm8971_set_bias_level(codec, codec->dapm.bias_level);
596} 599}
597 600
598static int wm8971_suspend(struct snd_soc_codec *codec, pm_message_t state) 601static int wm8971_suspend(struct snd_soc_codec *codec, pm_message_t state)
@@ -620,11 +623,11 @@ static int wm8971_resume(struct snd_soc_codec *codec)
620 wm8971_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 623 wm8971_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
621 624
622 /* charge wm8971 caps */ 625 /* charge wm8971 caps */
623 if (codec->suspend_bias_level == SND_SOC_BIAS_ON) { 626 if (codec->dapm.suspend_bias_level == SND_SOC_BIAS_ON) {
624 reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e; 627 reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e;
625 snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0); 628 snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0);
626 codec->bias_level = SND_SOC_BIAS_ON; 629 codec->dapm.bias_level = SND_SOC_BIAS_ON;
627 queue_delayed_work(wm8971_workq, &codec->delayed_work, 630 queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work,
628 msecs_to_jiffies(1000)); 631 msecs_to_jiffies(1000));
629 } 632 }
630 633
@@ -643,7 +646,7 @@ static int wm8971_probe(struct snd_soc_codec *codec)
643 return ret; 646 return ret;
644 } 647 }
645 648
646 INIT_DELAYED_WORK(&codec->delayed_work, wm8971_work); 649 INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8971_work);
647 wm8971_workq = create_workqueue("wm8971"); 650 wm8971_workq = create_workqueue("wm8971");
648 if (wm8971_workq == NULL) 651 if (wm8971_workq == NULL)
649 return -ENOMEM; 652 return -ENOMEM;
@@ -653,8 +656,8 @@ static int wm8971_probe(struct snd_soc_codec *codec)
653 /* charge output caps - set vmid to 5k for quick power up */ 656 /* charge output caps - set vmid to 5k for quick power up */
654 reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e; 657 reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e;
655 snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0); 658 snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0);
656 codec->bias_level = SND_SOC_BIAS_STANDBY; 659 codec->dapm.bias_level = SND_SOC_BIAS_STANDBY;
657 queue_delayed_work(wm8971_workq, &codec->delayed_work, 660 queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work,
658 msecs_to_jiffies(1000)); 661 msecs_to_jiffies(1000));
659 662
660 /* set the update bits */ 663 /* set the update bits */
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index b4363f6d19b3..d19bb14842d4 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -274,10 +274,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
274 274
275static int wm8974_add_widgets(struct snd_soc_codec *codec) 275static int wm8974_add_widgets(struct snd_soc_codec *codec)
276{ 276{
277 snd_soc_dapm_new_controls(codec, wm8974_dapm_widgets, 277 struct snd_soc_dapm_context *dapm = &codec->dapm;
278 ARRAY_SIZE(wm8974_dapm_widgets));
279 278
280 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 279 snd_soc_dapm_new_controls(dapm, wm8974_dapm_widgets,
280 ARRAY_SIZE(wm8974_dapm_widgets));
281 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
281 282
282 return 0; 283 return 0;
283} 284}
@@ -530,7 +531,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec,
530 case SND_SOC_BIAS_STANDBY: 531 case SND_SOC_BIAS_STANDBY:
531 power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN; 532 power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN;
532 533
533 if (codec->bias_level == SND_SOC_BIAS_OFF) { 534 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
534 /* Initial cap charge at VMID 5k */ 535 /* Initial cap charge at VMID 5k */
535 snd_soc_write(codec, WM8974_POWER1, power1 | 0x3); 536 snd_soc_write(codec, WM8974_POWER1, power1 | 0x3);
536 mdelay(100); 537 mdelay(100);
@@ -547,7 +548,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec,
547 break; 548 break;
548 } 549 }
549 550
550 codec->bias_level = level; 551 codec->dapm.bias_level = level;
551 return 0; 552 return 0;
552} 553}
553 554
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 13b979a71a7c..ac43b6088e2e 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -355,11 +355,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
355 355
356static int wm8978_add_widgets(struct snd_soc_codec *codec) 356static int wm8978_add_widgets(struct snd_soc_codec *codec)
357{ 357{
358 snd_soc_dapm_new_controls(codec, wm8978_dapm_widgets, 358 struct snd_soc_dapm_context *dapm = &codec->dapm;
359 ARRAY_SIZE(wm8978_dapm_widgets));
360 359
360 snd_soc_dapm_new_controls(dapm, wm8978_dapm_widgets,
361 ARRAY_SIZE(wm8978_dapm_widgets));
361 /* set up the WM8978 audio map */ 362 /* set up the WM8978 audio map */
362 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 363 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
363 364
364 return 0; 365 return 0;
365} 366}
@@ -837,7 +838,7 @@ static int wm8978_set_bias_level(struct snd_soc_codec *codec,
837 /* bit 3: enable bias, bit 2: enable I/O tie off buffer */ 838 /* bit 3: enable bias, bit 2: enable I/O tie off buffer */
838 power1 |= 0xc; 839 power1 |= 0xc;
839 840
840 if (codec->bias_level == SND_SOC_BIAS_OFF) { 841 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
841 /* Initial cap charge at VMID 5k */ 842 /* Initial cap charge at VMID 5k */
842 snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, 843 snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1,
843 power1 | 0x3); 844 power1 | 0x3);
@@ -857,7 +858,7 @@ static int wm8978_set_bias_level(struct snd_soc_codec *codec,
857 858
858 dev_dbg(codec->dev, "%s: %d, %x\n", __func__, level, power1); 859 dev_dbg(codec->dev, "%s: %d, %x\n", __func__, level, power1);
859 860
860 codec->bias_level = level; 861 codec->dapm.bias_level = level;
861 return 0; 862 return 0;
862} 863}
863 864
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c
index fd2e7cca1228..c3c8fd23d503 100644
--- a/sound/soc/codecs/wm8985.c
+++ b/sound/soc/codecs/wm8985.c
@@ -533,10 +533,11 @@ static int eqmode_put(struct snd_kcontrol *kcontrol,
533 533
534static int wm8985_add_widgets(struct snd_soc_codec *codec) 534static int wm8985_add_widgets(struct snd_soc_codec *codec)
535{ 535{
536 snd_soc_dapm_new_controls(codec, wm8985_dapm_widgets, 536 struct snd_soc_dapm_context *dapm = &codec->dapm;
537 ARRAY_SIZE(wm8985_dapm_widgets));
538 537
539 snd_soc_dapm_add_routes(codec, audio_map, 538 snd_soc_dapm_new_controls(dapm, wm8985_dapm_widgets,
539 ARRAY_SIZE(wm8985_dapm_widgets));
540 snd_soc_dapm_add_routes(dapm, audio_map,
540 ARRAY_SIZE(audio_map)); 541 ARRAY_SIZE(audio_map));
541 return 0; 542 return 0;
542} 543}
@@ -879,7 +880,7 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec,
879 1 << WM8985_VMIDSEL_SHIFT); 880 1 << WM8985_VMIDSEL_SHIFT);
880 break; 881 break;
881 case SND_SOC_BIAS_STANDBY: 882 case SND_SOC_BIAS_STANDBY:
882 if (codec->bias_level == SND_SOC_BIAS_OFF) { 883 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
883 ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies), 884 ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies),
884 wm8985->supplies); 885 wm8985->supplies);
885 if (ret) { 886 if (ret) {
@@ -939,7 +940,7 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec,
939 break; 940 break;
940 } 941 }
941 942
942 codec->bias_level = level; 943 codec->dapm.bias_level = level;
943 return 0; 944 return 0;
944} 945}
945 946
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index d7f259711970..0bc2eb530c7a 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -677,7 +677,7 @@ static int wm8988_set_bias_level(struct snd_soc_codec *codec,
677 break; 677 break;
678 678
679 case SND_SOC_BIAS_STANDBY: 679 case SND_SOC_BIAS_STANDBY:
680 if (codec->bias_level == SND_SOC_BIAS_OFF) { 680 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
681 /* VREF, VMID=2x5k */ 681 /* VREF, VMID=2x5k */
682 snd_soc_write(codec, WM8988_PWR1, pwr_reg | 0x1c1); 682 snd_soc_write(codec, WM8988_PWR1, pwr_reg | 0x1c1);
683 683
@@ -693,7 +693,7 @@ static int wm8988_set_bias_level(struct snd_soc_codec *codec,
693 snd_soc_write(codec, WM8988_PWR1, 0x0000); 693 snd_soc_write(codec, WM8988_PWR1, 0x0000);
694 break; 694 break;
695 } 695 }
696 codec->bias_level = level; 696 codec->dapm.bias_level = level;
697 return 0; 697 return 0;
698} 698}
699 699
@@ -759,6 +759,7 @@ static int wm8988_resume(struct snd_soc_codec *codec)
759static int wm8988_probe(struct snd_soc_codec *codec) 759static int wm8988_probe(struct snd_soc_codec *codec)
760{ 760{
761 struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec); 761 struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
762 struct snd_soc_dapm_context *dapm = &codec->dapm;
762 int ret = 0; 763 int ret = 0;
763 u16 reg; 764 u16 reg;
764 765
@@ -790,9 +791,9 @@ static int wm8988_probe(struct snd_soc_codec *codec)
790 791
791 snd_soc_add_controls(codec, wm8988_snd_controls, 792 snd_soc_add_controls(codec, wm8988_snd_controls,
792 ARRAY_SIZE(wm8988_snd_controls)); 793 ARRAY_SIZE(wm8988_snd_controls));
793 snd_soc_dapm_new_controls(codec, wm8988_dapm_widgets, 794 snd_soc_dapm_new_controls(dapm, wm8988_dapm_widgets,
794 ARRAY_SIZE(wm8988_dapm_widgets)); 795 ARRAY_SIZE(wm8988_dapm_widgets));
795 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 796 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
796 797
797 return 0; 798 return 0;
798} 799}
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index 264828e4e67c..309664ea7dc3 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -914,11 +914,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
914 914
915static int wm8990_add_widgets(struct snd_soc_codec *codec) 915static int wm8990_add_widgets(struct snd_soc_codec *codec)
916{ 916{
917 snd_soc_dapm_new_controls(codec, wm8990_dapm_widgets, 917 struct snd_soc_dapm_context *dapm = &codec->dapm;
918 ARRAY_SIZE(wm8990_dapm_widgets));
919 918
919 snd_soc_dapm_new_controls(dapm, wm8990_dapm_widgets,
920 ARRAY_SIZE(wm8990_dapm_widgets));
920 /* set up the WM8990 audio map */ 921 /* set up the WM8990 audio map */
921 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 922 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
922 923
923 return 0; 924 return 0;
924} 925}
@@ -1170,7 +1171,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec,
1170 break; 1171 break;
1171 1172
1172 case SND_SOC_BIAS_STANDBY: 1173 case SND_SOC_BIAS_STANDBY:
1173 if (codec->bias_level == SND_SOC_BIAS_OFF) { 1174 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
1174 /* Enable all output discharge bits */ 1175 /* Enable all output discharge bits */
1175 snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE | 1176 snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE |
1176 WM8990_DIS_RLINE | WM8990_DIS_OUT3 | 1177 WM8990_DIS_RLINE | WM8990_DIS_OUT3 |
@@ -1266,7 +1267,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec,
1266 break; 1267 break;
1267 } 1268 }
1268 1269
1269 codec->bias_level = level; 1270 codec->dapm.bias_level = level;
1270 return 0; 1271 return 0;
1271} 1272}
1272 1273
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index 67fe5ccc6082..bcc54be572ce 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -970,7 +970,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec,
970 break; 970 break;
971 971
972 case SND_SOC_BIAS_STANDBY: 972 case SND_SOC_BIAS_STANDBY:
973 if (codec->bias_level == SND_SOC_BIAS_OFF) { 973 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
974 ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), 974 ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies),
975 wm8993->supplies); 975 wm8993->supplies);
976 if (ret != 0) 976 if (ret != 0)
@@ -1045,7 +1045,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec,
1045 break; 1045 break;
1046 } 1046 }
1047 1047
1048 codec->bias_level = level; 1048 codec->dapm.bias_level = level;
1049 1049
1050 return 0; 1050 return 0;
1051} 1051}
@@ -1424,6 +1424,7 @@ static struct snd_soc_dai_driver wm8993_dai = {
1424static int wm8993_probe(struct snd_soc_codec *codec) 1424static int wm8993_probe(struct snd_soc_codec *codec)
1425{ 1425{
1426 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); 1426 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1427 struct snd_soc_dapm_context *dapm = &codec->dapm;
1427 int ret, i, val; 1428 int ret, i, val;
1428 1429
1429 wm8993->hubs_data.hp_startup_mode = 1; 1430 wm8993->hubs_data.hp_startup_mode = 1;
@@ -1505,11 +1506,11 @@ static int wm8993_probe(struct snd_soc_codec *codec)
1505 ARRAY_SIZE(wm8993_eq_controls)); 1506 ARRAY_SIZE(wm8993_eq_controls));
1506 } 1507 }
1507 1508
1508 snd_soc_dapm_new_controls(codec, wm8993_dapm_widgets, 1509 snd_soc_dapm_new_controls(dapm, wm8993_dapm_widgets,
1509 ARRAY_SIZE(wm8993_dapm_widgets)); 1510 ARRAY_SIZE(wm8993_dapm_widgets));
1510 wm_hubs_add_analogue_controls(codec); 1511 wm_hubs_add_analogue_controls(codec);
1511 1512
1512 snd_soc_dapm_add_routes(codec, routes, ARRAY_SIZE(routes)); 1513 snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
1513 wm_hubs_add_analogue_routes(codec, wm8993->pdata.lineout1_diff, 1514 wm_hubs_add_analogue_routes(codec, wm8993->pdata.lineout1_diff,
1514 wm8993->pdata.lineout2_diff); 1515 wm8993->pdata.lineout2_diff);
1515 1516
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index d81cac5b93b4..f7dea3d34a3e 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -1835,7 +1835,7 @@ static int configure_clock(struct snd_soc_codec *codec)
1835 1835
1836 snd_soc_update_bits(codec, WM8994_CLOCKING_1, WM8994_SYSCLK_SRC, new); 1836 snd_soc_update_bits(codec, WM8994_CLOCKING_1, WM8994_SYSCLK_SRC, new);
1837 1837
1838 snd_soc_dapm_sync(codec); 1838 snd_soc_dapm_sync(&codec->dapm);
1839 1839
1840 return 0; 1840 return 0;
1841} 1841}
@@ -3108,7 +3108,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
3108 break; 3108 break;
3109 3109
3110 case SND_SOC_BIAS_STANDBY: 3110 case SND_SOC_BIAS_STANDBY:
3111 if (codec->bias_level == SND_SOC_BIAS_OFF) { 3111 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
3112 /* Tweak DC servo and DSP configuration for 3112 /* Tweak DC servo and DSP configuration for
3113 * improved performance. */ 3113 * improved performance. */
3114 if (wm8994->revision < 4) { 3114 if (wm8994->revision < 4) {
@@ -3152,7 +3152,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
3152 break; 3152 break;
3153 3153
3154 case SND_SOC_BIAS_OFF: 3154 case SND_SOC_BIAS_OFF:
3155 if (codec->bias_level == SND_SOC_BIAS_STANDBY) { 3155 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
3156 /* Switch over to startup biases */ 3156 /* Switch over to startup biases */
3157 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, 3157 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
3158 WM8994_BIAS_SRC | 3158 WM8994_BIAS_SRC |
@@ -3187,7 +3187,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
3187 } 3187 }
3188 break; 3188 break;
3189 } 3189 }
3190 codec->bias_level = level; 3190 codec->dapm.bias_level = level;
3191 return 0; 3191 return 0;
3192} 3192}
3193 3193
@@ -3895,6 +3895,7 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data)
3895static int wm8994_codec_probe(struct snd_soc_codec *codec) 3895static int wm8994_codec_probe(struct snd_soc_codec *codec)
3896{ 3896{
3897 struct wm8994_priv *wm8994; 3897 struct wm8994_priv *wm8994;
3898 struct snd_soc_dapm_context *dapm = &codec->dapm;
3898 int ret, i; 3899 int ret, i;
3899 3900
3900 codec->control_data = dev_get_drvdata(codec->dev->parent); 3901 codec->control_data = dev_get_drvdata(codec->dev->parent);
@@ -4033,10 +4034,10 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
4033 wm_hubs_add_analogue_controls(codec); 4034 wm_hubs_add_analogue_controls(codec);
4034 snd_soc_add_controls(codec, wm8994_snd_controls, 4035 snd_soc_add_controls(codec, wm8994_snd_controls,
4035 ARRAY_SIZE(wm8994_snd_controls)); 4036 ARRAY_SIZE(wm8994_snd_controls));
4036 snd_soc_dapm_new_controls(codec, wm8994_dapm_widgets, 4037 snd_soc_dapm_new_controls(dapm, wm8994_dapm_widgets,
4037 ARRAY_SIZE(wm8994_dapm_widgets)); 4038 ARRAY_SIZE(wm8994_dapm_widgets));
4038 wm_hubs_add_analogue_routes(codec, 0, 0); 4039 wm_hubs_add_analogue_routes(codec, 0, 0);
4039 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 4040 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
4040 4041
4041 return 0; 4042 return 0;
4042 4043
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index ecc7c37180c7..c03e2c3e24e1 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -805,7 +805,7 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec,
805 805
806 case SND_SOC_BIAS_STANDBY: 806 case SND_SOC_BIAS_STANDBY:
807 /* Initial cold start */ 807 /* Initial cold start */
808 if (codec->bias_level == SND_SOC_BIAS_OFF) { 808 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
809 /* Disable LINEOUT discharge */ 809 /* Disable LINEOUT discharge */
810 reg = snd_soc_read(codec, WM9081_ANTI_POP_CONTROL); 810 reg = snd_soc_read(codec, WM9081_ANTI_POP_CONTROL);
811 reg &= ~WM9081_LINEOUT_DISCH; 811 reg &= ~WM9081_LINEOUT_DISCH;
@@ -865,7 +865,7 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec,
865 break; 865 break;
866 } 866 }
867 867
868 codec->bias_level = level; 868 codec->dapm.bias_level = level;
869 869
870 return 0; 870 return 0;
871} 871}
@@ -1228,6 +1228,7 @@ static struct snd_soc_dai_driver wm9081_dai = {
1228static int wm9081_probe(struct snd_soc_codec *codec) 1228static int wm9081_probe(struct snd_soc_codec *codec)
1229{ 1229{
1230 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); 1230 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
1231 struct snd_soc_dapm_context *dapm = &codec->dapm;
1231 int ret; 1232 int ret;
1232 u16 reg; 1233 u16 reg;
1233 1234
@@ -1269,9 +1270,9 @@ static int wm9081_probe(struct snd_soc_codec *codec)
1269 ARRAY_SIZE(wm9081_eq_controls)); 1270 ARRAY_SIZE(wm9081_eq_controls));
1270 } 1271 }
1271 1272
1272 snd_soc_dapm_new_controls(codec, wm9081_dapm_widgets, 1273 snd_soc_dapm_new_controls(dapm, wm9081_dapm_widgets,
1273 ARRAY_SIZE(wm9081_dapm_widgets)); 1274 ARRAY_SIZE(wm9081_dapm_widgets));
1274 snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); 1275 snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
1275 1276
1276 return ret; 1277 return ret;
1277} 1278}
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c
index 99c046ba46bb..b5afa01aa383 100644
--- a/sound/soc/codecs/wm9090.c
+++ b/sound/soc/codecs/wm9090.c
@@ -443,31 +443,32 @@ static const struct snd_soc_dapm_route audio_map_in2_diff[] = {
443static int wm9090_add_controls(struct snd_soc_codec *codec) 443static int wm9090_add_controls(struct snd_soc_codec *codec)
444{ 444{
445 struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); 445 struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec);
446 struct snd_soc_dapm_context *dapm = &codec->dapm;
446 int i; 447 int i;
447 448
448 snd_soc_dapm_new_controls(codec, wm9090_dapm_widgets, 449 snd_soc_dapm_new_controls(dapm, wm9090_dapm_widgets,
449 ARRAY_SIZE(wm9090_dapm_widgets)); 450 ARRAY_SIZE(wm9090_dapm_widgets));
450 451
451 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 452 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
452 453
453 snd_soc_add_controls(codec, wm9090_controls, 454 snd_soc_add_controls(codec, wm9090_controls,
454 ARRAY_SIZE(wm9090_controls)); 455 ARRAY_SIZE(wm9090_controls));
455 456
456 if (wm9090->pdata.lin1_diff) { 457 if (wm9090->pdata.lin1_diff) {
457 snd_soc_dapm_add_routes(codec, audio_map_in1_diff, 458 snd_soc_dapm_add_routes(dapm, audio_map_in1_diff,
458 ARRAY_SIZE(audio_map_in1_diff)); 459 ARRAY_SIZE(audio_map_in1_diff));
459 } else { 460 } else {
460 snd_soc_dapm_add_routes(codec, audio_map_in1_se, 461 snd_soc_dapm_add_routes(dapm, audio_map_in1_se,
461 ARRAY_SIZE(audio_map_in1_se)); 462 ARRAY_SIZE(audio_map_in1_se));
462 snd_soc_add_controls(codec, wm9090_in1_se_controls, 463 snd_soc_add_controls(codec, wm9090_in1_se_controls,
463 ARRAY_SIZE(wm9090_in1_se_controls)); 464 ARRAY_SIZE(wm9090_in1_se_controls));
464 } 465 }
465 466
466 if (wm9090->pdata.lin2_diff) { 467 if (wm9090->pdata.lin2_diff) {
467 snd_soc_dapm_add_routes(codec, audio_map_in2_diff, 468 snd_soc_dapm_add_routes(dapm, audio_map_in2_diff,
468 ARRAY_SIZE(audio_map_in2_diff)); 469 ARRAY_SIZE(audio_map_in2_diff));
469 } else { 470 } else {
470 snd_soc_dapm_add_routes(codec, audio_map_in2_se, 471 snd_soc_dapm_add_routes(dapm, audio_map_in2_se,
471 ARRAY_SIZE(audio_map_in2_se)); 472 ARRAY_SIZE(audio_map_in2_se));
472 snd_soc_add_controls(codec, wm9090_in2_se_controls, 473 snd_soc_add_controls(codec, wm9090_in2_se_controls,
473 ARRAY_SIZE(wm9090_in2_se_controls)); 474 ARRAY_SIZE(wm9090_in2_se_controls));
@@ -514,7 +515,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
514 break; 515 break;
515 516
516 case SND_SOC_BIAS_STANDBY: 517 case SND_SOC_BIAS_STANDBY:
517 if (codec->bias_level == SND_SOC_BIAS_OFF) { 518 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
518 /* Restore the register cache */ 519 /* Restore the register cache */
519 for (i = 1; i < codec->driver->reg_cache_size; i++) { 520 for (i = 1; i < codec->driver->reg_cache_size; i++) {
520 if (reg_cache[i] == wm9090_reg_defaults[i]) 521 if (reg_cache[i] == wm9090_reg_defaults[i])
@@ -544,7 +545,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
544 break; 545 break;
545 } 546 }
546 547
547 codec->bias_level = level; 548 codec->dapm.bias_level = level;
548 549
549 return 0; 550 return 0;
550} 551}
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c
index a144acda751c..58d120824498 100644
--- a/sound/soc/codecs/wm9705.c
+++ b/sound/soc/codecs/wm9705.c
@@ -203,9 +203,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
203 203
204static int wm9705_add_widgets(struct snd_soc_codec *codec) 204static int wm9705_add_widgets(struct snd_soc_codec *codec)
205{ 205{
206 snd_soc_dapm_new_controls(codec, wm9705_dapm_widgets, 206 struct snd_soc_dapm_context *dapm = &codec->dapm;
207
208 snd_soc_dapm_new_controls(dapm, wm9705_dapm_widgets,
207 ARRAY_SIZE(wm9705_dapm_widgets)); 209 ARRAY_SIZE(wm9705_dapm_widgets));
208 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 210 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
209 211
210 return 0; 212 return 0;
211} 213}
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index d2f224d62744..3ca42a35e03a 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -432,10 +432,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
432 432
433static int wm9712_add_widgets(struct snd_soc_codec *codec) 433static int wm9712_add_widgets(struct snd_soc_codec *codec)
434{ 434{
435 snd_soc_dapm_new_controls(codec, wm9712_dapm_widgets, 435 struct snd_soc_dapm_context *dapm = &codec->dapm;
436 ARRAY_SIZE(wm9712_dapm_widgets));
437 436
438 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 437 snd_soc_dapm_new_controls(dapm, wm9712_dapm_widgets,
438 ARRAY_SIZE(wm9712_dapm_widgets));
439 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
439 440
440 return 0; 441 return 0;
441} 442}
@@ -570,7 +571,7 @@ static int wm9712_set_bias_level(struct snd_soc_codec *codec,
570 ac97_write(codec, AC97_POWERDOWN, 0xffff); 571 ac97_write(codec, AC97_POWERDOWN, 0xffff);
571 break; 572 break;
572 } 573 }
573 codec->bias_level = level; 574 codec->dapm.bias_level = level;
574 return 0; 575 return 0;
575} 576}
576 577
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 7da13b07a53d..87b236b16016 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -647,10 +647,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
647 647
648static int wm9713_add_widgets(struct snd_soc_codec *codec) 648static int wm9713_add_widgets(struct snd_soc_codec *codec)
649{ 649{
650 snd_soc_dapm_new_controls(codec, wm9713_dapm_widgets, 650 struct snd_soc_dapm_context *dapm = &codec->dapm;
651
652 snd_soc_dapm_new_controls(dapm, wm9713_dapm_widgets,
651 ARRAY_SIZE(wm9713_dapm_widgets)); 653 ARRAY_SIZE(wm9713_dapm_widgets));
652 654
653 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 655 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
654 656
655 return 0; 657 return 0;
656} 658}
@@ -1147,7 +1149,7 @@ static int wm9713_set_bias_level(struct snd_soc_codec *codec,
1147 ac97_write(codec, AC97_POWERDOWN, 0xffff); 1149 ac97_write(codec, AC97_POWERDOWN, 0xffff);
1148 break; 1150 break;
1149 } 1151 }
1150 codec->bias_level = level; 1152 codec->dapm.bias_level = level;
1151 return 0; 1153 return 0;
1152} 1154}
1153 1155
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 008b1f27aea8..8aff0efe72f5 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -814,6 +814,8 @@ static const struct snd_soc_dapm_route lineout2_se_routes[] = {
814 814
815int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec) 815int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec)
816{ 816{
817 struct snd_soc_dapm_context *dapm = &codec->dapm;
818
817 /* Latch volume update bits & default ZC on */ 819 /* Latch volume update bits & default ZC on */
818 snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME, 820 snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME,
819 WM8993_IN1_VU, WM8993_IN1_VU); 821 WM8993_IN1_VU, WM8993_IN1_VU);
@@ -842,7 +844,7 @@ int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec)
842 snd_soc_add_controls(codec, analogue_snd_controls, 844 snd_soc_add_controls(codec, analogue_snd_controls,
843 ARRAY_SIZE(analogue_snd_controls)); 845 ARRAY_SIZE(analogue_snd_controls));
844 846
845 snd_soc_dapm_new_controls(codec, analogue_dapm_widgets, 847 snd_soc_dapm_new_controls(dapm, analogue_dapm_widgets,
846 ARRAY_SIZE(analogue_dapm_widgets)); 848 ARRAY_SIZE(analogue_dapm_widgets));
847 return 0; 849 return 0;
848} 850}
@@ -851,24 +853,26 @@ EXPORT_SYMBOL_GPL(wm_hubs_add_analogue_controls);
851int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec, 853int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec,
852 int lineout1_diff, int lineout2_diff) 854 int lineout1_diff, int lineout2_diff)
853{ 855{
854 snd_soc_dapm_add_routes(codec, analogue_routes, 856 struct snd_soc_dapm_context *dapm = &codec->dapm;
857
858 snd_soc_dapm_add_routes(dapm, analogue_routes,
855 ARRAY_SIZE(analogue_routes)); 859 ARRAY_SIZE(analogue_routes));
856 860
857 if (lineout1_diff) 861 if (lineout1_diff)
858 snd_soc_dapm_add_routes(codec, 862 snd_soc_dapm_add_routes(dapm,
859 lineout1_diff_routes, 863 lineout1_diff_routes,
860 ARRAY_SIZE(lineout1_diff_routes)); 864 ARRAY_SIZE(lineout1_diff_routes));
861 else 865 else
862 snd_soc_dapm_add_routes(codec, 866 snd_soc_dapm_add_routes(dapm,
863 lineout1_se_routes, 867 lineout1_se_routes,
864 ARRAY_SIZE(lineout1_se_routes)); 868 ARRAY_SIZE(lineout1_se_routes));
865 869
866 if (lineout2_diff) 870 if (lineout2_diff)
867 snd_soc_dapm_add_routes(codec, 871 snd_soc_dapm_add_routes(dapm,
868 lineout2_diff_routes, 872 lineout2_diff_routes,
869 ARRAY_SIZE(lineout2_diff_routes)); 873 ARRAY_SIZE(lineout2_diff_routes));
870 else 874 else
871 snd_soc_dapm_add_routes(codec, 875 snd_soc_dapm_add_routes(dapm,
872 lineout2_se_routes, 876 lineout2_se_routes,
873 ARRAY_SIZE(lineout2_se_routes)); 877 ARRAY_SIZE(lineout2_se_routes));
874 878
@@ -895,7 +899,7 @@ int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *codec,
895 * VMID as an output and can disable it. 899 * VMID as an output and can disable it.
896 */ 900 */
897 if (lineout1_diff && lineout2_diff) 901 if (lineout1_diff && lineout2_diff)
898 codec->idle_bias_off = 1; 902 codec->dapm.idle_bias_off = 1;
899 903
900 if (lineout1fb) 904 if (lineout1fb)
901 snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL, 905 snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 2b07b17a6b2d..a2cf64b221e5 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -132,26 +132,27 @@ static const struct snd_soc_dapm_route audio_map[] = {
132static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) 132static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
133{ 133{
134 struct snd_soc_codec *codec = rtd->codec; 134 struct snd_soc_codec *codec = rtd->codec;
135 struct snd_soc_dapm_context *dapm = &codec->dapm;
135 136
136 /* Add davinci-evm specific widgets */ 137 /* Add davinci-evm specific widgets */
137 snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, 138 snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
138 ARRAY_SIZE(aic3x_dapm_widgets)); 139 ARRAY_SIZE(aic3x_dapm_widgets));
139 140
140 /* Set up davinci-evm specific audio path audio_map */ 141 /* Set up davinci-evm specific audio path audio_map */
141 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 142 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
142 143
143 /* not connected */ 144 /* not connected */
144 snd_soc_dapm_disable_pin(codec, "MONO_LOUT"); 145 snd_soc_dapm_disable_pin(dapm, "MONO_LOUT");
145 snd_soc_dapm_disable_pin(codec, "HPLCOM"); 146 snd_soc_dapm_disable_pin(dapm, "HPLCOM");
146 snd_soc_dapm_disable_pin(codec, "HPRCOM"); 147 snd_soc_dapm_disable_pin(dapm, "HPRCOM");
147 148
148 /* always connected */ 149 /* always connected */
149 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 150 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
150 snd_soc_dapm_enable_pin(codec, "Line Out"); 151 snd_soc_dapm_enable_pin(dapm, "Line Out");
151 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 152 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
152 snd_soc_dapm_enable_pin(codec, "Line In"); 153 snd_soc_dapm_enable_pin(dapm, "Line In");
153 154
154 snd_soc_dapm_sync(codec); 155 snd_soc_dapm_sync(dapm);
155 156
156 return 0; 157 return 0;
157} 158}
diff --git a/sound/soc/ep93xx/snappercl15.c b/sound/soc/ep93xx/snappercl15.c
index 28ab5ff772ac..f1c78516ccac 100644
--- a/sound/soc/ep93xx/snappercl15.c
+++ b/sound/soc/ep93xx/snappercl15.c
@@ -79,11 +79,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
79static int snappercl15_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) 79static int snappercl15_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
80{ 80{
81 struct snd_soc_codec *codec = rtd->codec; 81 struct snd_soc_codec *codec = rtd->codec;
82 struct snd_soc_dapm_context *dapm = &codec->dapm;
82 83
83 snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, 84 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
84 ARRAY_SIZE(tlv320aic23_dapm_widgets)); 85 ARRAY_SIZE(tlv320aic23_dapm_widgets));
85 86
86 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 87 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
87 return 0; 88 return 0;
88} 89}
89 90
diff --git a/sound/soc/imx/wm1133-ev1.c b/sound/soc/imx/wm1133-ev1.c
index 30fdb15065be..46fadf497243 100644
--- a/sound/soc/imx/wm1133-ev1.c
+++ b/sound/soc/imx/wm1133-ev1.c
@@ -213,11 +213,12 @@ static struct snd_soc_jack_pin mic_jack_pins[] = {
213static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd) 213static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd)
214{ 214{
215 struct snd_soc_codec *codec = rtd->codec; 215 struct snd_soc_codec *codec = rtd->codec;
216 struct snd_soc_dapm_context *dapm = &codec->dapm;
216 217
217 snd_soc_dapm_new_controls(codec, wm1133_ev1_widgets, 218 snd_soc_dapm_new_controls(dapm, wm1133_ev1_widgets,
218 ARRAY_SIZE(wm1133_ev1_widgets)); 219 ARRAY_SIZE(wm1133_ev1_widgets));
219 220
220 snd_soc_dapm_add_routes(codec, wm1133_ev1_map, 221 snd_soc_dapm_add_routes(dapm, wm1133_ev1_map,
221 ARRAY_SIZE(wm1133_ev1_map)); 222 ARRAY_SIZE(wm1133_ev1_map));
222 223
223 /* Headphone jack detection */ 224 /* Headphone jack detection */
@@ -234,7 +235,7 @@ static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd)
234 wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE, 235 wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE,
235 SND_JACK_BTN_0); 236 SND_JACK_BTN_0);
236 237
237 snd_soc_dapm_force_enable_pin(codec, "Mic Bias"); 238 snd_soc_dapm_force_enable_pin(dapm, "Mic Bias");
238 239
239 return 0; 240 return 0;
240} 241}
diff --git a/sound/soc/jz4740/qi_lb60.c b/sound/soc/jz4740/qi_lb60.c
index ef1a99e6a3bd..70afbfada9fd 100644
--- a/sound/soc/jz4740/qi_lb60.c
+++ b/sound/soc/jz4740/qi_lb60.c
@@ -59,10 +59,11 @@ static int qi_lb60_codec_init(struct snd_soc_pcm_runtime *rtd)
59{ 59{
60 struct snd_soc_codec *codec = rtd->codec; 60 struct snd_soc_codec *codec = rtd->codec;
61 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 61 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
62 struct snd_soc_dapm_context *dapm = &codec->dapm;
62 int ret; 63 int ret;
63 64
64 snd_soc_dapm_nc_pin(codec, "LIN"); 65 snd_soc_dapm_nc_pin(dapm, "LIN");
65 snd_soc_dapm_nc_pin(codec, "RIN"); 66 snd_soc_dapm_nc_pin(dapm, "RIN");
66 67
67 ret = snd_soc_dai_set_fmt(cpu_dai, QI_LB60_DAIFMT); 68 ret = snd_soc_dai_set_fmt(cpu_dai, QI_LB60_DAIFMT);
68 if (ret < 0) { 69 if (ret < 0) {
@@ -70,9 +71,11 @@ static int qi_lb60_codec_init(struct snd_soc_pcm_runtime *rtd)
70 return ret; 71 return ret;
71 } 72 }
72 73
73 snd_soc_dapm_new_controls(codec, qi_lb60_widgets, ARRAY_SIZE(qi_lb60_widgets)); 74 snd_soc_dapm_new_controls(dapm, qi_lb60_widgets,
74 snd_soc_dapm_add_routes(codec, qi_lb60_routes, ARRAY_SIZE(qi_lb60_routes)); 75 ARRAY_SIZE(qi_lb60_widgets));
75 snd_soc_dapm_sync(codec); 76 snd_soc_dapm_add_routes(dapm, qi_lb60_routes,
77 ARRAY_SIZE(qi_lb60_routes));
78 snd_soc_dapm_sync(dapm);
76 79
77 return 0; 80 return 0;
78} 81}
diff --git a/sound/soc/kirkwood/kirkwood-t5325.c b/sound/soc/kirkwood/kirkwood-t5325.c
index 51b52e31cb0b..07b6ecaed2f2 100644
--- a/sound/soc/kirkwood/kirkwood-t5325.c
+++ b/sound/soc/kirkwood/kirkwood-t5325.c
@@ -69,17 +69,18 @@ static const struct snd_soc_dapm_route t5325_route[] = {
69static int t5325_dai_init(struct snd_soc_pcm_runtime *rtd) 69static int t5325_dai_init(struct snd_soc_pcm_runtime *rtd)
70{ 70{
71 struct snd_soc_codec *codec = rtd->codec; 71 struct snd_soc_codec *codec = rtd->codec;
72 struct snd_soc_dapm_context *dapm = &codec->dapm;
72 73
73 snd_soc_dapm_new_controls(codec, t5325_dapm_widgets, 74 snd_soc_dapm_new_controls(dapm, t5325_dapm_widgets,
74 ARRAY_SIZE(t5325_dapm_widgets)); 75 ARRAY_SIZE(t5325_dapm_widgets));
75 76
76 snd_soc_dapm_add_routes(codec, t5325_route, ARRAY_SIZE(t5325_route)); 77 snd_soc_dapm_add_routes(dapm, t5325_route, ARRAY_SIZE(t5325_route));
77 78
78 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 79 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
79 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 80 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
80 snd_soc_dapm_enable_pin(codec, "Speaker"); 81 snd_soc_dapm_enable_pin(dapm, "Speaker");
81 82
82 snd_soc_dapm_sync(codec); 83 snd_soc_dapm_sync(dapm);
83 84
84 return 0; 85 return 0;
85} 86}
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}
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 97e9423615c9..810633cc3b6d 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -48,51 +48,53 @@ static int corgi_spk_func;
48 48
49static void corgi_ext_control(struct snd_soc_codec *codec) 49static void corgi_ext_control(struct snd_soc_codec *codec)
50{ 50{
51 struct snd_soc_dapm_context *dapm = &codec->dapm;
52
51 /* set up jack connection */ 53 /* set up jack connection */
52 switch (corgi_jack_func) { 54 switch (corgi_jack_func) {
53 case CORGI_HP: 55 case CORGI_HP:
54 /* set = unmute headphone */ 56 /* set = unmute headphone */
55 gpio_set_value(CORGI_GPIO_MUTE_L, 1); 57 gpio_set_value(CORGI_GPIO_MUTE_L, 1);
56 gpio_set_value(CORGI_GPIO_MUTE_R, 1); 58 gpio_set_value(CORGI_GPIO_MUTE_R, 1);
57 snd_soc_dapm_disable_pin(codec, "Mic Jack"); 59 snd_soc_dapm_disable_pin(dapm, "Mic Jack");
58 snd_soc_dapm_disable_pin(codec, "Line Jack"); 60 snd_soc_dapm_disable_pin(dapm, "Line Jack");
59 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 61 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
60 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 62 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
61 break; 63 break;
62 case CORGI_MIC: 64 case CORGI_MIC:
63 /* reset = mute headphone */ 65 /* reset = mute headphone */
64 gpio_set_value(CORGI_GPIO_MUTE_L, 0); 66 gpio_set_value(CORGI_GPIO_MUTE_L, 0);
65 gpio_set_value(CORGI_GPIO_MUTE_R, 0); 67 gpio_set_value(CORGI_GPIO_MUTE_R, 0);
66 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 68 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
67 snd_soc_dapm_disable_pin(codec, "Line Jack"); 69 snd_soc_dapm_disable_pin(dapm, "Line Jack");
68 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 70 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
69 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 71 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
70 break; 72 break;
71 case CORGI_LINE: 73 case CORGI_LINE:
72 gpio_set_value(CORGI_GPIO_MUTE_L, 0); 74 gpio_set_value(CORGI_GPIO_MUTE_L, 0);
73 gpio_set_value(CORGI_GPIO_MUTE_R, 0); 75 gpio_set_value(CORGI_GPIO_MUTE_R, 0);
74 snd_soc_dapm_disable_pin(codec, "Mic Jack"); 76 snd_soc_dapm_disable_pin(dapm, "Mic Jack");
75 snd_soc_dapm_enable_pin(codec, "Line Jack"); 77 snd_soc_dapm_enable_pin(dapm, "Line Jack");
76 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 78 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
77 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 79 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
78 break; 80 break;
79 case CORGI_HEADSET: 81 case CORGI_HEADSET:
80 gpio_set_value(CORGI_GPIO_MUTE_L, 0); 82 gpio_set_value(CORGI_GPIO_MUTE_L, 0);
81 gpio_set_value(CORGI_GPIO_MUTE_R, 1); 83 gpio_set_value(CORGI_GPIO_MUTE_R, 1);
82 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 84 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
83 snd_soc_dapm_disable_pin(codec, "Line Jack"); 85 snd_soc_dapm_disable_pin(dapm, "Line Jack");
84 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 86 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
85 snd_soc_dapm_enable_pin(codec, "Headset Jack"); 87 snd_soc_dapm_enable_pin(dapm, "Headset Jack");
86 break; 88 break;
87 } 89 }
88 90
89 if (corgi_spk_func == CORGI_SPK_ON) 91 if (corgi_spk_func == CORGI_SPK_ON)
90 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 92 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
91 else 93 else
92 snd_soc_dapm_disable_pin(codec, "Ext Spk"); 94 snd_soc_dapm_disable_pin(dapm, "Ext Spk");
93 95
94 /* signal a DAPM event */ 96 /* signal a DAPM event */
95 snd_soc_dapm_sync(codec); 97 snd_soc_dapm_sync(dapm);
96} 98}
97 99
98static int corgi_startup(struct snd_pcm_substream *substream) 100static int corgi_startup(struct snd_pcm_substream *substream)
@@ -274,10 +276,11 @@ static const struct snd_kcontrol_new wm8731_corgi_controls[] = {
274static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) 276static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd)
275{ 277{
276 struct snd_soc_codec *codec = rtd->codec; 278 struct snd_soc_codec *codec = rtd->codec;
279 struct snd_soc_dapm_context *dapm = &codec->dapm;
277 int err; 280 int err;
278 281
279 snd_soc_dapm_nc_pin(codec, "LLINEIN"); 282 snd_soc_dapm_nc_pin(dapm, "LLINEIN");
280 snd_soc_dapm_nc_pin(codec, "RLINEIN"); 283 snd_soc_dapm_nc_pin(dapm, "RLINEIN");
281 284
282 /* Add corgi specific controls */ 285 /* Add corgi specific controls */
283 err = snd_soc_add_controls(codec, wm8731_corgi_controls, 286 err = snd_soc_add_controls(codec, wm8731_corgi_controls,
@@ -286,13 +289,13 @@ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd)
286 return err; 289 return err;
287 290
288 /* Add corgi specific widgets */ 291 /* Add corgi specific widgets */
289 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, 292 snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
290 ARRAY_SIZE(wm8731_dapm_widgets)); 293 ARRAY_SIZE(wm8731_dapm_widgets));
291 294
292 /* Set up corgi specific audio path audio_map */ 295 /* Set up corgi specific audio path audio_map */
293 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 296 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
294 297
295 snd_soc_dapm_sync(codec); 298 snd_soc_dapm_sync(dapm);
296 return 0; 299 return 0;
297} 300}
298 301
diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c
index c82cedb602fd..38a84b821ff4 100644
--- a/sound/soc/pxa/e740_wm9705.c
+++ b/sound/soc/pxa/e740_wm9705.c
@@ -92,23 +92,24 @@ static const struct snd_soc_dapm_route audio_map[] = {
92static int e740_ac97_init(struct snd_soc_pcm_runtime *rtd) 92static int e740_ac97_init(struct snd_soc_pcm_runtime *rtd)
93{ 93{
94 struct snd_soc_codec *codec = rtd->codec; 94 struct snd_soc_codec *codec = rtd->codec;
95 95 struct snd_soc_dapm_context *dapm = &codec->dapm;
96 snd_soc_dapm_nc_pin(codec, "HPOUTL"); 96
97 snd_soc_dapm_nc_pin(codec, "HPOUTR"); 97 snd_soc_dapm_nc_pin(dapm, "HPOUTL");
98 snd_soc_dapm_nc_pin(codec, "PHONE"); 98 snd_soc_dapm_nc_pin(dapm, "HPOUTR");
99 snd_soc_dapm_nc_pin(codec, "LINEINL"); 99 snd_soc_dapm_nc_pin(dapm, "PHONE");
100 snd_soc_dapm_nc_pin(codec, "LINEINR"); 100 snd_soc_dapm_nc_pin(dapm, "LINEINL");
101 snd_soc_dapm_nc_pin(codec, "CDINL"); 101 snd_soc_dapm_nc_pin(dapm, "LINEINR");
102 snd_soc_dapm_nc_pin(codec, "CDINR"); 102 snd_soc_dapm_nc_pin(dapm, "CDINL");
103 snd_soc_dapm_nc_pin(codec, "PCBEEP"); 103 snd_soc_dapm_nc_pin(dapm, "CDINR");
104 snd_soc_dapm_nc_pin(codec, "MIC2"); 104 snd_soc_dapm_nc_pin(dapm, "PCBEEP");
105 105 snd_soc_dapm_nc_pin(dapm, "MIC2");
106 snd_soc_dapm_new_controls(codec, e740_dapm_widgets, 106
107 snd_soc_dapm_new_controls(dapm, e740_dapm_widgets,
107 ARRAY_SIZE(e740_dapm_widgets)); 108 ARRAY_SIZE(e740_dapm_widgets));
108 109
109 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 110 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
110 111
111 snd_soc_dapm_sync(codec); 112 snd_soc_dapm_sync(dapm);
112 113
113 return 0; 114 return 0;
114} 115}
diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c
index 4c143803a75e..2bc97e92446b 100644
--- a/sound/soc/pxa/e750_wm9705.c
+++ b/sound/soc/pxa/e750_wm9705.c
@@ -74,23 +74,24 @@ static const struct snd_soc_dapm_route audio_map[] = {
74static int e750_ac97_init(struct snd_soc_pcm_runtime *rtd) 74static int e750_ac97_init(struct snd_soc_pcm_runtime *rtd)
75{ 75{
76 struct snd_soc_codec *codec = rtd->codec; 76 struct snd_soc_codec *codec = rtd->codec;
77 77 struct snd_soc_dapm_context *dapm = &codec->dapm;
78 snd_soc_dapm_nc_pin(codec, "LOUT"); 78
79 snd_soc_dapm_nc_pin(codec, "ROUT"); 79 snd_soc_dapm_nc_pin(dapm, "LOUT");
80 snd_soc_dapm_nc_pin(codec, "PHONE"); 80 snd_soc_dapm_nc_pin(dapm, "ROUT");
81 snd_soc_dapm_nc_pin(codec, "LINEINL"); 81 snd_soc_dapm_nc_pin(dapm, "PHONE");
82 snd_soc_dapm_nc_pin(codec, "LINEINR"); 82 snd_soc_dapm_nc_pin(dapm, "LINEINL");
83 snd_soc_dapm_nc_pin(codec, "CDINL"); 83 snd_soc_dapm_nc_pin(dapm, "LINEINR");
84 snd_soc_dapm_nc_pin(codec, "CDINR"); 84 snd_soc_dapm_nc_pin(dapm, "CDINL");
85 snd_soc_dapm_nc_pin(codec, "PCBEEP"); 85 snd_soc_dapm_nc_pin(dapm, "CDINR");
86 snd_soc_dapm_nc_pin(codec, "MIC2"); 86 snd_soc_dapm_nc_pin(dapm, "PCBEEP");
87 87 snd_soc_dapm_nc_pin(dapm, "MIC2");
88 snd_soc_dapm_new_controls(codec, e750_dapm_widgets, 88
89 snd_soc_dapm_new_controls(dapm, e750_dapm_widgets,
89 ARRAY_SIZE(e750_dapm_widgets)); 90 ARRAY_SIZE(e750_dapm_widgets));
90 91
91 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 92 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
92 93
93 snd_soc_dapm_sync(codec); 94 snd_soc_dapm_sync(dapm);
94 95
95 return 0; 96 return 0;
96} 97}
diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c
index d42e5fe832c5..eac846c7bd9c 100644
--- a/sound/soc/pxa/e800_wm9712.c
+++ b/sound/soc/pxa/e800_wm9712.c
@@ -75,12 +75,13 @@ static const struct snd_soc_dapm_route audio_map[] = {
75static int e800_ac97_init(struct snd_soc_pcm_runtime *rtd) 75static int e800_ac97_init(struct snd_soc_pcm_runtime *rtd)
76{ 76{
77 struct snd_soc_codec *codec = rtd->codec; 77 struct snd_soc_codec *codec = rtd->codec;
78 struct snd_soc_dapm_context *dapm = &codec->dapm;
78 79
79 snd_soc_dapm_new_controls(codec, e800_dapm_widgets, 80 snd_soc_dapm_new_controls(dapm, e800_dapm_widgets,
80 ARRAY_SIZE(e800_dapm_widgets)); 81 ARRAY_SIZE(e800_dapm_widgets));
81 82
82 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 83 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
83 snd_soc_dapm_sync(codec); 84 snd_soc_dapm_sync(dapm);
84 85
85 return 0; 86 return 0;
86} 87}
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index b8207ced4072..f1acdc57cfd8 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -44,27 +44,29 @@ static int magician_in_sel = MAGICIAN_MIC;
44 44
45static void magician_ext_control(struct snd_soc_codec *codec) 45static void magician_ext_control(struct snd_soc_codec *codec)
46{ 46{
47 struct snd_soc_dapm_context *dapm = &codec->dapm;
48
47 if (magician_spk_switch) 49 if (magician_spk_switch)
48 snd_soc_dapm_enable_pin(codec, "Speaker"); 50 snd_soc_dapm_enable_pin(dapm, "Speaker");
49 else 51 else
50 snd_soc_dapm_disable_pin(codec, "Speaker"); 52 snd_soc_dapm_disable_pin(dapm, "Speaker");
51 if (magician_hp_switch) 53 if (magician_hp_switch)
52 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 54 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
53 else 55 else
54 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 56 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
55 57
56 switch (magician_in_sel) { 58 switch (magician_in_sel) {
57 case MAGICIAN_MIC: 59 case MAGICIAN_MIC:
58 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 60 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
59 snd_soc_dapm_enable_pin(codec, "Call Mic"); 61 snd_soc_dapm_enable_pin(dapm, "Call Mic");
60 break; 62 break;
61 case MAGICIAN_MIC_EXT: 63 case MAGICIAN_MIC_EXT:
62 snd_soc_dapm_disable_pin(codec, "Call Mic"); 64 snd_soc_dapm_disable_pin(dapm, "Call Mic");
63 snd_soc_dapm_enable_pin(codec, "Headset Mic"); 65 snd_soc_dapm_enable_pin(dapm, "Headset Mic");
64 break; 66 break;
65 } 67 }
66 68
67 snd_soc_dapm_sync(codec); 69 snd_soc_dapm_sync(dapm);
68} 70}
69 71
70static int magician_startup(struct snd_pcm_substream *substream) 72static int magician_startup(struct snd_pcm_substream *substream)
@@ -395,15 +397,16 @@ static const struct snd_kcontrol_new uda1380_magician_controls[] = {
395static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd) 397static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
396{ 398{
397 struct snd_soc_codec *codec = rtd->codec; 399 struct snd_soc_codec *codec = rtd->codec;
400 struct snd_soc_dapm_context *dapm = &codec->dapm;
398 int err; 401 int err;
399 402
400 /* NC codec pins */ 403 /* NC codec pins */
401 snd_soc_dapm_nc_pin(codec, "VOUTLHP"); 404 snd_soc_dapm_nc_pin(dapm, "VOUTLHP");
402 snd_soc_dapm_nc_pin(codec, "VOUTRHP"); 405 snd_soc_dapm_nc_pin(dapm, "VOUTRHP");
403 406
404 /* FIXME: is anything connected here? */ 407 /* FIXME: is anything connected here? */
405 snd_soc_dapm_nc_pin(codec, "VINL"); 408 snd_soc_dapm_nc_pin(dapm, "VINL");
406 snd_soc_dapm_nc_pin(codec, "VINR"); 409 snd_soc_dapm_nc_pin(dapm, "VINR");
407 410
408 /* Add magician specific controls */ 411 /* Add magician specific controls */
409 err = snd_soc_add_controls(codec, uda1380_magician_controls, 412 err = snd_soc_add_controls(codec, uda1380_magician_controls,
@@ -412,13 +415,13 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
412 return err; 415 return err;
413 416
414 /* Add magician specific widgets */ 417 /* Add magician specific widgets */
415 snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, 418 snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
416 ARRAY_SIZE(uda1380_dapm_widgets)); 419 ARRAY_SIZE(uda1380_dapm_widgets));
417 420
418 /* Set up magician specific audio path interconnects */ 421 /* Set up magician specific audio path interconnects */
419 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 422 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
420 423
421 snd_soc_dapm_sync(codec); 424 snd_soc_dapm_sync(dapm);
422 return 0; 425 return 0;
423} 426}
424 427
diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c
index f284cc54bc80..f7a1e8f09f9a 100644
--- a/sound/soc/pxa/mioa701_wm9713.c
+++ b/sound/soc/pxa/mioa701_wm9713.c
@@ -130,13 +130,14 @@ static const struct snd_soc_dapm_route audio_map[] = {
130static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd) 130static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
131{ 131{
132 struct snd_soc_codec *codec = rtd->codec; 132 struct snd_soc_codec *codec = rtd->codec;
133 struct snd_soc_dapm_context *dapm = &codec->dapm;
133 unsigned short reg; 134 unsigned short reg;
134 135
135 /* Add mioa701 specific widgets */ 136 /* Add mioa701 specific widgets */
136 snd_soc_dapm_new_controls(codec, ARRAY_AND_SIZE(mioa701_dapm_widgets)); 137 snd_soc_dapm_new_controls(dapm, ARRAY_AND_SIZE(mioa701_dapm_widgets));
137 138
138 /* Set up mioa701 specific audio path audio_mapnects */ 139 /* Set up mioa701 specific audio path audio_mapnects */
139 snd_soc_dapm_add_routes(codec, ARRAY_AND_SIZE(audio_map)); 140 snd_soc_dapm_add_routes(dapm, ARRAY_AND_SIZE(audio_map));
140 141
141 /* Prepare GPIO8 for rear speaker amplifier */ 142 /* Prepare GPIO8 for rear speaker amplifier */
142 reg = codec->driver->read(codec, AC97_GPIO_CFG); 143 reg = codec->driver->read(codec, AC97_GPIO_CFG);
@@ -146,12 +147,12 @@ static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
146 reg = codec->driver->read(codec, AC97_3D_CONTROL); 147 reg = codec->driver->read(codec, AC97_3D_CONTROL);
147 codec->driver->write(codec, AC97_3D_CONTROL, reg | 0xc000); 148 codec->driver->write(codec, AC97_3D_CONTROL, reg | 0xc000);
148 149
149 snd_soc_dapm_enable_pin(codec, "Front Speaker"); 150 snd_soc_dapm_enable_pin(dapm, "Front Speaker");
150 snd_soc_dapm_enable_pin(codec, "Rear Speaker"); 151 snd_soc_dapm_enable_pin(dapm, "Rear Speaker");
151 snd_soc_dapm_enable_pin(codec, "Front Mic"); 152 snd_soc_dapm_enable_pin(dapm, "Front Mic");
152 snd_soc_dapm_enable_pin(codec, "GSM Line In"); 153 snd_soc_dapm_enable_pin(dapm, "GSM Line In");
153 snd_soc_dapm_enable_pin(codec, "GSM Line Out"); 154 snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
154 snd_soc_dapm_sync(codec); 155 snd_soc_dapm_sync(dapm);
155 156
156 return 0; 157 return 0;
157} 158}
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c
index 13f6d485d571..530064dd06a9 100644
--- a/sound/soc/pxa/palm27x.c
+++ b/sound/soc/pxa/palm27x.c
@@ -77,37 +77,38 @@ static struct snd_soc_card palm27x_asoc;
77static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd) 77static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd)
78{ 78{
79 struct snd_soc_codec *codec = rtd->codec; 79 struct snd_soc_codec *codec = rtd->codec;
80 struct snd_soc_dapm_context *dapm = &codec->dapm;
80 int err; 81 int err;
81 82
82 /* add palm27x specific widgets */ 83 /* add palm27x specific widgets */
83 err = snd_soc_dapm_new_controls(codec, palm27x_dapm_widgets, 84 err = snd_soc_dapm_new_controls(dapm, palm27x_dapm_widgets,
84 ARRAY_SIZE(palm27x_dapm_widgets)); 85 ARRAY_SIZE(palm27x_dapm_widgets));
85 if (err) 86 if (err)
86 return err; 87 return err;
87 88
88 /* set up palm27x specific audio path audio_map */ 89 /* set up palm27x specific audio path audio_map */
89 err = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 90 err = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
90 if (err) 91 if (err)
91 return err; 92 return err;
92 93
93 /* connected pins */ 94 /* connected pins */
94 if (machine_is_palmld()) 95 if (machine_is_palmld())
95 snd_soc_dapm_enable_pin(codec, "MIC1"); 96 snd_soc_dapm_enable_pin(dapm, "MIC1");
96 snd_soc_dapm_enable_pin(codec, "HPOUTL"); 97 snd_soc_dapm_enable_pin(dapm, "HPOUTL");
97 snd_soc_dapm_enable_pin(codec, "HPOUTR"); 98 snd_soc_dapm_enable_pin(dapm, "HPOUTR");
98 snd_soc_dapm_enable_pin(codec, "LOUT2"); 99 snd_soc_dapm_enable_pin(dapm, "LOUT2");
99 snd_soc_dapm_enable_pin(codec, "ROUT2"); 100 snd_soc_dapm_enable_pin(dapm, "ROUT2");
100 101
101 /* not connected pins */ 102 /* not connected pins */
102 snd_soc_dapm_nc_pin(codec, "OUT3"); 103 snd_soc_dapm_nc_pin(dapm, "OUT3");
103 snd_soc_dapm_nc_pin(codec, "MONOOUT"); 104 snd_soc_dapm_nc_pin(dapm, "MONOOUT");
104 snd_soc_dapm_nc_pin(codec, "LINEINL"); 105 snd_soc_dapm_nc_pin(dapm, "LINEINL");
105 snd_soc_dapm_nc_pin(codec, "LINEINR"); 106 snd_soc_dapm_nc_pin(dapm, "LINEINR");
106 snd_soc_dapm_nc_pin(codec, "PCBEEP"); 107 snd_soc_dapm_nc_pin(dapm, "PCBEEP");
107 snd_soc_dapm_nc_pin(codec, "PHONE"); 108 snd_soc_dapm_nc_pin(dapm, "PHONE");
108 snd_soc_dapm_nc_pin(codec, "MIC2"); 109 snd_soc_dapm_nc_pin(dapm, "MIC2");
109 110
110 err = snd_soc_dapm_sync(codec); 111 err = snd_soc_dapm_sync(dapm);
111 if (err) 112 if (err)
112 return err; 113 return err;
113 114
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index af84ee9c5e11..7353ee5034fe 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -46,6 +46,8 @@ static int poodle_spk_func;
46 46
47static void poodle_ext_control(struct snd_soc_codec *codec) 47static void poodle_ext_control(struct snd_soc_codec *codec)
48{ 48{
49 struct snd_soc_dapm_context *dapm = &codec->dapm;
50
49 /* set up jack connection */ 51 /* set up jack connection */
50 if (poodle_jack_func == POODLE_HP) { 52 if (poodle_jack_func == POODLE_HP) {
51 /* set = unmute headphone */ 53 /* set = unmute headphone */
@@ -53,23 +55,23 @@ static void poodle_ext_control(struct snd_soc_codec *codec)
53 POODLE_LOCOMO_GPIO_MUTE_L, 1); 55 POODLE_LOCOMO_GPIO_MUTE_L, 1);
54 locomo_gpio_write(&poodle_locomo_device.dev, 56 locomo_gpio_write(&poodle_locomo_device.dev,
55 POODLE_LOCOMO_GPIO_MUTE_R, 1); 57 POODLE_LOCOMO_GPIO_MUTE_R, 1);
56 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 58 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
57 } else { 59 } else {
58 locomo_gpio_write(&poodle_locomo_device.dev, 60 locomo_gpio_write(&poodle_locomo_device.dev,
59 POODLE_LOCOMO_GPIO_MUTE_L, 0); 61 POODLE_LOCOMO_GPIO_MUTE_L, 0);
60 locomo_gpio_write(&poodle_locomo_device.dev, 62 locomo_gpio_write(&poodle_locomo_device.dev,
61 POODLE_LOCOMO_GPIO_MUTE_R, 0); 63 POODLE_LOCOMO_GPIO_MUTE_R, 0);
62 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 64 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
63 } 65 }
64 66
65 /* set the enpoints to their new connetion states */ 67 /* set the enpoints to their new connetion states */
66 if (poodle_spk_func == POODLE_SPK_ON) 68 if (poodle_spk_func == POODLE_SPK_ON)
67 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 69 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
68 else 70 else
69 snd_soc_dapm_disable_pin(codec, "Ext Spk"); 71 snd_soc_dapm_disable_pin(dapm, "Ext Spk");
70 72
71 /* signal a DAPM event */ 73 /* signal a DAPM event */
72 snd_soc_dapm_sync(codec); 74 snd_soc_dapm_sync(dapm);
73} 75}
74 76
75static int poodle_startup(struct snd_pcm_substream *substream) 77static int poodle_startup(struct snd_pcm_substream *substream)
@@ -239,11 +241,12 @@ static const struct snd_kcontrol_new wm8731_poodle_controls[] = {
239static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd) 241static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd)
240{ 242{
241 struct snd_soc_codec *codec = rtd->codec; 243 struct snd_soc_codec *codec = rtd->codec;
244 struct snd_soc_dapm_context *dapm = &codec->dapm;
242 int err; 245 int err;
243 246
244 snd_soc_dapm_nc_pin(codec, "LLINEIN"); 247 snd_soc_dapm_nc_pin(dapm, "LLINEIN");
245 snd_soc_dapm_nc_pin(codec, "RLINEIN"); 248 snd_soc_dapm_nc_pin(dapm, "RLINEIN");
246 snd_soc_dapm_enable_pin(codec, "MICIN"); 249 snd_soc_dapm_enable_pin(dapm, "MICIN");
247 250
248 /* Add poodle specific controls */ 251 /* Add poodle specific controls */
249 err = snd_soc_add_controls(codec, wm8731_poodle_controls, 252 err = snd_soc_add_controls(codec, wm8731_poodle_controls,
@@ -252,13 +255,13 @@ static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd)
252 return err; 255 return err;
253 256
254 /* Add poodle specific widgets */ 257 /* Add poodle specific widgets */
255 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, 258 snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
256 ARRAY_SIZE(wm8731_dapm_widgets)); 259 ARRAY_SIZE(wm8731_dapm_widgets));
257 260
258 /* Set up poodle specific audio path audio_map */ 261 /* Set up poodle specific audio path audio_map */
259 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 262 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
260 263
261 snd_soc_dapm_sync(codec); 264 snd_soc_dapm_sync(dapm);
262 return 0; 265 return 0;
263} 266}
264 267
diff --git a/sound/soc/pxa/saarb.c b/sound/soc/pxa/saarb.c
index d63cb474b4e1..ee06f9982c09 100644
--- a/sound/soc/pxa/saarb.c
+++ b/sound/soc/pxa/saarb.c
@@ -133,20 +133,21 @@ static struct snd_soc_card snd_soc_card_saarb = {
133static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd) 133static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd)
134{ 134{
135 struct snd_soc_codec *codec = rtd->codec; 135 struct snd_soc_codec *codec = rtd->codec;
136 struct snd_soc_dapm_context *dapm = &codec->dapm;
136 int ret; 137 int ret;
137 138
138 snd_soc_dapm_new_controls(codec, saarb_dapm_widgets, 139 snd_soc_dapm_new_controls(dapm, saarb_dapm_widgets,
139 ARRAY_SIZE(saarb_dapm_widgets)); 140 ARRAY_SIZE(saarb_dapm_widgets));
140 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 141 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
141 142
142 /* connected pins */ 143 /* connected pins */
143 snd_soc_dapm_enable_pin(codec, "Ext Speaker"); 144 snd_soc_dapm_enable_pin(dapm, "Ext Speaker");
144 snd_soc_dapm_enable_pin(codec, "Ext Mic 1"); 145 snd_soc_dapm_enable_pin(dapm, "Ext Mic 1");
145 snd_soc_dapm_enable_pin(codec, "Ext Mic 3"); 146 snd_soc_dapm_enable_pin(dapm, "Ext Mic 3");
146 snd_soc_dapm_disable_pin(codec, "Headset Mic 2"); 147 snd_soc_dapm_disable_pin(dapm, "Headset Mic 2");
147 snd_soc_dapm_disable_pin(codec, "Headset Stereophone"); 148 snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");
148 149
149 ret = snd_soc_dapm_sync(codec); 150 ret = snd_soc_dapm_sync(dapm);
150 if (ret) 151 if (ret)
151 return ret; 152 return ret;
152 153
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index f470f360f4dd..0680b11c2685 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -46,61 +46,63 @@ static int spitz_spk_func;
46 46
47static void spitz_ext_control(struct snd_soc_codec *codec) 47static void spitz_ext_control(struct snd_soc_codec *codec)
48{ 48{
49 struct snd_soc_dapm_context *dapm = &codec->dapm;
50
49 if (spitz_spk_func == SPITZ_SPK_ON) 51 if (spitz_spk_func == SPITZ_SPK_ON)
50 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 52 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
51 else 53 else
52 snd_soc_dapm_disable_pin(codec, "Ext Spk"); 54 snd_soc_dapm_disable_pin(dapm, "Ext Spk");
53 55
54 /* set up jack connection */ 56 /* set up jack connection */
55 switch (spitz_jack_func) { 57 switch (spitz_jack_func) {
56 case SPITZ_HP: 58 case SPITZ_HP:
57 /* enable and unmute hp jack, disable mic bias */ 59 /* enable and unmute hp jack, disable mic bias */
58 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 60 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
59 snd_soc_dapm_disable_pin(codec, "Mic Jack"); 61 snd_soc_dapm_disable_pin(dapm, "Mic Jack");
60 snd_soc_dapm_disable_pin(codec, "Line Jack"); 62 snd_soc_dapm_disable_pin(dapm, "Line Jack");
61 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 63 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
62 gpio_set_value(SPITZ_GPIO_MUTE_L, 1); 64 gpio_set_value(SPITZ_GPIO_MUTE_L, 1);
63 gpio_set_value(SPITZ_GPIO_MUTE_R, 1); 65 gpio_set_value(SPITZ_GPIO_MUTE_R, 1);
64 break; 66 break;
65 case SPITZ_MIC: 67 case SPITZ_MIC:
66 /* enable mic jack and bias, mute hp */ 68 /* enable mic jack and bias, mute hp */
67 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 69 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
68 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 70 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
69 snd_soc_dapm_disable_pin(codec, "Line Jack"); 71 snd_soc_dapm_disable_pin(dapm, "Line Jack");
70 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 72 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
71 gpio_set_value(SPITZ_GPIO_MUTE_L, 0); 73 gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
72 gpio_set_value(SPITZ_GPIO_MUTE_R, 0); 74 gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
73 break; 75 break;
74 case SPITZ_LINE: 76 case SPITZ_LINE:
75 /* enable line jack, disable mic bias and mute hp */ 77 /* enable line jack, disable mic bias and mute hp */
76 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 78 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
77 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 79 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
78 snd_soc_dapm_disable_pin(codec, "Mic Jack"); 80 snd_soc_dapm_disable_pin(dapm, "Mic Jack");
79 snd_soc_dapm_enable_pin(codec, "Line Jack"); 81 snd_soc_dapm_enable_pin(dapm, "Line Jack");
80 gpio_set_value(SPITZ_GPIO_MUTE_L, 0); 82 gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
81 gpio_set_value(SPITZ_GPIO_MUTE_R, 0); 83 gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
82 break; 84 break;
83 case SPITZ_HEADSET: 85 case SPITZ_HEADSET:
84 /* enable and unmute headset jack enable mic bias, mute L hp */ 86 /* enable and unmute headset jack enable mic bias, mute L hp */
85 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 87 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
86 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 88 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
87 snd_soc_dapm_disable_pin(codec, "Line Jack"); 89 snd_soc_dapm_disable_pin(dapm, "Line Jack");
88 snd_soc_dapm_enable_pin(codec, "Headset Jack"); 90 snd_soc_dapm_enable_pin(dapm, "Headset Jack");
89 gpio_set_value(SPITZ_GPIO_MUTE_L, 0); 91 gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
90 gpio_set_value(SPITZ_GPIO_MUTE_R, 1); 92 gpio_set_value(SPITZ_GPIO_MUTE_R, 1);
91 break; 93 break;
92 case SPITZ_HP_OFF: 94 case SPITZ_HP_OFF:
93 95
94 /* jack removed, everything off */ 96 /* jack removed, everything off */
95 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 97 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
96 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 98 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
97 snd_soc_dapm_disable_pin(codec, "Mic Jack"); 99 snd_soc_dapm_disable_pin(dapm, "Mic Jack");
98 snd_soc_dapm_disable_pin(codec, "Line Jack"); 100 snd_soc_dapm_disable_pin(dapm, "Line Jack");
99 gpio_set_value(SPITZ_GPIO_MUTE_L, 0); 101 gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
100 gpio_set_value(SPITZ_GPIO_MUTE_R, 0); 102 gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
101 break; 103 break;
102 } 104 }
103 snd_soc_dapm_sync(codec); 105 snd_soc_dapm_sync(dapm);
104} 106}
105 107
106static int spitz_startup(struct snd_pcm_substream *substream) 108static int spitz_startup(struct snd_pcm_substream *substream)
@@ -276,16 +278,17 @@ static const struct snd_kcontrol_new wm8750_spitz_controls[] = {
276static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd) 278static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd)
277{ 279{
278 struct snd_soc_codec *codec = rtd->codec; 280 struct snd_soc_codec *codec = rtd->codec;
281 struct snd_soc_dapm_context *dapm = &codec->dapm;
279 int err; 282 int err;
280 283
281 /* NC codec pins */ 284 /* NC codec pins */
282 snd_soc_dapm_nc_pin(codec, "RINPUT1"); 285 snd_soc_dapm_nc_pin(dapm, "RINPUT1");
283 snd_soc_dapm_nc_pin(codec, "LINPUT2"); 286 snd_soc_dapm_nc_pin(dapm, "LINPUT2");
284 snd_soc_dapm_nc_pin(codec, "RINPUT2"); 287 snd_soc_dapm_nc_pin(dapm, "RINPUT2");
285 snd_soc_dapm_nc_pin(codec, "LINPUT3"); 288 snd_soc_dapm_nc_pin(dapm, "LINPUT3");
286 snd_soc_dapm_nc_pin(codec, "RINPUT3"); 289 snd_soc_dapm_nc_pin(dapm, "RINPUT3");
287 snd_soc_dapm_nc_pin(codec, "OUT3"); 290 snd_soc_dapm_nc_pin(dapm, "OUT3");
288 snd_soc_dapm_nc_pin(codec, "MONO1"); 291 snd_soc_dapm_nc_pin(dapm, "MONO1");
289 292
290 /* Add spitz specific controls */ 293 /* Add spitz specific controls */
291 err = snd_soc_add_controls(codec, wm8750_spitz_controls, 294 err = snd_soc_add_controls(codec, wm8750_spitz_controls,
@@ -294,13 +297,13 @@ static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd)
294 return err; 297 return err;
295 298
296 /* Add spitz specific widgets */ 299 /* Add spitz specific widgets */
297 snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, 300 snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
298 ARRAY_SIZE(wm8750_dapm_widgets)); 301 ARRAY_SIZE(wm8750_dapm_widgets));
299 302
300 /* Set up spitz specific audio paths */ 303 /* Set up spitz specific audio paths */
301 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 304 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
302 305
303 snd_soc_dapm_sync(codec); 306 snd_soc_dapm_sync(dapm);
304 return 0; 307 return 0;
305} 308}
306 309
diff --git a/sound/soc/pxa/tavorevb3.c b/sound/soc/pxa/tavorevb3.c
index 248c283fc4df..18cbe0e7c223 100644
--- a/sound/soc/pxa/tavorevb3.c
+++ b/sound/soc/pxa/tavorevb3.c
@@ -133,20 +133,21 @@ static struct snd_soc_card snd_soc_card_evb3 = {
133static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd) 133static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd)
134{ 134{
135 struct snd_soc_codec *codec = rtd->codec; 135 struct snd_soc_codec *codec = rtd->codec;
136 struct snd_soc_dapm_context *dapm = &codec->dapm;
136 int ret; 137 int ret;
137 138
138 snd_soc_dapm_new_controls(codec, evb3_dapm_widgets, 139 snd_soc_dapm_new_controls(dapm, evb3_dapm_widgets,
139 ARRAY_SIZE(evb3_dapm_widgets)); 140 ARRAY_SIZE(evb3_dapm_widgets));
140 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 141 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
141 142
142 /* connected pins */ 143 /* connected pins */
143 snd_soc_dapm_enable_pin(codec, "Ext Speaker"); 144 snd_soc_dapm_enable_pin(dapm, "Ext Speaker");
144 snd_soc_dapm_enable_pin(codec, "Ext Mic 1"); 145 snd_soc_dapm_enable_pin(dapm, "Ext Mic 1");
145 snd_soc_dapm_enable_pin(codec, "Ext Mic 3"); 146 snd_soc_dapm_enable_pin(dapm, "Ext Mic 3");
146 snd_soc_dapm_disable_pin(codec, "Headset Mic 2"); 147 snd_soc_dapm_disable_pin(dapm, "Headset Mic 2");
147 snd_soc_dapm_disable_pin(codec, "Headset Stereophone"); 148 snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");
148 149
149 ret = snd_soc_dapm_sync(codec); 150 ret = snd_soc_dapm_sync(dapm);
150 if (ret) 151 if (ret)
151 return ret; 152 return ret;
152 153
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index 73d0edd8ded9..0a9bd68ef749 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -49,31 +49,33 @@ static int tosa_spk_func;
49 49
50static void tosa_ext_control(struct snd_soc_codec *codec) 50static void tosa_ext_control(struct snd_soc_codec *codec)
51{ 51{
52 struct snd_soc_dapm_context *dapm = &codec->dapm;
53
52 /* set up jack connection */ 54 /* set up jack connection */
53 switch (tosa_jack_func) { 55 switch (tosa_jack_func) {
54 case TOSA_HP: 56 case TOSA_HP:
55 snd_soc_dapm_disable_pin(codec, "Mic (Internal)"); 57 snd_soc_dapm_disable_pin(dapm, "Mic (Internal)");
56 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 58 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
57 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 59 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
58 break; 60 break;
59 case TOSA_MIC_INT: 61 case TOSA_MIC_INT:
60 snd_soc_dapm_enable_pin(codec, "Mic (Internal)"); 62 snd_soc_dapm_enable_pin(dapm, "Mic (Internal)");
61 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 63 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
62 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 64 snd_soc_dapm_disable_pin(dapm, "Headset Jack");
63 break; 65 break;
64 case TOSA_HEADSET: 66 case TOSA_HEADSET:
65 snd_soc_dapm_disable_pin(codec, "Mic (Internal)"); 67 snd_soc_dapm_disable_pin(dapm, "Mic (Internal)");
66 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 68 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
67 snd_soc_dapm_enable_pin(codec, "Headset Jack"); 69 snd_soc_dapm_enable_pin(dapm, "Headset Jack");
68 break; 70 break;
69 } 71 }
70 72
71 if (tosa_spk_func == TOSA_SPK_ON) 73 if (tosa_spk_func == TOSA_SPK_ON)
72 snd_soc_dapm_enable_pin(codec, "Speaker"); 74 snd_soc_dapm_enable_pin(dapm, "Speaker");
73 else 75 else
74 snd_soc_dapm_disable_pin(codec, "Speaker"); 76 snd_soc_dapm_disable_pin(dapm, "Speaker");
75 77
76 snd_soc_dapm_sync(codec); 78 snd_soc_dapm_sync(dapm);
77} 79}
78 80
79static int tosa_startup(struct snd_pcm_substream *substream) 81static int tosa_startup(struct snd_pcm_substream *substream)
@@ -186,10 +188,11 @@ static const struct snd_kcontrol_new tosa_controls[] = {
186static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd) 188static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd)
187{ 189{
188 struct snd_soc_codec *codec = rtd->codec; 190 struct snd_soc_codec *codec = rtd->codec;
191 struct snd_soc_dapm_context *dapm = &codec->dapm;
189 int err; 192 int err;
190 193
191 snd_soc_dapm_nc_pin(codec, "OUT3"); 194 snd_soc_dapm_nc_pin(dapm, "OUT3");
192 snd_soc_dapm_nc_pin(codec, "MONOOUT"); 195 snd_soc_dapm_nc_pin(dapm, "MONOOUT");
193 196
194 /* add tosa specific controls */ 197 /* add tosa specific controls */
195 err = snd_soc_add_controls(codec, tosa_controls, 198 err = snd_soc_add_controls(codec, tosa_controls,
@@ -198,13 +201,13 @@ static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd)
198 return err; 201 return err;
199 202
200 /* add tosa specific widgets */ 203 /* add tosa specific widgets */
201 snd_soc_dapm_new_controls(codec, tosa_dapm_widgets, 204 snd_soc_dapm_new_controls(dapm, tosa_dapm_widgets,
202 ARRAY_SIZE(tosa_dapm_widgets)); 205 ARRAY_SIZE(tosa_dapm_widgets));
203 206
204 /* set up tosa specific audio path audio_map */ 207 /* set up tosa specific audio path audio_map */
205 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 208 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
206 209
207 snd_soc_dapm_sync(codec); 210 snd_soc_dapm_sync(dapm);
208 return 0; 211 return 0;
209} 212}
210 213
diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c
index 4cc841b44182..cacbcd4a55eb 100644
--- a/sound/soc/pxa/z2.c
+++ b/sound/soc/pxa/z2.c
@@ -140,22 +140,23 @@ static const struct snd_soc_dapm_route audio_map[] = {
140static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd) 140static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd)
141{ 141{
142 struct snd_soc_codec *codec = rtd->codec; 142 struct snd_soc_codec *codec = rtd->codec;
143 struct snd_soc_dapm_context *dapm = &codec->dapm;
143 int ret; 144 int ret;
144 145
145 /* NC codec pins */ 146 /* NC codec pins */
146 snd_soc_dapm_disable_pin(codec, "LINPUT3"); 147 snd_soc_dapm_disable_pin(dapm, "LINPUT3");
147 snd_soc_dapm_disable_pin(codec, "RINPUT3"); 148 snd_soc_dapm_disable_pin(dapm, "RINPUT3");
148 snd_soc_dapm_disable_pin(codec, "OUT3"); 149 snd_soc_dapm_disable_pin(dapm, "OUT3");
149 snd_soc_dapm_disable_pin(codec, "MONO"); 150 snd_soc_dapm_disable_pin(dapm, "MONO");
150 151
151 /* Add z2 specific widgets */ 152 /* Add z2 specific widgets */
152 snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, 153 snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
153 ARRAY_SIZE(wm8750_dapm_widgets)); 154 ARRAY_SIZE(wm8750_dapm_widgets));
154 155
155 /* Set up z2 specific audio paths */ 156 /* Set up z2 specific audio paths */
156 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 157 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
157 158
158 ret = snd_soc_dapm_sync(codec); 159 ret = snd_soc_dapm_sync(dapm);
159 if (ret) 160 if (ret)
160 goto err; 161 goto err;
161 162
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c
index d27e05af7759..c74eac30ebff 100644
--- a/sound/soc/pxa/zylonite.c
+++ b/sound/soc/pxa/zylonite.c
@@ -73,21 +73,22 @@ static const struct snd_soc_dapm_route audio_map[] = {
73static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd) 73static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd)
74{ 74{
75 struct snd_soc_codec *codec = rtd->codec; 75 struct snd_soc_codec *codec = rtd->codec;
76 struct snd_soc_dapm_context *dapm = &codec->dapm;
76 77
77 if (clk_pout) 78 if (clk_pout)
78 snd_soc_dai_set_pll(rtd->codec_dai, 0, 0, 79 snd_soc_dai_set_pll(rtd->codec_dai, 0, 0,
79 clk_get_rate(pout), 0); 80 clk_get_rate(pout), 0);
80 81
81 snd_soc_dapm_new_controls(codec, zylonite_dapm_widgets, 82 snd_soc_dapm_new_controls(dapm, zylonite_dapm_widgets,
82 ARRAY_SIZE(zylonite_dapm_widgets)); 83 ARRAY_SIZE(zylonite_dapm_widgets));
83 84
84 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 85 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
85 86
86 /* Static setup for now */ 87 /* Static setup for now */
87 snd_soc_dapm_enable_pin(codec, "Headphone"); 88 snd_soc_dapm_enable_pin(dapm, "Headphone");
88 snd_soc_dapm_enable_pin(codec, "Headset Earpiece"); 89 snd_soc_dapm_enable_pin(dapm, "Headset Earpiece");
89 90
90 snd_soc_dapm_sync(codec); 91 snd_soc_dapm_sync(dapm);
91 return 0; 92 return 0;
92} 93}
93 94
diff --git a/sound/soc/s3c24xx/aquila_wm8994.c b/sound/soc/s3c24xx/aquila_wm8994.c
index 235d1973f7d0..33bebdae08a7 100644
--- a/sound/soc/s3c24xx/aquila_wm8994.c
+++ b/sound/soc/s3c24xx/aquila_wm8994.c
@@ -93,27 +93,28 @@ static const struct snd_soc_dapm_route aquila_dapm_routes[] = {
93static int aquila_wm8994_init(struct snd_soc_pcm_runtime *rtd) 93static int aquila_wm8994_init(struct snd_soc_pcm_runtime *rtd)
94{ 94{
95 struct snd_soc_codec *codec = rtd->codec; 95 struct snd_soc_codec *codec = rtd->codec;
96 struct snd_soc_dapm_context *dapm = &codec->dapm;
96 int ret; 97 int ret;
97 98
98 /* add aquila specific widgets */ 99 /* add aquila specific widgets */
99 snd_soc_dapm_new_controls(codec, aquila_dapm_widgets, 100 snd_soc_dapm_new_controls(dapm, aquila_dapm_widgets,
100 ARRAY_SIZE(aquila_dapm_widgets)); 101 ARRAY_SIZE(aquila_dapm_widgets));
101 102
102 /* set up aquila specific audio routes */ 103 /* set up aquila specific audio routes */
103 snd_soc_dapm_add_routes(codec, aquila_dapm_routes, 104 snd_soc_dapm_add_routes(dapm, aquila_dapm_routes,
104 ARRAY_SIZE(aquila_dapm_routes)); 105 ARRAY_SIZE(aquila_dapm_routes));
105 106
106 /* set endpoints to not connected */ 107 /* set endpoints to not connected */
107 snd_soc_dapm_nc_pin(codec, "IN2LP:VXRN"); 108 snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN");
108 snd_soc_dapm_nc_pin(codec, "IN2RP:VXRP"); 109 snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP");
109 snd_soc_dapm_nc_pin(codec, "LINEOUT1N"); 110 snd_soc_dapm_nc_pin(dapm, "LINEOUT1N");
110 snd_soc_dapm_nc_pin(codec, "LINEOUT1P"); 111 snd_soc_dapm_nc_pin(dapm, "LINEOUT1P");
111 snd_soc_dapm_nc_pin(codec, "LINEOUT2N"); 112 snd_soc_dapm_nc_pin(dapm, "LINEOUT2N");
112 snd_soc_dapm_nc_pin(codec, "LINEOUT2P"); 113 snd_soc_dapm_nc_pin(dapm, "LINEOUT2P");
113 snd_soc_dapm_nc_pin(codec, "SPKOUTRN"); 114 snd_soc_dapm_nc_pin(dapm, "SPKOUTRN");
114 snd_soc_dapm_nc_pin(codec, "SPKOUTRP"); 115 snd_soc_dapm_nc_pin(dapm, "SPKOUTRP");
115 116
116 snd_soc_dapm_sync(codec); 117 snd_soc_dapm_sync(dapm);
117 118
118 /* Headset jack detection */ 119 /* Headset jack detection */
119 ret = snd_soc_jack_new(&aquila, "Headset Jack", 120 ret = snd_soc_jack_new(&aquila, "Headset Jack",
diff --git a/sound/soc/s3c24xx/goni_wm8994.c b/sound/soc/s3c24xx/goni_wm8994.c
index 694f702cc8e2..052729c6540d 100644
--- a/sound/soc/s3c24xx/goni_wm8994.c
+++ b/sound/soc/s3c24xx/goni_wm8994.c
@@ -97,25 +97,26 @@ static const struct snd_soc_dapm_route goni_dapm_routes[] = {
97static int goni_wm8994_init(struct snd_soc_pcm_runtime *rtd) 97static int goni_wm8994_init(struct snd_soc_pcm_runtime *rtd)
98{ 98{
99 struct snd_soc_codec *codec = rtd->codec; 99 struct snd_soc_codec *codec = rtd->codec;
100 struct snd_soc_dapm_context *dapm = &codec->dapm;
100 int ret; 101 int ret;
101 102
102 /* add goni specific widgets */ 103 /* add goni specific widgets */
103 snd_soc_dapm_new_controls(codec, goni_dapm_widgets, 104 snd_soc_dapm_new_controls(dapm, goni_dapm_widgets,
104 ARRAY_SIZE(goni_dapm_widgets)); 105 ARRAY_SIZE(goni_dapm_widgets));
105 106
106 /* set up goni specific audio routes */ 107 /* set up goni specific audio routes */
107 snd_soc_dapm_add_routes(codec, goni_dapm_routes, 108 snd_soc_dapm_add_routes(dapm, goni_dapm_routes,
108 ARRAY_SIZE(goni_dapm_routes)); 109 ARRAY_SIZE(goni_dapm_routes));
109 110
110 /* set endpoints to not connected */ 111 /* set endpoints to not connected */
111 snd_soc_dapm_nc_pin(codec, "IN2LP:VXRN"); 112 snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN");
112 snd_soc_dapm_nc_pin(codec, "IN2RP:VXRP"); 113 snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP");
113 snd_soc_dapm_nc_pin(codec, "LINEOUT1N"); 114 snd_soc_dapm_nc_pin(dapm, "LINEOUT1N");
114 snd_soc_dapm_nc_pin(codec, "LINEOUT1P"); 115 snd_soc_dapm_nc_pin(dapm, "LINEOUT1P");
115 snd_soc_dapm_nc_pin(codec, "LINEOUT2N"); 116 snd_soc_dapm_nc_pin(dapm, "LINEOUT2N");
116 snd_soc_dapm_nc_pin(codec, "LINEOUT2P"); 117 snd_soc_dapm_nc_pin(dapm, "LINEOUT2P");
117 118
118 snd_soc_dapm_sync(codec); 119 snd_soc_dapm_sync(dapm);
119 120
120 /* Headset jack detection */ 121 /* Headset jack detection */
121 ret = snd_soc_jack_new(&goni, "Headset Jack", 122 ret = snd_soc_jack_new(&goni, "Headset Jack",
diff --git a/sound/soc/s3c24xx/jive_wm8750.c b/sound/soc/s3c24xx/jive_wm8750.c
index 49605cd83947..e3599e283568 100644
--- a/sound/soc/s3c24xx/jive_wm8750.c
+++ b/sound/soc/s3c24xx/jive_wm8750.c
@@ -111,18 +111,19 @@ static struct snd_soc_ops jive_ops = {
111static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd) 111static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd)
112{ 112{
113 struct snd_soc_codec *codec = rtd->codec; 113 struct snd_soc_codec *codec = rtd->codec;
114 struct snd_soc_dapm_context *dapm = &codec->dapm;
114 int err; 115 int err;
115 116
116 /* These endpoints are not being used. */ 117 /* These endpoints are not being used. */
117 snd_soc_dapm_nc_pin(codec, "LINPUT2"); 118 snd_soc_dapm_nc_pin(dapm, "LINPUT2");
118 snd_soc_dapm_nc_pin(codec, "RINPUT2"); 119 snd_soc_dapm_nc_pin(dapm, "RINPUT2");
119 snd_soc_dapm_nc_pin(codec, "LINPUT3"); 120 snd_soc_dapm_nc_pin(dapm, "LINPUT3");
120 snd_soc_dapm_nc_pin(codec, "RINPUT3"); 121 snd_soc_dapm_nc_pin(dapm, "RINPUT3");
121 snd_soc_dapm_nc_pin(codec, "OUT3"); 122 snd_soc_dapm_nc_pin(dapm, "OUT3");
122 snd_soc_dapm_nc_pin(codec, "MONO"); 123 snd_soc_dapm_nc_pin(dapm, "MONO");
123 124
124 /* Add jive specific widgets */ 125 /* Add jive specific widgets */
125 err = snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, 126 err = snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
126 ARRAY_SIZE(wm8750_dapm_widgets)); 127 ARRAY_SIZE(wm8750_dapm_widgets));
127 if (err) { 128 if (err) {
128 printk(KERN_ERR "%s: failed to add widgets (%d)\n", 129 printk(KERN_ERR "%s: failed to add widgets (%d)\n",
@@ -130,8 +131,8 @@ static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd)
130 return err; 131 return err;
131 } 132 }
132 133
133 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 134 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
134 snd_soc_dapm_sync(codec); 135 snd_soc_dapm_sync(dapm);
135 136
136 return 0; 137 return 0;
137} 138}
diff --git a/sound/soc/s3c24xx/neo1973_gta02_wm8753.c b/sound/soc/s3c24xx/neo1973_gta02_wm8753.c
index e97bdf150a03..c3f63ef8ab12 100644
--- a/sound/soc/s3c24xx/neo1973_gta02_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_gta02_wm8753.c
@@ -333,16 +333,17 @@ static const struct snd_kcontrol_new wm8753_neo1973_gta02_controls[] = {
333static int neo1973_gta02_wm8753_init(struct snd_soc_pcm_runtime *rtd) 333static int neo1973_gta02_wm8753_init(struct snd_soc_pcm_runtime *rtd)
334{ 334{
335 struct snd_soc_codec *codec = rtd->codec; 335 struct snd_soc_codec *codec = rtd->codec;
336 struct snd_soc_dapm_context *dapm = &codec->dapm;
336 int err; 337 int err;
337 338
338 /* set up NC codec pins */ 339 /* set up NC codec pins */
339 snd_soc_dapm_nc_pin(codec, "OUT3"); 340 snd_soc_dapm_nc_pin(dapm, "OUT3");
340 snd_soc_dapm_nc_pin(codec, "OUT4"); 341 snd_soc_dapm_nc_pin(dapm, "OUT4");
341 snd_soc_dapm_nc_pin(codec, "LINE1"); 342 snd_soc_dapm_nc_pin(dapm, "LINE1");
342 snd_soc_dapm_nc_pin(codec, "LINE2"); 343 snd_soc_dapm_nc_pin(dapm, "LINE2");
343 344
344 /* Add neo1973 gta02 specific widgets */ 345 /* Add neo1973 gta02 specific widgets */
345 snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, 346 snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets,
346 ARRAY_SIZE(wm8753_dapm_widgets)); 347 ARRAY_SIZE(wm8753_dapm_widgets));
347 348
348 /* add neo1973 gta02 specific controls */ 349 /* add neo1973 gta02 specific controls */
@@ -353,25 +354,25 @@ static int neo1973_gta02_wm8753_init(struct snd_soc_pcm_runtime *rtd)
353 return err; 354 return err;
354 355
355 /* set up neo1973 gta02 specific audio path audio_map */ 356 /* set up neo1973 gta02 specific audio path audio_map */
356 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 357 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
357 358
358 /* set endpoints to default off mode */ 359 /* set endpoints to default off mode */
359 snd_soc_dapm_disable_pin(codec, "Stereo Out"); 360 snd_soc_dapm_disable_pin(dapm, "Stereo Out");
360 snd_soc_dapm_disable_pin(codec, "GSM Line Out"); 361 snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
361 snd_soc_dapm_disable_pin(codec, "GSM Line In"); 362 snd_soc_dapm_disable_pin(dapm, "GSM Line In");
362 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 363 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
363 snd_soc_dapm_disable_pin(codec, "Handset Mic"); 364 snd_soc_dapm_disable_pin(dapm, "Handset Mic");
364 snd_soc_dapm_disable_pin(codec, "Handset Spk"); 365 snd_soc_dapm_disable_pin(dapm, "Handset Spk");
365 366
366 /* allow audio paths from the GSM modem to run during suspend */ 367 /* allow audio paths from the GSM modem to run during suspend */
367 snd_soc_dapm_ignore_suspend(codec, "Stereo Out"); 368 snd_soc_dapm_ignore_suspend(dapm, "Stereo Out");
368 snd_soc_dapm_ignore_suspend(codec, "GSM Line Out"); 369 snd_soc_dapm_ignore_suspend(dapm, "GSM Line Out");
369 snd_soc_dapm_ignore_suspend(codec, "GSM Line In"); 370 snd_soc_dapm_ignore_suspend(dapm, "GSM Line In");
370 snd_soc_dapm_ignore_suspend(codec, "Headset Mic"); 371 snd_soc_dapm_ignore_suspend(dapm, "Headset Mic");
371 snd_soc_dapm_ignore_suspend(codec, "Handset Mic"); 372 snd_soc_dapm_ignore_suspend(dapm, "Handset Mic");
372 snd_soc_dapm_ignore_suspend(codec, "Handset Spk"); 373 snd_soc_dapm_ignore_suspend(dapm, "Handset Spk");
373 374
374 snd_soc_dapm_sync(codec); 375 snd_soc_dapm_sync(dapm);
375 376
376 return 0; 377 return 0;
377} 378}
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
index f4f2ee731f01..e94ffe01a4a5 100644
--- a/sound/soc/s3c24xx/neo1973_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -237,81 +237,83 @@ static int neo1973_get_scenario(struct snd_kcontrol *kcontrol,
237 237
238static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario) 238static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario)
239{ 239{
240 struct snd_soc_dapm_context *dapm = &codec->dapm;
241
240 pr_debug("Entered %s\n", __func__); 242 pr_debug("Entered %s\n", __func__);
241 243
242 switch (neo1973_scenario) { 244 switch (neo1973_scenario) {
243 case NEO_AUDIO_OFF: 245 case NEO_AUDIO_OFF:
244 snd_soc_dapm_disable_pin(codec, "Audio Out"); 246 snd_soc_dapm_disable_pin(dapm, "Audio Out");
245 snd_soc_dapm_disable_pin(codec, "GSM Line Out"); 247 snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
246 snd_soc_dapm_disable_pin(codec, "GSM Line In"); 248 snd_soc_dapm_disable_pin(dapm, "GSM Line In");
247 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 249 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
248 snd_soc_dapm_disable_pin(codec, "Call Mic"); 250 snd_soc_dapm_disable_pin(dapm, "Call Mic");
249 break; 251 break;
250 case NEO_GSM_CALL_AUDIO_HANDSET: 252 case NEO_GSM_CALL_AUDIO_HANDSET:
251 snd_soc_dapm_enable_pin(codec, "Audio Out"); 253 snd_soc_dapm_enable_pin(dapm, "Audio Out");
252 snd_soc_dapm_enable_pin(codec, "GSM Line Out"); 254 snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
253 snd_soc_dapm_enable_pin(codec, "GSM Line In"); 255 snd_soc_dapm_enable_pin(dapm, "GSM Line In");
254 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 256 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
255 snd_soc_dapm_enable_pin(codec, "Call Mic"); 257 snd_soc_dapm_enable_pin(dapm, "Call Mic");
256 break; 258 break;
257 case NEO_GSM_CALL_AUDIO_HEADSET: 259 case NEO_GSM_CALL_AUDIO_HEADSET:
258 snd_soc_dapm_enable_pin(codec, "Audio Out"); 260 snd_soc_dapm_enable_pin(dapm, "Audio Out");
259 snd_soc_dapm_enable_pin(codec, "GSM Line Out"); 261 snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
260 snd_soc_dapm_enable_pin(codec, "GSM Line In"); 262 snd_soc_dapm_enable_pin(dapm, "GSM Line In");
261 snd_soc_dapm_enable_pin(codec, "Headset Mic"); 263 snd_soc_dapm_enable_pin(dapm, "Headset Mic");
262 snd_soc_dapm_disable_pin(codec, "Call Mic"); 264 snd_soc_dapm_disable_pin(dapm, "Call Mic");
263 break; 265 break;
264 case NEO_GSM_CALL_AUDIO_BLUETOOTH: 266 case NEO_GSM_CALL_AUDIO_BLUETOOTH:
265 snd_soc_dapm_disable_pin(codec, "Audio Out"); 267 snd_soc_dapm_disable_pin(dapm, "Audio Out");
266 snd_soc_dapm_enable_pin(codec, "GSM Line Out"); 268 snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
267 snd_soc_dapm_enable_pin(codec, "GSM Line In"); 269 snd_soc_dapm_enable_pin(dapm, "GSM Line In");
268 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 270 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
269 snd_soc_dapm_disable_pin(codec, "Call Mic"); 271 snd_soc_dapm_disable_pin(dapm, "Call Mic");
270 break; 272 break;
271 case NEO_STEREO_TO_SPEAKERS: 273 case NEO_STEREO_TO_SPEAKERS:
272 snd_soc_dapm_enable_pin(codec, "Audio Out"); 274 snd_soc_dapm_enable_pin(dapm, "Audio Out");
273 snd_soc_dapm_disable_pin(codec, "GSM Line Out"); 275 snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
274 snd_soc_dapm_disable_pin(codec, "GSM Line In"); 276 snd_soc_dapm_disable_pin(dapm, "GSM Line In");
275 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 277 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
276 snd_soc_dapm_disable_pin(codec, "Call Mic"); 278 snd_soc_dapm_disable_pin(dapm, "Call Mic");
277 break; 279 break;
278 case NEO_STEREO_TO_HEADPHONES: 280 case NEO_STEREO_TO_HEADPHONES:
279 snd_soc_dapm_enable_pin(codec, "Audio Out"); 281 snd_soc_dapm_enable_pin(dapm, "Audio Out");
280 snd_soc_dapm_disable_pin(codec, "GSM Line Out"); 282 snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
281 snd_soc_dapm_disable_pin(codec, "GSM Line In"); 283 snd_soc_dapm_disable_pin(dapm, "GSM Line In");
282 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 284 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
283 snd_soc_dapm_disable_pin(codec, "Call Mic"); 285 snd_soc_dapm_disable_pin(dapm, "Call Mic");
284 break; 286 break;
285 case NEO_CAPTURE_HANDSET: 287 case NEO_CAPTURE_HANDSET:
286 snd_soc_dapm_disable_pin(codec, "Audio Out"); 288 snd_soc_dapm_disable_pin(dapm, "Audio Out");
287 snd_soc_dapm_disable_pin(codec, "GSM Line Out"); 289 snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
288 snd_soc_dapm_disable_pin(codec, "GSM Line In"); 290 snd_soc_dapm_disable_pin(dapm, "GSM Line In");
289 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 291 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
290 snd_soc_dapm_enable_pin(codec, "Call Mic"); 292 snd_soc_dapm_enable_pin(dapm, "Call Mic");
291 break; 293 break;
292 case NEO_CAPTURE_HEADSET: 294 case NEO_CAPTURE_HEADSET:
293 snd_soc_dapm_disable_pin(codec, "Audio Out"); 295 snd_soc_dapm_disable_pin(dapm, "Audio Out");
294 snd_soc_dapm_disable_pin(codec, "GSM Line Out"); 296 snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
295 snd_soc_dapm_disable_pin(codec, "GSM Line In"); 297 snd_soc_dapm_disable_pin(dapm, "GSM Line In");
296 snd_soc_dapm_enable_pin(codec, "Headset Mic"); 298 snd_soc_dapm_enable_pin(dapm, "Headset Mic");
297 snd_soc_dapm_disable_pin(codec, "Call Mic"); 299 snd_soc_dapm_disable_pin(dapm, "Call Mic");
298 break; 300 break;
299 case NEO_CAPTURE_BLUETOOTH: 301 case NEO_CAPTURE_BLUETOOTH:
300 snd_soc_dapm_disable_pin(codec, "Audio Out"); 302 snd_soc_dapm_disable_pin(dapm, "Audio Out");
301 snd_soc_dapm_disable_pin(codec, "GSM Line Out"); 303 snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
302 snd_soc_dapm_disable_pin(codec, "GSM Line In"); 304 snd_soc_dapm_disable_pin(dapm, "GSM Line In");
303 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 305 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
304 snd_soc_dapm_disable_pin(codec, "Call Mic"); 306 snd_soc_dapm_disable_pin(dapm, "Call Mic");
305 break; 307 break;
306 default: 308 default:
307 snd_soc_dapm_disable_pin(codec, "Audio Out"); 309 snd_soc_dapm_disable_pin(dapm, "Audio Out");
308 snd_soc_dapm_disable_pin(codec, "GSM Line Out"); 310 snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
309 snd_soc_dapm_disable_pin(codec, "GSM Line In"); 311 snd_soc_dapm_disable_pin(dapm, "GSM Line In");
310 snd_soc_dapm_disable_pin(codec, "Headset Mic"); 312 snd_soc_dapm_disable_pin(dapm, "Headset Mic");
311 snd_soc_dapm_disable_pin(codec, "Call Mic"); 313 snd_soc_dapm_disable_pin(dapm, "Call Mic");
312 } 314 }
313 315
314 snd_soc_dapm_sync(codec); 316 snd_soc_dapm_sync(dapm);
315 317
316 return 0; 318 return 0;
317} 319}
@@ -502,20 +504,21 @@ static const struct snd_kcontrol_new wm8753_neo1973_controls[] = {
502static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) 504static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
503{ 505{
504 struct snd_soc_codec *codec = rtd->codec; 506 struct snd_soc_codec *codec = rtd->codec;
507 struct snd_soc_dapm_context *dapm = &codec->dapm;
505 int err; 508 int err;
506 509
507 pr_debug("Entered %s\n", __func__); 510 pr_debug("Entered %s\n", __func__);
508 511
509 /* set up NC codec pins */ 512 /* set up NC codec pins */
510 snd_soc_dapm_nc_pin(codec, "LOUT2"); 513 snd_soc_dapm_nc_pin(dapm, "LOUT2");
511 snd_soc_dapm_nc_pin(codec, "ROUT2"); 514 snd_soc_dapm_nc_pin(dapm, "ROUT2");
512 snd_soc_dapm_nc_pin(codec, "OUT3"); 515 snd_soc_dapm_nc_pin(dapm, "OUT3");
513 snd_soc_dapm_nc_pin(codec, "OUT4"); 516 snd_soc_dapm_nc_pin(dapm, "OUT4");
514 snd_soc_dapm_nc_pin(codec, "LINE1"); 517 snd_soc_dapm_nc_pin(dapm, "LINE1");
515 snd_soc_dapm_nc_pin(codec, "LINE2"); 518 snd_soc_dapm_nc_pin(dapm, "LINE2");
516 519
517 /* Add neo1973 specific widgets */ 520 /* Add neo1973 specific widgets */
518 snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, 521 snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets,
519 ARRAY_SIZE(wm8753_dapm_widgets)); 522 ARRAY_SIZE(wm8753_dapm_widgets));
520 523
521 /* set endpoints to default mode */ 524 /* set endpoints to default mode */
@@ -528,10 +531,10 @@ static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
528 return err; 531 return err;
529 532
530 /* set up neo1973 specific audio routes */ 533 /* set up neo1973 specific audio routes */
531 err = snd_soc_dapm_add_routes(codec, dapm_routes, 534 err = snd_soc_dapm_add_routes(dapm, dapm_routes,
532 ARRAY_SIZE(dapm_routes)); 535 ARRAY_SIZE(dapm_routes));
533 536
534 snd_soc_dapm_sync(codec); 537 snd_soc_dapm_sync(dapm);
535 return 0; 538 return 0;
536} 539}
537 540
diff --git a/sound/soc/s3c24xx/rx1950_uda1380.c b/sound/soc/s3c24xx/rx1950_uda1380.c
index ffd5cf2fb0a9..105d177fa427 100644
--- a/sound/soc/s3c24xx/rx1950_uda1380.c
+++ b/sound/soc/s3c24xx/rx1950_uda1380.c
@@ -232,26 +232,27 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream,
232static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd) 232static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd)
233{ 233{
234 struct snd_soc_codec *codec = rtd->codec; 234 struct snd_soc_codec *codec = rtd->codec;
235 struct snd_soc_dapm_context *dapm = &codec->dapm;
235 int err; 236 int err;
236 237
237 /* Add rx1950 specific widgets */ 238 /* Add rx1950 specific widgets */
238 err = snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, 239 err = snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
239 ARRAY_SIZE(uda1380_dapm_widgets)); 240 ARRAY_SIZE(uda1380_dapm_widgets));
240 241
241 if (err) 242 if (err)
242 return err; 243 return err;
243 244
244 /* Set up rx1950 specific audio path audio_mapnects */ 245 /* Set up rx1950 specific audio path audio_mapnects */
245 err = snd_soc_dapm_add_routes(codec, audio_map, 246 err = snd_soc_dapm_add_routes(dapm, audio_map,
246 ARRAY_SIZE(audio_map)); 247 ARRAY_SIZE(audio_map));
247 248
248 if (err) 249 if (err)
249 return err; 250 return err;
250 251
251 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 252 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
252 snd_soc_dapm_enable_pin(codec, "Speaker"); 253 snd_soc_dapm_enable_pin(dapm, "Speaker");
253 254
254 snd_soc_dapm_sync(codec); 255 snd_soc_dapm_sync(dapm);
255 256
256 snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, 257 snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
257 &hp_jack); 258 &hp_jack);
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c b/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
index f88453735ae2..05c793705d90 100644
--- a/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
+++ b/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
@@ -76,19 +76,20 @@ static const struct snd_soc_dapm_route base_map[] = {
76static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd) 76static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
77{ 77{
78 struct snd_soc_codec *codec = rtd->codec; 78 struct snd_soc_codec *codec = rtd->codec;
79 struct snd_soc_dapm_context *dapm = &codec->dapm;
79 80
80 snd_soc_dapm_new_controls(codec, dapm_widgets, 81 snd_soc_dapm_new_controls(dapm, dapm_widgets,
81 ARRAY_SIZE(dapm_widgets)); 82 ARRAY_SIZE(dapm_widgets));
82 83
83 snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map)); 84 snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));
84 85
85 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 86 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
86 snd_soc_dapm_enable_pin(codec, "Line In"); 87 snd_soc_dapm_enable_pin(dapm, "Line In");
87 snd_soc_dapm_enable_pin(codec, "Line Out"); 88 snd_soc_dapm_enable_pin(dapm, "Line Out");
88 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 89 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
89 90
90 simtec_audio_init(rtd); 91 simtec_audio_init(rtd);
91 snd_soc_dapm_sync(codec); 92 snd_soc_dapm_sync(dapm);
92 93
93 return 0; 94 return 0;
94} 95}
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c b/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c
index c0967593510d..653dc7592e81 100644
--- a/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c
+++ b/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c
@@ -65,19 +65,20 @@ static const struct snd_soc_dapm_route base_map[] = {
65static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) 65static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
66{ 66{
67 struct snd_soc_codec *codec = rtd->codec; 67 struct snd_soc_codec *codec = rtd->codec;
68 struct snd_soc_dapm_context *dapm = &codec->dapm;
68 69
69 snd_soc_dapm_new_controls(codec, dapm_widgets, 70 snd_soc_dapm_new_controls(dapm, dapm_widgets,
70 ARRAY_SIZE(dapm_widgets)); 71 ARRAY_SIZE(dapm_widgets));
71 72
72 snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map)); 73 snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));
73 74
74 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 75 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
75 snd_soc_dapm_enable_pin(codec, "Line In"); 76 snd_soc_dapm_enable_pin(dapm, "Line In");
76 snd_soc_dapm_enable_pin(codec, "Line Out"); 77 snd_soc_dapm_enable_pin(dapm, "Line Out");
77 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 78 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
78 79
79 simtec_audio_init(rtd); 80 simtec_audio_init(rtd);
80 snd_soc_dapm_sync(codec); 81 snd_soc_dapm_sync(dapm);
81 82
82 return 0; 83 return 0;
83} 84}
diff --git a/sound/soc/s3c24xx/smartq_wm8987.c b/sound/soc/s3c24xx/smartq_wm8987.c
index dd20ca7f4681..1f6da1e27b1e 100644
--- a/sound/soc/s3c24xx/smartq_wm8987.c
+++ b/sound/soc/s3c24xx/smartq_wm8987.c
@@ -158,10 +158,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
158 158
159static int smartq_wm8987_init(struct snd_soc_codec *codec) 159static int smartq_wm8987_init(struct snd_soc_codec *codec)
160{ 160{
161 struct snd_soc_dapm_context *dapm = &codec->dapm;
161 int err = 0; 162 int err = 0;
162 163
163 /* Add SmartQ specific widgets */ 164 /* Add SmartQ specific widgets */
164 snd_soc_dapm_new_controls(codec, wm8987_dapm_widgets, 165 snd_soc_dapm_new_controls(dapm, wm8987_dapm_widgets,
165 ARRAY_SIZE(wm8987_dapm_widgets)); 166 ARRAY_SIZE(wm8987_dapm_widgets));
166 167
167 /* add SmartQ specific controls */ 168 /* add SmartQ specific controls */
@@ -172,20 +173,20 @@ static int smartq_wm8987_init(struct snd_soc_codec *codec)
172 return err; 173 return err;
173 174
174 /* setup SmartQ specific audio path */ 175 /* setup SmartQ specific audio path */
175 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 176 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
176 177
177 /* set endpoints to not connected */ 178 /* set endpoints to not connected */
178 snd_soc_dapm_nc_pin(codec, "LINPUT1"); 179 snd_soc_dapm_nc_pin(dapm, "LINPUT1");
179 snd_soc_dapm_nc_pin(codec, "RINPUT1"); 180 snd_soc_dapm_nc_pin(dapm, "RINPUT1");
180 snd_soc_dapm_nc_pin(codec, "OUT3"); 181 snd_soc_dapm_nc_pin(dapm, "OUT3");
181 snd_soc_dapm_nc_pin(codec, "ROUT1"); 182 snd_soc_dapm_nc_pin(dapm, "ROUT1");
182 183
183 /* set endpoints to default off mode */ 184 /* set endpoints to default off mode */
184 snd_soc_dapm_enable_pin(codec, "Internal Speaker"); 185 snd_soc_dapm_enable_pin(dapm, "Internal Speaker");
185 snd_soc_dapm_enable_pin(codec, "Internal Mic"); 186 snd_soc_dapm_enable_pin(dapm, "Internal Mic");
186 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 187 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
187 188
188 err = snd_soc_dapm_sync(codec); 189 err = snd_soc_dapm_sync(dapm);
189 if (err) 190 if (err)
190 return err; 191 return err;
191 192
diff --git a/sound/soc/s3c24xx/smdk64xx_wm8580.c b/sound/soc/s3c24xx/smdk64xx_wm8580.c
index 052e499b68d1..291939cf8483 100644
--- a/sound/soc/s3c24xx/smdk64xx_wm8580.c
+++ b/sound/soc/s3c24xx/smdk64xx_wm8580.c
@@ -182,21 +182,22 @@ static const struct snd_soc_dapm_route audio_map_rx[] = {
182static int smdk64xx_wm8580_init_paiftx(struct snd_soc_pcm_runtime *rtd) 182static int smdk64xx_wm8580_init_paiftx(struct snd_soc_pcm_runtime *rtd)
183{ 183{
184 struct snd_soc_codec *codec = rtd->codec; 184 struct snd_soc_codec *codec = rtd->codec;
185 struct snd_soc_dapm_context *dapm = &codec->dapm;
185 186
186 /* Add smdk64xx specific Capture widgets */ 187 /* Add smdk64xx specific Capture widgets */
187 snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_cpt, 188 snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets_cpt,
188 ARRAY_SIZE(wm8580_dapm_widgets_cpt)); 189 ARRAY_SIZE(wm8580_dapm_widgets_cpt));
189 190
190 /* Set up PAIFTX audio path */ 191 /* Set up PAIFTX audio path */
191 snd_soc_dapm_add_routes(codec, audio_map_tx, ARRAY_SIZE(audio_map_tx)); 192 snd_soc_dapm_add_routes(dapm, audio_map_tx, ARRAY_SIZE(audio_map_tx));
192 193
193 /* Enabling the microphone requires the fitting of a 0R 194 /* Enabling the microphone requires the fitting of a 0R
194 * resistor to connect the line from the microphone jack. 195 * resistor to connect the line from the microphone jack.
195 */ 196 */
196 snd_soc_dapm_disable_pin(codec, "MicIn"); 197 snd_soc_dapm_disable_pin(dapm, "MicIn");
197 198
198 /* signal a DAPM event */ 199 /* signal a DAPM event */
199 snd_soc_dapm_sync(codec); 200 snd_soc_dapm_sync(dapm);
200 201
201 return 0; 202 return 0;
202} 203}
@@ -204,16 +205,17 @@ static int smdk64xx_wm8580_init_paiftx(struct snd_soc_pcm_runtime *rtd)
204static int smdk64xx_wm8580_init_paifrx(struct snd_soc_pcm_runtime *rtd) 205static int smdk64xx_wm8580_init_paifrx(struct snd_soc_pcm_runtime *rtd)
205{ 206{
206 struct snd_soc_codec *codec = rtd->codec; 207 struct snd_soc_codec *codec = rtd->codec;
208 struct snd_soc_dapm_context *dapm = &codec->dapm;
207 209
208 /* Add smdk64xx specific Playback widgets */ 210 /* Add smdk64xx specific Playback widgets */
209 snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_pbk, 211 snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets_pbk,
210 ARRAY_SIZE(wm8580_dapm_widgets_pbk)); 212 ARRAY_SIZE(wm8580_dapm_widgets_pbk));
211 213
212 /* Set up PAIFRX audio path */ 214 /* Set up PAIFRX audio path */
213 snd_soc_dapm_add_routes(codec, audio_map_rx, ARRAY_SIZE(audio_map_rx)); 215 snd_soc_dapm_add_routes(dapm, audio_map_rx, ARRAY_SIZE(audio_map_rx));
214 216
215 /* signal a DAPM event */ 217 /* signal a DAPM event */
216 snd_soc_dapm_sync(codec); 218 snd_soc_dapm_sync(dapm);
217 219
218 return 0; 220 return 0;
219} 221}
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c
index 96c05e137538..db1803d9665a 100644
--- a/sound/soc/s6000/s6105-ipcam.c
+++ b/sound/soc/s6000/s6105-ipcam.c
@@ -107,6 +107,7 @@ static int output_type_put(struct snd_kcontrol *kcontrol,
107 struct snd_ctl_elem_value *ucontrol) 107 struct snd_ctl_elem_value *ucontrol)
108{ 108{
109 struct snd_soc_codec *codec = kcontrol->private_data; 109 struct snd_soc_codec *codec = kcontrol->private_data;
110 struct snd_soc_dapm_context *dapm = &codec->dapm;
110 unsigned int val = (ucontrol->value.enumerated.item[0] != 0); 111 unsigned int val = (ucontrol->value.enumerated.item[0] != 0);
111 char *differential = "Audio Out Differential"; 112 char *differential = "Audio Out Differential";
112 char *stereo = "Audio Out Stereo"; 113 char *stereo = "Audio Out Stereo";
@@ -114,10 +115,10 @@ static int output_type_put(struct snd_kcontrol *kcontrol,
114 if (kcontrol->private_value == val) 115 if (kcontrol->private_value == val)
115 return 0; 116 return 0;
116 kcontrol->private_value = val; 117 kcontrol->private_value = val;
117 snd_soc_dapm_disable_pin(codec, val ? differential : stereo); 118 snd_soc_dapm_disable_pin(dapm, val ? differential : stereo);
118 snd_soc_dapm_sync(codec); 119 snd_soc_dapm_sync(dapm);
119 snd_soc_dapm_enable_pin(codec, val ? stereo : differential); 120 snd_soc_dapm_enable_pin(dapm, val ? stereo : differential);
120 snd_soc_dapm_sync(codec); 121 snd_soc_dapm_sync(dapm);
121 122
122 return 1; 123 return 1;
123} 124}
@@ -137,35 +138,36 @@ static const struct snd_kcontrol_new audio_out_mux = {
137static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd) 138static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd)
138{ 139{
139 struct snd_soc_codec *codec = rtd->codec; 140 struct snd_soc_codec *codec = rtd->codec;
141 struct snd_soc_dapm_context *dapm = &codec->dapm;
140 142
141 /* Add s6105 specific widgets */ 143 /* Add s6105 specific widgets */
142 snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, 144 snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
143 ARRAY_SIZE(aic3x_dapm_widgets)); 145 ARRAY_SIZE(aic3x_dapm_widgets));
144 146
145 /* Set up s6105 specific audio path audio_map */ 147 /* Set up s6105 specific audio path audio_map */
146 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));
147 149
148 /* not present */ 150 /* not present */
149 snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); 151 snd_soc_dapm_nc_pin(dapm, "MONO_LOUT");
150 snd_soc_dapm_nc_pin(codec, "LINE2L"); 152 snd_soc_dapm_nc_pin(dapm, "LINE2L");
151 snd_soc_dapm_nc_pin(codec, "LINE2R"); 153 snd_soc_dapm_nc_pin(dapm, "LINE2R");
152 154
153 /* not connected */ 155 /* not connected */
154 snd_soc_dapm_nc_pin(codec, "MIC3L"); /* LINE2L on this chip */ 156 snd_soc_dapm_nc_pin(dapm, "MIC3L"); /* LINE2L on this chip */
155 snd_soc_dapm_nc_pin(codec, "MIC3R"); /* LINE2R on this chip */ 157 snd_soc_dapm_nc_pin(dapm, "MIC3R"); /* LINE2R on this chip */
156 snd_soc_dapm_nc_pin(codec, "LLOUT"); 158 snd_soc_dapm_nc_pin(dapm, "LLOUT");
157 snd_soc_dapm_nc_pin(codec, "RLOUT"); 159 snd_soc_dapm_nc_pin(dapm, "RLOUT");
158 snd_soc_dapm_nc_pin(codec, "HPRCOM"); 160 snd_soc_dapm_nc_pin(dapm, "HPRCOM");
159 161
160 /* always connected */ 162 /* always connected */
161 snd_soc_dapm_enable_pin(codec, "Audio In"); 163 snd_soc_dapm_enable_pin(dapm, "Audio In");
162 164
163 /* must correspond to audio_out_mux.private_value initializer */ 165 /* must correspond to audio_out_mux.private_value initializer */
164 snd_soc_dapm_disable_pin(codec, "Audio Out Differential"); 166 snd_soc_dapm_disable_pin(dapm, "Audio Out Differential");
165 snd_soc_dapm_sync(codec); 167 snd_soc_dapm_sync(dapm);
166 snd_soc_dapm_enable_pin(codec, "Audio Out Stereo"); 168 snd_soc_dapm_enable_pin(dapm, "Audio Out Stereo");
167 169
168 snd_soc_dapm_sync(codec); 170 snd_soc_dapm_sync(dapm);
169 171
170 snd_ctl_add(codec->snd_card, snd_ctl_new1(&audio_out_mux, codec)); 172 snd_ctl_add(codec->snd_card, snd_ctl_new1(&audio_out_mux, codec));
171 173
diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c
index ac6c49ce6fdf..c61fc188394d 100644
--- a/sound/soc/sh/migor.c
+++ b/sound/soc/sh/migor.c
@@ -140,11 +140,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
140static int migor_dai_init(struct snd_soc_pcm_runtime *rtd) 140static int migor_dai_init(struct snd_soc_pcm_runtime *rtd)
141{ 141{
142 struct snd_soc_codec *codec = rtd->codec; 142 struct snd_soc_codec *codec = rtd->codec;
143 struct snd_soc_dapm_context *dapm = &codec->dapm;
143 144
144 snd_soc_dapm_new_controls(codec, migor_dapm_widgets, 145 snd_soc_dapm_new_controls(dapm, migor_dapm_widgets,
145 ARRAY_SIZE(migor_dapm_widgets)); 146 ARRAY_SIZE(migor_dapm_widgets));
146 147
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 return 0; 150 return 0;
150} 151}
diff --git a/sound/soc/sh/sh7760-ac97.c b/sound/soc/sh/sh7760-ac97.c
index f8e0ab82ef59..105d4112e3ba 100644
--- a/sound/soc/sh/sh7760-ac97.c
+++ b/sound/soc/sh/sh7760-ac97.c
@@ -23,7 +23,7 @@ extern struct snd_soc_platform_driver sh7760_soc_platform;
23 23
24static int machine_init(struct snd_soc_pcm_runtime *rtd) 24static int machine_init(struct snd_soc_pcm_runtime *rtd)
25{ 25{
26 snd_soc_dapm_sync(rtd->codec); 26 snd_soc_dapm_sync(&rtd->codec->dapm);
27 return 0; 27 return 0;
28} 28}
29 29
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 2198936cfb68..3c7c884f212c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -255,18 +255,18 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
255 255
256 codec->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644, 256 codec->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644,
257 codec->debugfs_codec_root, 257 codec->debugfs_codec_root,
258 &codec->pop_time); 258 &codec->dapm.pop_time);
259 if (!codec->debugfs_pop_time) 259 if (!codec->debugfs_pop_time)
260 printk(KERN_WARNING 260 printk(KERN_WARNING
261 "Failed to create pop time debugfs file\n"); 261 "Failed to create pop time debugfs file\n");
262 262
263 codec->debugfs_dapm = debugfs_create_dir("dapm", 263 codec->dapm.debugfs_dapm = debugfs_create_dir("dapm",
264 codec->debugfs_codec_root); 264 codec->debugfs_codec_root);
265 if (!codec->debugfs_dapm) 265 if (!codec->dapm.debugfs_dapm)
266 printk(KERN_WARNING 266 printk(KERN_WARNING
267 "Failed to create DAPM debugfs directory\n"); 267 "Failed to create DAPM debugfs directory\n");
268 268
269 snd_soc_dapm_debugfs_init(codec); 269 snd_soc_dapm_debugfs_init(&codec->dapm);
270} 270}
271 271
272static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec) 272static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
@@ -1017,7 +1017,7 @@ static int soc_suspend(struct device *dev)
1017 /* close any waiting streams and save state */ 1017 /* close any waiting streams and save state */
1018 for (i = 0; i < card->num_rtd; i++) { 1018 for (i = 0; i < card->num_rtd; i++) {
1019 run_delayed_work(&card->rtd[i].delayed_work); 1019 run_delayed_work(&card->rtd[i].delayed_work);
1020 card->rtd[i].codec->suspend_bias_level = card->rtd[i].codec->bias_level; 1020 card->rtd[i].codec->dapm.suspend_bias_level = card->rtd[i].codec->dapm.bias_level;
1021 } 1021 }
1022 1022
1023 for (i = 0; i < card->num_rtd; i++) { 1023 for (i = 0; i < card->num_rtd; i++) {
@@ -1041,7 +1041,7 @@ static int soc_suspend(struct device *dev)
1041 /* If there are paths active then the CODEC will be held with 1041 /* If there are paths active then the CODEC will be held with
1042 * bias _ON and should not be suspended. */ 1042 * bias _ON and should not be suspended. */
1043 if (!codec->suspended && codec->driver->suspend) { 1043 if (!codec->suspended && codec->driver->suspend) {
1044 switch (codec->bias_level) { 1044 switch (codec->dapm.bias_level) {
1045 case SND_SOC_BIAS_STANDBY: 1045 case SND_SOC_BIAS_STANDBY:
1046 case SND_SOC_BIAS_OFF: 1046 case SND_SOC_BIAS_OFF:
1047 codec->driver->suspend(codec, PMSG_SUSPEND); 1047 codec->driver->suspend(codec, PMSG_SUSPEND);
@@ -1110,7 +1110,7 @@ static void soc_resume_deferred(struct work_struct *work)
1110 * resume. Otherwise the suspend was suppressed. 1110 * resume. Otherwise the suspend was suppressed.
1111 */ 1111 */
1112 if (codec->driver->resume && codec->suspended) { 1112 if (codec->driver->resume && codec->suspended) {
1113 switch (codec->bias_level) { 1113 switch (codec->dapm.bias_level) {
1114 case SND_SOC_BIAS_STANDBY: 1114 case SND_SOC_BIAS_STANDBY:
1115 case SND_SOC_BIAS_OFF: 1115 case SND_SOC_BIAS_OFF:
1116 codec->driver->resume(codec); 1116 codec->driver->resume(codec);
@@ -1346,7 +1346,7 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num)
1346 } 1346 }
1347 1347
1348 /* Make sure all DAPM widgets are freed */ 1348 /* Make sure all DAPM widgets are freed */
1349 snd_soc_dapm_free(codec); 1349 snd_soc_dapm_free(&codec->dapm);
1350 1350
1351 soc_cleanup_codec_debugfs(codec); 1351 soc_cleanup_codec_debugfs(codec);
1352 device_remove_file(&rtd->dev, &dev_attr_codec_reg); 1352 device_remove_file(&rtd->dev, &dev_attr_codec_reg);
@@ -1470,8 +1470,8 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num)
1470 } 1470 }
1471 1471
1472 /* Make sure all DAPM widgets are instantiated */ 1472 /* Make sure all DAPM widgets are instantiated */
1473 snd_soc_dapm_new_widgets(codec); 1473 snd_soc_dapm_new_widgets(&codec->dapm);
1474 snd_soc_dapm_sync(codec); 1474 snd_soc_dapm_sync(&codec->dapm);
1475 1475
1476 /* register the rtd device */ 1476 /* register the rtd device */
1477 rtd->dev.release = rtd_release; 1477 rtd->dev.release = rtd_release;
@@ -3238,6 +3238,12 @@ int snd_soc_register_codec(struct device *dev,
3238 return -ENOMEM; 3238 return -ENOMEM;
3239 } 3239 }
3240 3240
3241 INIT_LIST_HEAD(&codec->dapm.widgets);
3242 INIT_LIST_HEAD(&codec->dapm.paths);
3243 codec->dapm.bias_level = SND_SOC_BIAS_OFF;
3244 codec->dapm.dev = dev;
3245 codec->dapm.codec = codec;
3246
3241 /* allocate CODEC register cache */ 3247 /* allocate CODEC register cache */
3242 if (codec_drv->reg_cache_size && codec_drv->reg_word_size) { 3248 if (codec_drv->reg_cache_size && codec_drv->reg_word_size) {
3243 3249
@@ -3257,11 +3263,8 @@ int snd_soc_register_codec(struct device *dev,
3257 3263
3258 codec->dev = dev; 3264 codec->dev = dev;
3259 codec->driver = codec_drv; 3265 codec->driver = codec_drv;
3260 codec->bias_level = SND_SOC_BIAS_OFF;
3261 codec->num_dai = num_dai; 3266 codec->num_dai = num_dai;
3262 mutex_init(&codec->mutex); 3267 mutex_init(&codec->mutex);
3263 INIT_LIST_HEAD(&codec->dapm_widgets);
3264 INIT_LIST_HEAD(&codec->dapm_paths);
3265 3268
3266 for (i = 0; i < num_dai; i++) { 3269 for (i = 0; i < num_dai; i++) {
3267 fixup_codec_formats(&dai_drv[i].playback); 3270 fixup_codec_formats(&dai_drv[i].playback);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7d85c6496afa..b8f653eaffaa 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -42,6 +42,7 @@
42#include <sound/core.h> 42#include <sound/core.h>
43#include <sound/pcm.h> 43#include <sound/pcm.h>
44#include <sound/pcm_params.h> 44#include <sound/pcm_params.h>
45#include <sound/soc.h>
45#include <sound/soc-dapm.h> 46#include <sound/soc-dapm.h>
46#include <sound/initval.h> 47#include <sound/initval.h>
47 48
@@ -120,35 +121,36 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(
120 * Returns 0 for success else error. 121 * Returns 0 for success else error.
121 */ 122 */
122static int snd_soc_dapm_set_bias_level(struct snd_soc_card *card, 123static int snd_soc_dapm_set_bias_level(struct snd_soc_card *card,
123 struct snd_soc_codec *codec, enum snd_soc_bias_level level) 124 struct snd_soc_dapm_context *dapm,
125 enum snd_soc_bias_level level)
124{ 126{
125 int ret = 0; 127 int ret = 0;
126 128
127 switch (level) { 129 switch (level) {
128 case SND_SOC_BIAS_ON: 130 case SND_SOC_BIAS_ON:
129 dev_dbg(codec->dev, "Setting full bias\n"); 131 dev_dbg(dapm->dev, "Setting full bias\n");
130 break; 132 break;
131 case SND_SOC_BIAS_PREPARE: 133 case SND_SOC_BIAS_PREPARE:
132 dev_dbg(codec->dev, "Setting bias prepare\n"); 134 dev_dbg(dapm->dev, "Setting bias prepare\n");
133 break; 135 break;
134 case SND_SOC_BIAS_STANDBY: 136 case SND_SOC_BIAS_STANDBY:
135 dev_dbg(codec->dev, "Setting standby bias\n"); 137 dev_dbg(dapm->dev, "Setting standby bias\n");
136 break; 138 break;
137 case SND_SOC_BIAS_OFF: 139 case SND_SOC_BIAS_OFF:
138 dev_dbg(codec->dev, "Setting bias off\n"); 140 dev_dbg(dapm->dev, "Setting bias off\n");
139 break; 141 break;
140 default: 142 default:
141 dev_err(codec->dev, "Setting invalid bias %d\n", level); 143 dev_err(dapm->dev, "Setting invalid bias %d\n", level);
142 return -EINVAL; 144 return -EINVAL;
143 } 145 }
144 146
145 if (card && card->set_bias_level) 147 if (card && card->set_bias_level)
146 ret = card->set_bias_level(card, level); 148 ret = card->set_bias_level(card, level);
147 if (ret == 0) { 149 if (ret == 0) {
148 if (codec->driver->set_bias_level) 150 if (dapm->codec && dapm->codec->driver->set_bias_level)
149 ret = codec->driver->set_bias_level(codec, level); 151 ret = dapm->codec->driver->set_bias_level(dapm->codec, level);
150 else 152 else
151 codec->bias_level = level; 153 dapm->bias_level = level;
152 } 154 }
153 155
154 return ret; 156 return ret;
@@ -241,7 +243,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
241} 243}
242 244
243/* connect mux widget to its interconnecting audio paths */ 245/* connect mux widget to its interconnecting audio paths */
244static int dapm_connect_mux(struct snd_soc_codec *codec, 246static int dapm_connect_mux(struct snd_soc_dapm_context *dapm,
245 struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest, 247 struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest,
246 struct snd_soc_dapm_path *path, const char *control_name, 248 struct snd_soc_dapm_path *path, const char *control_name,
247 const struct snd_kcontrol_new *kcontrol) 249 const struct snd_kcontrol_new *kcontrol)
@@ -251,7 +253,7 @@ static int dapm_connect_mux(struct snd_soc_codec *codec,
251 253
252 for (i = 0; i < e->max; i++) { 254 for (i = 0; i < e->max; i++) {
253 if (!(strcmp(control_name, e->texts[i]))) { 255 if (!(strcmp(control_name, e->texts[i]))) {
254 list_add(&path->list, &codec->dapm_paths); 256 list_add(&path->list, &dapm->paths);
255 list_add(&path->list_sink, &dest->sources); 257 list_add(&path->list_sink, &dest->sources);
256 list_add(&path->list_source, &src->sinks); 258 list_add(&path->list_source, &src->sinks);
257 path->name = (char*)e->texts[i]; 259 path->name = (char*)e->texts[i];
@@ -264,7 +266,7 @@ static int dapm_connect_mux(struct snd_soc_codec *codec,
264} 266}
265 267
266/* connect mixer widget to its interconnecting audio paths */ 268/* connect mixer widget to its interconnecting audio paths */
267static int dapm_connect_mixer(struct snd_soc_codec *codec, 269static int dapm_connect_mixer(struct snd_soc_dapm_context *dapm,
268 struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest, 270 struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest,
269 struct snd_soc_dapm_path *path, const char *control_name) 271 struct snd_soc_dapm_path *path, const char *control_name)
270{ 272{
@@ -273,7 +275,7 @@ static int dapm_connect_mixer(struct snd_soc_codec *codec,
273 /* search for mixer kcontrol */ 275 /* search for mixer kcontrol */
274 for (i = 0; i < dest->num_kcontrols; i++) { 276 for (i = 0; i < dest->num_kcontrols; i++) {
275 if (!strcmp(control_name, dest->kcontrols[i].name)) { 277 if (!strcmp(control_name, dest->kcontrols[i].name)) {
276 list_add(&path->list, &codec->dapm_paths); 278 list_add(&path->list, &dapm->paths);
277 list_add(&path->list_sink, &dest->sources); 279 list_add(&path->list_sink, &dest->sources);
278 list_add(&path->list_source, &src->sinks); 280 list_add(&path->list_source, &src->sinks);
279 path->name = dest->kcontrols[i].name; 281 path->name = dest->kcontrols[i].name;
@@ -290,6 +292,7 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
290 int change, power; 292 int change, power;
291 unsigned int old, new; 293 unsigned int old, new;
292 struct snd_soc_codec *codec = widget->codec; 294 struct snd_soc_codec *codec = widget->codec;
295 struct snd_soc_dapm_context *dapm = widget->dapm;
293 296
294 /* check for valid widgets */ 297 /* check for valid widgets */
295 if (widget->reg < 0 || widget->id == snd_soc_dapm_input || 298 if (widget->reg < 0 || widget->id == snd_soc_dapm_input ||
@@ -309,10 +312,10 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
309 312
310 change = old != new; 313 change = old != new;
311 if (change) { 314 if (change) {
312 pop_dbg(codec->pop_time, "pop test %s : %s in %d ms\n", 315 pop_dbg(dapm->pop_time, "pop test %s : %s in %d ms\n",
313 widget->name, widget->power ? "on" : "off", 316 widget->name, widget->power ? "on" : "off",
314 codec->pop_time); 317 dapm->pop_time);
315 pop_wait(codec->pop_time); 318 pop_wait(dapm->pop_time);
316 snd_soc_write(codec, widget->reg, new); 319 snd_soc_write(codec, widget->reg, new);
317 } 320 }
318 pr_debug("reg %x old %x new %x change %d\n", widget->reg, 321 pr_debug("reg %x old %x new %x change %d\n", widget->reg,
@@ -321,12 +324,13 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
321} 324}
322 325
323/* create new dapm mixer control */ 326/* create new dapm mixer control */
324static int dapm_new_mixer(struct snd_soc_codec *codec, 327static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
325 struct snd_soc_dapm_widget *w) 328 struct snd_soc_dapm_widget *w)
326{ 329{
327 int i, ret = 0; 330 int i, ret = 0;
328 size_t name_len; 331 size_t name_len;
329 struct snd_soc_dapm_path *path; 332 struct snd_soc_dapm_path *path;
333 struct snd_card *card = dapm->codec->card->snd_card;
330 334
331 /* add kcontrol */ 335 /* add kcontrol */
332 for (i = 0; i < w->num_kcontrols; i++) { 336 for (i = 0; i < w->num_kcontrols; i++) {
@@ -368,7 +372,7 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
368 372
369 path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, 373 path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w,
370 path->long_name); 374 path->long_name);
371 ret = snd_ctl_add(codec->card->snd_card, path->kcontrol); 375 ret = snd_ctl_add(card, path->kcontrol);
372 if (ret < 0) { 376 if (ret < 0) {
373 printk(KERN_ERR "asoc: failed to add dapm kcontrol %s: %d\n", 377 printk(KERN_ERR "asoc: failed to add dapm kcontrol %s: %d\n",
374 path->long_name, 378 path->long_name,
@@ -383,11 +387,12 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
383} 387}
384 388
385/* create new dapm mux control */ 389/* create new dapm mux control */
386static int dapm_new_mux(struct snd_soc_codec *codec, 390static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
387 struct snd_soc_dapm_widget *w) 391 struct snd_soc_dapm_widget *w)
388{ 392{
389 struct snd_soc_dapm_path *path = NULL; 393 struct snd_soc_dapm_path *path = NULL;
390 struct snd_kcontrol *kcontrol; 394 struct snd_kcontrol *kcontrol;
395 struct snd_card *card = dapm->codec->card->snd_card;
391 int ret = 0; 396 int ret = 0;
392 397
393 if (!w->num_kcontrols) { 398 if (!w->num_kcontrols) {
@@ -396,7 +401,8 @@ static int dapm_new_mux(struct snd_soc_codec *codec,
396 } 401 }
397 402
398 kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name); 403 kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name);
399 ret = snd_ctl_add(codec->card->snd_card, kcontrol); 404 ret = snd_ctl_add(card, kcontrol);
405
400 if (ret < 0) 406 if (ret < 0)
401 goto err; 407 goto err;
402 408
@@ -411,7 +417,7 @@ err:
411} 417}
412 418
413/* create new dapm volume control */ 419/* create new dapm volume control */
414static int dapm_new_pga(struct snd_soc_codec *codec, 420static int dapm_new_pga(struct snd_soc_dapm_context *dapm,
415 struct snd_soc_dapm_widget *w) 421 struct snd_soc_dapm_widget *w)
416{ 422{
417 if (w->num_kcontrols) 423 if (w->num_kcontrols)
@@ -421,11 +427,11 @@ static int dapm_new_pga(struct snd_soc_codec *codec,
421} 427}
422 428
423/* reset 'walked' bit for each dapm path */ 429/* reset 'walked' bit for each dapm path */
424static inline void dapm_clear_walk(struct snd_soc_codec *codec) 430static inline void dapm_clear_walk(struct snd_soc_dapm_context *dapm)
425{ 431{
426 struct snd_soc_dapm_path *p; 432 struct snd_soc_dapm_path *p;
427 433
428 list_for_each_entry(p, &codec->dapm_paths, list) 434 list_for_each_entry(p, &dapm->paths, list)
429 p->walked = 0; 435 p->walked = 0;
430} 436}
431 437
@@ -435,7 +441,7 @@ static inline void dapm_clear_walk(struct snd_soc_codec *codec)
435 */ 441 */
436static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget) 442static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget)
437{ 443{
438 int level = snd_power_get_state(widget->codec->card->snd_card); 444 int level = snd_power_get_state(widget->dapm->codec->card->snd_card);
439 445
440 switch (level) { 446 switch (level) {
441 case SNDRV_CTL_POWER_D3hot: 447 case SNDRV_CTL_POWER_D3hot:
@@ -621,9 +627,9 @@ static int dapm_generic_check_power(struct snd_soc_dapm_widget *w)
621 int in, out; 627 int in, out;
622 628
623 in = is_connected_input_ep(w); 629 in = is_connected_input_ep(w);
624 dapm_clear_walk(w->codec); 630 dapm_clear_walk(w->dapm);
625 out = is_connected_output_ep(w); 631 out = is_connected_output_ep(w);
626 dapm_clear_walk(w->codec); 632 dapm_clear_walk(w->dapm);
627 return out != 0 && in != 0; 633 return out != 0 && in != 0;
628} 634}
629 635
@@ -634,7 +640,7 @@ static int dapm_adc_check_power(struct snd_soc_dapm_widget *w)
634 640
635 if (w->active) { 641 if (w->active) {
636 in = is_connected_input_ep(w); 642 in = is_connected_input_ep(w);
637 dapm_clear_walk(w->codec); 643 dapm_clear_walk(w->dapm);
638 return in != 0; 644 return in != 0;
639 } else { 645 } else {
640 return dapm_generic_check_power(w); 646 return dapm_generic_check_power(w);
@@ -648,7 +654,7 @@ static int dapm_dac_check_power(struct snd_soc_dapm_widget *w)
648 654
649 if (w->active) { 655 if (w->active) {
650 out = is_connected_output_ep(w); 656 out = is_connected_output_ep(w);
651 dapm_clear_walk(w->codec); 657 dapm_clear_walk(w->dapm);
652 return out != 0; 658 return out != 0;
653 } else { 659 } else {
654 return dapm_generic_check_power(w); 660 return dapm_generic_check_power(w);
@@ -674,7 +680,7 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
674 } 680 }
675 } 681 }
676 682
677 dapm_clear_walk(w->codec); 683 dapm_clear_walk(w->dapm);
678 684
679 return power; 685 return power;
680} 686}
@@ -710,7 +716,7 @@ static void dapm_seq_insert(struct snd_soc_dapm_widget *new_widget,
710} 716}
711 717
712/* Apply the coalesced changes from a DAPM sequence */ 718/* Apply the coalesced changes from a DAPM sequence */
713static void dapm_seq_run_coalesced(struct snd_soc_codec *codec, 719static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
714 struct list_head *pending) 720 struct list_head *pending)
715{ 721{
716 struct snd_soc_dapm_widget *w; 722 struct snd_soc_dapm_widget *w;
@@ -735,14 +741,14 @@ static void dapm_seq_run_coalesced(struct snd_soc_codec *codec,
735 if (power) 741 if (power)
736 value |= cur_mask; 742 value |= cur_mask;
737 743
738 pop_dbg(codec->pop_time, 744 pop_dbg(dapm->pop_time,
739 "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", 745 "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n",
740 w->name, reg, value, mask); 746 w->name, reg, value, mask);
741 747
742 /* power up pre event */ 748 /* power up pre event */
743 if (w->power && w->event && 749 if (w->power && w->event &&
744 (w->event_flags & SND_SOC_DAPM_PRE_PMU)) { 750 (w->event_flags & SND_SOC_DAPM_PRE_PMU)) {
745 pop_dbg(codec->pop_time, "pop test : %s PRE_PMU\n", 751 pop_dbg(dapm->pop_time, "pop test : %s PRE_PMU\n",
746 w->name); 752 w->name);
747 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU); 753 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU);
748 if (ret < 0) 754 if (ret < 0)
@@ -753,7 +759,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_codec *codec,
753 /* power down pre event */ 759 /* power down pre event */
754 if (!w->power && w->event && 760 if (!w->power && w->event &&
755 (w->event_flags & SND_SOC_DAPM_PRE_PMD)) { 761 (w->event_flags & SND_SOC_DAPM_PRE_PMD)) {
756 pop_dbg(codec->pop_time, "pop test : %s PRE_PMD\n", 762 pop_dbg(dapm->pop_time, "pop test : %s PRE_PMD\n",
757 w->name); 763 w->name);
758 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD); 764 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD);
759 if (ret < 0) 765 if (ret < 0)
@@ -763,18 +769,18 @@ static void dapm_seq_run_coalesced(struct snd_soc_codec *codec,
763 } 769 }
764 770
765 if (reg >= 0) { 771 if (reg >= 0) {
766 pop_dbg(codec->pop_time, 772 pop_dbg(dapm->pop_time,
767 "pop test : Applying 0x%x/0x%x to %x in %dms\n", 773 "pop test : Applying 0x%x/0x%x to %x in %dms\n",
768 value, mask, reg, codec->pop_time); 774 value, mask, reg, dapm->pop_time);
769 pop_wait(codec->pop_time); 775 pop_wait(dapm->pop_time);
770 snd_soc_update_bits(codec, reg, mask, value); 776 snd_soc_update_bits(dapm->codec, reg, mask, value);
771 } 777 }
772 778
773 list_for_each_entry(w, pending, power_list) { 779 list_for_each_entry(w, pending, power_list) {
774 /* power up post event */ 780 /* power up post event */
775 if (w->power && w->event && 781 if (w->power && w->event &&
776 (w->event_flags & SND_SOC_DAPM_POST_PMU)) { 782 (w->event_flags & SND_SOC_DAPM_POST_PMU)) {
777 pop_dbg(codec->pop_time, "pop test : %s POST_PMU\n", 783 pop_dbg(dapm->pop_time, "pop test : %s POST_PMU\n",
778 w->name); 784 w->name);
779 ret = w->event(w, 785 ret = w->event(w,
780 NULL, SND_SOC_DAPM_POST_PMU); 786 NULL, SND_SOC_DAPM_POST_PMU);
@@ -786,7 +792,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_codec *codec,
786 /* power down post event */ 792 /* power down post event */
787 if (!w->power && w->event && 793 if (!w->power && w->event &&
788 (w->event_flags & SND_SOC_DAPM_POST_PMD)) { 794 (w->event_flags & SND_SOC_DAPM_POST_PMD)) {
789 pop_dbg(codec->pop_time, "pop test : %s POST_PMD\n", 795 pop_dbg(dapm->pop_time, "pop test : %s POST_PMD\n",
790 w->name); 796 w->name);
791 ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD); 797 ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD);
792 if (ret < 0) 798 if (ret < 0)
@@ -804,8 +810,8 @@ static void dapm_seq_run_coalesced(struct snd_soc_codec *codec,
804 * Currently anything that requires more than a single write is not 810 * Currently anything that requires more than a single write is not
805 * handled. 811 * handled.
806 */ 812 */
807static void dapm_seq_run(struct snd_soc_codec *codec, struct list_head *list, 813static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
808 int event, int sort[]) 814 struct list_head *list, int event, int sort[])
809{ 815{
810 struct snd_soc_dapm_widget *w, *n; 816 struct snd_soc_dapm_widget *w, *n;
811 LIST_HEAD(pending); 817 LIST_HEAD(pending);
@@ -819,7 +825,7 @@ static void dapm_seq_run(struct snd_soc_codec *codec, struct list_head *list,
819 /* Do we need to apply any queued changes? */ 825 /* Do we need to apply any queued changes? */
820 if (sort[w->id] != cur_sort || w->reg != cur_reg) { 826 if (sort[w->id] != cur_sort || w->reg != cur_reg) {
821 if (!list_empty(&pending)) 827 if (!list_empty(&pending))
822 dapm_seq_run_coalesced(codec, &pending); 828 dapm_seq_run_coalesced(dapm, &pending);
823 829
824 INIT_LIST_HEAD(&pending); 830 INIT_LIST_HEAD(&pending);
825 cur_sort = -1; 831 cur_sort = -1;
@@ -877,7 +883,7 @@ static void dapm_seq_run(struct snd_soc_codec *codec, struct list_head *list,
877 } 883 }
878 884
879 if (!list_empty(&pending)) 885 if (!list_empty(&pending))
880 dapm_seq_run_coalesced(codec, &pending); 886 dapm_seq_run_coalesced(dapm, &pending);
881} 887}
882 888
883/* 889/*
@@ -889,9 +895,9 @@ static void dapm_seq_run(struct snd_soc_codec *codec, struct list_head *list,
889 * o Input pin to Output pin (bypass, sidetone) 895 * o Input pin to Output pin (bypass, sidetone)
890 * o DAC to ADC (loopback). 896 * o DAC to ADC (loopback).
891 */ 897 */
892static int dapm_power_widgets(struct snd_soc_codec *codec, int event) 898static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
893{ 899{
894 struct snd_soc_card *card = codec->card; 900 struct snd_soc_card *card = dapm->codec->card;
895 struct snd_soc_dapm_widget *w; 901 struct snd_soc_dapm_widget *w;
896 LIST_HEAD(up_list); 902 LIST_HEAD(up_list);
897 LIST_HEAD(down_list); 903 LIST_HEAD(down_list);
@@ -902,7 +908,7 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
902 /* Check which widgets we need to power and store them in 908 /* Check which widgets we need to power and store them in
903 * lists indicating if they should be powered up or down. 909 * lists indicating if they should be powered up or down.
904 */ 910 */
905 list_for_each_entry(w, &codec->dapm_widgets, list) { 911 list_for_each_entry(w, &dapm->widgets, list) {
906 switch (w->id) { 912 switch (w->id) {
907 case snd_soc_dapm_pre: 913 case snd_soc_dapm_pre:
908 dapm_seq_insert(w, &down_list, dapm_down_seq); 914 dapm_seq_insert(w, &down_list, dapm_down_seq);
@@ -938,7 +944,7 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
938 /* If there are no DAPM widgets then try to figure out power from the 944 /* If there are no DAPM widgets then try to figure out power from the
939 * event type. 945 * event type.
940 */ 946 */
941 if (list_empty(&codec->dapm_widgets)) { 947 if (list_empty(&dapm->widgets)) {
942 switch (event) { 948 switch (event) {
943 case SND_SOC_DAPM_STREAM_START: 949 case SND_SOC_DAPM_STREAM_START:
944 case SND_SOC_DAPM_STREAM_RESUME: 950 case SND_SOC_DAPM_STREAM_RESUME:
@@ -948,7 +954,7 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
948 sys_power = 0; 954 sys_power = 0;
949 break; 955 break;
950 case SND_SOC_DAPM_STREAM_NOP: 956 case SND_SOC_DAPM_STREAM_NOP:
951 switch (codec->bias_level) { 957 switch (dapm->bias_level) {
952 case SND_SOC_BIAS_STANDBY: 958 case SND_SOC_BIAS_STANDBY:
953 case SND_SOC_BIAS_OFF: 959 case SND_SOC_BIAS_OFF:
954 sys_power = 0; 960 sys_power = 0;
@@ -963,52 +969,52 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
963 } 969 }
964 } 970 }
965 971
966 if (sys_power && codec->bias_level == SND_SOC_BIAS_OFF) { 972 if (sys_power && dapm->bias_level == SND_SOC_BIAS_OFF) {
967 ret = snd_soc_dapm_set_bias_level(card, codec, 973 ret = snd_soc_dapm_set_bias_level(card, dapm,
968 SND_SOC_BIAS_STANDBY); 974 SND_SOC_BIAS_STANDBY);
969 if (ret != 0) 975 if (ret != 0)
970 pr_err("Failed to turn on bias: %d\n", ret); 976 pr_err("Failed to turn on bias: %d\n", ret);
971 } 977 }
972 978
973 /* If we're changing to all on or all off then prepare */ 979 /* If we're changing to all on or all off then prepare */
974 if ((sys_power && codec->bias_level == SND_SOC_BIAS_STANDBY) || 980 if ((sys_power && dapm->bias_level == SND_SOC_BIAS_STANDBY) ||
975 (!sys_power && codec->bias_level == SND_SOC_BIAS_ON)) { 981 (!sys_power && dapm->bias_level == SND_SOC_BIAS_ON)) {
976 ret = snd_soc_dapm_set_bias_level(card, codec, SND_SOC_BIAS_PREPARE); 982 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_PREPARE);
977 if (ret != 0) 983 if (ret != 0)
978 pr_err("Failed to prepare bias: %d\n", ret); 984 pr_err("Failed to prepare bias: %d\n", ret);
979 } 985 }
980 986
981 /* Power down widgets first; try to avoid amplifying pops. */ 987 /* Power down widgets first; try to avoid amplifying pops. */
982 dapm_seq_run(codec, &down_list, event, dapm_down_seq); 988 dapm_seq_run(dapm, &down_list, event, dapm_down_seq);
983 989
984 /* Now power up. */ 990 /* Now power up. */
985 dapm_seq_run(codec, &up_list, event, dapm_up_seq); 991 dapm_seq_run(dapm, &up_list, event, dapm_up_seq);
986 992
987 /* If we just powered the last thing off drop to standby bias */ 993 /* If we just powered the last thing off drop to standby bias */
988 if (codec->bias_level == SND_SOC_BIAS_PREPARE && !sys_power) { 994 if (dapm->bias_level == SND_SOC_BIAS_PREPARE && !sys_power) {
989 ret = snd_soc_dapm_set_bias_level(card, codec, SND_SOC_BIAS_STANDBY); 995 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_STANDBY);
990 if (ret != 0) 996 if (ret != 0)
991 pr_err("Failed to apply standby bias: %d\n", ret); 997 pr_err("Failed to apply standby bias: %d\n", ret);
992 } 998 }
993 999
994 /* If we're in standby and can support bias off then do that */ 1000 /* If we're in standby and can support bias off then do that */
995 if (codec->bias_level == SND_SOC_BIAS_STANDBY && 1001 if (dapm->bias_level == SND_SOC_BIAS_STANDBY &&
996 codec->idle_bias_off) { 1002 dapm->idle_bias_off) {
997 ret = snd_soc_dapm_set_bias_level(card, codec, SND_SOC_BIAS_OFF); 1003 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_OFF);
998 if (ret != 0) 1004 if (ret != 0)
999 pr_err("Failed to turn off bias: %d\n", ret); 1005 pr_err("Failed to turn off bias: %d\n", ret);
1000 } 1006 }
1001 1007
1002 /* If we just powered up then move to active bias */ 1008 /* If we just powered up then move to active bias */
1003 if (codec->bias_level == SND_SOC_BIAS_PREPARE && sys_power) { 1009 if (dapm->bias_level == SND_SOC_BIAS_PREPARE && sys_power) {
1004 ret = snd_soc_dapm_set_bias_level(card, codec, SND_SOC_BIAS_ON); 1010 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_ON);
1005 if (ret != 0) 1011 if (ret != 0)
1006 pr_err("Failed to apply active bias: %d\n", ret); 1012 pr_err("Failed to apply active bias: %d\n", ret);
1007 } 1013 }
1008 1014
1009 pop_dbg(codec->pop_time, "DAPM sequencing finished, waiting %dms\n", 1015 pop_dbg(dapm->pop_time, "DAPM sequencing finished, waiting %dms\n",
1010 codec->pop_time); 1016 dapm->pop_time);
1011 pop_wait(codec->pop_time); 1017 pop_wait(dapm->pop_time);
1012 1018
1013 return 0; 1019 return 0;
1014} 1020}
@@ -1035,9 +1041,9 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1035 return -ENOMEM; 1041 return -ENOMEM;
1036 1042
1037 in = is_connected_input_ep(w); 1043 in = is_connected_input_ep(w);
1038 dapm_clear_walk(w->codec); 1044 dapm_clear_walk(w->dapm);
1039 out = is_connected_output_ep(w); 1045 out = is_connected_output_ep(w);
1040 dapm_clear_walk(w->codec); 1046 dapm_clear_walk(w->dapm);
1041 1047
1042 ret = snprintf(buf, PAGE_SIZE, "%s: %s in %d out %d", 1048 ret = snprintf(buf, PAGE_SIZE, "%s: %s in %d out %d",
1043 w->name, w->power ? "On" : "Off", in, out); 1049 w->name, w->power ? "On" : "Off", in, out);
@@ -1087,20 +1093,20 @@ static const struct file_operations dapm_widget_power_fops = {
1087 .llseek = default_llseek, 1093 .llseek = default_llseek,
1088}; 1094};
1089 1095
1090void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec) 1096void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm)
1091{ 1097{
1092 struct snd_soc_dapm_widget *w; 1098 struct snd_soc_dapm_widget *w;
1093 struct dentry *d; 1099 struct dentry *d;
1094 1100
1095 if (!codec->debugfs_dapm) 1101 if (!dapm->debugfs_dapm)
1096 return; 1102 return;
1097 1103
1098 list_for_each_entry(w, &codec->dapm_widgets, list) { 1104 list_for_each_entry(w, &dapm->widgets, list) {
1099 if (!w->name) 1105 if (!w->name)
1100 continue; 1106 continue;
1101 1107
1102 d = debugfs_create_file(w->name, 0444, 1108 d = debugfs_create_file(w->name, 0444,
1103 codec->debugfs_dapm, w, 1109 dapm->debugfs_dapm, w,
1104 &dapm_widget_power_fops); 1110 &dapm_widget_power_fops);
1105 if (!d) 1111 if (!d)
1106 printk(KERN_WARNING 1112 printk(KERN_WARNING
@@ -1109,7 +1115,7 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec)
1109 } 1115 }
1110} 1116}
1111#else 1117#else
1112void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec) 1118void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm)
1113{ 1119{
1114} 1120}
1115#endif 1121#endif
@@ -1130,7 +1136,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1130 return 0; 1136 return 0;
1131 1137
1132 /* find dapm widget path assoc with kcontrol */ 1138 /* find dapm widget path assoc with kcontrol */
1133 list_for_each_entry(path, &widget->codec->dapm_paths, list) { 1139 list_for_each_entry(path, &widget->dapm->paths, list) {
1134 if (path->kcontrol != kcontrol) 1140 if (path->kcontrol != kcontrol)
1135 continue; 1141 continue;
1136 1142
@@ -1146,7 +1152,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1146 } 1152 }
1147 1153
1148 if (found) 1154 if (found)
1149 dapm_power_widgets(widget->codec, SND_SOC_DAPM_STREAM_NOP); 1155 dapm_power_widgets(widget->dapm, SND_SOC_DAPM_STREAM_NOP);
1150 1156
1151 return 0; 1157 return 0;
1152} 1158}
@@ -1164,7 +1170,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
1164 return -ENODEV; 1170 return -ENODEV;
1165 1171
1166 /* find dapm widget path assoc with kcontrol */ 1172 /* find dapm widget path assoc with kcontrol */
1167 list_for_each_entry(path, &widget->codec->dapm_paths, list) { 1173 list_for_each_entry(path, &widget->dapm->paths, list) {
1168 if (path->kcontrol != kcontrol) 1174 if (path->kcontrol != kcontrol)
1169 continue; 1175 continue;
1170 1176
@@ -1175,7 +1181,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
1175 } 1181 }
1176 1182
1177 if (found) 1183 if (found)
1178 dapm_power_widgets(widget->codec, SND_SOC_DAPM_STREAM_NOP); 1184 dapm_power_widgets(widget->dapm, SND_SOC_DAPM_STREAM_NOP);
1179 1185
1180 return 0; 1186 return 0;
1181} 1187}
@@ -1191,7 +1197,7 @@ static ssize_t dapm_widget_show(struct device *dev,
1191 int count = 0; 1197 int count = 0;
1192 char *state = "not set"; 1198 char *state = "not set";
1193 1199
1194 list_for_each_entry(w, &codec->dapm_widgets, list) { 1200 list_for_each_entry(w, &codec->dapm.widgets, list) {
1195 1201
1196 /* only display widgets that burnm power */ 1202 /* only display widgets that burnm power */
1197 switch (w->id) { 1203 switch (w->id) {
@@ -1215,7 +1221,7 @@ static ssize_t dapm_widget_show(struct device *dev,
1215 } 1221 }
1216 } 1222 }
1217 1223
1218 switch (codec->bias_level) { 1224 switch (codec->dapm.bias_level) {
1219 case SND_SOC_BIAS_ON: 1225 case SND_SOC_BIAS_ON:
1220 state = "On"; 1226 state = "On";
1221 break; 1227 break;
@@ -1247,31 +1253,31 @@ static void snd_soc_dapm_sys_remove(struct device *dev)
1247} 1253}
1248 1254
1249/* free all dapm widgets and resources */ 1255/* free all dapm widgets and resources */
1250static void dapm_free_widgets(struct snd_soc_codec *codec) 1256static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
1251{ 1257{
1252 struct snd_soc_dapm_widget *w, *next_w; 1258 struct snd_soc_dapm_widget *w, *next_w;
1253 struct snd_soc_dapm_path *p, *next_p; 1259 struct snd_soc_dapm_path *p, *next_p;
1254 1260
1255 list_for_each_entry_safe(w, next_w, &codec->dapm_widgets, list) { 1261 list_for_each_entry_safe(w, next_w, &dapm->widgets, list) {
1256 list_del(&w->list); 1262 list_del(&w->list);
1257 kfree(w); 1263 kfree(w);
1258 } 1264 }
1259 1265
1260 list_for_each_entry_safe(p, next_p, &codec->dapm_paths, list) { 1266 list_for_each_entry_safe(p, next_p, &dapm->paths, list) {
1261 list_del(&p->list); 1267 list_del(&p->list);
1262 kfree(p->long_name); 1268 kfree(p->long_name);
1263 kfree(p); 1269 kfree(p);
1264 } 1270 }
1265} 1271}
1266 1272
1267static int snd_soc_dapm_set_pin(struct snd_soc_codec *codec, 1273static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
1268 const char *pin, int status) 1274 const char *pin, int status)
1269{ 1275{
1270 struct snd_soc_dapm_widget *w; 1276 struct snd_soc_dapm_widget *w;
1271 1277
1272 list_for_each_entry(w, &codec->dapm_widgets, list) { 1278 list_for_each_entry(w, &dapm->widgets, list) {
1273 if (!strcmp(w->name, pin)) { 1279 if (!strcmp(w->name, pin)) {
1274 pr_debug("dapm: %s: pin %s\n", codec->name, pin); 1280 pr_debug("dapm: %s: pin %s\n", dapm->codec->name, pin);
1275 w->connected = status; 1281 w->connected = status;
1276 /* Allow disabling of forced pins */ 1282 /* Allow disabling of forced pins */
1277 if (status == 0) 1283 if (status == 0)
@@ -1280,26 +1286,27 @@ static int snd_soc_dapm_set_pin(struct snd_soc_codec *codec,
1280 } 1286 }
1281 } 1287 }
1282 1288
1283 pr_err("dapm: %s: configuring unknown pin %s\n", codec->name, pin); 1289 pr_err("dapm: %s: configuring unknown pin %s\n",
1290 dapm->codec->name, pin);
1284 return -EINVAL; 1291 return -EINVAL;
1285} 1292}
1286 1293
1287/** 1294/**
1288 * snd_soc_dapm_sync - scan and power dapm paths 1295 * snd_soc_dapm_sync - scan and power dapm paths
1289 * @codec: audio codec 1296 * @dapm: DAPM context
1290 * 1297 *
1291 * Walks all dapm audio paths and powers widgets according to their 1298 * Walks all dapm audio paths and powers widgets according to their
1292 * stream or path usage. 1299 * stream or path usage.
1293 * 1300 *
1294 * Returns 0 for success. 1301 * Returns 0 for success.
1295 */ 1302 */
1296int snd_soc_dapm_sync(struct snd_soc_codec *codec) 1303int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm)
1297{ 1304{
1298 return dapm_power_widgets(codec, SND_SOC_DAPM_STREAM_NOP); 1305 return dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP);
1299} 1306}
1300EXPORT_SYMBOL_GPL(snd_soc_dapm_sync); 1307EXPORT_SYMBOL_GPL(snd_soc_dapm_sync);
1301 1308
1302static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, 1309static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
1303 const struct snd_soc_dapm_route *route) 1310 const struct snd_soc_dapm_route *route)
1304{ 1311{
1305 struct snd_soc_dapm_path *path; 1312 struct snd_soc_dapm_path *path;
@@ -1310,7 +1317,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
1310 int ret = 0; 1317 int ret = 0;
1311 1318
1312 /* find src and dest widgets */ 1319 /* find src and dest widgets */
1313 list_for_each_entry(w, &codec->dapm_widgets, list) { 1320 list_for_each_entry(w, &dapm->widgets, list) {
1314 1321
1315 if (!wsink && !(strcmp(w->name, sink))) { 1322 if (!wsink && !(strcmp(w->name, sink))) {
1316 wsink = w; 1323 wsink = w;
@@ -1353,7 +1360,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
1353 1360
1354 /* connect static paths */ 1361 /* connect static paths */
1355 if (control == NULL) { 1362 if (control == NULL) {
1356 list_add(&path->list, &codec->dapm_paths); 1363 list_add(&path->list, &dapm->paths);
1357 list_add(&path->list_sink, &wsink->sources); 1364 list_add(&path->list_sink, &wsink->sources);
1358 list_add(&path->list_source, &wsource->sinks); 1365 list_add(&path->list_source, &wsource->sinks);
1359 path->connect = 1; 1366 path->connect = 1;
@@ -1374,14 +1381,14 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
1374 case snd_soc_dapm_supply: 1381 case snd_soc_dapm_supply:
1375 case snd_soc_dapm_aif_in: 1382 case snd_soc_dapm_aif_in:
1376 case snd_soc_dapm_aif_out: 1383 case snd_soc_dapm_aif_out:
1377 list_add(&path->list, &codec->dapm_paths); 1384 list_add(&path->list, &dapm->paths);
1378 list_add(&path->list_sink, &wsink->sources); 1385 list_add(&path->list_sink, &wsink->sources);
1379 list_add(&path->list_source, &wsource->sinks); 1386 list_add(&path->list_source, &wsource->sinks);
1380 path->connect = 1; 1387 path->connect = 1;
1381 return 0; 1388 return 0;
1382 case snd_soc_dapm_mux: 1389 case snd_soc_dapm_mux:
1383 case snd_soc_dapm_value_mux: 1390 case snd_soc_dapm_value_mux:
1384 ret = dapm_connect_mux(codec, wsource, wsink, path, control, 1391 ret = dapm_connect_mux(dapm, wsource, wsink, path, control,
1385 &wsink->kcontrols[0]); 1392 &wsink->kcontrols[0]);
1386 if (ret != 0) 1393 if (ret != 0)
1387 goto err; 1394 goto err;
@@ -1389,7 +1396,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
1389 case snd_soc_dapm_switch: 1396 case snd_soc_dapm_switch:
1390 case snd_soc_dapm_mixer: 1397 case snd_soc_dapm_mixer:
1391 case snd_soc_dapm_mixer_named_ctl: 1398 case snd_soc_dapm_mixer_named_ctl:
1392 ret = dapm_connect_mixer(codec, wsource, wsink, path, control); 1399 ret = dapm_connect_mixer(dapm, wsource, wsink, path, control);
1393 if (ret != 0) 1400 if (ret != 0)
1394 goto err; 1401 goto err;
1395 break; 1402 break;
@@ -1397,7 +1404,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
1397 case snd_soc_dapm_mic: 1404 case snd_soc_dapm_mic:
1398 case snd_soc_dapm_line: 1405 case snd_soc_dapm_line:
1399 case snd_soc_dapm_spk: 1406 case snd_soc_dapm_spk:
1400 list_add(&path->list, &codec->dapm_paths); 1407 list_add(&path->list, &dapm->paths);
1401 list_add(&path->list_sink, &wsink->sources); 1408 list_add(&path->list_sink, &wsink->sources);
1402 list_add(&path->list_source, &wsource->sinks); 1409 list_add(&path->list_source, &wsource->sinks);
1403 path->connect = 0; 1410 path->connect = 0;
@@ -1414,7 +1421,7 @@ err:
1414 1421
1415/** 1422/**
1416 * snd_soc_dapm_add_routes - Add routes between DAPM widgets 1423 * snd_soc_dapm_add_routes - Add routes between DAPM widgets
1417 * @codec: codec 1424 * @dapm: DAPM context
1418 * @route: audio routes 1425 * @route: audio routes
1419 * @num: number of routes 1426 * @num: number of routes
1420 * 1427 *
@@ -1425,13 +1432,13 @@ err:
1425 * Returns 0 for success else error. On error all resources can be freed 1432 * Returns 0 for success else error. On error all resources can be freed
1426 * with a call to snd_soc_card_free(). 1433 * with a call to snd_soc_card_free().
1427 */ 1434 */
1428int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, 1435int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
1429 const struct snd_soc_dapm_route *route, int num) 1436 const struct snd_soc_dapm_route *route, int num)
1430{ 1437{
1431 int i, ret; 1438 int i, ret;
1432 1439
1433 for (i = 0; i < num; i++) { 1440 for (i = 0; i < num; i++) {
1434 ret = snd_soc_dapm_add_route(codec, route); 1441 ret = snd_soc_dapm_add_route(dapm, route);
1435 if (ret < 0) { 1442 if (ret < 0) {
1436 printk(KERN_ERR "Failed to add route %s->%s\n", 1443 printk(KERN_ERR "Failed to add route %s->%s\n",
1437 route->source, 1444 route->source,
@@ -1447,17 +1454,17 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes);
1447 1454
1448/** 1455/**
1449 * snd_soc_dapm_new_widgets - add new dapm widgets 1456 * snd_soc_dapm_new_widgets - add new dapm widgets
1450 * @codec: audio codec 1457 * @dapm: DAPM context
1451 * 1458 *
1452 * Checks the codec for any new dapm widgets and creates them if found. 1459 * Checks the codec for any new dapm widgets and creates them if found.
1453 * 1460 *
1454 * Returns 0 for success. 1461 * Returns 0 for success.
1455 */ 1462 */
1456int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec) 1463int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
1457{ 1464{
1458 struct snd_soc_dapm_widget *w; 1465 struct snd_soc_dapm_widget *w;
1459 1466
1460 list_for_each_entry(w, &codec->dapm_widgets, list) 1467 list_for_each_entry(w, &dapm->widgets, list)
1461 { 1468 {
1462 if (w->new) 1469 if (w->new)
1463 continue; 1470 continue;
@@ -1467,12 +1474,12 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec)
1467 case snd_soc_dapm_mixer: 1474 case snd_soc_dapm_mixer:
1468 case snd_soc_dapm_mixer_named_ctl: 1475 case snd_soc_dapm_mixer_named_ctl:
1469 w->power_check = dapm_generic_check_power; 1476 w->power_check = dapm_generic_check_power;
1470 dapm_new_mixer(codec, w); 1477 dapm_new_mixer(dapm, w);
1471 break; 1478 break;
1472 case snd_soc_dapm_mux: 1479 case snd_soc_dapm_mux:
1473 case snd_soc_dapm_value_mux: 1480 case snd_soc_dapm_value_mux:
1474 w->power_check = dapm_generic_check_power; 1481 w->power_check = dapm_generic_check_power;
1475 dapm_new_mux(codec, w); 1482 dapm_new_mux(dapm, w);
1476 break; 1483 break;
1477 case snd_soc_dapm_adc: 1484 case snd_soc_dapm_adc:
1478 case snd_soc_dapm_aif_out: 1485 case snd_soc_dapm_aif_out:
@@ -1484,7 +1491,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec)
1484 break; 1491 break;
1485 case snd_soc_dapm_pga: 1492 case snd_soc_dapm_pga:
1486 w->power_check = dapm_generic_check_power; 1493 w->power_check = dapm_generic_check_power;
1487 dapm_new_pga(codec, w); 1494 dapm_new_pga(dapm, w);
1488 break; 1495 break;
1489 case snd_soc_dapm_input: 1496 case snd_soc_dapm_input:
1490 case snd_soc_dapm_output: 1497 case snd_soc_dapm_output:
@@ -1505,7 +1512,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec)
1505 w->new = 1; 1512 w->new = 1;
1506 } 1513 }
1507 1514
1508 dapm_power_widgets(codec, SND_SOC_DAPM_STREAM_NOP); 1515 dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP);
1509 return 0; 1516 return 0;
1510} 1517}
1511EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets); 1518EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
@@ -1889,7 +1896,7 @@ int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
1889 mutex_lock(&codec->mutex); 1896 mutex_lock(&codec->mutex);
1890 1897
1891 ucontrol->value.integer.value[0] = 1898 ucontrol->value.integer.value[0] =
1892 snd_soc_dapm_get_pin_status(codec, pin); 1899 snd_soc_dapm_get_pin_status(&codec->dapm, pin);
1893 1900
1894 mutex_unlock(&codec->mutex); 1901 mutex_unlock(&codec->mutex);
1895 1902
@@ -1912,11 +1919,11 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
1912 mutex_lock(&codec->mutex); 1919 mutex_lock(&codec->mutex);
1913 1920
1914 if (ucontrol->value.integer.value[0]) 1921 if (ucontrol->value.integer.value[0])
1915 snd_soc_dapm_enable_pin(codec, pin); 1922 snd_soc_dapm_enable_pin(&codec->dapm, pin);
1916 else 1923 else
1917 snd_soc_dapm_disable_pin(codec, pin); 1924 snd_soc_dapm_disable_pin(&codec->dapm, pin);
1918 1925
1919 snd_soc_dapm_sync(codec); 1926 snd_soc_dapm_sync(&codec->dapm);
1920 1927
1921 mutex_unlock(&codec->mutex); 1928 mutex_unlock(&codec->mutex);
1922 1929
@@ -1926,14 +1933,14 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch);
1926 1933
1927/** 1934/**
1928 * snd_soc_dapm_new_control - create new dapm control 1935 * snd_soc_dapm_new_control - create new dapm control
1929 * @codec: audio codec 1936 * @dapm: DAPM context
1930 * @widget: widget template 1937 * @widget: widget template
1931 * 1938 *
1932 * Creates a new dapm control based upon the template. 1939 * Creates a new dapm control based upon the template.
1933 * 1940 *
1934 * Returns 0 for success else error. 1941 * Returns 0 for success else error.
1935 */ 1942 */
1936int snd_soc_dapm_new_control(struct snd_soc_codec *codec, 1943int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
1937 const struct snd_soc_dapm_widget *widget) 1944 const struct snd_soc_dapm_widget *widget)
1938{ 1945{
1939 struct snd_soc_dapm_widget *w; 1946 struct snd_soc_dapm_widget *w;
@@ -1941,11 +1948,12 @@ int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
1941 if ((w = dapm_cnew_widget(widget)) == NULL) 1948 if ((w = dapm_cnew_widget(widget)) == NULL)
1942 return -ENOMEM; 1949 return -ENOMEM;
1943 1950
1944 w->codec = codec; 1951 w->dapm = dapm;
1952 w->codec = dapm->codec;
1945 INIT_LIST_HEAD(&w->sources); 1953 INIT_LIST_HEAD(&w->sources);
1946 INIT_LIST_HEAD(&w->sinks); 1954 INIT_LIST_HEAD(&w->sinks);
1947 INIT_LIST_HEAD(&w->list); 1955 INIT_LIST_HEAD(&w->list);
1948 list_add(&w->list, &codec->dapm_widgets); 1956 list_add(&w->list, &dapm->widgets);
1949 1957
1950 /* machine layer set ups unconnected pins and insertions */ 1958 /* machine layer set ups unconnected pins and insertions */
1951 w->connected = 1; 1959 w->connected = 1;
@@ -1955,7 +1963,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_control);
1955 1963
1956/** 1964/**
1957 * snd_soc_dapm_new_controls - create new dapm controls 1965 * snd_soc_dapm_new_controls - create new dapm controls
1958 * @codec: audio codec 1966 * @dapm: DAPM context
1959 * @widget: widget array 1967 * @widget: widget array
1960 * @num: number of widgets 1968 * @num: number of widgets
1961 * 1969 *
@@ -1963,14 +1971,14 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_control);
1963 * 1971 *
1964 * Returns 0 for success else error. 1972 * Returns 0 for success else error.
1965 */ 1973 */
1966int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, 1974int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
1967 const struct snd_soc_dapm_widget *widget, 1975 const struct snd_soc_dapm_widget *widget,
1968 int num) 1976 int num)
1969{ 1977{
1970 int i, ret; 1978 int i, ret;
1971 1979
1972 for (i = 0; i < num; i++) { 1980 for (i = 0; i < num; i++) {
1973 ret = snd_soc_dapm_new_control(codec, widget); 1981 ret = snd_soc_dapm_new_control(dapm, widget);
1974 if (ret < 0) { 1982 if (ret < 0) {
1975 printk(KERN_ERR 1983 printk(KERN_ERR
1976 "ASoC: Failed to create DAPM control %s: %d\n", 1984 "ASoC: Failed to create DAPM control %s: %d\n",
@@ -1983,29 +1991,12 @@ int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
1983} 1991}
1984EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls); 1992EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls);
1985 1993
1986 1994static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
1987/**
1988 * snd_soc_dapm_stream_event - send a stream event to the dapm core
1989 * @codec: audio codec
1990 * @stream: stream name
1991 * @event: stream event
1992 *
1993 * Sends a stream event to the dapm core. The core then makes any
1994 * necessary widget power changes.
1995 *
1996 * Returns 0 for success else error.
1997 */
1998int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd,
1999 const char *stream, int event) 1995 const char *stream, int event)
2000{ 1996{
2001 struct snd_soc_codec *codec = rtd->codec;
2002 struct snd_soc_dapm_widget *w; 1997 struct snd_soc_dapm_widget *w;
2003 1998
2004 if (stream == NULL) 1999 list_for_each_entry(w, &dapm->widgets, list)
2005 return 0;
2006
2007 mutex_lock(&codec->mutex);
2008 list_for_each_entry(w, &codec->dapm_widgets, list)
2009 { 2000 {
2010 if (!w->sname) 2001 if (!w->sname)
2011 continue; 2002 continue;
@@ -2028,7 +2019,30 @@ int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd,
2028 } 2019 }
2029 } 2020 }
2030 2021
2031 dapm_power_widgets(codec, event); 2022 dapm_power_widgets(dapm, event);
2023}
2024
2025/**
2026 * snd_soc_dapm_stream_event - send a stream event to the dapm core
2027 * @rtd: PCM runtime data
2028 * @stream: stream name
2029 * @event: stream event
2030 *
2031 * Sends a stream event to the dapm core. The core then makes any
2032 * necessary widget power changes.
2033 *
2034 * Returns 0 for success else error.
2035 */
2036int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd,
2037 const char *stream, int event)
2038{
2039 struct snd_soc_codec *codec = rtd->codec;
2040
2041 if (stream == NULL)
2042 return 0;
2043
2044 mutex_lock(&codec->mutex);
2045 soc_dapm_stream_event(&codec->dapm, stream, event);
2032 mutex_unlock(&codec->mutex); 2046 mutex_unlock(&codec->mutex);
2033 return 0; 2047 return 0;
2034} 2048}
@@ -2036,7 +2050,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_stream_event);
2036 2050
2037/** 2051/**
2038 * snd_soc_dapm_enable_pin - enable pin. 2052 * snd_soc_dapm_enable_pin - enable pin.
2039 * @codec: SoC codec 2053 * @dapm: DAPM context
2040 * @pin: pin name 2054 * @pin: pin name
2041 * 2055 *
2042 * Enables input/output pin and its parents or children widgets iff there is 2056 * Enables input/output pin and its parents or children widgets iff there is
@@ -2044,15 +2058,15 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_stream_event);
2044 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to 2058 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
2045 * do any widget power switching. 2059 * do any widget power switching.
2046 */ 2060 */
2047int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin) 2061int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin)
2048{ 2062{
2049 return snd_soc_dapm_set_pin(codec, pin, 1); 2063 return snd_soc_dapm_set_pin(dapm, pin, 1);
2050} 2064}
2051EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); 2065EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin);
2052 2066
2053/** 2067/**
2054 * snd_soc_dapm_force_enable_pin - force a pin to be enabled 2068 * snd_soc_dapm_force_enable_pin - force a pin to be enabled
2055 * @codec: SoC codec 2069 * @dapm: DAPM context
2056 * @pin: pin name 2070 * @pin: pin name
2057 * 2071 *
2058 * Enables input/output pin regardless of any other state. This is 2072 * Enables input/output pin regardless of any other state. This is
@@ -2062,42 +2076,45 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin);
2062 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to 2076 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
2063 * do any widget power switching. 2077 * do any widget power switching.
2064 */ 2078 */
2065int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec, const char *pin) 2079int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
2080 const char *pin)
2066{ 2081{
2067 struct snd_soc_dapm_widget *w; 2082 struct snd_soc_dapm_widget *w;
2068 2083
2069 list_for_each_entry(w, &codec->dapm_widgets, list) { 2084 list_for_each_entry(w, &dapm->widgets, list) {
2070 if (!strcmp(w->name, pin)) { 2085 if (!strcmp(w->name, pin)) {
2071 pr_debug("dapm: %s: pin %s\n", codec->name, pin); 2086 pr_debug("dapm: %s: pin %s\n", dapm->codec->name, pin);
2072 w->connected = 1; 2087 w->connected = 1;
2073 w->force = 1; 2088 w->force = 1;
2074 return 0; 2089 return 0;
2075 } 2090 }
2076 } 2091 }
2077 2092
2078 pr_err("dapm: %s: configuring unknown pin %s\n", codec->name, pin); 2093 pr_err("dapm: %s: configuring unknown pin %s\n",
2094 dapm->codec->name, pin);
2079 return -EINVAL; 2095 return -EINVAL;
2080} 2096}
2081EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); 2097EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin);
2082 2098
2083/** 2099/**
2084 * snd_soc_dapm_disable_pin - disable pin. 2100 * snd_soc_dapm_disable_pin - disable pin.
2085 * @codec: SoC codec 2101 * @dapm: DAPM context
2086 * @pin: pin name 2102 * @pin: pin name
2087 * 2103 *
2088 * Disables input/output pin and its parents or children widgets. 2104 * Disables input/output pin and its parents or children widgets.
2089 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to 2105 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
2090 * do any widget power switching. 2106 * do any widget power switching.
2091 */ 2107 */
2092int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin) 2108int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
2109 const char *pin)
2093{ 2110{
2094 return snd_soc_dapm_set_pin(codec, pin, 0); 2111 return snd_soc_dapm_set_pin(dapm, pin, 0);
2095} 2112}
2096EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); 2113EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin);
2097 2114
2098/** 2115/**
2099 * snd_soc_dapm_nc_pin - permanently disable pin. 2116 * snd_soc_dapm_nc_pin - permanently disable pin.
2100 * @codec: SoC codec 2117 * @dapm: DAPM context
2101 * @pin: pin name 2118 * @pin: pin name
2102 * 2119 *
2103 * Marks the specified pin as being not connected, disabling it along 2120 * Marks the specified pin as being not connected, disabling it along
@@ -2109,26 +2126,27 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin);
2109 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to 2126 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
2110 * do any widget power switching. 2127 * do any widget power switching.
2111 */ 2128 */
2112int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin) 2129int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin)
2113{ 2130{
2114 return snd_soc_dapm_set_pin(codec, pin, 0); 2131 return snd_soc_dapm_set_pin(dapm, pin, 0);
2115} 2132}
2116EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); 2133EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin);
2117 2134
2118/** 2135/**
2119 * snd_soc_dapm_get_pin_status - get audio pin status 2136 * snd_soc_dapm_get_pin_status - get audio pin status
2120 * @codec: audio codec 2137 * @dapm: DAPM context
2121 * @pin: audio signal pin endpoint (or start point) 2138 * @pin: audio signal pin endpoint (or start point)
2122 * 2139 *
2123 * Get audio pin status - connected or disconnected. 2140 * Get audio pin status - connected or disconnected.
2124 * 2141 *
2125 * Returns 1 for connected otherwise 0. 2142 * Returns 1 for connected otherwise 0.
2126 */ 2143 */
2127int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin) 2144int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
2145 const char *pin)
2128{ 2146{
2129 struct snd_soc_dapm_widget *w; 2147 struct snd_soc_dapm_widget *w;
2130 2148
2131 list_for_each_entry(w, &codec->dapm_widgets, list) { 2149 list_for_each_entry(w, &dapm->widgets, list) {
2132 if (!strcmp(w->name, pin)) 2150 if (!strcmp(w->name, pin))
2133 return w->connected; 2151 return w->connected;
2134 } 2152 }
@@ -2139,7 +2157,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_pin_status);
2139 2157
2140/** 2158/**
2141 * snd_soc_dapm_ignore_suspend - ignore suspend status for DAPM endpoint 2159 * snd_soc_dapm_ignore_suspend - ignore suspend status for DAPM endpoint
2142 * @codec: audio codec 2160 * @dapm: DAPM context
2143 * @pin: audio signal pin endpoint (or start point) 2161 * @pin: audio signal pin endpoint (or start point)
2144 * 2162 *
2145 * Mark the given endpoint or pin as ignoring suspend. When the 2163 * Mark the given endpoint or pin as ignoring suspend. When the
@@ -2148,11 +2166,12 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_pin_status);
2148 * normal means at suspend time, it will not be turned on if it was not 2166 * normal means at suspend time, it will not be turned on if it was not
2149 * already enabled. 2167 * already enabled.
2150 */ 2168 */
2151int snd_soc_dapm_ignore_suspend(struct snd_soc_codec *codec, const char *pin) 2169int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
2170 const char *pin)
2152{ 2171{
2153 struct snd_soc_dapm_widget *w; 2172 struct snd_soc_dapm_widget *w;
2154 2173
2155 list_for_each_entry(w, &codec->dapm_widgets, list) { 2174 list_for_each_entry(w, &dapm->widgets, list) {
2156 if (!strcmp(w->name, pin)) { 2175 if (!strcmp(w->name, pin)) {
2157 w->ignore_suspend = 1; 2176 w->ignore_suspend = 1;
2158 return 0; 2177 return 0;
@@ -2170,20 +2189,20 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);
2170 * 2189 *
2171 * Free all dapm widgets and resources. 2190 * Free all dapm widgets and resources.
2172 */ 2191 */
2173void snd_soc_dapm_free(struct snd_soc_codec *codec) 2192void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm)
2174{ 2193{
2175 snd_soc_dapm_sys_remove(codec->dev); 2194 snd_soc_dapm_sys_remove(dapm->dev);
2176 dapm_free_widgets(codec); 2195 dapm_free_widgets(dapm);
2177} 2196}
2178EXPORT_SYMBOL_GPL(snd_soc_dapm_free); 2197EXPORT_SYMBOL_GPL(snd_soc_dapm_free);
2179 2198
2180static void soc_dapm_shutdown_codec(struct snd_soc_codec *codec) 2199static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
2181{ 2200{
2182 struct snd_soc_dapm_widget *w; 2201 struct snd_soc_dapm_widget *w;
2183 LIST_HEAD(down_list); 2202 LIST_HEAD(down_list);
2184 int powerdown = 0; 2203 int powerdown = 0;
2185 2204
2186 list_for_each_entry(w, &codec->dapm_widgets, list) { 2205 list_for_each_entry(w, &dapm->widgets, list) {
2187 if (w->power) { 2206 if (w->power) {
2188 dapm_seq_insert(w, &down_list, dapm_down_seq); 2207 dapm_seq_insert(w, &down_list, dapm_down_seq);
2189 w->power = 0; 2208 w->power = 0;
@@ -2195,9 +2214,9 @@ static void soc_dapm_shutdown_codec(struct snd_soc_codec *codec)
2195 * standby. 2214 * standby.
2196 */ 2215 */
2197 if (powerdown) { 2216 if (powerdown) {
2198 snd_soc_dapm_set_bias_level(NULL, codec, SND_SOC_BIAS_PREPARE); 2217 snd_soc_dapm_set_bias_level(NULL, dapm, SND_SOC_BIAS_PREPARE);
2199 dapm_seq_run(codec, &down_list, 0, dapm_down_seq); 2218 dapm_seq_run(dapm, &down_list, 0, dapm_down_seq);
2200 snd_soc_dapm_set_bias_level(NULL, codec, SND_SOC_BIAS_STANDBY); 2219 snd_soc_dapm_set_bias_level(NULL, dapm, SND_SOC_BIAS_STANDBY);
2201 } 2220 }
2202} 2221}
2203 2222
@@ -2208,10 +2227,10 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card)
2208{ 2227{
2209 struct snd_soc_codec *codec; 2228 struct snd_soc_codec *codec;
2210 2229
2211 list_for_each_entry(codec, &card->codec_dev_list, list) 2230 list_for_each_entry(codec, &card->codec_dev_list, list) {
2212 soc_dapm_shutdown_codec(codec); 2231 soc_dapm_shutdown_codec(&codec->dapm);
2213 2232 snd_soc_dapm_set_bias_level(card, &codec->dapm, SND_SOC_BIAS_OFF);
2214 snd_soc_dapm_set_bias_level(card, codec, SND_SOC_BIAS_OFF); 2233 }
2215} 2234}
2216 2235
2217/* Module information */ 2236/* Module information */
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 9f07551e155f..4d95abb40288 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -60,6 +60,7 @@ EXPORT_SYMBOL_GPL(snd_soc_jack_new);
60void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) 60void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
61{ 61{
62 struct snd_soc_codec *codec; 62 struct snd_soc_codec *codec;
63 struct snd_soc_dapm_context *dapm;
63 struct snd_soc_jack_pin *pin; 64 struct snd_soc_jack_pin *pin;
64 int enable; 65 int enable;
65 int oldstatus; 66 int oldstatus;
@@ -68,6 +69,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
68 return; 69 return;
69 70
70 codec = jack->codec; 71 codec = jack->codec;
72 dapm = &codec->dapm;
71 73
72 mutex_lock(&codec->mutex); 74 mutex_lock(&codec->mutex);
73 75
@@ -88,15 +90,15 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
88 enable = !enable; 90 enable = !enable;
89 91
90 if (enable) 92 if (enable)
91 snd_soc_dapm_enable_pin(codec, pin->pin); 93 snd_soc_dapm_enable_pin(dapm, pin->pin);
92 else 94 else
93 snd_soc_dapm_disable_pin(codec, pin->pin); 95 snd_soc_dapm_disable_pin(dapm, pin->pin);
94 } 96 }
95 97
96 /* Report before the DAPM sync to help users updating micbias status */ 98 /* Report before the DAPM sync to help users updating micbias status */
97 blocking_notifier_call_chain(&jack->notifier, status, NULL); 99 blocking_notifier_call_chain(&jack->notifier, status, NULL);
98 100
99 snd_soc_dapm_sync(codec); 101 snd_soc_dapm_sync(dapm);
100 102
101 snd_jack_report(jack->jack, status); 103 snd_jack_report(jack->jack, status);
102 104