aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
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/codecs
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/codecs')
-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
59 files changed, 379 insertions, 312 deletions
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,