aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-01-23 17:55:23 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-01-27 05:30:54 -0500
commit6627a653bceb3a54e55e5cdc478ec5b8d5c9cc44 (patch)
tree9a6f157ad1123e4f047689bbf3c4ef88ec1259a4 /sound/soc/codecs
parent0db4d0705260dd4bddf1e5a5441c58bdf08bdc9f (diff)
ASoC: Push the codec runtime storage into the card structure
This is a further stage on the road to refactoring away the ASoC platform device. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/ac97.c20
-rw-r--r--sound/soc/codecs/ad1980.c12
-rw-r--r--sound/soc/codecs/ad73311.c8
-rw-r--r--sound/soc/codecs/ak4535.c14
-rw-r--r--sound/soc/codecs/cs4270.c6
-rw-r--r--sound/soc/codecs/pcm3008.c12
-rw-r--r--sound/soc/codecs/ssm2602.c20
-rw-r--r--sound/soc/codecs/tlv320aic23.c18
-rw-r--r--sound/soc/codecs/tlv320aic26.c4
-rw-r--r--sound/soc/codecs/tlv320aic3x.c14
-rw-r--r--sound/soc/codecs/twl4030.c12
-rw-r--r--sound/soc/codecs/uda134x.c18
-rw-r--r--sound/soc/codecs/uda1380.c18
-rw-r--r--sound/soc/codecs/wm8350.c10
-rw-r--r--sound/soc/codecs/wm8510.c16
-rw-r--r--sound/soc/codecs/wm8580.c10
-rw-r--r--sound/soc/codecs/wm8728.c16
-rw-r--r--sound/soc/codecs/wm8731.c20
-rw-r--r--sound/soc/codecs/wm8750.c16
-rw-r--r--sound/soc/codecs/wm8753.c18
-rw-r--r--sound/soc/codecs/wm8900.c8
-rw-r--r--sound/soc/codecs/wm8903.c18
-rw-r--r--sound/soc/codecs/wm8971.c14
-rw-r--r--sound/soc/codecs/wm8990.c14
-rw-r--r--sound/soc/codecs/wm9705.c15
-rw-r--r--sound/soc/codecs/wm9712.c21
-rw-r--r--sound/soc/codecs/wm9713.c17
27 files changed, 196 insertions, 193 deletions
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 89d41277616d..11f84b6e5cb8 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -30,7 +30,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
30 struct snd_pcm_runtime *runtime = substream->runtime; 30 struct snd_pcm_runtime *runtime = substream->runtime;
31 struct snd_soc_pcm_runtime *rtd = substream->private_data; 31 struct snd_soc_pcm_runtime *rtd = substream->private_data;
32 struct snd_soc_device *socdev = rtd->socdev; 32 struct snd_soc_device *socdev = rtd->socdev;
33 struct snd_soc_codec *codec = socdev->codec; 33 struct snd_soc_codec *codec = socdev->card->codec;
34 34
35 int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 35 int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
36 AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; 36 AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE;
@@ -84,10 +84,10 @@ static int ac97_soc_probe(struct platform_device *pdev)
84 84
85 printk(KERN_INFO "AC97 SoC Audio Codec %s\n", AC97_VERSION); 85 printk(KERN_INFO "AC97 SoC Audio Codec %s\n", AC97_VERSION);
86 86
87 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 87 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
88 if (!socdev->codec) 88 if (!socdev->card->codec)
89 return -ENOMEM; 89 return -ENOMEM;
90 codec = socdev->codec; 90 codec = socdev->card->codec;
91 mutex_init(&codec->mutex); 91 mutex_init(&codec->mutex);
92 92
93 codec->name = "AC97"; 93 codec->name = "AC97";
@@ -123,21 +123,21 @@ bus_err:
123 snd_soc_free_pcms(socdev); 123 snd_soc_free_pcms(socdev);
124 124
125err: 125err:
126 kfree(socdev->codec); 126 kfree(socdev->card->codec);
127 socdev->codec = NULL; 127 socdev->card->codec = NULL;
128 return ret; 128 return ret;
129} 129}
130 130
131static int ac97_soc_remove(struct platform_device *pdev) 131static int ac97_soc_remove(struct platform_device *pdev)
132{ 132{
133 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 133 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
134 struct snd_soc_codec *codec = socdev->codec; 134 struct snd_soc_codec *codec = socdev->card->codec;
135 135
136 if (!codec) 136 if (!codec)
137 return 0; 137 return 0;
138 138
139 snd_soc_free_pcms(socdev); 139 snd_soc_free_pcms(socdev);
140 kfree(socdev->codec); 140 kfree(socdev->card->codec);
141 141
142 return 0; 142 return 0;
143} 143}
@@ -147,7 +147,7 @@ static int ac97_soc_suspend(struct platform_device *pdev, pm_message_t msg)
147{ 147{
148 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 148 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
149 149
150 snd_ac97_suspend(socdev->codec->ac97); 150 snd_ac97_suspend(socdev->card->codec->ac97);
151 151
152 return 0; 152 return 0;
153} 153}
@@ -156,7 +156,7 @@ static int ac97_soc_resume(struct platform_device *pdev)
156{ 156{
157 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 157 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
158 158
159 snd_ac97_resume(socdev->codec->ac97); 159 snd_ac97_resume(socdev->card->codec->ac97);
160 160
161 return 0; 161 return 0;
162} 162}
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c
index faf358758e13..ddb3b08ac23c 100644
--- a/sound/soc/codecs/ad1980.c
+++ b/sound/soc/codecs/ad1980.c
@@ -186,10 +186,10 @@ static int ad1980_soc_probe(struct platform_device *pdev)
186 186
187 printk(KERN_INFO "AD1980 SoC Audio Codec\n"); 187 printk(KERN_INFO "AD1980 SoC Audio Codec\n");
188 188
189 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 189 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
190 if (socdev->codec == NULL) 190 if (socdev->card->codec == NULL)
191 return -ENOMEM; 191 return -ENOMEM;
192 codec = socdev->codec; 192 codec = socdev->card->codec;
193 mutex_init(&codec->mutex); 193 mutex_init(&codec->mutex);
194 194
195 codec->reg_cache = 195 codec->reg_cache =
@@ -275,15 +275,15 @@ codec_err:
275 kfree(codec->reg_cache); 275 kfree(codec->reg_cache);
276 276
277cache_err: 277cache_err:
278 kfree(socdev->codec); 278 kfree(socdev->card->codec);
279 socdev->codec = NULL; 279 socdev->card->codec = NULL;
280 return ret; 280 return ret;
281} 281}
282 282
283static int ad1980_soc_remove(struct platform_device *pdev) 283static int ad1980_soc_remove(struct platform_device *pdev)
284{ 284{
285 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 285 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
286 struct snd_soc_codec *codec = socdev->codec; 286 struct snd_soc_codec *codec = socdev->card->codec;
287 287
288 if (codec == NULL) 288 if (codec == NULL)
289 return 0; 289 return 0;
diff --git a/sound/soc/codecs/ad73311.c b/sound/soc/codecs/ad73311.c
index b09289a1e55a..e61dac5e7b8f 100644
--- a/sound/soc/codecs/ad73311.c
+++ b/sound/soc/codecs/ad73311.c
@@ -53,7 +53,7 @@ static int ad73311_soc_probe(struct platform_device *pdev)
53 codec->owner = THIS_MODULE; 53 codec->owner = THIS_MODULE;
54 codec->dai = &ad73311_dai; 54 codec->dai = &ad73311_dai;
55 codec->num_dai = 1; 55 codec->num_dai = 1;
56 socdev->codec = codec; 56 socdev->card->codec = codec;
57 INIT_LIST_HEAD(&codec->dapm_widgets); 57 INIT_LIST_HEAD(&codec->dapm_widgets);
58 INIT_LIST_HEAD(&codec->dapm_paths); 58 INIT_LIST_HEAD(&codec->dapm_paths);
59 59
@@ -75,15 +75,15 @@ static int ad73311_soc_probe(struct platform_device *pdev)
75register_err: 75register_err:
76 snd_soc_free_pcms(socdev); 76 snd_soc_free_pcms(socdev);
77pcm_err: 77pcm_err:
78 kfree(socdev->codec); 78 kfree(socdev->card->codec);
79 socdev->codec = NULL; 79 socdev->card->codec = NULL;
80 return ret; 80 return ret;
81} 81}
82 82
83static int ad73311_soc_remove(struct platform_device *pdev) 83static int ad73311_soc_remove(struct platform_device *pdev)
84{ 84{
85 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 85 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
86 struct snd_soc_codec *codec = socdev->codec; 86 struct snd_soc_codec *codec = socdev->card->codec;
87 87
88 if (codec == NULL) 88 if (codec == NULL)
89 return 0; 89 return 0;
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index f17c363cb1db..d56e6bb1fedb 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -329,7 +329,7 @@ static int ak4535_hw_params(struct snd_pcm_substream *substream,
329{ 329{
330 struct snd_soc_pcm_runtime *rtd = substream->private_data; 330 struct snd_soc_pcm_runtime *rtd = substream->private_data;
331 struct snd_soc_device *socdev = rtd->socdev; 331 struct snd_soc_device *socdev = rtd->socdev;
332 struct snd_soc_codec *codec = socdev->codec; 332 struct snd_soc_codec *codec = socdev->card->codec;
333 struct ak4535_priv *ak4535 = codec->private_data; 333 struct ak4535_priv *ak4535 = codec->private_data;
334 u8 mode2 = ak4535_read_reg_cache(codec, AK4535_MODE2) & ~(0x3 << 5); 334 u8 mode2 = ak4535_read_reg_cache(codec, AK4535_MODE2) & ~(0x3 << 5);
335 int rate = params_rate(params), fs = 256; 335 int rate = params_rate(params), fs = 256;
@@ -447,7 +447,7 @@ EXPORT_SYMBOL_GPL(ak4535_dai);
447static int ak4535_suspend(struct platform_device *pdev, pm_message_t state) 447static int ak4535_suspend(struct platform_device *pdev, pm_message_t state)
448{ 448{
449 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 449 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
450 struct snd_soc_codec *codec = socdev->codec; 450 struct snd_soc_codec *codec = socdev->card->codec;
451 451
452 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF); 452 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
453 return 0; 453 return 0;
@@ -456,7 +456,7 @@ static int ak4535_suspend(struct platform_device *pdev, pm_message_t state)
456static int ak4535_resume(struct platform_device *pdev) 456static int ak4535_resume(struct platform_device *pdev)
457{ 457{
458 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 458 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
459 struct snd_soc_codec *codec = socdev->codec; 459 struct snd_soc_codec *codec = socdev->card->codec;
460 ak4535_sync(codec); 460 ak4535_sync(codec);
461 ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 461 ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
462 ak4535_set_bias_level(codec, codec->suspend_bias_level); 462 ak4535_set_bias_level(codec, codec->suspend_bias_level);
@@ -469,7 +469,7 @@ static int ak4535_resume(struct platform_device *pdev)
469 */ 469 */
470static int ak4535_init(struct snd_soc_device *socdev) 470static int ak4535_init(struct snd_soc_device *socdev)
471{ 471{
472 struct snd_soc_codec *codec = socdev->codec; 472 struct snd_soc_codec *codec = socdev->card->codec;
473 int ret = 0; 473 int ret = 0;
474 474
475 codec->name = "AK4535"; 475 codec->name = "AK4535";
@@ -523,7 +523,7 @@ static int ak4535_i2c_probe(struct i2c_client *i2c,
523 const struct i2c_device_id *id) 523 const struct i2c_device_id *id)
524{ 524{
525 struct snd_soc_device *socdev = ak4535_socdev; 525 struct snd_soc_device *socdev = ak4535_socdev;
526 struct snd_soc_codec *codec = socdev->codec; 526 struct snd_soc_codec *codec = socdev->card->codec;
527 int ret; 527 int ret;
528 528
529 i2c_set_clientdata(i2c, codec); 529 i2c_set_clientdata(i2c, codec);
@@ -622,7 +622,7 @@ static int ak4535_probe(struct platform_device *pdev)
622 } 622 }
623 623
624 codec->private_data = ak4535; 624 codec->private_data = ak4535;
625 socdev->codec = codec; 625 socdev->card->codec = codec;
626 mutex_init(&codec->mutex); 626 mutex_init(&codec->mutex);
627 INIT_LIST_HEAD(&codec->dapm_widgets); 627 INIT_LIST_HEAD(&codec->dapm_widgets);
628 INIT_LIST_HEAD(&codec->dapm_paths); 628 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -649,7 +649,7 @@ static int ak4535_probe(struct platform_device *pdev)
649static int ak4535_remove(struct platform_device *pdev) 649static int ak4535_remove(struct platform_device *pdev)
650{ 650{
651 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 651 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
652 struct snd_soc_codec *codec = socdev->codec; 652 struct snd_soc_codec *codec = socdev->card->codec;
653 653
654 if (codec->control_data) 654 if (codec->control_data)
655 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF); 655 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 2aa12fdbd2ca..21253b48289f 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -350,7 +350,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
350{ 350{
351 struct snd_soc_pcm_runtime *rtd = substream->private_data; 351 struct snd_soc_pcm_runtime *rtd = substream->private_data;
352 struct snd_soc_device *socdev = rtd->socdev; 352 struct snd_soc_device *socdev = rtd->socdev;
353 struct snd_soc_codec *codec = socdev->codec; 353 struct snd_soc_codec *codec = socdev->card->codec;
354 struct cs4270_private *cs4270 = codec->private_data; 354 struct cs4270_private *cs4270 = codec->private_data;
355 int ret; 355 int ret;
356 unsigned int i; 356 unsigned int i;
@@ -575,7 +575,7 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
575 return -ENOMEM; 575 return -ENOMEM;
576 } 576 }
577 codec = &cs4270->codec; 577 codec = &cs4270->codec;
578 socdev->codec = codec; 578 socdev->card->codec = codec;
579 579
580 mutex_init(&codec->mutex); 580 mutex_init(&codec->mutex);
581 INIT_LIST_HEAD(&codec->dapm_widgets); 581 INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -653,7 +653,7 @@ error_free_codec:
653static int cs4270_i2c_remove(struct i2c_client *i2c_client) 653static int cs4270_i2c_remove(struct i2c_client *i2c_client)
654{ 654{
655 struct snd_soc_device *socdev = i2c_get_clientdata(i2c_client); 655 struct snd_soc_device *socdev = i2c_get_clientdata(i2c_client);
656 struct snd_soc_codec *codec = socdev->codec; 656 struct snd_soc_codec *codec = socdev->card->codec;
657 struct cs4270_private *cs4270 = codec->private_data; 657 struct cs4270_private *cs4270 = codec->private_data;
658 658
659 snd_soc_free_pcms(socdev); 659 snd_soc_free_pcms(socdev);
diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c
index 9a3e67e5319c..5cda9e6b5a74 100644
--- a/sound/soc/codecs/pcm3008.c
+++ b/sound/soc/codecs/pcm3008.c
@@ -67,11 +67,11 @@ static int pcm3008_soc_probe(struct platform_device *pdev)
67 67
68 printk(KERN_INFO "PCM3008 SoC Audio Codec %s\n", PCM3008_VERSION); 68 printk(KERN_INFO "PCM3008 SoC Audio Codec %s\n", PCM3008_VERSION);
69 69
70 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 70 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
71 if (!socdev->codec) 71 if (!socdev->card->codec)
72 return -ENOMEM; 72 return -ENOMEM;
73 73
74 codec = socdev->codec; 74 codec = socdev->card->codec;
75 mutex_init(&codec->mutex); 75 mutex_init(&codec->mutex);
76 76
77 codec->name = "PCM3008"; 77 codec->name = "PCM3008";
@@ -139,7 +139,7 @@ gpio_err:
139card_err: 139card_err:
140 snd_soc_free_pcms(socdev); 140 snd_soc_free_pcms(socdev);
141pcm_err: 141pcm_err:
142 kfree(socdev->codec); 142 kfree(socdev->card->codec);
143 143
144 return ret; 144 return ret;
145} 145}
@@ -147,7 +147,7 @@ pcm_err:
147static int pcm3008_soc_remove(struct platform_device *pdev) 147static int pcm3008_soc_remove(struct platform_device *pdev)
148{ 148{
149 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 149 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
150 struct snd_soc_codec *codec = socdev->codec; 150 struct snd_soc_codec *codec = socdev->card->codec;
151 struct pcm3008_setup_data *setup = socdev->codec_data; 151 struct pcm3008_setup_data *setup = socdev->codec_data;
152 152
153 if (!codec) 153 if (!codec)
@@ -155,7 +155,7 @@ static int pcm3008_soc_remove(struct platform_device *pdev)
155 155
156 pcm3008_gpio_free(setup); 156 pcm3008_gpio_free(setup);
157 snd_soc_free_pcms(socdev); 157 snd_soc_free_pcms(socdev);
158 kfree(socdev->codec); 158 kfree(socdev->card->codec);
159 159
160 return 0; 160 return 0;
161} 161}
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index ec7fe3b7b0cb..58e225dadc7e 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -276,7 +276,7 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
276 u16 srate; 276 u16 srate;
277 struct snd_soc_pcm_runtime *rtd = substream->private_data; 277 struct snd_soc_pcm_runtime *rtd = substream->private_data;
278 struct snd_soc_device *socdev = rtd->socdev; 278 struct snd_soc_device *socdev = rtd->socdev;
279 struct snd_soc_codec *codec = socdev->codec; 279 struct snd_soc_codec *codec = socdev->card->codec;
280 struct ssm2602_priv *ssm2602 = codec->private_data; 280 struct ssm2602_priv *ssm2602 = codec->private_data;
281 struct i2c_client *i2c = codec->control_data; 281 struct i2c_client *i2c = codec->control_data;
282 u16 iface = ssm2602_read_reg_cache(codec, SSM2602_IFACE) & 0xfff3; 282 u16 iface = ssm2602_read_reg_cache(codec, SSM2602_IFACE) & 0xfff3;
@@ -321,7 +321,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
321{ 321{
322 struct snd_soc_pcm_runtime *rtd = substream->private_data; 322 struct snd_soc_pcm_runtime *rtd = substream->private_data;
323 struct snd_soc_device *socdev = rtd->socdev; 323 struct snd_soc_device *socdev = rtd->socdev;
324 struct snd_soc_codec *codec = socdev->codec; 324 struct snd_soc_codec *codec = socdev->card->codec;
325 struct ssm2602_priv *ssm2602 = codec->private_data; 325 struct ssm2602_priv *ssm2602 = codec->private_data;
326 struct i2c_client *i2c = codec->control_data; 326 struct i2c_client *i2c = codec->control_data;
327 struct snd_pcm_runtime *master_runtime; 327 struct snd_pcm_runtime *master_runtime;
@@ -358,7 +358,7 @@ static int ssm2602_pcm_prepare(struct snd_pcm_substream *substream,
358{ 358{
359 struct snd_soc_pcm_runtime *rtd = substream->private_data; 359 struct snd_soc_pcm_runtime *rtd = substream->private_data;
360 struct snd_soc_device *socdev = rtd->socdev; 360 struct snd_soc_device *socdev = rtd->socdev;
361 struct snd_soc_codec *codec = socdev->codec; 361 struct snd_soc_codec *codec = socdev->card->codec;
362 /* set active */ 362 /* set active */
363 ssm2602_write(codec, SSM2602_ACTIVE, ACTIVE_ACTIVATE_CODEC); 363 ssm2602_write(codec, SSM2602_ACTIVE, ACTIVE_ACTIVATE_CODEC);
364 364
@@ -370,7 +370,7 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream,
370{ 370{
371 struct snd_soc_pcm_runtime *rtd = substream->private_data; 371 struct snd_soc_pcm_runtime *rtd = substream->private_data;
372 struct snd_soc_device *socdev = rtd->socdev; 372 struct snd_soc_device *socdev = rtd->socdev;
373 struct snd_soc_codec *codec = socdev->codec; 373 struct snd_soc_codec *codec = socdev->card->codec;
374 struct ssm2602_priv *ssm2602 = codec->private_data; 374 struct ssm2602_priv *ssm2602 = codec->private_data;
375 /* deactivate */ 375 /* deactivate */
376 if (!codec->active) 376 if (!codec->active)
@@ -535,7 +535,7 @@ EXPORT_SYMBOL_GPL(ssm2602_dai);
535static int ssm2602_suspend(struct platform_device *pdev, pm_message_t state) 535static int ssm2602_suspend(struct platform_device *pdev, pm_message_t state)
536{ 536{
537 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 537 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
538 struct snd_soc_codec *codec = socdev->codec; 538 struct snd_soc_codec *codec = socdev->card->codec;
539 539
540 ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF); 540 ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF);
541 return 0; 541 return 0;
@@ -544,7 +544,7 @@ static int ssm2602_suspend(struct platform_device *pdev, pm_message_t state)
544static int ssm2602_resume(struct platform_device *pdev) 544static int ssm2602_resume(struct platform_device *pdev)
545{ 545{
546 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 546 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
547 struct snd_soc_codec *codec = socdev->codec; 547 struct snd_soc_codec *codec = socdev->card->codec;
548 int i; 548 int i;
549 u8 data[2]; 549 u8 data[2];
550 u16 *cache = codec->reg_cache; 550 u16 *cache = codec->reg_cache;
@@ -566,7 +566,7 @@ static int ssm2602_resume(struct platform_device *pdev)
566 */ 566 */
567static int ssm2602_init(struct snd_soc_device *socdev) 567static int ssm2602_init(struct snd_soc_device *socdev)
568{ 568{
569 struct snd_soc_codec *codec = socdev->codec; 569 struct snd_soc_codec *codec = socdev->card->codec;
570 int reg, ret = 0; 570 int reg, ret = 0;
571 571
572 codec->name = "SSM2602"; 572 codec->name = "SSM2602";
@@ -639,7 +639,7 @@ static int ssm2602_i2c_probe(struct i2c_client *i2c,
639 const struct i2c_device_id *id) 639 const struct i2c_device_id *id)
640{ 640{
641 struct snd_soc_device *socdev = ssm2602_socdev; 641 struct snd_soc_device *socdev = ssm2602_socdev;
642 struct snd_soc_codec *codec = socdev->codec; 642 struct snd_soc_codec *codec = socdev->card->codec;
643 int ret; 643 int ret;
644 644
645 i2c_set_clientdata(i2c, codec); 645 i2c_set_clientdata(i2c, codec);
@@ -733,7 +733,7 @@ static int ssm2602_probe(struct platform_device *pdev)
733 } 733 }
734 734
735 codec->private_data = ssm2602; 735 codec->private_data = ssm2602;
736 socdev->codec = codec; 736 socdev->card->codec = codec;
737 mutex_init(&codec->mutex); 737 mutex_init(&codec->mutex);
738 INIT_LIST_HEAD(&codec->dapm_widgets); 738 INIT_LIST_HEAD(&codec->dapm_widgets);
739 INIT_LIST_HEAD(&codec->dapm_paths); 739 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -754,7 +754,7 @@ static int ssm2602_probe(struct platform_device *pdev)
754static int ssm2602_remove(struct platform_device *pdev) 754static int ssm2602_remove(struct platform_device *pdev)
755{ 755{
756 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 756 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
757 struct snd_soc_codec *codec = socdev->codec; 757 struct snd_soc_codec *codec = socdev->card->codec;
758 758
759 if (codec->control_data) 759 if (codec->control_data)
760 ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF); 760 ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index a0e47c1dcd64..8b20c360adf5 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -405,7 +405,7 @@ static int tlv320aic23_hw_params(struct snd_pcm_substream *substream,
405{ 405{
406 struct snd_soc_pcm_runtime *rtd = substream->private_data; 406 struct snd_soc_pcm_runtime *rtd = substream->private_data;
407 struct snd_soc_device *socdev = rtd->socdev; 407 struct snd_soc_device *socdev = rtd->socdev;
408 struct snd_soc_codec *codec = socdev->codec; 408 struct snd_soc_codec *codec = socdev->card->codec;
409 u16 iface_reg; 409 u16 iface_reg;
410 int ret; 410 int ret;
411 struct aic23 *aic23 = container_of(codec, struct aic23, codec); 411 struct aic23 *aic23 = container_of(codec, struct aic23, codec);
@@ -453,7 +453,7 @@ static int tlv320aic23_pcm_prepare(struct snd_pcm_substream *substream,
453{ 453{
454 struct snd_soc_pcm_runtime *rtd = substream->private_data; 454 struct snd_soc_pcm_runtime *rtd = substream->private_data;
455 struct snd_soc_device *socdev = rtd->socdev; 455 struct snd_soc_device *socdev = rtd->socdev;
456 struct snd_soc_codec *codec = socdev->codec; 456 struct snd_soc_codec *codec = socdev->card->codec;
457 457
458 /* set active */ 458 /* set active */
459 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0001); 459 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0001);
@@ -466,7 +466,7 @@ static void tlv320aic23_shutdown(struct snd_pcm_substream *substream,
466{ 466{
467 struct snd_soc_pcm_runtime *rtd = substream->private_data; 467 struct snd_soc_pcm_runtime *rtd = substream->private_data;
468 struct snd_soc_device *socdev = rtd->socdev; 468 struct snd_soc_device *socdev = rtd->socdev;
469 struct snd_soc_codec *codec = socdev->codec; 469 struct snd_soc_codec *codec = socdev->card->codec;
470 struct aic23 *aic23 = container_of(codec, struct aic23, codec); 470 struct aic23 *aic23 = container_of(codec, struct aic23, codec);
471 471
472 /* deactivate */ 472 /* deactivate */
@@ -609,7 +609,7 @@ static int tlv320aic23_suspend(struct platform_device *pdev,
609 pm_message_t state) 609 pm_message_t state)
610{ 610{
611 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 611 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
612 struct snd_soc_codec *codec = socdev->codec; 612 struct snd_soc_codec *codec = socdev->card->codec;
613 613
614 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0); 614 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0);
615 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF); 615 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -620,7 +620,7 @@ static int tlv320aic23_suspend(struct platform_device *pdev,
620static int tlv320aic23_resume(struct platform_device *pdev) 620static int tlv320aic23_resume(struct platform_device *pdev)
621{ 621{
622 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 622 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
623 struct snd_soc_codec *codec = socdev->codec; 623 struct snd_soc_codec *codec = socdev->card->codec;
624 int i; 624 int i;
625 u16 reg; 625 u16 reg;
626 626
@@ -642,7 +642,7 @@ static int tlv320aic23_resume(struct platform_device *pdev)
642 */ 642 */
643static int tlv320aic23_init(struct snd_soc_device *socdev) 643static int tlv320aic23_init(struct snd_soc_device *socdev)
644{ 644{
645 struct snd_soc_codec *codec = socdev->codec; 645 struct snd_soc_codec *codec = socdev->card->codec;
646 int ret = 0; 646 int ret = 0;
647 u16 reg; 647 u16 reg;
648 648
@@ -729,7 +729,7 @@ static int tlv320aic23_codec_probe(struct i2c_client *i2c,
729 const struct i2c_device_id *i2c_id) 729 const struct i2c_device_id *i2c_id)
730{ 730{
731 struct snd_soc_device *socdev = tlv320aic23_socdev; 731 struct snd_soc_device *socdev = tlv320aic23_socdev;
732 struct snd_soc_codec *codec = socdev->codec; 732 struct snd_soc_codec *codec = socdev->card->codec;
733 int ret; 733 int ret;
734 734
735 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 735 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -787,7 +787,7 @@ static int tlv320aic23_probe(struct platform_device *pdev)
787 if (aic23 == NULL) 787 if (aic23 == NULL)
788 return -ENOMEM; 788 return -ENOMEM;
789 codec = &aic23->codec; 789 codec = &aic23->codec;
790 socdev->codec = codec; 790 socdev->card->codec = codec;
791 mutex_init(&codec->mutex); 791 mutex_init(&codec->mutex);
792 INIT_LIST_HEAD(&codec->dapm_widgets); 792 INIT_LIST_HEAD(&codec->dapm_widgets);
793 INIT_LIST_HEAD(&codec->dapm_paths); 793 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -806,7 +806,7 @@ static int tlv320aic23_probe(struct platform_device *pdev)
806static int tlv320aic23_remove(struct platform_device *pdev) 806static int tlv320aic23_remove(struct platform_device *pdev)
807{ 807{
808 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 808 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
809 struct snd_soc_codec *codec = socdev->codec; 809 struct snd_soc_codec *codec = socdev->card->codec;
810 struct aic23 *aic23 = container_of(codec, struct aic23, codec); 810 struct aic23 *aic23 = container_of(codec, struct aic23, codec);
811 811
812 if (codec->control_data) 812 if (codec->control_data)
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
index 29f2f1a017fd..229e464cf713 100644
--- a/sound/soc/codecs/tlv320aic26.c
+++ b/sound/soc/codecs/tlv320aic26.c
@@ -130,7 +130,7 @@ static int aic26_hw_params(struct snd_pcm_substream *substream,
130{ 130{
131 struct snd_soc_pcm_runtime *rtd = substream->private_data; 131 struct snd_soc_pcm_runtime *rtd = substream->private_data;
132 struct snd_soc_device *socdev = rtd->socdev; 132 struct snd_soc_device *socdev = rtd->socdev;
133 struct snd_soc_codec *codec = socdev->codec; 133 struct snd_soc_codec *codec = socdev->card->codec;
134 struct aic26 *aic26 = codec->private_data; 134 struct aic26 *aic26 = codec->private_data;
135 int fsref, divisor, wlen, pval, jval, dval, qval; 135 int fsref, divisor, wlen, pval, jval, dval, qval;
136 u16 reg; 136 u16 reg;
@@ -338,7 +338,7 @@ static int aic26_probe(struct platform_device *pdev)
338 return -ENODEV; 338 return -ENODEV;
339 } 339 }
340 codec = &aic26->codec; 340 codec = &aic26->codec;
341 socdev->codec = codec; 341 socdev->card->codec = codec;
342 342
343 dev_dbg(&pdev->dev, "Registering PCMs, dev=%p, socdev->dev=%p\n", 343 dev_dbg(&pdev->dev, "Registering PCMs, dev=%p, socdev->dev=%p\n",
344 &pdev->dev, socdev->dev); 344 &pdev->dev, socdev->dev);
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 36ab0198ca3f..ba64b0c617e6 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -727,7 +727,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
727{ 727{
728 struct snd_soc_pcm_runtime *rtd = substream->private_data; 728 struct snd_soc_pcm_runtime *rtd = substream->private_data;
729 struct snd_soc_device *socdev = rtd->socdev; 729 struct snd_soc_device *socdev = rtd->socdev;
730 struct snd_soc_codec *codec = socdev->codec; 730 struct snd_soc_codec *codec = socdev->card->codec;
731 struct aic3x_priv *aic3x = codec->private_data; 731 struct aic3x_priv *aic3x = codec->private_data;
732 int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; 732 int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0;
733 u8 data, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; 733 u8 data, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1;
@@ -1079,7 +1079,7 @@ EXPORT_SYMBOL_GPL(aic3x_dai);
1079static int aic3x_suspend(struct platform_device *pdev, pm_message_t state) 1079static int aic3x_suspend(struct platform_device *pdev, pm_message_t state)
1080{ 1080{
1081 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1081 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1082 struct snd_soc_codec *codec = socdev->codec; 1082 struct snd_soc_codec *codec = socdev->card->codec;
1083 1083
1084 aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); 1084 aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF);
1085 1085
@@ -1089,7 +1089,7 @@ static int aic3x_suspend(struct platform_device *pdev, pm_message_t state)
1089static int aic3x_resume(struct platform_device *pdev) 1089static int aic3x_resume(struct platform_device *pdev)
1090{ 1090{
1091 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1091 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1092 struct snd_soc_codec *codec = socdev->codec; 1092 struct snd_soc_codec *codec = socdev->card->codec;
1093 int i; 1093 int i;
1094 u8 data[2]; 1094 u8 data[2];
1095 u8 *cache = codec->reg_cache; 1095 u8 *cache = codec->reg_cache;
@@ -1112,7 +1112,7 @@ static int aic3x_resume(struct platform_device *pdev)
1112 */ 1112 */
1113static int aic3x_init(struct snd_soc_device *socdev) 1113static int aic3x_init(struct snd_soc_device *socdev)
1114{ 1114{
1115 struct snd_soc_codec *codec = socdev->codec; 1115 struct snd_soc_codec *codec = socdev->card->codec;
1116 struct aic3x_setup_data *setup = socdev->codec_data; 1116 struct aic3x_setup_data *setup = socdev->codec_data;
1117 int reg, ret = 0; 1117 int reg, ret = 0;
1118 1118
@@ -1243,7 +1243,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
1243 const struct i2c_device_id *id) 1243 const struct i2c_device_id *id)
1244{ 1244{
1245 struct snd_soc_device *socdev = aic3x_socdev; 1245 struct snd_soc_device *socdev = aic3x_socdev;
1246 struct snd_soc_codec *codec = socdev->codec; 1246 struct snd_soc_codec *codec = socdev->card->codec;
1247 int ret; 1247 int ret;
1248 1248
1249 i2c_set_clientdata(i2c, codec); 1249 i2c_set_clientdata(i2c, codec);
@@ -1348,7 +1348,7 @@ static int aic3x_probe(struct platform_device *pdev)
1348 } 1348 }
1349 1349
1350 codec->private_data = aic3x; 1350 codec->private_data = aic3x;
1351 socdev->codec = codec; 1351 socdev->card->codec = codec;
1352 mutex_init(&codec->mutex); 1352 mutex_init(&codec->mutex);
1353 INIT_LIST_HEAD(&codec->dapm_widgets); 1353 INIT_LIST_HEAD(&codec->dapm_widgets);
1354 INIT_LIST_HEAD(&codec->dapm_paths); 1354 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -1374,7 +1374,7 @@ static int aic3x_probe(struct platform_device *pdev)
1374static int aic3x_remove(struct platform_device *pdev) 1374static int aic3x_remove(struct platform_device *pdev)
1375{ 1375{
1376 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1376 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1377 struct snd_soc_codec *codec = socdev->codec; 1377 struct snd_soc_codec *codec = socdev->card->codec;
1378 1378
1379 /* power down chip */ 1379 /* power down chip */
1380 if (codec->control_data) 1380 if (codec->control_data)
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index f530c1e6d9e8..796f34cac85d 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -981,7 +981,7 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
981{ 981{
982 struct snd_soc_pcm_runtime *rtd = substream->private_data; 982 struct snd_soc_pcm_runtime *rtd = substream->private_data;
983 struct snd_soc_device *socdev = rtd->socdev; 983 struct snd_soc_device *socdev = rtd->socdev;
984 struct snd_soc_codec *codec = socdev->codec; 984 struct snd_soc_codec *codec = socdev->card->codec;
985 u8 mode, old_mode, format, old_format; 985 u8 mode, old_mode, format, old_format;
986 986
987 987
@@ -1166,7 +1166,7 @@ EXPORT_SYMBOL_GPL(twl4030_dai);
1166static int twl4030_suspend(struct platform_device *pdev, pm_message_t state) 1166static int twl4030_suspend(struct platform_device *pdev, pm_message_t state)
1167{ 1167{
1168 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1168 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1169 struct snd_soc_codec *codec = socdev->codec; 1169 struct snd_soc_codec *codec = socdev->card->codec;
1170 1170
1171 twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF); 1171 twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF);
1172 1172
@@ -1176,7 +1176,7 @@ static int twl4030_suspend(struct platform_device *pdev, pm_message_t state)
1176static int twl4030_resume(struct platform_device *pdev) 1176static int twl4030_resume(struct platform_device *pdev)
1177{ 1177{
1178 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1178 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1179 struct snd_soc_codec *codec = socdev->codec; 1179 struct snd_soc_codec *codec = socdev->card->codec;
1180 1180
1181 twl4030_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1181 twl4030_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1182 twl4030_set_bias_level(codec, codec->suspend_bias_level); 1182 twl4030_set_bias_level(codec, codec->suspend_bias_level);
@@ -1190,7 +1190,7 @@ static int twl4030_resume(struct platform_device *pdev)
1190 1190
1191static int twl4030_init(struct snd_soc_device *socdev) 1191static int twl4030_init(struct snd_soc_device *socdev)
1192{ 1192{
1193 struct snd_soc_codec *codec = socdev->codec; 1193 struct snd_soc_codec *codec = socdev->card->codec;
1194 int ret = 0; 1194 int ret = 0;
1195 1195
1196 printk(KERN_INFO "TWL4030 Audio Codec init \n"); 1196 printk(KERN_INFO "TWL4030 Audio Codec init \n");
@@ -1251,7 +1251,7 @@ static int twl4030_probe(struct platform_device *pdev)
1251 if (codec == NULL) 1251 if (codec == NULL)
1252 return -ENOMEM; 1252 return -ENOMEM;
1253 1253
1254 socdev->codec = codec; 1254 socdev->card->codec = codec;
1255 mutex_init(&codec->mutex); 1255 mutex_init(&codec->mutex);
1256 INIT_LIST_HEAD(&codec->dapm_widgets); 1256 INIT_LIST_HEAD(&codec->dapm_widgets);
1257 INIT_LIST_HEAD(&codec->dapm_paths); 1257 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -1265,7 +1265,7 @@ static int twl4030_probe(struct platform_device *pdev)
1265static int twl4030_remove(struct platform_device *pdev) 1265static int twl4030_remove(struct platform_device *pdev)
1266{ 1266{
1267 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1267 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1268 struct snd_soc_codec *codec = socdev->codec; 1268 struct snd_soc_codec *codec = socdev->card->codec;
1269 1269
1270 printk(KERN_INFO "TWL4030 Audio Codec remove\n"); 1270 printk(KERN_INFO "TWL4030 Audio Codec remove\n");
1271 snd_soc_free_pcms(socdev); 1271 snd_soc_free_pcms(socdev);
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index 277825d155a6..661599295ca7 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -173,7 +173,7 @@ static int uda134x_startup(struct snd_pcm_substream *substream,
173{ 173{
174 struct snd_soc_pcm_runtime *rtd = substream->private_data; 174 struct snd_soc_pcm_runtime *rtd = substream->private_data;
175 struct snd_soc_device *socdev = rtd->socdev; 175 struct snd_soc_device *socdev = rtd->socdev;
176 struct snd_soc_codec *codec = socdev->codec; 176 struct snd_soc_codec *codec = socdev->card->codec;
177 struct uda134x_priv *uda134x = codec->private_data; 177 struct uda134x_priv *uda134x = codec->private_data;
178 struct snd_pcm_runtime *master_runtime; 178 struct snd_pcm_runtime *master_runtime;
179 179
@@ -206,7 +206,7 @@ static void uda134x_shutdown(struct snd_pcm_substream *substream,
206{ 206{
207 struct snd_soc_pcm_runtime *rtd = substream->private_data; 207 struct snd_soc_pcm_runtime *rtd = substream->private_data;
208 struct snd_soc_device *socdev = rtd->socdev; 208 struct snd_soc_device *socdev = rtd->socdev;
209 struct snd_soc_codec *codec = socdev->codec; 209 struct snd_soc_codec *codec = socdev->card->codec;
210 struct uda134x_priv *uda134x = codec->private_data; 210 struct uda134x_priv *uda134x = codec->private_data;
211 211
212 if (uda134x->master_substream == substream) 212 if (uda134x->master_substream == substream)
@@ -221,7 +221,7 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream,
221{ 221{
222 struct snd_soc_pcm_runtime *rtd = substream->private_data; 222 struct snd_soc_pcm_runtime *rtd = substream->private_data;
223 struct snd_soc_device *socdev = rtd->socdev; 223 struct snd_soc_device *socdev = rtd->socdev;
224 struct snd_soc_codec *codec = socdev->codec; 224 struct snd_soc_codec *codec = socdev->card->codec;
225 struct uda134x_priv *uda134x = codec->private_data; 225 struct uda134x_priv *uda134x = codec->private_data;
226 u8 hw_params; 226 u8 hw_params;
227 227
@@ -492,11 +492,11 @@ static int uda134x_soc_probe(struct platform_device *pdev)
492 return -EINVAL; 492 return -EINVAL;
493 } 493 }
494 494
495 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 495 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
496 if (socdev->codec == NULL) 496 if (socdev->card->codec == NULL)
497 return ret; 497 return ret;
498 498
499 codec = socdev->codec; 499 codec = socdev->card->codec;
500 500
501 uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL); 501 uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL);
502 if (uda134x == NULL) 502 if (uda134x == NULL)
@@ -584,7 +584,7 @@ priv_err:
584static int uda134x_soc_remove(struct platform_device *pdev) 584static int uda134x_soc_remove(struct platform_device *pdev)
585{ 585{
586 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 586 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
587 struct snd_soc_codec *codec = socdev->codec; 587 struct snd_soc_codec *codec = socdev->card->codec;
588 588
589 uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 589 uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
590 uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF); 590 uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -604,7 +604,7 @@ static int uda134x_soc_suspend(struct platform_device *pdev,
604 pm_message_t state) 604 pm_message_t state)
605{ 605{
606 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 606 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
607 struct snd_soc_codec *codec = socdev->codec; 607 struct snd_soc_codec *codec = socdev->card->codec;
608 608
609 uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 609 uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
610 uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF); 610 uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -614,7 +614,7 @@ static int uda134x_soc_suspend(struct platform_device *pdev,
614static int uda134x_soc_resume(struct platform_device *pdev) 614static int uda134x_soc_resume(struct platform_device *pdev)
615{ 615{
616 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 616 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
617 struct snd_soc_codec *codec = socdev->codec; 617 struct snd_soc_codec *codec = socdev->card->codec;
618 618
619 uda134x_set_bias_level(codec, SND_SOC_BIAS_PREPARE); 619 uda134x_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
620 uda134x_set_bias_level(codec, SND_SOC_BIAS_ON); 620 uda134x_set_bias_level(codec, SND_SOC_BIAS_ON);
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index a957b4365b9d..98e4a6560f06 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -397,7 +397,7 @@ static int uda1380_pcm_prepare(struct snd_pcm_substream *substream,
397{ 397{
398 struct snd_soc_pcm_runtime *rtd = substream->private_data; 398 struct snd_soc_pcm_runtime *rtd = substream->private_data;
399 struct snd_soc_device *socdev = rtd->socdev; 399 struct snd_soc_device *socdev = rtd->socdev;
400 struct snd_soc_codec *codec = socdev->codec; 400 struct snd_soc_codec *codec = socdev->card->codec;
401 int reg, reg_start, reg_end, clk; 401 int reg, reg_start, reg_end, clk;
402 402
403 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 403 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
@@ -430,7 +430,7 @@ static int uda1380_pcm_hw_params(struct snd_pcm_substream *substream,
430{ 430{
431 struct snd_soc_pcm_runtime *rtd = substream->private_data; 431 struct snd_soc_pcm_runtime *rtd = substream->private_data;
432 struct snd_soc_device *socdev = rtd->socdev; 432 struct snd_soc_device *socdev = rtd->socdev;
433 struct snd_soc_codec *codec = socdev->codec; 433 struct snd_soc_codec *codec = socdev->card->codec;
434 u16 clk = uda1380_read_reg_cache(codec, UDA1380_CLK); 434 u16 clk = uda1380_read_reg_cache(codec, UDA1380_CLK);
435 435
436 /* set WSPLL power and divider if running from this clock */ 436 /* set WSPLL power and divider if running from this clock */
@@ -469,7 +469,7 @@ static void uda1380_pcm_shutdown(struct snd_pcm_substream *substream,
469{ 469{
470 struct snd_soc_pcm_runtime *rtd = substream->private_data; 470 struct snd_soc_pcm_runtime *rtd = substream->private_data;
471 struct snd_soc_device *socdev = rtd->socdev; 471 struct snd_soc_device *socdev = rtd->socdev;
472 struct snd_soc_codec *codec = socdev->codec; 472 struct snd_soc_codec *codec = socdev->card->codec;
473 u16 clk = uda1380_read_reg_cache(codec, UDA1380_CLK); 473 u16 clk = uda1380_read_reg_cache(codec, UDA1380_CLK);
474 474
475 /* shut down WSPLL power if running from this clock */ 475 /* shut down WSPLL power if running from this clock */
@@ -591,7 +591,7 @@ EXPORT_SYMBOL_GPL(uda1380_dai);
591static int uda1380_suspend(struct platform_device *pdev, pm_message_t state) 591static int uda1380_suspend(struct platform_device *pdev, pm_message_t state)
592{ 592{
593 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 593 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
594 struct snd_soc_codec *codec = socdev->codec; 594 struct snd_soc_codec *codec = socdev->card->codec;
595 595
596 uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF); 596 uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF);
597 return 0; 597 return 0;
@@ -600,7 +600,7 @@ static int uda1380_suspend(struct platform_device *pdev, pm_message_t state)
600static int uda1380_resume(struct platform_device *pdev) 600static int uda1380_resume(struct platform_device *pdev)
601{ 601{
602 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 602 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
603 struct snd_soc_codec *codec = socdev->codec; 603 struct snd_soc_codec *codec = socdev->card->codec;
604 int i; 604 int i;
605 u8 data[2]; 605 u8 data[2];
606 u16 *cache = codec->reg_cache; 606 u16 *cache = codec->reg_cache;
@@ -622,7 +622,7 @@ static int uda1380_resume(struct platform_device *pdev)
622 */ 622 */
623static int uda1380_init(struct snd_soc_device *socdev, int dac_clk) 623static int uda1380_init(struct snd_soc_device *socdev, int dac_clk)
624{ 624{
625 struct snd_soc_codec *codec = socdev->codec; 625 struct snd_soc_codec *codec = socdev->card->codec;
626 int ret = 0; 626 int ret = 0;
627 627
628 codec->name = "UDA1380"; 628 codec->name = "UDA1380";
@@ -688,7 +688,7 @@ static int uda1380_i2c_probe(struct i2c_client *i2c,
688{ 688{
689 struct snd_soc_device *socdev = uda1380_socdev; 689 struct snd_soc_device *socdev = uda1380_socdev;
690 struct uda1380_setup_data *setup = socdev->codec_data; 690 struct uda1380_setup_data *setup = socdev->codec_data;
691 struct snd_soc_codec *codec = socdev->codec; 691 struct snd_soc_codec *codec = socdev->card->codec;
692 int ret; 692 int ret;
693 693
694 i2c_set_clientdata(i2c, codec); 694 i2c_set_clientdata(i2c, codec);
@@ -779,7 +779,7 @@ static int uda1380_probe(struct platform_device *pdev)
779 if (codec == NULL) 779 if (codec == NULL)
780 return -ENOMEM; 780 return -ENOMEM;
781 781
782 socdev->codec = codec; 782 socdev->card->codec = codec;
783 mutex_init(&codec->mutex); 783 mutex_init(&codec->mutex);
784 INIT_LIST_HEAD(&codec->dapm_widgets); 784 INIT_LIST_HEAD(&codec->dapm_widgets);
785 INIT_LIST_HEAD(&codec->dapm_paths); 785 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -803,7 +803,7 @@ static int uda1380_probe(struct platform_device *pdev)
803static int uda1380_remove(struct platform_device *pdev) 803static int uda1380_remove(struct platform_device *pdev)
804{ 804{
805 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 805 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
806 struct snd_soc_codec *codec = socdev->codec; 806 struct snd_soc_codec *codec = socdev->card->codec;
807 807
808 if (codec->control_data) 808 if (codec->control_data)
809 uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF); 809 uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 2e0db29b4998..75d3438ccb87 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1301,7 +1301,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
1301static int wm8350_suspend(struct platform_device *pdev, pm_message_t state) 1301static int wm8350_suspend(struct platform_device *pdev, pm_message_t state)
1302{ 1302{
1303 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1303 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1304 struct snd_soc_codec *codec = socdev->codec; 1304 struct snd_soc_codec *codec = socdev->card->codec;
1305 1305
1306 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF); 1306 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF);
1307 return 0; 1307 return 0;
@@ -1310,7 +1310,7 @@ static int wm8350_suspend(struct platform_device *pdev, pm_message_t state)
1310static int wm8350_resume(struct platform_device *pdev) 1310static int wm8350_resume(struct platform_device *pdev)
1311{ 1311{
1312 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1312 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1313 struct snd_soc_codec *codec = socdev->codec; 1313 struct snd_soc_codec *codec = socdev->card->codec;
1314 1314
1315 wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1315 wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1316 1316
@@ -1423,8 +1423,8 @@ static int wm8350_probe(struct platform_device *pdev)
1423 1423
1424 BUG_ON(!wm8350_codec); 1424 BUG_ON(!wm8350_codec);
1425 1425
1426 socdev->codec = wm8350_codec; 1426 socdev->card->codec = wm8350_codec;
1427 codec = socdev->codec; 1427 codec = socdev->card->codec;
1428 wm8350 = codec->control_data; 1428 wm8350 = codec->control_data;
1429 priv = codec->private_data; 1429 priv = codec->private_data;
1430 1430
@@ -1498,7 +1498,7 @@ card_err:
1498static int wm8350_remove(struct platform_device *pdev) 1498static int wm8350_remove(struct platform_device *pdev)
1499{ 1499{
1500 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1500 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1501 struct snd_soc_codec *codec = socdev->codec; 1501 struct snd_soc_codec *codec = socdev->card->codec;
1502 struct wm8350 *wm8350 = codec->control_data; 1502 struct wm8350 *wm8350 = codec->control_data;
1503 struct wm8350_data *priv = codec->private_data; 1503 struct wm8350_data *priv = codec->private_data;
1504 int ret; 1504 int ret;
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index abe7cce87714..f01078cfbd72 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -452,7 +452,7 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream,
452{ 452{
453 struct snd_soc_pcm_runtime *rtd = substream->private_data; 453 struct snd_soc_pcm_runtime *rtd = substream->private_data;
454 struct snd_soc_device *socdev = rtd->socdev; 454 struct snd_soc_device *socdev = rtd->socdev;
455 struct snd_soc_codec *codec = socdev->codec; 455 struct snd_soc_codec *codec = socdev->card->codec;
456 u16 iface = wm8510_read_reg_cache(codec, WM8510_IFACE) & 0x19f; 456 u16 iface = wm8510_read_reg_cache(codec, WM8510_IFACE) & 0x19f;
457 u16 adn = wm8510_read_reg_cache(codec, WM8510_ADD) & 0x1f1; 457 u16 adn = wm8510_read_reg_cache(codec, WM8510_ADD) & 0x1f1;
458 458
@@ -581,7 +581,7 @@ EXPORT_SYMBOL_GPL(wm8510_dai);
581static int wm8510_suspend(struct platform_device *pdev, pm_message_t state) 581static int wm8510_suspend(struct platform_device *pdev, pm_message_t state)
582{ 582{
583 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 583 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
584 struct snd_soc_codec *codec = socdev->codec; 584 struct snd_soc_codec *codec = socdev->card->codec;
585 585
586 wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF); 586 wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF);
587 return 0; 587 return 0;
@@ -590,7 +590,7 @@ static int wm8510_suspend(struct platform_device *pdev, pm_message_t state)
590static int wm8510_resume(struct platform_device *pdev) 590static int wm8510_resume(struct platform_device *pdev)
591{ 591{
592 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 592 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
593 struct snd_soc_codec *codec = socdev->codec; 593 struct snd_soc_codec *codec = socdev->card->codec;
594 int i; 594 int i;
595 u8 data[2]; 595 u8 data[2];
596 u16 *cache = codec->reg_cache; 596 u16 *cache = codec->reg_cache;
@@ -612,7 +612,7 @@ static int wm8510_resume(struct platform_device *pdev)
612 */ 612 */
613static int wm8510_init(struct snd_soc_device *socdev) 613static int wm8510_init(struct snd_soc_device *socdev)
614{ 614{
615 struct snd_soc_codec *codec = socdev->codec; 615 struct snd_soc_codec *codec = socdev->card->codec;
616 int ret = 0; 616 int ret = 0;
617 617
618 codec->name = "WM8510"; 618 codec->name = "WM8510";
@@ -670,7 +670,7 @@ static int wm8510_i2c_probe(struct i2c_client *i2c,
670 const struct i2c_device_id *id) 670 const struct i2c_device_id *id)
671{ 671{
672 struct snd_soc_device *socdev = wm8510_socdev; 672 struct snd_soc_device *socdev = wm8510_socdev;
673 struct snd_soc_codec *codec = socdev->codec; 673 struct snd_soc_codec *codec = socdev->card->codec;
674 int ret; 674 int ret;
675 675
676 i2c_set_clientdata(i2c, codec); 676 i2c_set_clientdata(i2c, codec);
@@ -751,7 +751,7 @@ err_driver:
751static int __devinit wm8510_spi_probe(struct spi_device *spi) 751static int __devinit wm8510_spi_probe(struct spi_device *spi)
752{ 752{
753 struct snd_soc_device *socdev = wm8510_socdev; 753 struct snd_soc_device *socdev = wm8510_socdev;
754 struct snd_soc_codec *codec = socdev->codec; 754 struct snd_soc_codec *codec = socdev->card->codec;
755 int ret; 755 int ret;
756 756
757 codec->control_data = spi; 757 codec->control_data = spi;
@@ -817,7 +817,7 @@ static int wm8510_probe(struct platform_device *pdev)
817 if (codec == NULL) 817 if (codec == NULL)
818 return -ENOMEM; 818 return -ENOMEM;
819 819
820 socdev->codec = codec; 820 socdev->card->codec = codec;
821 mutex_init(&codec->mutex); 821 mutex_init(&codec->mutex);
822 INIT_LIST_HEAD(&codec->dapm_widgets); 822 INIT_LIST_HEAD(&codec->dapm_widgets);
823 INIT_LIST_HEAD(&codec->dapm_paths); 823 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -847,7 +847,7 @@ static int wm8510_probe(struct platform_device *pdev)
847static int wm8510_remove(struct platform_device *pdev) 847static int wm8510_remove(struct platform_device *pdev)
848{ 848{
849 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 849 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
850 struct snd_soc_codec *codec = socdev->codec; 850 struct snd_soc_codec *codec = socdev->card->codec;
851 851
852 if (codec->control_data) 852 if (codec->control_data)
853 wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF); 853 wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 3faf0e70ce10..d3c51ba5e6f9 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -539,7 +539,7 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream,
539{ 539{
540 struct snd_soc_pcm_runtime *rtd = substream->private_data; 540 struct snd_soc_pcm_runtime *rtd = substream->private_data;
541 struct snd_soc_device *socdev = rtd->socdev; 541 struct snd_soc_device *socdev = rtd->socdev;
542 struct snd_soc_codec *codec = socdev->codec; 542 struct snd_soc_codec *codec = socdev->card->codec;
543 u16 paifb = wm8580_read(codec, WM8580_PAIF3 + dai->id); 543 u16 paifb = wm8580_read(codec, WM8580_PAIF3 + dai->id);
544 544
545 paifb &= ~WM8580_AIF_LENGTH_MASK; 545 paifb &= ~WM8580_AIF_LENGTH_MASK;
@@ -816,7 +816,7 @@ EXPORT_SYMBOL_GPL(wm8580_dai);
816 */ 816 */
817static int wm8580_init(struct snd_soc_device *socdev) 817static int wm8580_init(struct snd_soc_device *socdev)
818{ 818{
819 struct snd_soc_codec *codec = socdev->codec; 819 struct snd_soc_codec *codec = socdev->card->codec;
820 int ret = 0; 820 int ret = 0;
821 821
822 codec->name = "WM8580"; 822 codec->name = "WM8580";
@@ -888,7 +888,7 @@ static int wm8580_i2c_probe(struct i2c_client *i2c,
888 const struct i2c_device_id *id) 888 const struct i2c_device_id *id)
889{ 889{
890 struct snd_soc_device *socdev = wm8580_socdev; 890 struct snd_soc_device *socdev = wm8580_socdev;
891 struct snd_soc_codec *codec = socdev->codec; 891 struct snd_soc_codec *codec = socdev->card->codec;
892 int ret; 892 int ret;
893 893
894 i2c_set_clientdata(i2c, codec); 894 i2c_set_clientdata(i2c, codec);
@@ -986,7 +986,7 @@ static int wm8580_probe(struct platform_device *pdev)
986 } 986 }
987 987
988 codec->private_data = wm8580; 988 codec->private_data = wm8580;
989 socdev->codec = codec; 989 socdev->card->codec = codec;
990 mutex_init(&codec->mutex); 990 mutex_init(&codec->mutex);
991 INIT_LIST_HEAD(&codec->dapm_widgets); 991 INIT_LIST_HEAD(&codec->dapm_widgets);
992 INIT_LIST_HEAD(&codec->dapm_paths); 992 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -1007,7 +1007,7 @@ static int wm8580_probe(struct platform_device *pdev)
1007static int wm8580_remove(struct platform_device *pdev) 1007static int wm8580_remove(struct platform_device *pdev)
1008{ 1008{
1009 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1009 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1010 struct snd_soc_codec *codec = socdev->codec; 1010 struct snd_soc_codec *codec = socdev->card->codec;
1011 1011
1012 if (codec->control_data) 1012 if (codec->control_data)
1013 wm8580_set_bias_level(codec, SND_SOC_BIAS_OFF); 1013 wm8580_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c
index f90dc52e975d..f8363b308895 100644
--- a/sound/soc/codecs/wm8728.c
+++ b/sound/soc/codecs/wm8728.c
@@ -137,7 +137,7 @@ static int wm8728_hw_params(struct snd_pcm_substream *substream,
137{ 137{
138 struct snd_soc_pcm_runtime *rtd = substream->private_data; 138 struct snd_soc_pcm_runtime *rtd = substream->private_data;
139 struct snd_soc_device *socdev = rtd->socdev; 139 struct snd_soc_device *socdev = rtd->socdev;
140 struct snd_soc_codec *codec = socdev->codec; 140 struct snd_soc_codec *codec = socdev->card->codec;
141 u16 dac = wm8728_read_reg_cache(codec, WM8728_DACCTL); 141 u16 dac = wm8728_read_reg_cache(codec, WM8728_DACCTL);
142 142
143 dac &= ~0x18; 143 dac &= ~0x18;
@@ -264,7 +264,7 @@ EXPORT_SYMBOL_GPL(wm8728_dai);
264static int wm8728_suspend(struct platform_device *pdev, pm_message_t state) 264static int wm8728_suspend(struct platform_device *pdev, pm_message_t state)
265{ 265{
266 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 266 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
267 struct snd_soc_codec *codec = socdev->codec; 267 struct snd_soc_codec *codec = socdev->card->codec;
268 268
269 wm8728_set_bias_level(codec, SND_SOC_BIAS_OFF); 269 wm8728_set_bias_level(codec, SND_SOC_BIAS_OFF);
270 270
@@ -274,7 +274,7 @@ static int wm8728_suspend(struct platform_device *pdev, pm_message_t state)
274static int wm8728_resume(struct platform_device *pdev) 274static int wm8728_resume(struct platform_device *pdev)
275{ 275{
276 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 276 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
277 struct snd_soc_codec *codec = socdev->codec; 277 struct snd_soc_codec *codec = socdev->card->codec;
278 278
279 wm8728_set_bias_level(codec, codec->suspend_bias_level); 279 wm8728_set_bias_level(codec, codec->suspend_bias_level);
280 280
@@ -287,7 +287,7 @@ static int wm8728_resume(struct platform_device *pdev)
287 */ 287 */
288static int wm8728_init(struct snd_soc_device *socdev) 288static int wm8728_init(struct snd_soc_device *socdev)
289{ 289{
290 struct snd_soc_codec *codec = socdev->codec; 290 struct snd_soc_codec *codec = socdev->card->codec;
291 int ret = 0; 291 int ret = 0;
292 292
293 codec->name = "WM8728"; 293 codec->name = "WM8728";
@@ -349,7 +349,7 @@ static int wm8728_i2c_probe(struct i2c_client *i2c,
349 const struct i2c_device_id *id) 349 const struct i2c_device_id *id)
350{ 350{
351 struct snd_soc_device *socdev = wm8728_socdev; 351 struct snd_soc_device *socdev = wm8728_socdev;
352 struct snd_soc_codec *codec = socdev->codec; 352 struct snd_soc_codec *codec = socdev->card->codec;
353 int ret; 353 int ret;
354 354
355 i2c_set_clientdata(i2c, codec); 355 i2c_set_clientdata(i2c, codec);
@@ -430,7 +430,7 @@ err_driver:
430static int __devinit wm8728_spi_probe(struct spi_device *spi) 430static int __devinit wm8728_spi_probe(struct spi_device *spi)
431{ 431{
432 struct snd_soc_device *socdev = wm8728_socdev; 432 struct snd_soc_device *socdev = wm8728_socdev;
433 struct snd_soc_codec *codec = socdev->codec; 433 struct snd_soc_codec *codec = socdev->card->codec;
434 int ret; 434 int ret;
435 435
436 codec->control_data = spi; 436 codec->control_data = spi;
@@ -494,7 +494,7 @@ static int wm8728_probe(struct platform_device *pdev)
494 if (codec == NULL) 494 if (codec == NULL)
495 return -ENOMEM; 495 return -ENOMEM;
496 496
497 socdev->codec = codec; 497 socdev->card->codec = codec;
498 mutex_init(&codec->mutex); 498 mutex_init(&codec->mutex);
499 INIT_LIST_HEAD(&codec->dapm_widgets); 499 INIT_LIST_HEAD(&codec->dapm_widgets);
500 INIT_LIST_HEAD(&codec->dapm_paths); 500 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -527,7 +527,7 @@ static int wm8728_probe(struct platform_device *pdev)
527static int wm8728_remove(struct platform_device *pdev) 527static int wm8728_remove(struct platform_device *pdev)
528{ 528{
529 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 529 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
530 struct snd_soc_codec *codec = socdev->codec; 530 struct snd_soc_codec *codec = socdev->card->codec;
531 531
532 if (codec->control_data) 532 if (codec->control_data)
533 wm8728_set_bias_level(codec, SND_SOC_BIAS_OFF); 533 wm8728_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 96d6e1aeaf43..0150fe53a65d 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -253,7 +253,7 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream,
253{ 253{
254 struct snd_soc_pcm_runtime *rtd = substream->private_data; 254 struct snd_soc_pcm_runtime *rtd = substream->private_data;
255 struct snd_soc_device *socdev = rtd->socdev; 255 struct snd_soc_device *socdev = rtd->socdev;
256 struct snd_soc_codec *codec = socdev->codec; 256 struct snd_soc_codec *codec = socdev->card->codec;
257 struct wm8731_priv *wm8731 = codec->private_data; 257 struct wm8731_priv *wm8731 = codec->private_data;
258 u16 iface = wm8731_read_reg_cache(codec, WM8731_IFACE) & 0xfff3; 258 u16 iface = wm8731_read_reg_cache(codec, WM8731_IFACE) & 0xfff3;
259 int i = get_coeff(wm8731->sysclk, params_rate(params)); 259 int i = get_coeff(wm8731->sysclk, params_rate(params));
@@ -283,7 +283,7 @@ static int wm8731_pcm_prepare(struct snd_pcm_substream *substream,
283{ 283{
284 struct snd_soc_pcm_runtime *rtd = substream->private_data; 284 struct snd_soc_pcm_runtime *rtd = substream->private_data;
285 struct snd_soc_device *socdev = rtd->socdev; 285 struct snd_soc_device *socdev = rtd->socdev;
286 struct snd_soc_codec *codec = socdev->codec; 286 struct snd_soc_codec *codec = socdev->card->codec;
287 287
288 /* set active */ 288 /* set active */
289 wm8731_write(codec, WM8731_ACTIVE, 0x0001); 289 wm8731_write(codec, WM8731_ACTIVE, 0x0001);
@@ -296,7 +296,7 @@ static void wm8731_shutdown(struct snd_pcm_substream *substream,
296{ 296{
297 struct snd_soc_pcm_runtime *rtd = substream->private_data; 297 struct snd_soc_pcm_runtime *rtd = substream->private_data;
298 struct snd_soc_device *socdev = rtd->socdev; 298 struct snd_soc_device *socdev = rtd->socdev;
299 struct snd_soc_codec *codec = socdev->codec; 299 struct snd_soc_codec *codec = socdev->card->codec;
300 300
301 /* deactivate */ 301 /* deactivate */
302 if (!codec->active) { 302 if (!codec->active) {
@@ -458,7 +458,7 @@ EXPORT_SYMBOL_GPL(wm8731_dai);
458static int wm8731_suspend(struct platform_device *pdev, pm_message_t state) 458static int wm8731_suspend(struct platform_device *pdev, pm_message_t state)
459{ 459{
460 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 460 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
461 struct snd_soc_codec *codec = socdev->codec; 461 struct snd_soc_codec *codec = socdev->card->codec;
462 462
463 wm8731_write(codec, WM8731_ACTIVE, 0x0); 463 wm8731_write(codec, WM8731_ACTIVE, 0x0);
464 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF); 464 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -468,7 +468,7 @@ static int wm8731_suspend(struct platform_device *pdev, pm_message_t state)
468static int wm8731_resume(struct platform_device *pdev) 468static int wm8731_resume(struct platform_device *pdev)
469{ 469{
470 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 470 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
471 struct snd_soc_codec *codec = socdev->codec; 471 struct snd_soc_codec *codec = socdev->card->codec;
472 int i; 472 int i;
473 u8 data[2]; 473 u8 data[2];
474 u16 *cache = codec->reg_cache; 474 u16 *cache = codec->reg_cache;
@@ -490,7 +490,7 @@ static int wm8731_resume(struct platform_device *pdev)
490 */ 490 */
491static int wm8731_init(struct snd_soc_device *socdev) 491static int wm8731_init(struct snd_soc_device *socdev)
492{ 492{
493 struct snd_soc_codec *codec = socdev->codec; 493 struct snd_soc_codec *codec = socdev->card->codec;
494 int reg, ret = 0; 494 int reg, ret = 0;
495 495
496 codec->name = "WM8731"; 496 codec->name = "WM8731";
@@ -561,7 +561,7 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
561 const struct i2c_device_id *id) 561 const struct i2c_device_id *id)
562{ 562{
563 struct snd_soc_device *socdev = wm8731_socdev; 563 struct snd_soc_device *socdev = wm8731_socdev;
564 struct snd_soc_codec *codec = socdev->codec; 564 struct snd_soc_codec *codec = socdev->card->codec;
565 int ret; 565 int ret;
566 566
567 i2c_set_clientdata(i2c, codec); 567 i2c_set_clientdata(i2c, codec);
@@ -642,7 +642,7 @@ err_driver:
642static int __devinit wm8731_spi_probe(struct spi_device *spi) 642static int __devinit wm8731_spi_probe(struct spi_device *spi)
643{ 643{
644 struct snd_soc_device *socdev = wm8731_socdev; 644 struct snd_soc_device *socdev = wm8731_socdev;
645 struct snd_soc_codec *codec = socdev->codec; 645 struct snd_soc_codec *codec = socdev->card->codec;
646 int ret; 646 int ret;
647 647
648 codec->control_data = spi; 648 codec->control_data = spi;
@@ -716,7 +716,7 @@ static int wm8731_probe(struct platform_device *pdev)
716 } 716 }
717 717
718 codec->private_data = wm8731; 718 codec->private_data = wm8731;
719 socdev->codec = codec; 719 socdev->card->codec = codec;
720 mutex_init(&codec->mutex); 720 mutex_init(&codec->mutex);
721 INIT_LIST_HEAD(&codec->dapm_widgets); 721 INIT_LIST_HEAD(&codec->dapm_widgets);
722 INIT_LIST_HEAD(&codec->dapm_paths); 722 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -750,7 +750,7 @@ static int wm8731_probe(struct platform_device *pdev)
750static int wm8731_remove(struct platform_device *pdev) 750static int wm8731_remove(struct platform_device *pdev)
751{ 751{
752 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 752 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
753 struct snd_soc_codec *codec = socdev->codec; 753 struct snd_soc_codec *codec = socdev->card->codec;
754 754
755 if (codec->control_data) 755 if (codec->control_data)
756 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF); 756 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 1578569793a2..96afb86addc6 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -604,7 +604,7 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream,
604{ 604{
605 struct snd_soc_pcm_runtime *rtd = substream->private_data; 605 struct snd_soc_pcm_runtime *rtd = substream->private_data;
606 struct snd_soc_device *socdev = rtd->socdev; 606 struct snd_soc_device *socdev = rtd->socdev;
607 struct snd_soc_codec *codec = socdev->codec; 607 struct snd_soc_codec *codec = socdev->card->codec;
608 struct wm8750_priv *wm8750 = codec->private_data; 608 struct wm8750_priv *wm8750 = codec->private_data;
609 u16 iface = wm8750_read_reg_cache(codec, WM8750_IFACE) & 0x1f3; 609 u16 iface = wm8750_read_reg_cache(codec, WM8750_IFACE) & 0x1f3;
610 u16 srate = wm8750_read_reg_cache(codec, WM8750_SRATE) & 0x1c0; 610 u16 srate = wm8750_read_reg_cache(codec, WM8750_SRATE) & 0x1c0;
@@ -712,7 +712,7 @@ static void wm8750_work(struct work_struct *work)
712static int wm8750_suspend(struct platform_device *pdev, pm_message_t state) 712static int wm8750_suspend(struct platform_device *pdev, pm_message_t state)
713{ 713{
714 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 714 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
715 struct snd_soc_codec *codec = socdev->codec; 715 struct snd_soc_codec *codec = socdev->card->codec;
716 716
717 wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); 717 wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF);
718 return 0; 718 return 0;
@@ -721,7 +721,7 @@ static int wm8750_suspend(struct platform_device *pdev, pm_message_t state)
721static int wm8750_resume(struct platform_device *pdev) 721static int wm8750_resume(struct platform_device *pdev)
722{ 722{
723 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 723 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
724 struct snd_soc_codec *codec = socdev->codec; 724 struct snd_soc_codec *codec = socdev->card->codec;
725 int i; 725 int i;
726 u8 data[2]; 726 u8 data[2];
727 u16 *cache = codec->reg_cache; 727 u16 *cache = codec->reg_cache;
@@ -754,7 +754,7 @@ static int wm8750_resume(struct platform_device *pdev)
754 */ 754 */
755static int wm8750_init(struct snd_soc_device *socdev) 755static int wm8750_init(struct snd_soc_device *socdev)
756{ 756{
757 struct snd_soc_codec *codec = socdev->codec; 757 struct snd_soc_codec *codec = socdev->card->codec;
758 int reg, ret = 0; 758 int reg, ret = 0;
759 759
760 codec->name = "WM8750"; 760 codec->name = "WM8750";
@@ -836,7 +836,7 @@ static int wm8750_i2c_probe(struct i2c_client *i2c,
836 const struct i2c_device_id *id) 836 const struct i2c_device_id *id)
837{ 837{
838 struct snd_soc_device *socdev = wm8750_socdev; 838 struct snd_soc_device *socdev = wm8750_socdev;
839 struct snd_soc_codec *codec = socdev->codec; 839 struct snd_soc_codec *codec = socdev->card->codec;
840 int ret; 840 int ret;
841 841
842 i2c_set_clientdata(i2c, codec); 842 i2c_set_clientdata(i2c, codec);
@@ -917,7 +917,7 @@ err_driver:
917static int __devinit wm8750_spi_probe(struct spi_device *spi) 917static int __devinit wm8750_spi_probe(struct spi_device *spi)
918{ 918{
919 struct snd_soc_device *socdev = wm8750_socdev; 919 struct snd_soc_device *socdev = wm8750_socdev;
920 struct snd_soc_codec *codec = socdev->codec; 920 struct snd_soc_codec *codec = socdev->card->codec;
921 int ret; 921 int ret;
922 922
923 codec->control_data = spi; 923 codec->control_data = spi;
@@ -989,7 +989,7 @@ static int wm8750_probe(struct platform_device *pdev)
989 } 989 }
990 990
991 codec->private_data = wm8750; 991 codec->private_data = wm8750;
992 socdev->codec = codec; 992 socdev->card->codec = codec;
993 mutex_init(&codec->mutex); 993 mutex_init(&codec->mutex);
994 INIT_LIST_HEAD(&codec->dapm_widgets); 994 INIT_LIST_HEAD(&codec->dapm_widgets);
995 INIT_LIST_HEAD(&codec->dapm_paths); 995 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -1043,7 +1043,7 @@ static int run_delayed_work(struct delayed_work *dwork)
1043static int wm8750_remove(struct platform_device *pdev) 1043static int wm8750_remove(struct platform_device *pdev)
1044{ 1044{
1045 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1045 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1046 struct snd_soc_codec *codec = socdev->codec; 1046 struct snd_soc_codec *codec = socdev->card->codec;
1047 1047
1048 if (codec->control_data) 1048 if (codec->control_data)
1049 wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); 1049 wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 5a1c1fca120f..502766dce861 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -912,7 +912,7 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream,
912{ 912{
913 struct snd_soc_pcm_runtime *rtd = substream->private_data; 913 struct snd_soc_pcm_runtime *rtd = substream->private_data;
914 struct snd_soc_device *socdev = rtd->socdev; 914 struct snd_soc_device *socdev = rtd->socdev;
915 struct snd_soc_codec *codec = socdev->codec; 915 struct snd_soc_codec *codec = socdev->card->codec;
916 struct wm8753_priv *wm8753 = codec->private_data; 916 struct wm8753_priv *wm8753 = codec->private_data;
917 u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01f3; 917 u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01f3;
918 u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x017f; 918 u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x017f;
@@ -1146,7 +1146,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream,
1146{ 1146{
1147 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1147 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1148 struct snd_soc_device *socdev = rtd->socdev; 1148 struct snd_soc_device *socdev = rtd->socdev;
1149 struct snd_soc_codec *codec = socdev->codec; 1149 struct snd_soc_codec *codec = socdev->card->codec;
1150 struct wm8753_priv *wm8753 = codec->private_data; 1150 struct wm8753_priv *wm8753 = codec->private_data;
1151 u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x01c0; 1151 u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x01c0;
1152 u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01f3; 1152 u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01f3;
@@ -1483,7 +1483,7 @@ static void wm8753_work(struct work_struct *work)
1483static int wm8753_suspend(struct platform_device *pdev, pm_message_t state) 1483static int wm8753_suspend(struct platform_device *pdev, pm_message_t state)
1484{ 1484{
1485 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1485 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1486 struct snd_soc_codec *codec = socdev->codec; 1486 struct snd_soc_codec *codec = socdev->card->codec;
1487 1487
1488 /* we only need to suspend if we are a valid card */ 1488 /* we only need to suspend if we are a valid card */
1489 if (!codec->card) 1489 if (!codec->card)
@@ -1496,7 +1496,7 @@ static int wm8753_suspend(struct platform_device *pdev, pm_message_t state)
1496static int wm8753_resume(struct platform_device *pdev) 1496static int wm8753_resume(struct platform_device *pdev)
1497{ 1497{
1498 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1498 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1499 struct snd_soc_codec *codec = socdev->codec; 1499 struct snd_soc_codec *codec = socdev->card->codec;
1500 int i; 1500 int i;
1501 u8 data[2]; 1501 u8 data[2];
1502 u16 *cache = codec->reg_cache; 1502 u16 *cache = codec->reg_cache;
@@ -1533,7 +1533,7 @@ static int wm8753_resume(struct platform_device *pdev)
1533 */ 1533 */
1534static int wm8753_init(struct snd_soc_device *socdev) 1534static int wm8753_init(struct snd_soc_device *socdev)
1535{ 1535{
1536 struct snd_soc_codec *codec = socdev->codec; 1536 struct snd_soc_codec *codec = socdev->card->codec;
1537 int reg, ret = 0; 1537 int reg, ret = 0;
1538 1538
1539 codec->name = "WM8753"; 1539 codec->name = "WM8753";
@@ -1624,7 +1624,7 @@ static int wm8753_i2c_probe(struct i2c_client *i2c,
1624 const struct i2c_device_id *id) 1624 const struct i2c_device_id *id)
1625{ 1625{
1626 struct snd_soc_device *socdev = wm8753_socdev; 1626 struct snd_soc_device *socdev = wm8753_socdev;
1627 struct snd_soc_codec *codec = socdev->codec; 1627 struct snd_soc_codec *codec = socdev->card->codec;
1628 int ret; 1628 int ret;
1629 1629
1630 i2c_set_clientdata(i2c, codec); 1630 i2c_set_clientdata(i2c, codec);
@@ -1705,7 +1705,7 @@ err_driver:
1705static int __devinit wm8753_spi_probe(struct spi_device *spi) 1705static int __devinit wm8753_spi_probe(struct spi_device *spi)
1706{ 1706{
1707 struct snd_soc_device *socdev = wm8753_socdev; 1707 struct snd_soc_device *socdev = wm8753_socdev;
1708 struct snd_soc_codec *codec = socdev->codec; 1708 struct snd_soc_codec *codec = socdev->card->codec;
1709 int ret; 1709 int ret;
1710 1710
1711 codec->control_data = spi; 1711 codec->control_data = spi;
@@ -1780,7 +1780,7 @@ static int wm8753_probe(struct platform_device *pdev)
1780 } 1780 }
1781 1781
1782 codec->private_data = wm8753; 1782 codec->private_data = wm8753;
1783 socdev->codec = codec; 1783 socdev->card->codec = codec;
1784 mutex_init(&codec->mutex); 1784 mutex_init(&codec->mutex);
1785 INIT_LIST_HEAD(&codec->dapm_widgets); 1785 INIT_LIST_HEAD(&codec->dapm_widgets);
1786 INIT_LIST_HEAD(&codec->dapm_paths); 1786 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -1832,7 +1832,7 @@ static int run_delayed_work(struct delayed_work *dwork)
1832static int wm8753_remove(struct platform_device *pdev) 1832static int wm8753_remove(struct platform_device *pdev)
1833{ 1833{
1834 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1834 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1835 struct snd_soc_codec *codec = socdev->codec; 1835 struct snd_soc_codec *codec = socdev->card->codec;
1836 1836
1837 if (codec->control_data) 1837 if (codec->control_data)
1838 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); 1838 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index 1e08d4f065f2..85c0f1bc6766 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -720,7 +720,7 @@ static int wm8900_hw_params(struct snd_pcm_substream *substream,
720{ 720{
721 struct snd_soc_pcm_runtime *rtd = substream->private_data; 721 struct snd_soc_pcm_runtime *rtd = substream->private_data;
722 struct snd_soc_device *socdev = rtd->socdev; 722 struct snd_soc_device *socdev = rtd->socdev;
723 struct snd_soc_codec *codec = socdev->codec; 723 struct snd_soc_codec *codec = socdev->card->codec;
724 u16 reg; 724 u16 reg;
725 725
726 reg = wm8900_read(codec, WM8900_REG_AUDIO1) & ~0x60; 726 reg = wm8900_read(codec, WM8900_REG_AUDIO1) & ~0x60;
@@ -1210,7 +1210,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec,
1210static int wm8900_suspend(struct platform_device *pdev, pm_message_t state) 1210static int wm8900_suspend(struct platform_device *pdev, pm_message_t state)
1211{ 1211{
1212 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1212 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1213 struct snd_soc_codec *codec = socdev->codec; 1213 struct snd_soc_codec *codec = socdev->card->codec;
1214 struct wm8900_priv *wm8900 = codec->private_data; 1214 struct wm8900_priv *wm8900 = codec->private_data;
1215 int fll_out = wm8900->fll_out; 1215 int fll_out = wm8900->fll_out;
1216 int fll_in = wm8900->fll_in; 1216 int fll_in = wm8900->fll_in;
@@ -1234,7 +1234,7 @@ static int wm8900_suspend(struct platform_device *pdev, pm_message_t state)
1234static int wm8900_resume(struct platform_device *pdev) 1234static int wm8900_resume(struct platform_device *pdev)
1235{ 1235{
1236 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1236 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1237 struct snd_soc_codec *codec = socdev->codec; 1237 struct snd_soc_codec *codec = socdev->card->codec;
1238 struct wm8900_priv *wm8900 = codec->private_data; 1238 struct wm8900_priv *wm8900 = codec->private_data;
1239 u16 *cache; 1239 u16 *cache;
1240 int i, ret; 1240 int i, ret;
@@ -1414,7 +1414,7 @@ static int wm8900_probe(struct platform_device *pdev)
1414 } 1414 }
1415 1415
1416 codec = wm8900_codec; 1416 codec = wm8900_codec;
1417 socdev->codec = codec; 1417 socdev->card->codec = codec;
1418 1418
1419 /* Register pcms */ 1419 /* Register pcms */
1420 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1420 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 6ff34b957dce..d36b2b1edf19 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1261,7 +1261,7 @@ static int wm8903_startup(struct snd_pcm_substream *substream,
1261{ 1261{
1262 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1262 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1263 struct snd_soc_device *socdev = rtd->socdev; 1263 struct snd_soc_device *socdev = rtd->socdev;
1264 struct snd_soc_codec *codec = socdev->codec; 1264 struct snd_soc_codec *codec = socdev->card->codec;
1265 struct wm8903_priv *wm8903 = codec->private_data; 1265 struct wm8903_priv *wm8903 = codec->private_data;
1266 struct i2c_client *i2c = codec->control_data; 1266 struct i2c_client *i2c = codec->control_data;
1267 struct snd_pcm_runtime *master_runtime; 1267 struct snd_pcm_runtime *master_runtime;
@@ -1303,7 +1303,7 @@ static void wm8903_shutdown(struct snd_pcm_substream *substream,
1303{ 1303{
1304 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1304 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1305 struct snd_soc_device *socdev = rtd->socdev; 1305 struct snd_soc_device *socdev = rtd->socdev;
1306 struct snd_soc_codec *codec = socdev->codec; 1306 struct snd_soc_codec *codec = socdev->card->codec;
1307 struct wm8903_priv *wm8903 = codec->private_data; 1307 struct wm8903_priv *wm8903 = codec->private_data;
1308 1308
1309 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 1309 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -1323,7 +1323,7 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
1323{ 1323{
1324 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1324 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1325 struct snd_soc_device *socdev = rtd->socdev; 1325 struct snd_soc_device *socdev = rtd->socdev;
1326 struct snd_soc_codec *codec = socdev->codec; 1326 struct snd_soc_codec *codec = socdev->card->codec;
1327 struct wm8903_priv *wm8903 = codec->private_data; 1327 struct wm8903_priv *wm8903 = codec->private_data;
1328 struct i2c_client *i2c = codec->control_data; 1328 struct i2c_client *i2c = codec->control_data;
1329 int fs = params_rate(params); 1329 int fs = params_rate(params);
@@ -1527,7 +1527,7 @@ EXPORT_SYMBOL_GPL(wm8903_dai);
1527static int wm8903_suspend(struct platform_device *pdev, pm_message_t state) 1527static int wm8903_suspend(struct platform_device *pdev, pm_message_t state)
1528{ 1528{
1529 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1529 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1530 struct snd_soc_codec *codec = socdev->codec; 1530 struct snd_soc_codec *codec = socdev->card->codec;
1531 1531
1532 wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF); 1532 wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF);
1533 1533
@@ -1537,7 +1537,7 @@ static int wm8903_suspend(struct platform_device *pdev, pm_message_t state)
1537static int wm8903_resume(struct platform_device *pdev) 1537static int wm8903_resume(struct platform_device *pdev)
1538{ 1538{
1539 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1539 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1540 struct snd_soc_codec *codec = socdev->codec; 1540 struct snd_soc_codec *codec = socdev->card->codec;
1541 struct i2c_client *i2c = codec->control_data; 1541 struct i2c_client *i2c = codec->control_data;
1542 int i; 1542 int i;
1543 u16 *reg_cache = codec->reg_cache; 1543 u16 *reg_cache = codec->reg_cache;
@@ -1713,7 +1713,7 @@ static int wm8903_probe(struct platform_device *pdev)
1713 goto err; 1713 goto err;
1714 } 1714 }
1715 1715
1716 socdev->codec = wm8903_codec; 1716 socdev->card->codec = wm8903_codec;
1717 1717
1718 /* register pcms */ 1718 /* register pcms */
1719 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1719 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
@@ -1722,9 +1722,9 @@ static int wm8903_probe(struct platform_device *pdev)
1722 goto err; 1722 goto err;
1723 } 1723 }
1724 1724
1725 snd_soc_add_controls(socdev->codec, wm8903_snd_controls, 1725 snd_soc_add_controls(socdev->card->codec, wm8903_snd_controls,
1726 ARRAY_SIZE(wm8903_snd_controls)); 1726 ARRAY_SIZE(wm8903_snd_controls));
1727 wm8903_add_widgets(socdev->codec); 1727 wm8903_add_widgets(socdev->card->codec);
1728 1728
1729 ret = snd_soc_init_card(socdev); 1729 ret = snd_soc_init_card(socdev);
1730 if (ret < 0) { 1730 if (ret < 0) {
@@ -1745,7 +1745,7 @@ err:
1745static int wm8903_remove(struct platform_device *pdev) 1745static int wm8903_remove(struct platform_device *pdev)
1746{ 1746{
1747 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1747 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1748 struct snd_soc_codec *codec = socdev->codec; 1748 struct snd_soc_codec *codec = socdev->card->codec;
1749 1749
1750 if (codec->control_data) 1750 if (codec->control_data)
1751 wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF); 1751 wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index c8bd9b06f330..24d4c905a011 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -531,7 +531,7 @@ static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream,
531{ 531{
532 struct snd_soc_pcm_runtime *rtd = substream->private_data; 532 struct snd_soc_pcm_runtime *rtd = substream->private_data;
533 struct snd_soc_device *socdev = rtd->socdev; 533 struct snd_soc_device *socdev = rtd->socdev;
534 struct snd_soc_codec *codec = socdev->codec; 534 struct snd_soc_codec *codec = socdev->card->codec;
535 struct wm8971_priv *wm8971 = codec->private_data; 535 struct wm8971_priv *wm8971 = codec->private_data;
536 u16 iface = wm8971_read_reg_cache(codec, WM8971_IFACE) & 0x1f3; 536 u16 iface = wm8971_read_reg_cache(codec, WM8971_IFACE) & 0x1f3;
537 u16 srate = wm8971_read_reg_cache(codec, WM8971_SRATE) & 0x1c0; 537 u16 srate = wm8971_read_reg_cache(codec, WM8971_SRATE) & 0x1c0;
@@ -637,7 +637,7 @@ static void wm8971_work(struct work_struct *work)
637static int wm8971_suspend(struct platform_device *pdev, pm_message_t state) 637static int wm8971_suspend(struct platform_device *pdev, pm_message_t state)
638{ 638{
639 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 639 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
640 struct snd_soc_codec *codec = socdev->codec; 640 struct snd_soc_codec *codec = socdev->card->codec;
641 641
642 wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF); 642 wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF);
643 return 0; 643 return 0;
@@ -646,7 +646,7 @@ static int wm8971_suspend(struct platform_device *pdev, pm_message_t state)
646static int wm8971_resume(struct platform_device *pdev) 646static int wm8971_resume(struct platform_device *pdev)
647{ 647{
648 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 648 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
649 struct snd_soc_codec *codec = socdev->codec; 649 struct snd_soc_codec *codec = socdev->card->codec;
650 int i; 650 int i;
651 u8 data[2]; 651 u8 data[2];
652 u16 *cache = codec->reg_cache; 652 u16 *cache = codec->reg_cache;
@@ -677,7 +677,7 @@ static int wm8971_resume(struct platform_device *pdev)
677 677
678static int wm8971_init(struct snd_soc_device *socdev) 678static int wm8971_init(struct snd_soc_device *socdev)
679{ 679{
680 struct snd_soc_codec *codec = socdev->codec; 680 struct snd_soc_codec *codec = socdev->card->codec;
681 int reg, ret = 0; 681 int reg, ret = 0;
682 682
683 codec->name = "WM8971"; 683 codec->name = "WM8971";
@@ -758,7 +758,7 @@ static int wm8971_i2c_probe(struct i2c_client *i2c,
758 const struct i2c_device_id *id) 758 const struct i2c_device_id *id)
759{ 759{
760 struct snd_soc_device *socdev = wm8971_socdev; 760 struct snd_soc_device *socdev = wm8971_socdev;
761 struct snd_soc_codec *codec = socdev->codec; 761 struct snd_soc_codec *codec = socdev->card->codec;
762 int ret; 762 int ret;
763 763
764 i2c_set_clientdata(i2c, codec); 764 i2c_set_clientdata(i2c, codec);
@@ -859,7 +859,7 @@ static int wm8971_probe(struct platform_device *pdev)
859 } 859 }
860 860
861 codec->private_data = wm8971; 861 codec->private_data = wm8971;
862 socdev->codec = codec; 862 socdev->card->codec = codec;
863 mutex_init(&codec->mutex); 863 mutex_init(&codec->mutex);
864 INIT_LIST_HEAD(&codec->dapm_widgets); 864 INIT_LIST_HEAD(&codec->dapm_widgets);
865 INIT_LIST_HEAD(&codec->dapm_paths); 865 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -894,7 +894,7 @@ static int wm8971_probe(struct platform_device *pdev)
894static int wm8971_remove(struct platform_device *pdev) 894static int wm8971_remove(struct platform_device *pdev)
895{ 895{
896 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 896 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
897 struct snd_soc_codec *codec = socdev->codec; 897 struct snd_soc_codec *codec = socdev->card->codec;
898 898
899 if (codec->control_data) 899 if (codec->control_data)
900 wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF); 900 wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index f93c0955ed9d..6af1d399b316 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -1162,7 +1162,7 @@ static int wm8990_hw_params(struct snd_pcm_substream *substream,
1162{ 1162{
1163 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1163 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1164 struct snd_soc_device *socdev = rtd->socdev; 1164 struct snd_soc_device *socdev = rtd->socdev;
1165 struct snd_soc_codec *codec = socdev->codec; 1165 struct snd_soc_codec *codec = socdev->card->codec;
1166 u16 audio1 = wm8990_read_reg_cache(codec, WM8990_AUDIO_INTERFACE_1); 1166 u16 audio1 = wm8990_read_reg_cache(codec, WM8990_AUDIO_INTERFACE_1);
1167 1167
1168 audio1 &= ~WM8990_AIF_WL_MASK; 1168 audio1 &= ~WM8990_AIF_WL_MASK;
@@ -1361,7 +1361,7 @@ EXPORT_SYMBOL_GPL(wm8990_dai);
1361static int wm8990_suspend(struct platform_device *pdev, pm_message_t state) 1361static int wm8990_suspend(struct platform_device *pdev, pm_message_t state)
1362{ 1362{
1363 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1363 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1364 struct snd_soc_codec *codec = socdev->codec; 1364 struct snd_soc_codec *codec = socdev->card->codec;
1365 1365
1366 /* we only need to suspend if we are a valid card */ 1366 /* we only need to suspend if we are a valid card */
1367 if (!codec->card) 1367 if (!codec->card)
@@ -1374,7 +1374,7 @@ static int wm8990_suspend(struct platform_device *pdev, pm_message_t state)
1374static int wm8990_resume(struct platform_device *pdev) 1374static int wm8990_resume(struct platform_device *pdev)
1375{ 1375{
1376 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1376 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1377 struct snd_soc_codec *codec = socdev->codec; 1377 struct snd_soc_codec *codec = socdev->card->codec;
1378 int i; 1378 int i;
1379 u8 data[2]; 1379 u8 data[2];
1380 u16 *cache = codec->reg_cache; 1380 u16 *cache = codec->reg_cache;
@@ -1402,7 +1402,7 @@ static int wm8990_resume(struct platform_device *pdev)
1402 */ 1402 */
1403static int wm8990_init(struct snd_soc_device *socdev) 1403static int wm8990_init(struct snd_soc_device *socdev)
1404{ 1404{
1405 struct snd_soc_codec *codec = socdev->codec; 1405 struct snd_soc_codec *codec = socdev->card->codec;
1406 u16 reg; 1406 u16 reg;
1407 int ret = 0; 1407 int ret = 0;
1408 1408
@@ -1480,7 +1480,7 @@ static int wm8990_i2c_probe(struct i2c_client *i2c,
1480 const struct i2c_device_id *id) 1480 const struct i2c_device_id *id)
1481{ 1481{
1482 struct snd_soc_device *socdev = wm8990_socdev; 1482 struct snd_soc_device *socdev = wm8990_socdev;
1483 struct snd_soc_codec *codec = socdev->codec; 1483 struct snd_soc_codec *codec = socdev->card->codec;
1484 int ret; 1484 int ret;
1485 1485
1486 i2c_set_clientdata(i2c, codec); 1486 i2c_set_clientdata(i2c, codec);
@@ -1579,7 +1579,7 @@ static int wm8990_probe(struct platform_device *pdev)
1579 } 1579 }
1580 1580
1581 codec->private_data = wm8990; 1581 codec->private_data = wm8990;
1582 socdev->codec = codec; 1582 socdev->card->codec = codec;
1583 mutex_init(&codec->mutex); 1583 mutex_init(&codec->mutex);
1584 INIT_LIST_HEAD(&codec->dapm_widgets); 1584 INIT_LIST_HEAD(&codec->dapm_widgets);
1585 INIT_LIST_HEAD(&codec->dapm_paths); 1585 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -1605,7 +1605,7 @@ static int wm8990_probe(struct platform_device *pdev)
1605static int wm8990_remove(struct platform_device *pdev) 1605static int wm8990_remove(struct platform_device *pdev)
1606{ 1606{
1607 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1607 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1608 struct snd_soc_codec *codec = socdev->codec; 1608 struct snd_soc_codec *codec = socdev->card->codec;
1609 1609
1610 if (codec->control_data) 1610 if (codec->control_data)
1611 wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF); 1611 wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c
index d5c81bb3decb..2e9e06b2daaf 100644
--- a/sound/soc/codecs/wm9705.c
+++ b/sound/soc/codecs/wm9705.c
@@ -249,7 +249,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
249 struct snd_pcm_runtime *runtime = substream->runtime; 249 struct snd_pcm_runtime *runtime = substream->runtime;
250 struct snd_soc_pcm_runtime *rtd = substream->private_data; 250 struct snd_soc_pcm_runtime *rtd = substream->private_data;
251 struct snd_soc_device *socdev = rtd->socdev; 251 struct snd_soc_device *socdev = rtd->socdev;
252 struct snd_soc_codec *codec = socdev->codec; 252 struct snd_soc_codec *codec = socdev->card->codec;
253 int reg; 253 int reg;
254 u16 vra; 254 u16 vra;
255 255
@@ -323,10 +323,11 @@ static int wm9705_soc_probe(struct platform_device *pdev)
323 323
324 printk(KERN_INFO "WM9705 SoC Audio Codec\n"); 324 printk(KERN_INFO "WM9705 SoC Audio Codec\n");
325 325
326 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 326 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec),
327 if (socdev->codec == NULL) 327 GFP_KERNEL);
328 if (socdev->card->codec == NULL)
328 return -ENOMEM; 329 return -ENOMEM;
329 codec = socdev->codec; 330 codec = socdev->card->codec;
330 mutex_init(&codec->mutex); 331 mutex_init(&codec->mutex);
331 332
332 codec->reg_cache = kmemdup(wm9705_reg, sizeof(wm9705_reg), GFP_KERNEL); 333 codec->reg_cache = kmemdup(wm9705_reg, sizeof(wm9705_reg), GFP_KERNEL);
@@ -380,15 +381,15 @@ pcm_err:
380codec_err: 381codec_err:
381 kfree(codec->reg_cache); 382 kfree(codec->reg_cache);
382cache_err: 383cache_err:
383 kfree(socdev->codec); 384 kfree(socdev->card->codec);
384 socdev->codec = NULL; 385 socdev->card->codec = NULL;
385 return ret; 386 return ret;
386} 387}
387 388
388static int wm9705_soc_remove(struct platform_device *pdev) 389static int wm9705_soc_remove(struct platform_device *pdev)
389{ 390{
390 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 391 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
391 struct snd_soc_codec *codec = socdev->codec; 392 struct snd_soc_codec *codec = socdev->card->codec;
392 393
393 if (codec == NULL) 394 if (codec == NULL)
394 return 0; 395 return 0;
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 4dc90d67530e..b3a8be77676e 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -478,7 +478,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
478 struct snd_pcm_runtime *runtime = substream->runtime; 478 struct snd_pcm_runtime *runtime = substream->runtime;
479 struct snd_soc_pcm_runtime *rtd = substream->private_data; 479 struct snd_soc_pcm_runtime *rtd = substream->private_data;
480 struct snd_soc_device *socdev = rtd->socdev; 480 struct snd_soc_device *socdev = rtd->socdev;
481 struct snd_soc_codec *codec = socdev->codec; 481 struct snd_soc_codec *codec = socdev->card->codec;
482 int reg; 482 int reg;
483 u16 vra; 483 u16 vra;
484 484
@@ -499,7 +499,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
499 struct snd_pcm_runtime *runtime = substream->runtime; 499 struct snd_pcm_runtime *runtime = substream->runtime;
500 struct snd_soc_pcm_runtime *rtd = substream->private_data; 500 struct snd_soc_pcm_runtime *rtd = substream->private_data;
501 struct snd_soc_device *socdev = rtd->socdev; 501 struct snd_soc_device *socdev = rtd->socdev;
502 struct snd_soc_codec *codec = socdev->codec; 502 struct snd_soc_codec *codec = socdev->card->codec;
503 u16 vra, xsle; 503 u16 vra, xsle;
504 504
505 vra = ac97_read(codec, AC97_EXTENDED_STATUS); 505 vra = ac97_read(codec, AC97_EXTENDED_STATUS);
@@ -592,7 +592,7 @@ static int wm9712_soc_suspend(struct platform_device *pdev,
592 pm_message_t state) 592 pm_message_t state)
593{ 593{
594 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 594 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
595 struct snd_soc_codec *codec = socdev->codec; 595 struct snd_soc_codec *codec = socdev->card->codec;
596 596
597 wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF); 597 wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF);
598 return 0; 598 return 0;
@@ -601,7 +601,7 @@ static int wm9712_soc_suspend(struct platform_device *pdev,
601static int wm9712_soc_resume(struct platform_device *pdev) 601static int wm9712_soc_resume(struct platform_device *pdev)
602{ 602{
603 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 603 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
604 struct snd_soc_codec *codec = socdev->codec; 604 struct snd_soc_codec *codec = socdev->card->codec;
605 int i, ret; 605 int i, ret;
606 u16 *cache = codec->reg_cache; 606 u16 *cache = codec->reg_cache;
607 607
@@ -637,10 +637,11 @@ static int wm9712_soc_probe(struct platform_device *pdev)
637 637
638 printk(KERN_INFO "WM9711/WM9712 SoC Audio Codec %s\n", WM9712_VERSION); 638 printk(KERN_INFO "WM9711/WM9712 SoC Audio Codec %s\n", WM9712_VERSION);
639 639
640 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 640 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec),
641 if (socdev->codec == NULL) 641 GFP_KERNEL);
642 if (socdev->card->codec == NULL)
642 return -ENOMEM; 643 return -ENOMEM;
643 codec = socdev->codec; 644 codec = socdev->card->codec;
644 mutex_init(&codec->mutex); 645 mutex_init(&codec->mutex);
645 646
646 codec->reg_cache = kmemdup(wm9712_reg, sizeof(wm9712_reg), GFP_KERNEL); 647 codec->reg_cache = kmemdup(wm9712_reg, sizeof(wm9712_reg), GFP_KERNEL);
@@ -704,15 +705,15 @@ codec_err:
704 kfree(codec->reg_cache); 705 kfree(codec->reg_cache);
705 706
706cache_err: 707cache_err:
707 kfree(socdev->codec); 708 kfree(socdev->card->codec);
708 socdev->codec = NULL; 709 socdev->card->codec = NULL;
709 return ret; 710 return ret;
710} 711}
711 712
712static int wm9712_soc_remove(struct platform_device *pdev) 713static int wm9712_soc_remove(struct platform_device *pdev)
713{ 714{
714 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 715 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
715 struct snd_soc_codec *codec = socdev->codec; 716 struct snd_soc_codec *codec = socdev->card->codec;
716 717
717 if (codec == NULL) 718 if (codec == NULL)
718 return 0; 719 return 0;
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 0e60e16973d4..54db9c524988 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1115,7 +1115,7 @@ static int wm9713_soc_suspend(struct platform_device *pdev,
1115 pm_message_t state) 1115 pm_message_t state)
1116{ 1116{
1117 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1117 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1118 struct snd_soc_codec *codec = socdev->codec; 1118 struct snd_soc_codec *codec = socdev->card->codec;
1119 u16 reg; 1119 u16 reg;
1120 1120
1121 /* Disable everything except touchpanel - that will be handled 1121 /* Disable everything except touchpanel - that will be handled
@@ -1133,7 +1133,7 @@ static int wm9713_soc_suspend(struct platform_device *pdev,
1133static int wm9713_soc_resume(struct platform_device *pdev) 1133static int wm9713_soc_resume(struct platform_device *pdev)
1134{ 1134{
1135 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1135 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1136 struct snd_soc_codec *codec = socdev->codec; 1136 struct snd_soc_codec *codec = socdev->card->codec;
1137 struct wm9713_priv *wm9713 = codec->private_data; 1137 struct wm9713_priv *wm9713 = codec->private_data;
1138 int i, ret; 1138 int i, ret;
1139 u16 *cache = codec->reg_cache; 1139 u16 *cache = codec->reg_cache;
@@ -1174,10 +1174,11 @@ static int wm9713_soc_probe(struct platform_device *pdev)
1174 1174
1175 printk(KERN_INFO "WM9713/WM9714 SoC Audio Codec %s\n", WM9713_VERSION); 1175 printk(KERN_INFO "WM9713/WM9714 SoC Audio Codec %s\n", WM9713_VERSION);
1176 1176
1177 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 1177 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec),
1178 if (socdev->codec == NULL) 1178 GFP_KERNEL);
1179 if (socdev->card->codec == NULL)
1179 return -ENOMEM; 1180 return -ENOMEM;
1180 codec = socdev->codec; 1181 codec = socdev->card->codec;
1181 mutex_init(&codec->mutex); 1182 mutex_init(&codec->mutex);
1182 1183
1183 codec->reg_cache = kmemdup(wm9713_reg, sizeof(wm9713_reg), GFP_KERNEL); 1184 codec->reg_cache = kmemdup(wm9713_reg, sizeof(wm9713_reg), GFP_KERNEL);
@@ -1249,15 +1250,15 @@ priv_err:
1249 kfree(codec->reg_cache); 1250 kfree(codec->reg_cache);
1250 1251
1251cache_err: 1252cache_err:
1252 kfree(socdev->codec); 1253 kfree(socdev->card->codec);
1253 socdev->codec = NULL; 1254 socdev->card->codec = NULL;
1254 return ret; 1255 return ret;
1255} 1256}
1256 1257
1257static int wm9713_soc_remove(struct platform_device *pdev) 1258static int wm9713_soc_remove(struct platform_device *pdev)
1258{ 1259{
1259 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1260 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1260 struct snd_soc_codec *codec = socdev->codec; 1261 struct snd_soc_codec *codec = socdev->card->codec;
1261 1262
1262 if (codec == NULL) 1263 if (codec == NULL)
1263 return 0; 1264 return 0;