aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc.h13
-rw-r--r--sound/soc/codecs/ad1836.c2
-rw-r--r--sound/soc/codecs/ad193x.c2
-rw-r--r--sound/soc/codecs/ak4104.c2
-rw-r--r--sound/soc/codecs/ak4535.c10
-rw-r--r--sound/soc/codecs/ak4642.c2
-rw-r--r--sound/soc/codecs/ak4671.c2
-rw-r--r--sound/soc/codecs/cs4270.c20
-rw-r--r--sound/soc/codecs/cx20442.c2
-rw-r--r--sound/soc/codecs/da7210.c2
-rw-r--r--sound/soc/codecs/ssm2602.c12
-rw-r--r--sound/soc/codecs/stac9766.c2
-rw-r--r--sound/soc/codecs/tlv320aic3x.c10
-rw-r--r--sound/soc/codecs/tlv320dac33.c36
-rw-r--r--sound/soc/codecs/twl4030.c32
-rw-r--r--sound/soc/codecs/uda134x.c16
-rw-r--r--sound/soc/codecs/uda1380.c4
-rw-r--r--sound/soc/codecs/wm8350.c28
-rw-r--r--sound/soc/codecs/wm8400.c16
-rw-r--r--sound/soc/codecs/wm8523.c10
-rw-r--r--sound/soc/codecs/wm8580.c4
-rw-r--r--sound/soc/codecs/wm8711.c6
-rw-r--r--sound/soc/codecs/wm8731.c10
-rw-r--r--sound/soc/codecs/wm8750.c7
-rw-r--r--sound/soc/codecs/wm8753.c8
-rw-r--r--sound/soc/codecs/wm8776.c6
-rw-r--r--sound/soc/codecs/wm8900.c10
-rw-r--r--sound/soc/codecs/wm8903.c20
-rw-r--r--sound/soc/codecs/wm8904.c42
-rw-r--r--sound/soc/codecs/wm8940.c4
-rw-r--r--sound/soc/codecs/wm8955.c16
-rw-r--r--sound/soc/codecs/wm8960.c6
-rw-r--r--sound/soc/codecs/wm8961.c6
-rw-r--r--sound/soc/codecs/wm8971.c12
-rw-r--r--sound/soc/codecs/wm8974.c2
-rw-r--r--sound/soc/codecs/wm8978.c12
-rw-r--r--sound/soc/codecs/wm8988.c8
-rw-r--r--sound/soc/codecs/wm8990.c8
-rw-r--r--sound/soc/codecs/wm8993.c24
-rw-r--r--sound/soc/codecs/wm8994.c34
-rw-r--r--sound/soc/codecs/wm9081.c18
-rw-r--r--sound/soc/codecs/wm9713.c13
-rw-r--r--sound/soc/codecs/wm_hubs.c6
43 files changed, 258 insertions, 247 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4ab3dad4a9c..01e9c66ddc6 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -414,7 +414,7 @@ struct snd_soc_codec {
414 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 414 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
415 unsigned int active; 415 unsigned int active;
416 unsigned int pcm_devs; 416 unsigned int pcm_devs;
417 void *private_data; 417 void *drvdata;
418 418
419 /* codec IO */ 419 /* codec IO */
420 void *control_data; /* codec control (i2c/3wire) data */ 420 void *control_data; /* codec control (i2c/3wire) data */
@@ -597,6 +597,17 @@ static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
597 return codec->write(codec, reg, val); 597 return codec->write(codec, reg, val);
598} 598}
599 599
600static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
601 void *data)
602{
603 codec->drvdata = data;
604}
605
606static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
607{
608 return codec->drvdata;
609}
610
600#include <sound/soc-dai.h> 611#include <sound/soc-dai.h>
601 612
602#endif 613#endif
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
index 3c80137d593..48e1272892f 100644
--- a/sound/soc/codecs/ad1836.c
+++ b/sound/soc/codecs/ad1836.c
@@ -277,7 +277,7 @@ static int ad1836_register(struct ad1836_priv *ad1836)
277 mutex_init(&codec->mutex); 277 mutex_init(&codec->mutex);
278 INIT_LIST_HEAD(&codec->dapm_widgets); 278 INIT_LIST_HEAD(&codec->dapm_widgets);
279 INIT_LIST_HEAD(&codec->dapm_paths); 279 INIT_LIST_HEAD(&codec->dapm_paths);
280 codec->private_data = ad1836; 280 snd_soc_codec_set_drvdata(codec, ad1836);
281 codec->reg_cache = ad1836->reg_cache; 281 codec->reg_cache = ad1836->reg_cache;
282 codec->reg_cache_size = AD1836_NUM_REGS; 282 codec->reg_cache_size = AD1836_NUM_REGS;
283 codec->name = "AD1836"; 283 codec->name = "AD1836";
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c
index 4bfd66bc262..7ed787e2e51 100644
--- a/sound/soc/codecs/ad193x.c
+++ b/sound/soc/codecs/ad193x.c
@@ -305,7 +305,7 @@ static int ad193x_bus_probe(struct device *dev, void *ctrl_data, int bus_type)
305 mutex_init(&codec->mutex); 305 mutex_init(&codec->mutex);
306 codec->control_data = ctrl_data; 306 codec->control_data = ctrl_data;
307 codec->dev = dev; 307 codec->dev = dev;
308 codec->private_data = ad193x; 308 snd_soc_codec_set_drvdata(codec, ad193x);
309 codec->reg_cache = ad193x->reg_cache; 309 codec->reg_cache = ad193x->reg_cache;
310 codec->reg_cache_size = AD193X_NUM_REGS; 310 codec->reg_cache_size = AD193X_NUM_REGS;
311 codec->name = "AD193X"; 311 codec->name = "AD193X";
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c
index b68d99fb6af..962d7468212 100644
--- a/sound/soc/codecs/ak4104.c
+++ b/sound/soc/codecs/ak4104.c
@@ -221,7 +221,7 @@ static int ak4104_spi_probe(struct spi_device *spi)
221 codec->owner = THIS_MODULE; 221 codec->owner = THIS_MODULE;
222 codec->dai = &ak4104_dai; 222 codec->dai = &ak4104_dai;
223 codec->num_dai = 1; 223 codec->num_dai = 1;
224 codec->private_data = ak4104; 224 snd_soc_codec_set_drvdata(codec, ak4104);
225 codec->control_data = spi; 225 codec->control_data = spi;
226 codec->reg_cache = ak4104->reg_cache; 226 codec->reg_cache = ak4104->reg_cache;
227 codec->reg_cache_size = AK4104_NUM_REGS; 227 codec->reg_cache_size = AK4104_NUM_REGS;
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index ff966567e2b..2f6221b2ebb 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -301,7 +301,7 @@ static int ak4535_set_dai_sysclk(struct snd_soc_dai *codec_dai,
301 int clk_id, unsigned int freq, int dir) 301 int clk_id, unsigned int freq, int dir)
302{ 302{
303 struct snd_soc_codec *codec = codec_dai->codec; 303 struct snd_soc_codec *codec = codec_dai->codec;
304 struct ak4535_priv *ak4535 = codec->private_data; 304 struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec);
305 305
306 ak4535->sysclk = freq; 306 ak4535->sysclk = freq;
307 return 0; 307 return 0;
@@ -314,7 +314,7 @@ static int ak4535_hw_params(struct snd_pcm_substream *substream,
314 struct snd_soc_pcm_runtime *rtd = substream->private_data; 314 struct snd_soc_pcm_runtime *rtd = substream->private_data;
315 struct snd_soc_device *socdev = rtd->socdev; 315 struct snd_soc_device *socdev = rtd->socdev;
316 struct snd_soc_codec *codec = socdev->card->codec; 316 struct snd_soc_codec *codec = socdev->card->codec;
317 struct ak4535_priv *ak4535 = codec->private_data; 317 struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec);
318 u8 mode2 = ak4535_read_reg_cache(codec, AK4535_MODE2) & ~(0x3 << 5); 318 u8 mode2 = ak4535_read_reg_cache(codec, AK4535_MODE2) & ~(0x3 << 5);
319 int rate = params_rate(params), fs = 256; 319 int rate = params_rate(params), fs = 256;
320 320
@@ -599,7 +599,7 @@ static int ak4535_probe(struct platform_device *pdev)
599 return -ENOMEM; 599 return -ENOMEM;
600 } 600 }
601 601
602 codec->private_data = ak4535; 602 snd_soc_codec_set_drvdata(codec, ak4535);
603 socdev->card->codec = codec; 603 socdev->card->codec = codec;
604 mutex_init(&codec->mutex); 604 mutex_init(&codec->mutex);
605 INIT_LIST_HEAD(&codec->dapm_widgets); 605 INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -616,7 +616,7 @@ static int ak4535_probe(struct platform_device *pdev)
616#endif 616#endif
617 617
618 if (ret != 0) { 618 if (ret != 0) {
619 kfree(codec->private_data); 619 kfree(snd_soc_codec_get_drvdata(codec));
620 kfree(codec); 620 kfree(codec);
621 } 621 }
622 return ret; 622 return ret;
@@ -638,7 +638,7 @@ static int ak4535_remove(struct platform_device *pdev)
638 i2c_unregister_device(codec->control_data); 638 i2c_unregister_device(codec->control_data);
639 i2c_del_driver(&ak4535_i2c_driver); 639 i2c_del_driver(&ak4535_i2c_driver);
640#endif 640#endif
641 kfree(codec->private_data); 641 kfree(snd_soc_codec_get_drvdata(codec));
642 kfree(codec); 642 kfree(codec);
643 643
644 return 0; 644 return 0;
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index de1809dc8d9..1254a7ac561 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -431,7 +431,7 @@ static int ak4642_init(struct ak4642_priv *ak4642)
431 INIT_LIST_HEAD(&codec->dapm_widgets); 431 INIT_LIST_HEAD(&codec->dapm_widgets);
432 INIT_LIST_HEAD(&codec->dapm_paths); 432 INIT_LIST_HEAD(&codec->dapm_paths);
433 433
434 codec->private_data = ak4642; 434 snd_soc_codec_set_drvdata(codec, ak4642);
435 codec->name = "AK4642"; 435 codec->name = "AK4642";
436 codec->owner = THIS_MODULE; 436 codec->owner = THIS_MODULE;
437 codec->read = ak4642_read_reg_cache; 437 codec->read = ak4642_read_reg_cache;
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c
index 82fca284d00..18fd4475413 100644
--- a/sound/soc/codecs/ak4671.c
+++ b/sound/soc/codecs/ak4671.c
@@ -701,7 +701,7 @@ static int ak4671_register(struct ak4671_priv *ak4671,
701 INIT_LIST_HEAD(&codec->dapm_widgets); 701 INIT_LIST_HEAD(&codec->dapm_widgets);
702 INIT_LIST_HEAD(&codec->dapm_paths); 702 INIT_LIST_HEAD(&codec->dapm_paths);
703 703
704 codec->private_data = ak4671; 704 snd_soc_codec_set_drvdata(codec, ak4671);
705 codec->name = "AK4671"; 705 codec->name = "AK4671";
706 codec->owner = THIS_MODULE; 706 codec->owner = THIS_MODULE;
707 codec->bias_level = SND_SOC_BIAS_OFF; 707 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index dfbeb2db61b..a7f09f33c56 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -210,7 +210,7 @@ static int cs4270_set_dai_sysclk(struct snd_soc_dai *codec_dai,
210 int clk_id, unsigned int freq, int dir) 210 int clk_id, unsigned int freq, int dir)
211{ 211{
212 struct snd_soc_codec *codec = codec_dai->codec; 212 struct snd_soc_codec *codec = codec_dai->codec;
213 struct cs4270_private *cs4270 = codec->private_data; 213 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
214 unsigned int rates = 0; 214 unsigned int rates = 0;
215 unsigned int rate_min = -1; 215 unsigned int rate_min = -1;
216 unsigned int rate_max = 0; 216 unsigned int rate_max = 0;
@@ -269,7 +269,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai,
269 unsigned int format) 269 unsigned int format)
270{ 270{
271 struct snd_soc_codec *codec = codec_dai->codec; 271 struct snd_soc_codec *codec = codec_dai->codec;
272 struct cs4270_private *cs4270 = codec->private_data; 272 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
273 int ret = 0; 273 int ret = 0;
274 274
275 /* set DAI format */ 275 /* set DAI format */
@@ -411,7 +411,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
411 struct snd_soc_pcm_runtime *rtd = substream->private_data; 411 struct snd_soc_pcm_runtime *rtd = substream->private_data;
412 struct snd_soc_device *socdev = rtd->socdev; 412 struct snd_soc_device *socdev = rtd->socdev;
413 struct snd_soc_codec *codec = socdev->card->codec; 413 struct snd_soc_codec *codec = socdev->card->codec;
414 struct cs4270_private *cs4270 = codec->private_data; 414 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
415 int ret; 415 int ret;
416 unsigned int i; 416 unsigned int i;
417 unsigned int rate; 417 unsigned int rate;
@@ -490,7 +490,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
490static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute) 490static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute)
491{ 491{
492 struct snd_soc_codec *codec = dai->codec; 492 struct snd_soc_codec *codec = dai->codec;
493 struct cs4270_private *cs4270 = codec->private_data; 493 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
494 int reg6; 494 int reg6;
495 495
496 reg6 = snd_soc_read(codec, CS4270_MUTE); 496 reg6 = snd_soc_read(codec, CS4270_MUTE);
@@ -523,7 +523,7 @@ static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol,
523 struct snd_ctl_elem_value *ucontrol) 523 struct snd_ctl_elem_value *ucontrol)
524{ 524{
525 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 525 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
526 struct cs4270_private *cs4270 = codec->private_data; 526 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
527 int left = !ucontrol->value.integer.value[0]; 527 int left = !ucontrol->value.integer.value[0];
528 int right = !ucontrol->value.integer.value[1]; 528 int right = !ucontrol->value.integer.value[1];
529 529
@@ -599,7 +599,7 @@ static int cs4270_probe(struct platform_device *pdev)
599{ 599{
600 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 600 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
601 struct snd_soc_codec *codec = cs4270_codec; 601 struct snd_soc_codec *codec = cs4270_codec;
602 struct cs4270_private *cs4270 = codec->private_data; 602 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
603 int i, ret; 603 int i, ret;
604 604
605 /* Connect the codec to the socdev. snd_soc_new_pcms() needs this. */ 605 /* Connect the codec to the socdev. snd_soc_new_pcms() needs this. */
@@ -656,7 +656,7 @@ static int cs4270_remove(struct platform_device *pdev)
656{ 656{
657 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 657 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
658 struct snd_soc_codec *codec = cs4270_codec; 658 struct snd_soc_codec *codec = cs4270_codec;
659 struct cs4270_private *cs4270 = codec->private_data; 659 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
660 660
661 snd_soc_free_pcms(socdev); 661 snd_soc_free_pcms(socdev);
662 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); 662 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
@@ -729,7 +729,7 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
729 codec->owner = THIS_MODULE; 729 codec->owner = THIS_MODULE;
730 codec->dai = &cs4270_dai; 730 codec->dai = &cs4270_dai;
731 codec->num_dai = 1; 731 codec->num_dai = 1;
732 codec->private_data = cs4270; 732 snd_soc_codec_set_drvdata(codec, cs4270);
733 codec->control_data = i2c_client; 733 codec->control_data = i2c_client;
734 codec->read = cs4270_read_reg_cache; 734 codec->read = cs4270_read_reg_cache;
735 codec->write = cs4270_i2c_write; 735 codec->write = cs4270_i2c_write;
@@ -842,7 +842,7 @@ MODULE_DEVICE_TABLE(i2c, cs4270_id);
842static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg) 842static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg)
843{ 843{
844 struct snd_soc_codec *codec = cs4270_codec; 844 struct snd_soc_codec *codec = cs4270_codec;
845 struct cs4270_private *cs4270 = codec->private_data; 845 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
846 int reg, ret; 846 int reg, ret;
847 847
848 reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL; 848 reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL;
@@ -862,7 +862,7 @@ static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg)
862static int cs4270_soc_resume(struct platform_device *pdev) 862static int cs4270_soc_resume(struct platform_device *pdev)
863{ 863{
864 struct snd_soc_codec *codec = cs4270_codec; 864 struct snd_soc_codec *codec = cs4270_codec;
865 struct cs4270_private *cs4270 = codec->private_data; 865 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
866 struct i2c_client *i2c_client = codec->control_data; 866 struct i2c_client *i2c_client = codec->control_data;
867 int reg; 867 int reg;
868 868
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index e000cdfec1e..203e51f9148 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -386,7 +386,7 @@ static int cx20442_register(struct cx20442_priv *cx20442)
386 386
387 codec->name = "CX20442"; 387 codec->name = "CX20442";
388 codec->owner = THIS_MODULE; 388 codec->owner = THIS_MODULE;
389 codec->private_data = cx20442; 389 snd_soc_codec_set_drvdata(codec, cx20442);
390 390
391 codec->dai = &cx20442_dai; 391 codec->dai = &cx20442_dai;
392 codec->num_dai = 1; 392 codec->num_dai = 1;
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index 35b88163865..89cea32f942 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -460,7 +460,7 @@ static int da7210_init(struct da7210_priv *da7210)
460 INIT_LIST_HEAD(&codec->dapm_widgets); 460 INIT_LIST_HEAD(&codec->dapm_widgets);
461 INIT_LIST_HEAD(&codec->dapm_paths); 461 INIT_LIST_HEAD(&codec->dapm_paths);
462 462
463 codec->private_data = da7210; 463 snd_soc_codec_set_drvdata(codec, da7210);
464 codec->name = "DA7210"; 464 codec->name = "DA7210";
465 codec->owner = THIS_MODULE; 465 codec->owner = THIS_MODULE;
466 codec->read = da7210_read; 466 codec->read = da7210_read;
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 942f5dc3080..99ddec7df61 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -277,7 +277,7 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
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->card->codec; 279 struct snd_soc_codec *codec = socdev->card->codec;
280 struct ssm2602_priv *ssm2602 = codec->private_data; 280 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
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;
283 int i = get_coeff(ssm2602->sysclk, params_rate(params)); 283 int i = get_coeff(ssm2602->sysclk, params_rate(params));
@@ -322,7 +322,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
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->card->codec; 324 struct snd_soc_codec *codec = socdev->card->codec;
325 struct ssm2602_priv *ssm2602 = codec->private_data; 325 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
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;
328 328
@@ -373,7 +373,7 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream,
373 struct snd_soc_pcm_runtime *rtd = substream->private_data; 373 struct snd_soc_pcm_runtime *rtd = substream->private_data;
374 struct snd_soc_device *socdev = rtd->socdev; 374 struct snd_soc_device *socdev = rtd->socdev;
375 struct snd_soc_codec *codec = socdev->card->codec; 375 struct snd_soc_codec *codec = socdev->card->codec;
376 struct ssm2602_priv *ssm2602 = codec->private_data; 376 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
377 377
378 /* deactivate */ 378 /* deactivate */
379 if (!codec->active) 379 if (!codec->active)
@@ -401,7 +401,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
401 int clk_id, unsigned int freq, int dir) 401 int clk_id, unsigned int freq, int dir)
402{ 402{
403 struct snd_soc_codec *codec = codec_dai->codec; 403 struct snd_soc_codec *codec = codec_dai->codec;
404 struct ssm2602_priv *ssm2602 = codec->private_data; 404 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
405 switch (freq) { 405 switch (freq) {
406 case 11289600: 406 case 11289600:
407 case 12000000: 407 case 12000000:
@@ -726,7 +726,7 @@ static int ssm2602_probe(struct platform_device *pdev)
726 return -ENOMEM; 726 return -ENOMEM;
727 } 727 }
728 728
729 codec->private_data = ssm2602; 729 snd_soc_codec_set_drvdata(codec, ssm2602);
730 socdev->card->codec = codec; 730 socdev->card->codec = codec;
731 mutex_init(&codec->mutex); 731 mutex_init(&codec->mutex);
732 INIT_LIST_HEAD(&codec->dapm_widgets); 732 INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -759,7 +759,7 @@ static int ssm2602_remove(struct platform_device *pdev)
759 i2c_unregister_device(codec->control_data); 759 i2c_unregister_device(codec->control_data);
760 i2c_del_driver(&ssm2602_i2c_driver); 760 i2c_del_driver(&ssm2602_i2c_driver);
761#endif 761#endif
762 kfree(codec->private_data); 762 kfree(snd_soc_codec_get_drvdata(codec));
763 kfree(codec); 763 kfree(codec);
764 764
765 return 0; 765 return 0;
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 81b8c9dfe7f..a1c7ca869d0 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -409,7 +409,7 @@ reset_err:
409pcm_err: 409pcm_err:
410 snd_soc_free_ac97_codec(codec); 410 snd_soc_free_ac97_codec(codec);
411codec_err: 411codec_err:
412 kfree(codec->private_data); 412 kfree(snd_soc_codec_get_drvdata(codec));
413cache_err: 413cache_err:
414 kfree(socdev->card->codec); 414 kfree(socdev->card->codec);
415 socdev->card->codec = NULL; 415 socdev->card->codec = NULL;
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index e4b946a19ea..556123b4059 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -763,7 +763,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
763 struct snd_soc_pcm_runtime *rtd = substream->private_data; 763 struct snd_soc_pcm_runtime *rtd = substream->private_data;
764 struct snd_soc_device *socdev = rtd->socdev; 764 struct snd_soc_device *socdev = rtd->socdev;
765 struct snd_soc_codec *codec = socdev->card->codec; 765 struct snd_soc_codec *codec = socdev->card->codec;
766 struct aic3x_priv *aic3x = codec->private_data; 766 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
767 int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; 767 int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0;
768 u8 data, j, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; 768 u8 data, j, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1;
769 u16 d, pll_d = 1; 769 u16 d, pll_d = 1;
@@ -930,7 +930,7 @@ static int aic3x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
930 int clk_id, unsigned int freq, int dir) 930 int clk_id, unsigned int freq, int dir)
931{ 931{
932 struct snd_soc_codec *codec = codec_dai->codec; 932 struct snd_soc_codec *codec = codec_dai->codec;
933 struct aic3x_priv *aic3x = codec->private_data; 933 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
934 934
935 aic3x->sysclk = freq; 935 aic3x->sysclk = freq;
936 return 0; 936 return 0;
@@ -940,7 +940,7 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai,
940 unsigned int fmt) 940 unsigned int fmt)
941{ 941{
942 struct snd_soc_codec *codec = codec_dai->codec; 942 struct snd_soc_codec *codec = codec_dai->codec;
943 struct aic3x_priv *aic3x = codec->private_data; 943 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
944 u8 iface_areg, iface_breg; 944 u8 iface_areg, iface_breg;
945 int delay = 0; 945 int delay = 0;
946 946
@@ -994,7 +994,7 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai,
994static int aic3x_set_bias_level(struct snd_soc_codec *codec, 994static int aic3x_set_bias_level(struct snd_soc_codec *codec,
995 enum snd_soc_bias_level level) 995 enum snd_soc_bias_level level)
996{ 996{
997 struct aic3x_priv *aic3x = codec->private_data; 997 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
998 u8 reg; 998 u8 reg;
999 999
1000 switch (level) { 1000 switch (level) {
@@ -1338,7 +1338,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
1338 1338
1339 codec = &aic3x->codec; 1339 codec = &aic3x->codec;
1340 codec->dev = &i2c->dev; 1340 codec->dev = &i2c->dev;
1341 codec->private_data = aic3x; 1341 snd_soc_codec_set_drvdata(codec, aic3x);
1342 codec->control_data = i2c; 1342 codec->control_data = i2c;
1343 codec->hw_write = (hw_write_t) i2c_master_send; 1343 codec->hw_write = (hw_write_t) i2c_master_send;
1344 1344
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index ee2e1e36d99..824bb354ebc 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -167,7 +167,7 @@ static inline void dac33_write_reg_cache(struct snd_soc_codec *codec,
167static int dac33_read(struct snd_soc_codec *codec, unsigned int reg, 167static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
168 u8 *value) 168 u8 *value)
169{ 169{
170 struct tlv320dac33_priv *dac33 = codec->private_data; 170 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
171 int val; 171 int val;
172 172
173 *value = reg & 0xff; 173 *value = reg & 0xff;
@@ -192,7 +192,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
192static int dac33_write(struct snd_soc_codec *codec, unsigned int reg, 192static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
193 unsigned int value) 193 unsigned int value)
194{ 194{
195 struct tlv320dac33_priv *dac33 = codec->private_data; 195 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
196 u8 data[2]; 196 u8 data[2];
197 int ret = 0; 197 int ret = 0;
198 198
@@ -219,7 +219,7 @@ static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
219static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg, 219static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg,
220 unsigned int value) 220 unsigned int value)
221{ 221{
222 struct tlv320dac33_priv *dac33 = codec->private_data; 222 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
223 int ret; 223 int ret;
224 224
225 mutex_lock(&dac33->mutex); 225 mutex_lock(&dac33->mutex);
@@ -233,7 +233,7 @@ static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg,
233static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg, 233static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg,
234 unsigned int value) 234 unsigned int value)
235{ 235{
236 struct tlv320dac33_priv *dac33 = codec->private_data; 236 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
237 u8 data[3]; 237 u8 data[3];
238 int ret = 0; 238 int ret = 0;
239 239
@@ -265,7 +265,7 @@ static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg,
265 265
266static void dac33_restore_regs(struct snd_soc_codec *codec) 266static void dac33_restore_regs(struct snd_soc_codec *codec)
267{ 267{
268 struct tlv320dac33_priv *dac33 = codec->private_data; 268 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
269 u8 *cache = codec->reg_cache; 269 u8 *cache = codec->reg_cache;
270 u8 data[2]; 270 u8 data[2];
271 int i, ret; 271 int i, ret;
@@ -319,7 +319,7 @@ static inline void dac33_soft_power(struct snd_soc_codec *codec, int power)
319 319
320static int dac33_hard_power(struct snd_soc_codec *codec, int power) 320static int dac33_hard_power(struct snd_soc_codec *codec, int power)
321{ 321{
322 struct tlv320dac33_priv *dac33 = codec->private_data; 322 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
323 int ret; 323 int ret;
324 324
325 mutex_lock(&dac33->mutex); 325 mutex_lock(&dac33->mutex);
@@ -366,7 +366,7 @@ static int dac33_get_nsample(struct snd_kcontrol *kcontrol,
366 struct snd_ctl_elem_value *ucontrol) 366 struct snd_ctl_elem_value *ucontrol)
367{ 367{
368 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 368 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
369 struct tlv320dac33_priv *dac33 = codec->private_data; 369 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
370 370
371 ucontrol->value.integer.value[0] = dac33->nsample; 371 ucontrol->value.integer.value[0] = dac33->nsample;
372 372
@@ -377,7 +377,7 @@ static int dac33_set_nsample(struct snd_kcontrol *kcontrol,
377 struct snd_ctl_elem_value *ucontrol) 377 struct snd_ctl_elem_value *ucontrol)
378{ 378{
379 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 379 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
380 struct tlv320dac33_priv *dac33 = codec->private_data; 380 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
381 int ret = 0; 381 int ret = 0;
382 382
383 if (dac33->nsample == ucontrol->value.integer.value[0]) 383 if (dac33->nsample == ucontrol->value.integer.value[0])
@@ -396,7 +396,7 @@ static int dac33_get_fifo_mode(struct snd_kcontrol *kcontrol,
396 struct snd_ctl_elem_value *ucontrol) 396 struct snd_ctl_elem_value *ucontrol)
397{ 397{
398 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 398 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
399 struct tlv320dac33_priv *dac33 = codec->private_data; 399 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
400 400
401 ucontrol->value.integer.value[0] = dac33->fifo_mode; 401 ucontrol->value.integer.value[0] = dac33->fifo_mode;
402 402
@@ -407,7 +407,7 @@ static int dac33_set_fifo_mode(struct snd_kcontrol *kcontrol,
407 struct snd_ctl_elem_value *ucontrol) 407 struct snd_ctl_elem_value *ucontrol)
408{ 408{
409 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 409 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
410 struct tlv320dac33_priv *dac33 = codec->private_data; 410 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
411 int ret = 0; 411 int ret = 0;
412 412
413 if (dac33->fifo_mode == ucontrol->value.integer.value[0]) 413 if (dac33->fifo_mode == ucontrol->value.integer.value[0])
@@ -630,7 +630,7 @@ static void dac33_work(struct work_struct *work)
630static irqreturn_t dac33_interrupt_handler(int irq, void *dev) 630static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
631{ 631{
632 struct snd_soc_codec *codec = dev; 632 struct snd_soc_codec *codec = dev;
633 struct tlv320dac33_priv *dac33 = codec->private_data; 633 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
634 634
635 queue_work(dac33->dac33_wq, &dac33->work); 635 queue_work(dac33->dac33_wq, &dac33->work);
636 636
@@ -697,7 +697,7 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
697 struct snd_soc_pcm_runtime *rtd = substream->private_data; 697 struct snd_soc_pcm_runtime *rtd = substream->private_data;
698 struct snd_soc_device *socdev = rtd->socdev; 698 struct snd_soc_device *socdev = rtd->socdev;
699 struct snd_soc_codec *codec = socdev->card->codec; 699 struct snd_soc_codec *codec = socdev->card->codec;
700 struct tlv320dac33_priv *dac33 = codec->private_data; 700 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
701 unsigned int oscset, ratioset, pwr_ctrl, reg_tmp; 701 unsigned int oscset, ratioset, pwr_ctrl, reg_tmp;
702 u8 aictrl_a, aictrl_b, fifoctrl_a; 702 u8 aictrl_a, aictrl_b, fifoctrl_a;
703 703
@@ -883,7 +883,7 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
883 struct snd_soc_pcm_runtime *rtd = substream->private_data; 883 struct snd_soc_pcm_runtime *rtd = substream->private_data;
884 struct snd_soc_device *socdev = rtd->socdev; 884 struct snd_soc_device *socdev = rtd->socdev;
885 struct snd_soc_codec *codec = socdev->card->codec; 885 struct snd_soc_codec *codec = socdev->card->codec;
886 struct tlv320dac33_priv *dac33 = codec->private_data; 886 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
887 unsigned int nsample_limit; 887 unsigned int nsample_limit;
888 888
889 /* Number of samples (16bit, stereo) in one period */ 889 /* Number of samples (16bit, stereo) in one period */
@@ -936,7 +936,7 @@ static int dac33_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
936 struct snd_soc_pcm_runtime *rtd = substream->private_data; 936 struct snd_soc_pcm_runtime *rtd = substream->private_data;
937 struct snd_soc_device *socdev = rtd->socdev; 937 struct snd_soc_device *socdev = rtd->socdev;
938 struct snd_soc_codec *codec = socdev->card->codec; 938 struct snd_soc_codec *codec = socdev->card->codec;
939 struct tlv320dac33_priv *dac33 = codec->private_data; 939 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
940 int ret = 0; 940 int ret = 0;
941 941
942 switch (cmd) { 942 switch (cmd) {
@@ -967,7 +967,7 @@ static int dac33_set_dai_sysclk(struct snd_soc_dai *codec_dai,
967 int clk_id, unsigned int freq, int dir) 967 int clk_id, unsigned int freq, int dir)
968{ 968{
969 struct snd_soc_codec *codec = codec_dai->codec; 969 struct snd_soc_codec *codec = codec_dai->codec;
970 struct tlv320dac33_priv *dac33 = codec->private_data; 970 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
971 u8 ioc_reg, asrcb_reg; 971 u8 ioc_reg, asrcb_reg;
972 972
973 ioc_reg = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL); 973 ioc_reg = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL);
@@ -997,7 +997,7 @@ static int dac33_set_dai_fmt(struct snd_soc_dai *codec_dai,
997 unsigned int fmt) 997 unsigned int fmt)
998{ 998{
999 struct snd_soc_codec *codec = codec_dai->codec; 999 struct snd_soc_codec *codec = codec_dai->codec;
1000 struct tlv320dac33_priv *dac33 = codec->private_data; 1000 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
1001 u8 aictrl_a, aictrl_b; 1001 u8 aictrl_a, aictrl_b;
1002 1002
1003 aictrl_a = dac33_read_reg_cache(codec, DAC33_SER_AUDIOIF_CTRL_A); 1003 aictrl_a = dac33_read_reg_cache(codec, DAC33_SER_AUDIOIF_CTRL_A);
@@ -1088,7 +1088,7 @@ static int dac33_soc_probe(struct platform_device *pdev)
1088 1088
1089 codec = tlv320dac33_codec; 1089 codec = tlv320dac33_codec;
1090 socdev->card->codec = codec; 1090 socdev->card->codec = codec;
1091 dac33 = codec->private_data; 1091 dac33 = snd_soc_codec_get_drvdata(codec);
1092 1092
1093 /* Power up the codec */ 1093 /* Power up the codec */
1094 dac33_hard_power(codec, 1); 1094 dac33_hard_power(codec, 1);
@@ -1209,7 +1209,7 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client,
1209 return -ENOMEM; 1209 return -ENOMEM;
1210 1210
1211 codec = &dac33->codec; 1211 codec = &dac33->codec;
1212 codec->private_data = dac33; 1212 snd_soc_codec_set_drvdata(codec, dac33);
1213 codec->control_data = client; 1213 codec->control_data = client;
1214 1214
1215 mutex_init(&codec->mutex); 1215 mutex_init(&codec->mutex);
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index bf59b8a4d1d..4eb5a2e59f3 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -175,7 +175,7 @@ static inline void twl4030_write_reg_cache(struct snd_soc_codec *codec,
175static int twl4030_write(struct snd_soc_codec *codec, 175static int twl4030_write(struct snd_soc_codec *codec,
176 unsigned int reg, unsigned int value) 176 unsigned int reg, unsigned int value)
177{ 177{
178 struct twl4030_priv *twl4030 = codec->private_data; 178 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
179 int write_to_reg = 0; 179 int write_to_reg = 0;
180 180
181 twl4030_write_reg_cache(codec, reg, value); 181 twl4030_write_reg_cache(codec, reg, value);
@@ -220,7 +220,7 @@ static int twl4030_write(struct snd_soc_codec *codec,
220 220
221static void twl4030_codec_enable(struct snd_soc_codec *codec, int enable) 221static void twl4030_codec_enable(struct snd_soc_codec *codec, int enable)
222{ 222{
223 struct twl4030_priv *twl4030 = codec->private_data; 223 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
224 int mode; 224 int mode;
225 225
226 if (enable == twl4030->codec_powered) 226 if (enable == twl4030->codec_powered)
@@ -258,7 +258,7 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
258 258
259static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable) 259static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable)
260{ 260{
261 struct twl4030_priv *twl4030 = codec->private_data; 261 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
262 int status; 262 int status;
263 263
264 if (enable == twl4030->apll_enabled) 264 if (enable == twl4030->apll_enabled)
@@ -279,7 +279,7 @@ static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable)
279 279
280static void twl4030_power_up(struct snd_soc_codec *codec) 280static void twl4030_power_up(struct snd_soc_codec *codec)
281{ 281{
282 struct twl4030_priv *twl4030 = codec->private_data; 282 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
283 u8 anamicl, regmisc1, byte; 283 u8 anamicl, regmisc1, byte;
284 int i = 0; 284 int i = 0;
285 285
@@ -570,7 +570,7 @@ static int micpath_event(struct snd_soc_dapm_widget *w,
570static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \ 570static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \
571 struct snd_kcontrol *kcontrol, int event) \ 571 struct snd_kcontrol *kcontrol, int event) \
572{ \ 572{ \
573 struct twl4030_priv *twl4030 = w->codec->private_data; \ 573 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); \
574 \ 574 \
575 switch (event) { \ 575 switch (event) { \
576 case SND_SOC_DAPM_POST_PMU: \ 576 case SND_SOC_DAPM_POST_PMU: \
@@ -678,7 +678,7 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
678 struct twl4030_setup_data *setup = socdev->codec_data; 678 struct twl4030_setup_data *setup = socdev->codec_data;
679 679
680 unsigned char hs_gain, hs_pop; 680 unsigned char hs_gain, hs_pop;
681 struct twl4030_priv *twl4030 = codec->private_data; 681 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
682 /* Base values for ramp delay calculation: 2^19 - 2^26 */ 682 /* Base values for ramp delay calculation: 2^19 - 2^26 */
683 unsigned int ramp_base[] = {524288, 1048576, 2097152, 4194304, 683 unsigned int ramp_base[] = {524288, 1048576, 2097152, 4194304,
684 8388608, 16777216, 33554432, 67108864}; 684 8388608, 16777216, 33554432, 67108864};
@@ -741,7 +741,7 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
741static int headsetlpga_event(struct snd_soc_dapm_widget *w, 741static int headsetlpga_event(struct snd_soc_dapm_widget *w,
742 struct snd_kcontrol *kcontrol, int event) 742 struct snd_kcontrol *kcontrol, int event)
743{ 743{
744 struct twl4030_priv *twl4030 = w->codec->private_data; 744 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
745 745
746 switch (event) { 746 switch (event) {
747 case SND_SOC_DAPM_POST_PMU: 747 case SND_SOC_DAPM_POST_PMU:
@@ -765,7 +765,7 @@ static int headsetlpga_event(struct snd_soc_dapm_widget *w,
765static int headsetrpga_event(struct snd_soc_dapm_widget *w, 765static int headsetrpga_event(struct snd_soc_dapm_widget *w,
766 struct snd_kcontrol *kcontrol, int event) 766 struct snd_kcontrol *kcontrol, int event)
767{ 767{
768 struct twl4030_priv *twl4030 = w->codec->private_data; 768 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
769 769
770 switch (event) { 770 switch (event) {
771 case SND_SOC_DAPM_POST_PMU: 771 case SND_SOC_DAPM_POST_PMU:
@@ -957,7 +957,7 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
957 struct snd_ctl_elem_value *ucontrol) 957 struct snd_ctl_elem_value *ucontrol)
958{ 958{
959 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 959 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
960 struct twl4030_priv *twl4030 = codec->private_data; 960 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
961 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 961 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
962 unsigned short val; 962 unsigned short val;
963 unsigned short mask, bitmask; 963 unsigned short mask, bitmask;
@@ -1627,7 +1627,7 @@ static int twl4030_startup(struct snd_pcm_substream *substream,
1627 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1627 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1628 struct snd_soc_device *socdev = rtd->socdev; 1628 struct snd_soc_device *socdev = rtd->socdev;
1629 struct snd_soc_codec *codec = socdev->card->codec; 1629 struct snd_soc_codec *codec = socdev->card->codec;
1630 struct twl4030_priv *twl4030 = codec->private_data; 1630 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1631 1631
1632 if (twl4030->master_substream) { 1632 if (twl4030->master_substream) {
1633 twl4030->slave_substream = substream; 1633 twl4030->slave_substream = substream;
@@ -1658,7 +1658,7 @@ static void twl4030_shutdown(struct snd_pcm_substream *substream,
1658 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1658 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1659 struct snd_soc_device *socdev = rtd->socdev; 1659 struct snd_soc_device *socdev = rtd->socdev;
1660 struct snd_soc_codec *codec = socdev->card->codec; 1660 struct snd_soc_codec *codec = socdev->card->codec;
1661 struct twl4030_priv *twl4030 = codec->private_data; 1661 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1662 1662
1663 if (twl4030->master_substream == substream) 1663 if (twl4030->master_substream == substream)
1664 twl4030->master_substream = twl4030->slave_substream; 1664 twl4030->master_substream = twl4030->slave_substream;
@@ -1684,7 +1684,7 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
1684 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1684 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1685 struct snd_soc_device *socdev = rtd->socdev; 1685 struct snd_soc_device *socdev = rtd->socdev;
1686 struct snd_soc_codec *codec = socdev->card->codec; 1686 struct snd_soc_codec *codec = socdev->card->codec;
1687 struct twl4030_priv *twl4030 = codec->private_data; 1687 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1688 u8 mode, old_mode, format, old_format; 1688 u8 mode, old_mode, format, old_format;
1689 1689
1690 /* If the substream has 4 channel, do the necessary setup */ 1690 /* If the substream has 4 channel, do the necessary setup */
@@ -1804,7 +1804,7 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1804 int clk_id, unsigned int freq, int dir) 1804 int clk_id, unsigned int freq, int dir)
1805{ 1805{
1806 struct snd_soc_codec *codec = codec_dai->codec; 1806 struct snd_soc_codec *codec = codec_dai->codec;
1807 struct twl4030_priv *twl4030 = codec->private_data; 1807 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1808 1808
1809 switch (freq) { 1809 switch (freq) {
1810 case 19200000: 1810 case 19200000:
@@ -1919,7 +1919,7 @@ static int twl4030_voice_startup(struct snd_pcm_substream *substream,
1919 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1919 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1920 struct snd_soc_device *socdev = rtd->socdev; 1920 struct snd_soc_device *socdev = rtd->socdev;
1921 struct snd_soc_codec *codec = socdev->card->codec; 1921 struct snd_soc_codec *codec = socdev->card->codec;
1922 struct twl4030_priv *twl4030 = codec->private_data; 1922 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1923 u8 mode; 1923 u8 mode;
1924 1924
1925 /* If the system master clock is not 26MHz, the voice PCM interface is 1925 /* If the system master clock is not 26MHz, the voice PCM interface is
@@ -2164,7 +2164,7 @@ static int twl4030_soc_probe(struct platform_device *pdev)
2164 BUG_ON(!twl4030_codec); 2164 BUG_ON(!twl4030_codec);
2165 2165
2166 codec = twl4030_codec; 2166 codec = twl4030_codec;
2167 twl4030 = codec->private_data; 2167 twl4030 = snd_soc_codec_get_drvdata(codec);
2168 socdev->card->codec = codec; 2168 socdev->card->codec = codec;
2169 2169
2170 /* Configuration for headset ramp delay from setup data */ 2170 /* Configuration for headset ramp delay from setup data */
@@ -2227,7 +2227,7 @@ static int __devinit twl4030_codec_probe(struct platform_device *pdev)
2227 } 2227 }
2228 2228
2229 codec = &twl4030->codec; 2229 codec = &twl4030->codec;
2230 codec->private_data = twl4030; 2230 snd_soc_codec_set_drvdata(codec, twl4030);
2231 codec->dev = &pdev->dev; 2231 codec->dev = &pdev->dev;
2232 twl4030_dai[0].dev = &pdev->dev; 2232 twl4030_dai[0].dev = &pdev->dev;
2233 twl4030_dai[1].dev = &pdev->dev; 2233 twl4030_dai[1].dev = &pdev->dev;
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index 3e99fe5131d..20deaca8e10 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -174,7 +174,7 @@ static int uda134x_startup(struct snd_pcm_substream *substream,
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->card->codec; 176 struct snd_soc_codec *codec = socdev->card->codec;
177 struct uda134x_priv *uda134x = codec->private_data; 177 struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
178 struct snd_pcm_runtime *master_runtime; 178 struct snd_pcm_runtime *master_runtime;
179 179
180 if (uda134x->master_substream) { 180 if (uda134x->master_substream) {
@@ -207,7 +207,7 @@ static void uda134x_shutdown(struct snd_pcm_substream *substream,
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->card->codec; 209 struct snd_soc_codec *codec = socdev->card->codec;
210 struct uda134x_priv *uda134x = codec->private_data; 210 struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
211 211
212 if (uda134x->master_substream == substream) 212 if (uda134x->master_substream == substream)
213 uda134x->master_substream = uda134x->slave_substream; 213 uda134x->master_substream = uda134x->slave_substream;
@@ -222,7 +222,7 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream,
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->card->codec; 224 struct snd_soc_codec *codec = socdev->card->codec;
225 struct uda134x_priv *uda134x = codec->private_data; 225 struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
226 u8 hw_params; 226 u8 hw_params;
227 227
228 if (substream == uda134x->slave_substream) { 228 if (substream == uda134x->slave_substream) {
@@ -294,7 +294,7 @@ static int uda134x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
294 int clk_id, unsigned int freq, int dir) 294 int clk_id, unsigned int freq, int dir)
295{ 295{
296 struct snd_soc_codec *codec = codec_dai->codec; 296 struct snd_soc_codec *codec = codec_dai->codec;
297 struct uda134x_priv *uda134x = codec->private_data; 297 struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
298 298
299 pr_debug("%s clk_id: %d, freq: %u, dir: %d\n", __func__, 299 pr_debug("%s clk_id: %d, freq: %u, dir: %d\n", __func__,
300 clk_id, freq, dir); 300 clk_id, freq, dir);
@@ -316,7 +316,7 @@ static int uda134x_set_dai_fmt(struct snd_soc_dai *codec_dai,
316 unsigned int fmt) 316 unsigned int fmt)
317{ 317{
318 struct snd_soc_codec *codec = codec_dai->codec; 318 struct snd_soc_codec *codec = codec_dai->codec;
319 struct uda134x_priv *uda134x = codec->private_data; 319 struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
320 320
321 pr_debug("%s fmt: %08X\n", __func__, fmt); 321 pr_debug("%s fmt: %08X\n", __func__, fmt);
322 322
@@ -503,7 +503,7 @@ static int uda134x_soc_probe(struct platform_device *pdev)
503 uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL); 503 uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL);
504 if (uda134x == NULL) 504 if (uda134x == NULL)
505 goto priv_err; 505 goto priv_err;
506 codec->private_data = uda134x; 506 snd_soc_codec_set_drvdata(codec, uda134x);
507 507
508 codec->reg_cache = kmemdup(uda134x_reg, sizeof(uda134x_reg), 508 codec->reg_cache = kmemdup(uda134x_reg, sizeof(uda134x_reg),
509 GFP_KERNEL); 509 GFP_KERNEL);
@@ -567,7 +567,7 @@ static int uda134x_soc_probe(struct platform_device *pdev)
567pcm_err: 567pcm_err:
568 kfree(codec->reg_cache); 568 kfree(codec->reg_cache);
569reg_err: 569reg_err:
570 kfree(codec->private_data); 570 kfree(snd_soc_codec_get_drvdata(codec));
571priv_err: 571priv_err:
572 kfree(codec); 572 kfree(codec);
573 return ret; 573 return ret;
@@ -585,7 +585,7 @@ static int uda134x_soc_remove(struct platform_device *pdev)
585 snd_soc_free_pcms(socdev); 585 snd_soc_free_pcms(socdev);
586 snd_soc_dapm_free(socdev); 586 snd_soc_dapm_free(socdev);
587 587
588 kfree(codec->private_data); 588 kfree(snd_soc_codec_get_drvdata(codec));
589 kfree(codec->reg_cache); 589 kfree(codec->reg_cache);
590 kfree(codec); 590 kfree(codec);
591 591
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 9cd0a66b766..ecba686563a 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -476,7 +476,7 @@ static int uda1380_trigger(struct snd_pcm_substream *substream, int cmd,
476 struct snd_soc_pcm_runtime *rtd = substream->private_data; 476 struct snd_soc_pcm_runtime *rtd = substream->private_data;
477 struct snd_soc_device *socdev = rtd->socdev; 477 struct snd_soc_device *socdev = rtd->socdev;
478 struct snd_soc_codec *codec = socdev->card->codec; 478 struct snd_soc_codec *codec = socdev->card->codec;
479 struct uda1380_priv *uda1380 = codec->private_data; 479 struct uda1380_priv *uda1380 = snd_soc_codec_get_drvdata(codec);
480 int mixer = uda1380_read_reg_cache(codec, UDA1380_MIXER); 480 int mixer = uda1380_read_reg_cache(codec, UDA1380_MIXER);
481 481
482 switch (cmd) { 482 switch (cmd) {
@@ -774,7 +774,7 @@ static int uda1380_register(struct uda1380_priv *uda1380)
774 INIT_LIST_HEAD(&codec->dapm_widgets); 774 INIT_LIST_HEAD(&codec->dapm_widgets);
775 INIT_LIST_HEAD(&codec->dapm_paths); 775 INIT_LIST_HEAD(&codec->dapm_paths);
776 776
777 codec->private_data = uda1380; 777 snd_soc_codec_set_drvdata(codec, uda1380);
778 codec->name = "UDA1380"; 778 codec->name = "UDA1380";
779 codec->owner = THIS_MODULE; 779 codec->owner = THIS_MODULE;
780 codec->read = uda1380_read_reg_cache; 780 codec->read = uda1380_read_reg_cache;
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 8ac92f5e4f9..145467d3705 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -95,7 +95,7 @@ static int wm8350_codec_write(struct snd_soc_codec *codec, unsigned int reg,
95 */ 95 */
96static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec) 96static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec)
97{ 97{
98 struct wm8350_data *wm8350_data = codec->private_data; 98 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
99 struct wm8350_output *out1 = &wm8350_data->out1; 99 struct wm8350_output *out1 = &wm8350_data->out1;
100 struct wm8350 *wm8350 = codec->control_data; 100 struct wm8350 *wm8350 = codec->control_data;
101 int left_complete = 0, right_complete = 0; 101 int left_complete = 0, right_complete = 0;
@@ -161,7 +161,7 @@ static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec)
161 */ 161 */
162static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec) 162static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec)
163{ 163{
164 struct wm8350_data *wm8350_data = codec->private_data; 164 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
165 struct wm8350_output *out2 = &wm8350_data->out2; 165 struct wm8350_output *out2 = &wm8350_data->out2;
166 struct wm8350 *wm8350 = codec->control_data; 166 struct wm8350 *wm8350 = codec->control_data;
167 int left_complete = 0, right_complete = 0; 167 int left_complete = 0, right_complete = 0;
@@ -231,7 +231,7 @@ static void wm8350_pga_work(struct work_struct *work)
231{ 231{
232 struct snd_soc_codec *codec = 232 struct snd_soc_codec *codec =
233 container_of(work, struct snd_soc_codec, delayed_work.work); 233 container_of(work, struct snd_soc_codec, delayed_work.work);
234 struct wm8350_data *wm8350_data = codec->private_data; 234 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
235 struct wm8350_output *out1 = &wm8350_data->out1, 235 struct wm8350_output *out1 = &wm8350_data->out1,
236 *out2 = &wm8350_data->out2; 236 *out2 = &wm8350_data->out2;
237 int i, out1_complete, out2_complete; 237 int i, out1_complete, out2_complete;
@@ -278,7 +278,7 @@ static int pga_event(struct snd_soc_dapm_widget *w,
278 struct snd_kcontrol *kcontrol, int event) 278 struct snd_kcontrol *kcontrol, int event)
279{ 279{
280 struct snd_soc_codec *codec = w->codec; 280 struct snd_soc_codec *codec = w->codec;
281 struct wm8350_data *wm8350_data = codec->private_data; 281 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
282 struct wm8350_output *out; 282 struct wm8350_output *out;
283 283
284 switch (w->shift) { 284 switch (w->shift) {
@@ -323,7 +323,7 @@ static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol,
323 struct snd_ctl_elem_value *ucontrol) 323 struct snd_ctl_elem_value *ucontrol)
324{ 324{
325 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 325 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
326 struct wm8350_data *wm8350_priv = codec->private_data; 326 struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
327 struct wm8350_output *out = NULL; 327 struct wm8350_output *out = NULL;
328 struct soc_mixer_control *mc = 328 struct soc_mixer_control *mc =
329 (struct soc_mixer_control *)kcontrol->private_value; 329 (struct soc_mixer_control *)kcontrol->private_value;
@@ -366,7 +366,7 @@ static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol,
366 struct snd_ctl_elem_value *ucontrol) 366 struct snd_ctl_elem_value *ucontrol)
367{ 367{
368 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 368 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
369 struct wm8350_data *wm8350_priv = codec->private_data; 369 struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
370 struct wm8350_output *out1 = &wm8350_priv->out1; 370 struct wm8350_output *out1 = &wm8350_priv->out1;
371 struct wm8350_output *out2 = &wm8350_priv->out2; 371 struct wm8350_output *out2 = &wm8350_priv->out2;
372 struct soc_mixer_control *mc = 372 struct soc_mixer_control *mc =
@@ -1108,7 +1108,7 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
1108{ 1108{
1109 struct snd_soc_codec *codec = codec_dai->codec; 1109 struct snd_soc_codec *codec = codec_dai->codec;
1110 struct wm8350 *wm8350 = codec->control_data; 1110 struct wm8350 *wm8350 = codec->control_data;
1111 struct wm8350_data *priv = codec->private_data; 1111 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1112 struct _fll_div fll_div; 1112 struct _fll_div fll_div;
1113 int ret = 0; 1113 int ret = 0;
1114 u16 fll_1, fll_4; 1114 u16 fll_1, fll_4;
@@ -1160,7 +1160,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
1160 enum snd_soc_bias_level level) 1160 enum snd_soc_bias_level level)
1161{ 1161{
1162 struct wm8350 *wm8350 = codec->control_data; 1162 struct wm8350 *wm8350 = codec->control_data;
1163 struct wm8350_data *priv = codec->private_data; 1163 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1164 struct wm8350_audio_platform_data *platform = 1164 struct wm8350_audio_platform_data *platform =
1165 wm8350->codec.platform_data; 1165 wm8350->codec.platform_data;
1166 u16 pm1; 1166 u16 pm1;
@@ -1399,7 +1399,7 @@ static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
1399int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, 1399int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
1400 struct snd_soc_jack *jack, int report) 1400 struct snd_soc_jack *jack, int report)
1401{ 1401{
1402 struct wm8350_data *priv = codec->private_data; 1402 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1403 struct wm8350 *wm8350 = codec->control_data; 1403 struct wm8350 *wm8350 = codec->control_data;
1404 int irq; 1404 int irq;
1405 int ena; 1405 int ena;
@@ -1471,7 +1471,7 @@ int wm8350_mic_jack_detect(struct snd_soc_codec *codec,
1471 struct snd_soc_jack *jack, 1471 struct snd_soc_jack *jack,
1472 int detect_report, int short_report) 1472 int detect_report, int short_report)
1473{ 1473{
1474 struct wm8350_data *priv = codec->private_data; 1474 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1475 struct wm8350 *wm8350 = codec->control_data; 1475 struct wm8350 *wm8350 = codec->control_data;
1476 1476
1477 priv->mic.jack = jack; 1477 priv->mic.jack = jack;
@@ -1508,7 +1508,7 @@ static int wm8350_probe(struct platform_device *pdev)
1508 socdev->card->codec = wm8350_codec; 1508 socdev->card->codec = wm8350_codec;
1509 codec = socdev->card->codec; 1509 codec = socdev->card->codec;
1510 wm8350 = codec->control_data; 1510 wm8350 = codec->control_data;
1511 priv = codec->private_data; 1511 priv = snd_soc_codec_get_drvdata(codec);
1512 1512
1513 /* Enable the codec */ 1513 /* Enable the codec */
1514 wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1514 wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
@@ -1579,7 +1579,7 @@ static int wm8350_remove(struct platform_device *pdev)
1579 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1579 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1580 struct snd_soc_codec *codec = socdev->card->codec; 1580 struct snd_soc_codec *codec = socdev->card->codec;
1581 struct wm8350 *wm8350 = codec->control_data; 1581 struct wm8350 *wm8350 = codec->control_data;
1582 struct wm8350_data *priv = codec->private_data; 1582 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1583 int ret; 1583 int ret;
1584 1584
1585 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, 1585 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
@@ -1698,7 +1698,7 @@ static __devinit int wm8350_codec_probe(struct platform_device *pdev)
1698 codec->dai = &wm8350_dai; 1698 codec->dai = &wm8350_dai;
1699 codec->num_dai = 1; 1699 codec->num_dai = 1;
1700 codec->reg_cache_size = WM8350_MAX_REGISTER; 1700 codec->reg_cache_size = WM8350_MAX_REGISTER;
1701 codec->private_data = priv; 1701 snd_soc_codec_set_drvdata(codec, priv);
1702 codec->control_data = wm8350; 1702 codec->control_data = wm8350;
1703 1703
1704 /* Put the codec into reset if it wasn't already */ 1704 /* Put the codec into reset if it wasn't already */
@@ -1730,7 +1730,7 @@ static int __devexit wm8350_codec_remove(struct platform_device *pdev)
1730{ 1730{
1731 struct wm8350 *wm8350 = platform_get_drvdata(pdev); 1731 struct wm8350 *wm8350 = platform_get_drvdata(pdev);
1732 struct snd_soc_codec *codec = wm8350->codec.codec; 1732 struct snd_soc_codec *codec = wm8350->codec.codec;
1733 struct wm8350_data *priv = codec->private_data; 1733 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1734 1734
1735 snd_soc_unregister_dai(&wm8350_dai); 1735 snd_soc_unregister_dai(&wm8350_dai);
1736 snd_soc_unregister_codec(codec); 1736 snd_soc_unregister_codec(codec);
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index b432f4d4a32..a7506ae2b8c 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -76,7 +76,7 @@ struct wm8400_priv {
76static inline unsigned int wm8400_read(struct snd_soc_codec *codec, 76static inline unsigned int wm8400_read(struct snd_soc_codec *codec,
77 unsigned int reg) 77 unsigned int reg)
78{ 78{
79 struct wm8400_priv *wm8400 = codec->private_data; 79 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
80 80
81 if (reg == WM8400_INTDRIVBITS) 81 if (reg == WM8400_INTDRIVBITS)
82 return wm8400->fake_register; 82 return wm8400->fake_register;
@@ -90,7 +90,7 @@ static inline unsigned int wm8400_read(struct snd_soc_codec *codec,
90static int wm8400_write(struct snd_soc_codec *codec, unsigned int reg, 90static int wm8400_write(struct snd_soc_codec *codec, unsigned int reg,
91 unsigned int value) 91 unsigned int value)
92{ 92{
93 struct wm8400_priv *wm8400 = codec->private_data; 93 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
94 94
95 if (reg == WM8400_INTDRIVBITS) { 95 if (reg == WM8400_INTDRIVBITS) {
96 wm8400->fake_register = value; 96 wm8400->fake_register = value;
@@ -101,7 +101,7 @@ static int wm8400_write(struct snd_soc_codec *codec, unsigned int reg,
101 101
102static void wm8400_codec_reset(struct snd_soc_codec *codec) 102static void wm8400_codec_reset(struct snd_soc_codec *codec)
103{ 103{
104 struct wm8400_priv *wm8400 = codec->private_data; 104 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
105 105
106 wm8400_reset_codec_reg_cache(wm8400->wm8400); 106 wm8400_reset_codec_reg_cache(wm8400->wm8400);
107} 107}
@@ -925,7 +925,7 @@ static int wm8400_set_dai_sysclk(struct snd_soc_dai *codec_dai,
925 int clk_id, unsigned int freq, int dir) 925 int clk_id, unsigned int freq, int dir)
926{ 926{
927 struct snd_soc_codec *codec = codec_dai->codec; 927 struct snd_soc_codec *codec = codec_dai->codec;
928 struct wm8400_priv *wm8400 = codec->private_data; 928 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
929 929
930 wm8400->sysclk = freq; 930 wm8400->sysclk = freq;
931 return 0; 931 return 0;
@@ -1014,7 +1014,7 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
1014 unsigned int freq_out) 1014 unsigned int freq_out)
1015{ 1015{
1016 struct snd_soc_codec *codec = codec_dai->codec; 1016 struct snd_soc_codec *codec = codec_dai->codec;
1017 struct wm8400_priv *wm8400 = codec->private_data; 1017 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
1018 struct fll_factors factors; 1018 struct fll_factors factors;
1019 int ret; 1019 int ret;
1020 u16 reg; 1020 u16 reg;
@@ -1203,7 +1203,7 @@ static int wm8400_mute(struct snd_soc_dai *dai, int mute)
1203static int wm8400_set_bias_level(struct snd_soc_codec *codec, 1203static int wm8400_set_bias_level(struct snd_soc_codec *codec,
1204 enum snd_soc_bias_level level) 1204 enum snd_soc_bias_level level)
1205{ 1205{
1206 struct wm8400_priv *wm8400 = codec->private_data; 1206 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
1207 u16 val; 1207 u16 val;
1208 int ret; 1208 int ret;
1209 1209
@@ -1466,7 +1466,7 @@ static int wm8400_codec_probe(struct platform_device *dev)
1466 return -ENOMEM; 1466 return -ENOMEM;
1467 1467
1468 codec = &priv->codec; 1468 codec = &priv->codec;
1469 codec->private_data = priv; 1469 snd_soc_codec_set_drvdata(codec, priv);
1470 codec->control_data = dev_get_drvdata(&dev->dev); 1470 codec->control_data = dev_get_drvdata(&dev->dev);
1471 priv->wm8400 = dev_get_drvdata(&dev->dev); 1471 priv->wm8400 = dev_get_drvdata(&dev->dev);
1472 1472
@@ -1529,7 +1529,7 @@ err:
1529 1529
1530static int __exit wm8400_codec_remove(struct platform_device *dev) 1530static int __exit wm8400_codec_remove(struct platform_device *dev)
1531{ 1531{
1532 struct wm8400_priv *priv = wm8400_codec->private_data; 1532 struct wm8400_priv *priv = snd_soc_codec_get_drvdata(wm8400_codec);
1533 u16 reg; 1533 u16 reg;
1534 1534
1535 snd_soc_unregister_dai(&wm8400_dai); 1535 snd_soc_unregister_dai(&wm8400_dai);
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index d3a61d7ea0c..2cdffb0b2a8 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -137,7 +137,7 @@ static int wm8523_startup(struct snd_pcm_substream *substream,
137 struct snd_soc_dai *dai) 137 struct snd_soc_dai *dai)
138{ 138{
139 struct snd_soc_codec *codec = dai->codec; 139 struct snd_soc_codec *codec = dai->codec;
140 struct wm8523_priv *wm8523 = codec->private_data; 140 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
141 141
142 /* The set of sample rates that can be supported depends on the 142 /* The set of sample rates that can be supported depends on the
143 * MCLK supplied to the CODEC - enforce this. 143 * MCLK supplied to the CODEC - enforce this.
@@ -163,7 +163,7 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream,
163 struct snd_soc_pcm_runtime *rtd = substream->private_data; 163 struct snd_soc_pcm_runtime *rtd = substream->private_data;
164 struct snd_soc_device *socdev = rtd->socdev; 164 struct snd_soc_device *socdev = rtd->socdev;
165 struct snd_soc_codec *codec = socdev->card->codec; 165 struct snd_soc_codec *codec = socdev->card->codec;
166 struct wm8523_priv *wm8523 = codec->private_data; 166 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
167 int i; 167 int i;
168 u16 aifctrl1 = snd_soc_read(codec, WM8523_AIF_CTRL1); 168 u16 aifctrl1 = snd_soc_read(codec, WM8523_AIF_CTRL1);
169 u16 aifctrl2 = snd_soc_read(codec, WM8523_AIF_CTRL2); 169 u16 aifctrl2 = snd_soc_read(codec, WM8523_AIF_CTRL2);
@@ -210,7 +210,7 @@ static int wm8523_set_dai_sysclk(struct snd_soc_dai *codec_dai,
210 int clk_id, unsigned int freq, int dir) 210 int clk_id, unsigned int freq, int dir)
211{ 211{
212 struct snd_soc_codec *codec = codec_dai->codec; 212 struct snd_soc_codec *codec = codec_dai->codec;
213 struct wm8523_priv *wm8523 = codec->private_data; 213 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
214 unsigned int val; 214 unsigned int val;
215 int i; 215 int i;
216 216
@@ -317,7 +317,7 @@ static int wm8523_set_dai_fmt(struct snd_soc_dai *codec_dai,
317static int wm8523_set_bias_level(struct snd_soc_codec *codec, 317static int wm8523_set_bias_level(struct snd_soc_codec *codec,
318 enum snd_soc_bias_level level) 318 enum snd_soc_bias_level level)
319{ 319{
320 struct wm8523_priv *wm8523 = codec->private_data; 320 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
321 int ret, i; 321 int ret, i;
322 322
323 switch (level) { 323 switch (level) {
@@ -488,7 +488,7 @@ static int wm8523_register(struct wm8523_priv *wm8523,
488 INIT_LIST_HEAD(&codec->dapm_widgets); 488 INIT_LIST_HEAD(&codec->dapm_widgets);
489 INIT_LIST_HEAD(&codec->dapm_paths); 489 INIT_LIST_HEAD(&codec->dapm_paths);
490 490
491 codec->private_data = wm8523; 491 snd_soc_codec_set_drvdata(codec, wm8523);
492 codec->name = "WM8523"; 492 codec->name = "WM8523";
493 codec->owner = THIS_MODULE; 493 codec->owner = THIS_MODULE;
494 codec->bias_level = SND_SOC_BIAS_OFF; 494 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index d077df6f5e7..94b3f4c4d64 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -411,7 +411,7 @@ static int wm8580_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
411{ 411{
412 int offset; 412 int offset;
413 struct snd_soc_codec *codec = codec_dai->codec; 413 struct snd_soc_codec *codec = codec_dai->codec;
414 struct wm8580_priv *wm8580 = codec->private_data; 414 struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec);
415 struct pll_state *state; 415 struct pll_state *state;
416 struct _pll_div pll_div; 416 struct _pll_div pll_div;
417 unsigned int reg; 417 unsigned int reg;
@@ -839,7 +839,7 @@ static int wm8580_register(struct wm8580_priv *wm8580,
839 INIT_LIST_HEAD(&codec->dapm_widgets); 839 INIT_LIST_HEAD(&codec->dapm_widgets);
840 INIT_LIST_HEAD(&codec->dapm_paths); 840 INIT_LIST_HEAD(&codec->dapm_paths);
841 841
842 codec->private_data = wm8580; 842 snd_soc_codec_set_drvdata(codec, wm8580);
843 codec->name = "WM8580"; 843 codec->name = "WM8580";
844 codec->owner = THIS_MODULE; 844 codec->owner = THIS_MODULE;
845 codec->bias_level = SND_SOC_BIAS_OFF; 845 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c
index 24a35603bcf..f350c5ecd09 100644
--- a/sound/soc/codecs/wm8711.c
+++ b/sound/soc/codecs/wm8711.c
@@ -162,7 +162,7 @@ static int wm8711_hw_params(struct snd_pcm_substream *substream,
162 struct snd_soc_dai *dai) 162 struct snd_soc_dai *dai)
163{ 163{
164 struct snd_soc_codec *codec = dai->codec; 164 struct snd_soc_codec *codec = dai->codec;
165 struct wm8711_priv *wm8711 = codec->private_data; 165 struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
166 u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfffc; 166 u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfffc;
167 int i = get_coeff(wm8711->sysclk, params_rate(params)); 167 int i = get_coeff(wm8711->sysclk, params_rate(params));
168 u16 srate = (coeff_div[i].sr << 2) | 168 u16 srate = (coeff_div[i].sr << 2) |
@@ -226,7 +226,7 @@ static int wm8711_set_dai_sysclk(struct snd_soc_dai *codec_dai,
226 int clk_id, unsigned int freq, int dir) 226 int clk_id, unsigned int freq, int dir)
227{ 227{
228 struct snd_soc_codec *codec = codec_dai->codec; 228 struct snd_soc_codec *codec = codec_dai->codec;
229 struct wm8711_priv *wm8711 = codec->private_data; 229 struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
230 230
231 switch (freq) { 231 switch (freq) {
232 case 11289600: 232 case 11289600:
@@ -445,7 +445,7 @@ static int wm8711_register(struct wm8711_priv *wm8711,
445 INIT_LIST_HEAD(&codec->dapm_widgets); 445 INIT_LIST_HEAD(&codec->dapm_widgets);
446 INIT_LIST_HEAD(&codec->dapm_paths); 446 INIT_LIST_HEAD(&codec->dapm_paths);
447 447
448 codec->private_data = wm8711; 448 snd_soc_codec_set_drvdata(codec, wm8711);
449 codec->name = "WM8711"; 449 codec->name = "WM8711";
450 codec->owner = THIS_MODULE; 450 codec->owner = THIS_MODULE;
451 codec->bias_level = SND_SOC_BIAS_OFF; 451 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index d5e1c5b681e..63f90c4ad93 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -224,7 +224,7 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream,
224 struct snd_soc_pcm_runtime *rtd = substream->private_data; 224 struct snd_soc_pcm_runtime *rtd = substream->private_data;
225 struct snd_soc_device *socdev = rtd->socdev; 225 struct snd_soc_device *socdev = rtd->socdev;
226 struct snd_soc_codec *codec = socdev->card->codec; 226 struct snd_soc_codec *codec = socdev->card->codec;
227 struct wm8731_priv *wm8731 = codec->private_data; 227 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
228 u16 iface = snd_soc_read(codec, WM8731_IFACE) & 0xfff3; 228 u16 iface = snd_soc_read(codec, WM8731_IFACE) & 0xfff3;
229 int i = get_coeff(wm8731->sysclk, params_rate(params)); 229 int i = get_coeff(wm8731->sysclk, params_rate(params));
230 u16 srate = (coeff_div[i].sr << 2) | 230 u16 srate = (coeff_div[i].sr << 2) |
@@ -291,7 +291,7 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
291 int clk_id, unsigned int freq, int dir) 291 int clk_id, unsigned int freq, int dir)
292{ 292{
293 struct snd_soc_codec *codec = codec_dai->codec; 293 struct snd_soc_codec *codec = codec_dai->codec;
294 struct wm8731_priv *wm8731 = codec->private_data; 294 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
295 295
296 switch (freq) { 296 switch (freq) {
297 case 11289600: 297 case 11289600:
@@ -427,7 +427,7 @@ static int wm8731_suspend(struct platform_device *pdev, pm_message_t state)
427{ 427{
428 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 428 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
429 struct snd_soc_codec *codec = socdev->card->codec; 429 struct snd_soc_codec *codec = socdev->card->codec;
430 struct wm8731_priv *wm8731 = codec->private_data; 430 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
431 431
432 snd_soc_write(codec, WM8731_ACTIVE, 0x0); 432 snd_soc_write(codec, WM8731_ACTIVE, 0x0);
433 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF); 433 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -440,7 +440,7 @@ static int wm8731_resume(struct platform_device *pdev)
440{ 440{
441 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 441 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
442 struct snd_soc_codec *codec = socdev->card->codec; 442 struct snd_soc_codec *codec = socdev->card->codec;
443 struct wm8731_priv *wm8731 = codec->private_data; 443 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
444 int i, ret; 444 int i, ret;
445 u8 data[2]; 445 u8 data[2];
446 u16 *cache = codec->reg_cache; 446 u16 *cache = codec->reg_cache;
@@ -535,7 +535,7 @@ static int wm8731_register(struct wm8731_priv *wm8731,
535 INIT_LIST_HEAD(&codec->dapm_widgets); 535 INIT_LIST_HEAD(&codec->dapm_widgets);
536 INIT_LIST_HEAD(&codec->dapm_paths); 536 INIT_LIST_HEAD(&codec->dapm_paths);
537 537
538 codec->private_data = wm8731; 538 snd_soc_codec_set_drvdata(codec, wm8731);
539 codec->name = "WM8731"; 539 codec->name = "WM8731";
540 codec->owner = THIS_MODULE; 540 codec->owner = THIS_MODULE;
541 codec->bias_level = SND_SOC_BIAS_OFF; 541 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 4bbc512c083..60d7cf88bf1 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -482,7 +482,7 @@ static int wm8750_set_dai_sysclk(struct snd_soc_dai *codec_dai,
482 int clk_id, unsigned int freq, int dir) 482 int clk_id, unsigned int freq, int dir)
483{ 483{
484 struct snd_soc_codec *codec = codec_dai->codec; 484 struct snd_soc_codec *codec = codec_dai->codec;
485 struct wm8750_priv *wm8750 = codec->private_data; 485 struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec);
486 486
487 switch (freq) { 487 switch (freq) {
488 case 11289600: 488 case 11289600:
@@ -561,7 +561,7 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream,
561 struct snd_soc_pcm_runtime *rtd = substream->private_data; 561 struct snd_soc_pcm_runtime *rtd = substream->private_data;
562 struct snd_soc_device *socdev = rtd->socdev; 562 struct snd_soc_device *socdev = rtd->socdev;
563 struct snd_soc_codec *codec = socdev->card->codec; 563 struct snd_soc_codec *codec = socdev->card->codec;
564 struct wm8750_priv *wm8750 = codec->private_data; 564 struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec);
565 u16 iface = snd_soc_read(codec, WM8750_IFACE) & 0x1f3; 565 u16 iface = snd_soc_read(codec, WM8750_IFACE) & 0x1f3;
566 u16 srate = snd_soc_read(codec, WM8750_SRATE) & 0x1c0; 566 u16 srate = snd_soc_read(codec, WM8750_SRATE) & 0x1c0;
567 int coeff = get_coeff(wm8750->sysclk, params_rate(params)); 567 int coeff = get_coeff(wm8750->sysclk, params_rate(params));
@@ -775,10 +775,9 @@ static int wm8750_register(struct wm8750_priv *wm8750,
775 codec->set_bias_level = wm8750_set_bias_level; 775 codec->set_bias_level = wm8750_set_bias_level;
776 codec->dai = &wm8750_dai; 776 codec->dai = &wm8750_dai;
777 codec->num_dai = 1; 777 codec->num_dai = 1;
778 codec->private_data = wm8750;
779 codec->reg_cache_size = ARRAY_SIZE(wm8750->reg_cache) + 1; 778 codec->reg_cache_size = ARRAY_SIZE(wm8750->reg_cache) + 1;
780 codec->reg_cache = &wm8750->reg_cache; 779 codec->reg_cache = &wm8750->reg_cache;
781 codec->private_data = wm8750; 780 snd_soc_codec_set_drvdata(codec, wm8750);
782 781
783 memcpy(codec->reg_cache, wm8750_reg, sizeof(wm8750->reg_cache)); 782 memcpy(codec->reg_cache, wm8750_reg, sizeof(wm8750->reg_cache));
784 783
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index c2444e7c848..f9e56a1dfde 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -850,7 +850,7 @@ static int wm8753_set_dai_sysclk(struct snd_soc_dai *codec_dai,
850 int clk_id, unsigned int freq, int dir) 850 int clk_id, unsigned int freq, int dir)
851{ 851{
852 struct snd_soc_codec *codec = codec_dai->codec; 852 struct snd_soc_codec *codec = codec_dai->codec;
853 struct wm8753_priv *wm8753 = codec->private_data; 853 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
854 854
855 switch (freq) { 855 switch (freq) {
856 case 11289600: 856 case 11289600:
@@ -913,7 +913,7 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream,
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->card->codec; 915 struct snd_soc_codec *codec = socdev->card->codec;
916 struct wm8753_priv *wm8753 = codec->private_data; 916 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
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;
919 919
@@ -1147,7 +1147,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream,
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->card->codec; 1149 struct snd_soc_codec *codec = socdev->card->codec;
1150 struct wm8753_priv *wm8753 = codec->private_data; 1150 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
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;
1153 int coeff; 1153 int coeff;
@@ -1645,7 +1645,7 @@ static int wm8753_register(struct wm8753_priv *wm8753)
1645 codec->num_dai = 2; 1645 codec->num_dai = 2;
1646 codec->reg_cache_size = ARRAY_SIZE(wm8753->reg_cache) + 1; 1646 codec->reg_cache_size = ARRAY_SIZE(wm8753->reg_cache) + 1;
1647 codec->reg_cache = &wm8753->reg_cache; 1647 codec->reg_cache = &wm8753->reg_cache;
1648 codec->private_data = wm8753; 1648 snd_soc_codec_set_drvdata(codec, wm8753);
1649 1649
1650 memcpy(codec->reg_cache, wm8753_reg, sizeof(wm8753->reg_cache)); 1650 memcpy(codec->reg_cache, wm8753_reg, sizeof(wm8753->reg_cache));
1651 INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); 1651 INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work);
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index 44e7d9d82f8..694600969d6 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -226,7 +226,7 @@ static int wm8776_hw_params(struct snd_pcm_substream *substream,
226 struct snd_soc_dai *dai) 226 struct snd_soc_dai *dai)
227{ 227{
228 struct snd_soc_codec *codec = dai->codec; 228 struct snd_soc_codec *codec = dai->codec;
229 struct wm8776_priv *wm8776 = codec->private_data; 229 struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec);
230 int iface_reg, iface; 230 int iface_reg, iface;
231 int ratio_shift, master; 231 int ratio_shift, master;
232 int i; 232 int i;
@@ -303,7 +303,7 @@ static int wm8776_set_sysclk(struct snd_soc_dai *dai,
303 int clk_id, unsigned int freq, int dir) 303 int clk_id, unsigned int freq, int dir)
304{ 304{
305 struct snd_soc_codec *codec = dai->codec; 305 struct snd_soc_codec *codec = dai->codec;
306 struct wm8776_priv *wm8776 = codec->private_data; 306 struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec);
307 307
308 BUG_ON(dai->id >= ARRAY_SIZE(wm8776->sysclk)); 308 BUG_ON(dai->id >= ARRAY_SIZE(wm8776->sysclk));
309 309
@@ -490,7 +490,7 @@ static int wm8776_register(struct wm8776_priv *wm8776,
490 INIT_LIST_HEAD(&codec->dapm_widgets); 490 INIT_LIST_HEAD(&codec->dapm_widgets);
491 INIT_LIST_HEAD(&codec->dapm_paths); 491 INIT_LIST_HEAD(&codec->dapm_paths);
492 492
493 codec->private_data = wm8776; 493 snd_soc_codec_set_drvdata(codec, wm8776);
494 codec->name = "WM8776"; 494 codec->name = "WM8776";
495 codec->owner = THIS_MODULE; 495 codec->owner = THIS_MODULE;
496 codec->bias_level = SND_SOC_BIAS_OFF; 496 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index dbc368c0826..19a6b25988c 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -744,7 +744,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
744static int wm8900_set_fll(struct snd_soc_codec *codec, 744static int wm8900_set_fll(struct snd_soc_codec *codec,
745 int fll_id, unsigned int freq_in, unsigned int freq_out) 745 int fll_id, unsigned int freq_in, unsigned int freq_out)
746{ 746{
747 struct wm8900_priv *wm8900 = codec->private_data; 747 struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec);
748 struct _fll_div fll_div; 748 struct _fll_div fll_div;
749 unsigned int reg; 749 unsigned int reg;
750 750
@@ -1131,7 +1131,7 @@ static int wm8900_suspend(struct platform_device *pdev, pm_message_t state)
1131{ 1131{
1132 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1132 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1133 struct snd_soc_codec *codec = socdev->card->codec; 1133 struct snd_soc_codec *codec = socdev->card->codec;
1134 struct wm8900_priv *wm8900 = codec->private_data; 1134 struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec);
1135 int fll_out = wm8900->fll_out; 1135 int fll_out = wm8900->fll_out;
1136 int fll_in = wm8900->fll_in; 1136 int fll_in = wm8900->fll_in;
1137 int ret; 1137 int ret;
@@ -1155,7 +1155,7 @@ static int wm8900_resume(struct platform_device *pdev)
1155{ 1155{
1156 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1156 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1157 struct snd_soc_codec *codec = socdev->card->codec; 1157 struct snd_soc_codec *codec = socdev->card->codec;
1158 struct wm8900_priv *wm8900 = codec->private_data; 1158 struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec);
1159 u16 *cache; 1159 u16 *cache;
1160 int i, ret; 1160 int i, ret;
1161 1161
@@ -1205,7 +1205,7 @@ static __devinit int wm8900_i2c_probe(struct i2c_client *i2c,
1205 return -ENOMEM; 1205 return -ENOMEM;
1206 1206
1207 codec = &wm8900->codec; 1207 codec = &wm8900->codec;
1208 codec->private_data = wm8900; 1208 snd_soc_codec_set_drvdata(codec, wm8900);
1209 codec->reg_cache = &wm8900->reg_cache[0]; 1209 codec->reg_cache = &wm8900->reg_cache[0];
1210 codec->reg_cache_size = WM8900_MAXREG; 1210 codec->reg_cache_size = WM8900_MAXREG;
1211 1211
@@ -1304,7 +1304,7 @@ static __devexit int wm8900_i2c_remove(struct i2c_client *client)
1304 wm8900_set_bias_level(wm8900_codec, SND_SOC_BIAS_OFF); 1304 wm8900_set_bias_level(wm8900_codec, SND_SOC_BIAS_OFF);
1305 1305
1306 wm8900_dai.dev = NULL; 1306 wm8900_dai.dev = NULL;
1307 kfree(wm8900_codec->private_data); 1307 kfree(snd_soc_codec_get_drvdata(wm8900_codec));
1308 wm8900_codec = NULL; 1308 wm8900_codec = NULL;
1309 1309
1310 return 0; 1310 return 0;
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 134b17532f2..5a2510c39c1 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -252,7 +252,7 @@ static int wm8903_run_sequence(struct snd_soc_codec *codec, unsigned int start)
252{ 252{
253 u16 reg[5]; 253 u16 reg[5];
254 struct i2c_client *i2c = codec->control_data; 254 struct i2c_client *i2c = codec->control_data;
255 struct wm8903_priv *wm8903 = codec->private_data; 255 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
256 256
257 BUG_ON(start > 48); 257 BUG_ON(start > 48);
258 258
@@ -420,7 +420,7 @@ static int wm8903_class_w_put(struct snd_kcontrol *kcontrol,
420{ 420{
421 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 421 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
422 struct snd_soc_codec *codec = widget->codec; 422 struct snd_soc_codec *codec = widget->codec;
423 struct wm8903_priv *wm8903 = codec->private_data; 423 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
424 struct i2c_client *i2c = codec->control_data; 424 struct i2c_client *i2c = codec->control_data;
425 u16 reg; 425 u16 reg;
426 int ret; 426 int ret;
@@ -1001,7 +1001,7 @@ static int wm8903_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1001 int clk_id, unsigned int freq, int dir) 1001 int clk_id, unsigned int freq, int dir)
1002{ 1002{
1003 struct snd_soc_codec *codec = codec_dai->codec; 1003 struct snd_soc_codec *codec = codec_dai->codec;
1004 struct wm8903_priv *wm8903 = codec->private_data; 1004 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1005 1005
1006 wm8903->sysclk = freq; 1006 wm8903->sysclk = freq;
1007 1007
@@ -1229,7 +1229,7 @@ static int wm8903_startup(struct snd_pcm_substream *substream,
1229 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1229 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1230 struct snd_soc_device *socdev = rtd->socdev; 1230 struct snd_soc_device *socdev = rtd->socdev;
1231 struct snd_soc_codec *codec = socdev->card->codec; 1231 struct snd_soc_codec *codec = socdev->card->codec;
1232 struct wm8903_priv *wm8903 = codec->private_data; 1232 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1233 struct i2c_client *i2c = codec->control_data; 1233 struct i2c_client *i2c = codec->control_data;
1234 struct snd_pcm_runtime *master_runtime; 1234 struct snd_pcm_runtime *master_runtime;
1235 1235
@@ -1265,7 +1265,7 @@ static void wm8903_shutdown(struct snd_pcm_substream *substream,
1265 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1265 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1266 struct snd_soc_device *socdev = rtd->socdev; 1266 struct snd_soc_device *socdev = rtd->socdev;
1267 struct snd_soc_codec *codec = socdev->card->codec; 1267 struct snd_soc_codec *codec = socdev->card->codec;
1268 struct wm8903_priv *wm8903 = codec->private_data; 1268 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1269 1269
1270 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 1270 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
1271 wm8903->playback_active--; 1271 wm8903->playback_active--;
@@ -1285,7 +1285,7 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
1285 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1285 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1286 struct snd_soc_device *socdev = rtd->socdev; 1286 struct snd_soc_device *socdev = rtd->socdev;
1287 struct snd_soc_codec *codec = socdev->card->codec; 1287 struct snd_soc_codec *codec = socdev->card->codec;
1288 struct wm8903_priv *wm8903 = codec->private_data; 1288 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1289 struct i2c_client *i2c = codec->control_data; 1289 struct i2c_client *i2c = codec->control_data;
1290 int fs = params_rate(params); 1290 int fs = params_rate(params);
1291 int bclk; 1291 int bclk;
@@ -1464,7 +1464,7 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
1464int wm8903_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 1464int wm8903_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
1465 int det, int shrt) 1465 int det, int shrt)
1466{ 1466{
1467 struct wm8903_priv *wm8903 = codec->private_data; 1467 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1468 int irq_mask = WM8903_MICDET_EINT | WM8903_MICSHRT_EINT; 1468 int irq_mask = WM8903_MICDET_EINT | WM8903_MICSHRT_EINT;
1469 1469
1470 dev_dbg(codec->dev, "Enabling microphone detection: %x %x\n", 1470 dev_dbg(codec->dev, "Enabling microphone detection: %x %x\n",
@@ -1674,7 +1674,7 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
1674 codec->num_dai = 1; 1674 codec->num_dai = 1;
1675 codec->reg_cache_size = ARRAY_SIZE(wm8903->reg_cache); 1675 codec->reg_cache_size = ARRAY_SIZE(wm8903->reg_cache);
1676 codec->reg_cache = &wm8903->reg_cache[0]; 1676 codec->reg_cache = &wm8903->reg_cache[0];
1677 codec->private_data = wm8903; 1677 snd_soc_codec_set_drvdata(codec, wm8903);
1678 codec->volatile_register = wm8903_volatile_register; 1678 codec->volatile_register = wm8903_volatile_register;
1679 init_completion(&wm8903->wseq); 1679 init_completion(&wm8903->wseq);
1680 1680
@@ -1812,7 +1812,7 @@ err:
1812static __devexit int wm8903_i2c_remove(struct i2c_client *client) 1812static __devexit int wm8903_i2c_remove(struct i2c_client *client)
1813{ 1813{
1814 struct snd_soc_codec *codec = i2c_get_clientdata(client); 1814 struct snd_soc_codec *codec = i2c_get_clientdata(client);
1815 struct wm8903_priv *priv = codec->private_data; 1815 struct wm8903_priv *priv = snd_soc_codec_get_drvdata(codec);
1816 1816
1817 snd_soc_unregister_dai(&wm8903_dai); 1817 snd_soc_unregister_dai(&wm8903_dai);
1818 snd_soc_unregister_codec(codec); 1818 snd_soc_unregister_codec(codec);
@@ -1822,7 +1822,7 @@ static __devexit int wm8903_i2c_remove(struct i2c_client *client)
1822 if (client->irq) 1822 if (client->irq)
1823 free_irq(client->irq, priv); 1823 free_irq(client->irq, priv);
1824 1824
1825 kfree(codec->private_data); 1825 kfree(priv);
1826 1826
1827 wm8903_codec = NULL; 1827 wm8903_codec = NULL;
1828 wm8903_dai.dev = NULL; 1828 wm8903_dai.dev = NULL;
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index c5b50d73f2d..a022ca7e758 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -612,7 +612,7 @@ static int wm8904_reset(struct snd_soc_codec *codec)
612 612
613static int wm8904_configure_clocking(struct snd_soc_codec *codec) 613static int wm8904_configure_clocking(struct snd_soc_codec *codec)
614{ 614{
615 struct wm8904_priv *wm8904 = codec->private_data; 615 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
616 unsigned int clock0, clock2, rate; 616 unsigned int clock0, clock2, rate;
617 617
618 /* Gate the clock while we're updating to avoid misclocking */ 618 /* Gate the clock while we're updating to avoid misclocking */
@@ -668,7 +668,7 @@ static int wm8904_configure_clocking(struct snd_soc_codec *codec)
668 668
669static void wm8904_set_drc(struct snd_soc_codec *codec) 669static void wm8904_set_drc(struct snd_soc_codec *codec)
670{ 670{
671 struct wm8904_priv *wm8904 = codec->private_data; 671 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
672 struct wm8904_pdata *pdata = wm8904->pdata; 672 struct wm8904_pdata *pdata = wm8904->pdata;
673 int save, i; 673 int save, i;
674 674
@@ -688,7 +688,7 @@ static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol,
688 struct snd_ctl_elem_value *ucontrol) 688 struct snd_ctl_elem_value *ucontrol)
689{ 689{
690 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 690 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
691 struct wm8904_priv *wm8904 = codec->private_data; 691 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
692 struct wm8904_pdata *pdata = wm8904->pdata; 692 struct wm8904_pdata *pdata = wm8904->pdata;
693 int value = ucontrol->value.integer.value[0]; 693 int value = ucontrol->value.integer.value[0];
694 694
@@ -706,7 +706,7 @@ static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol,
706 struct snd_ctl_elem_value *ucontrol) 706 struct snd_ctl_elem_value *ucontrol)
707{ 707{
708 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 708 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
709 struct wm8904_priv *wm8904 = codec->private_data; 709 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
710 710
711 ucontrol->value.enumerated.item[0] = wm8904->drc_cfg; 711 ucontrol->value.enumerated.item[0] = wm8904->drc_cfg;
712 712
@@ -715,7 +715,7 @@ static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol,
715 715
716static void wm8904_set_retune_mobile(struct snd_soc_codec *codec) 716static void wm8904_set_retune_mobile(struct snd_soc_codec *codec)
717{ 717{
718 struct wm8904_priv *wm8904 = codec->private_data; 718 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
719 struct wm8904_pdata *pdata = wm8904->pdata; 719 struct wm8904_pdata *pdata = wm8904->pdata;
720 int best, best_val, save, i, cfg; 720 int best, best_val, save, i, cfg;
721 721
@@ -759,7 +759,7 @@ static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
759 struct snd_ctl_elem_value *ucontrol) 759 struct snd_ctl_elem_value *ucontrol)
760{ 760{
761 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 761 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
762 struct wm8904_priv *wm8904 = codec->private_data; 762 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
763 struct wm8904_pdata *pdata = wm8904->pdata; 763 struct wm8904_pdata *pdata = wm8904->pdata;
764 int value = ucontrol->value.integer.value[0]; 764 int value = ucontrol->value.integer.value[0];
765 765
@@ -777,7 +777,7 @@ static int wm8904_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
777 struct snd_ctl_elem_value *ucontrol) 777 struct snd_ctl_elem_value *ucontrol)
778{ 778{
779 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 779 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
780 struct wm8904_priv *wm8904 = codec->private_data; 780 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
781 781
782 ucontrol->value.enumerated.item[0] = wm8904->retune_mobile_cfg; 782 ucontrol->value.enumerated.item[0] = wm8904->retune_mobile_cfg;
783 783
@@ -788,7 +788,7 @@ static int deemph_settings[] = { 0, 32000, 44100, 48000 };
788 788
789static int wm8904_set_deemph(struct snd_soc_codec *codec) 789static int wm8904_set_deemph(struct snd_soc_codec *codec)
790{ 790{
791 struct wm8904_priv *wm8904 = codec->private_data; 791 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
792 int val, i, best; 792 int val, i, best;
793 793
794 /* If we're using deemphasis select the nearest available sample 794 /* If we're using deemphasis select the nearest available sample
@@ -817,7 +817,7 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
817 struct snd_ctl_elem_value *ucontrol) 817 struct snd_ctl_elem_value *ucontrol)
818{ 818{
819 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 819 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
820 struct wm8904_priv *wm8904 = codec->private_data; 820 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
821 821
822 return wm8904->deemph; 822 return wm8904->deemph;
823} 823}
@@ -826,7 +826,7 @@ static int wm8904_put_deemph(struct snd_kcontrol *kcontrol,
826 struct snd_ctl_elem_value *ucontrol) 826 struct snd_ctl_elem_value *ucontrol)
827{ 827{
828 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 828 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
829 struct wm8904_priv *wm8904 = codec->private_data; 829 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
830 int deemph = ucontrol->value.enumerated.item[0]; 830 int deemph = ucontrol->value.enumerated.item[0];
831 831
832 if (deemph > 1) 832 if (deemph > 1)
@@ -942,7 +942,7 @@ static int sysclk_event(struct snd_soc_dapm_widget *w,
942 struct snd_kcontrol *kcontrol, int event) 942 struct snd_kcontrol *kcontrol, int event)
943{ 943{
944 struct snd_soc_codec *codec = w->codec; 944 struct snd_soc_codec *codec = w->codec;
945 struct wm8904_priv *wm8904 = codec->private_data; 945 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
946 946
947 switch (event) { 947 switch (event) {
948 case SND_SOC_DAPM_PRE_PMU: 948 case SND_SOC_DAPM_PRE_PMU:
@@ -980,7 +980,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
980 struct snd_kcontrol *kcontrol, int event) 980 struct snd_kcontrol *kcontrol, int event)
981{ 981{
982 struct snd_soc_codec *codec = w->codec; 982 struct snd_soc_codec *codec = w->codec;
983 struct wm8904_priv *wm8904 = codec->private_data; 983 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
984 int reg, val; 984 int reg, val;
985 int dcs_mask; 985 int dcs_mask;
986 int dcs_l, dcs_r; 986 int dcs_l, dcs_r;
@@ -1428,7 +1428,7 @@ static const struct snd_soc_dapm_route wm8912_intercon[] = {
1428 1428
1429static int wm8904_add_widgets(struct snd_soc_codec *codec) 1429static int wm8904_add_widgets(struct snd_soc_codec *codec)
1430{ 1430{
1431 struct wm8904_priv *wm8904 = codec->private_data; 1431 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1432 1432
1433 snd_soc_dapm_new_controls(codec, wm8904_core_dapm_widgets, 1433 snd_soc_dapm_new_controls(codec, wm8904_core_dapm_widgets,
1434 ARRAY_SIZE(wm8904_core_dapm_widgets)); 1434 ARRAY_SIZE(wm8904_core_dapm_widgets));
@@ -1542,7 +1542,7 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream,
1542 struct snd_soc_dai *dai) 1542 struct snd_soc_dai *dai)
1543{ 1543{
1544 struct snd_soc_codec *codec = dai->codec; 1544 struct snd_soc_codec *codec = dai->codec;
1545 struct wm8904_priv *wm8904 = codec->private_data; 1545 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1546 int ret, i, best, best_val, cur_val; 1546 int ret, i, best, best_val, cur_val;
1547 unsigned int aif1 = 0; 1547 unsigned int aif1 = 0;
1548 unsigned int aif2 = 0; 1548 unsigned int aif2 = 0;
@@ -1669,7 +1669,7 @@ static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id,
1669 unsigned int freq, int dir) 1669 unsigned int freq, int dir)
1670{ 1670{
1671 struct snd_soc_codec *codec = dai->codec; 1671 struct snd_soc_codec *codec = dai->codec;
1672 struct wm8904_priv *priv = codec->private_data; 1672 struct wm8904_priv *priv = snd_soc_codec_get_drvdata(codec);
1673 1673
1674 switch (clk_id) { 1674 switch (clk_id) {
1675 case WM8904_CLK_MCLK: 1675 case WM8904_CLK_MCLK:
@@ -1785,7 +1785,7 @@ static int wm8904_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
1785 unsigned int rx_mask, int slots, int slot_width) 1785 unsigned int rx_mask, int slots, int slot_width)
1786{ 1786{
1787 struct snd_soc_codec *codec = dai->codec; 1787 struct snd_soc_codec *codec = dai->codec;
1788 struct wm8904_priv *wm8904 = codec->private_data; 1788 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1789 int aif1 = 0; 1789 int aif1 = 0;
1790 1790
1791 /* Don't need to validate anything if we're turning off TDM */ 1791 /* Don't need to validate anything if we're turning off TDM */
@@ -1942,7 +1942,7 @@ static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
1942 unsigned int Fref, unsigned int Fout) 1942 unsigned int Fref, unsigned int Fout)
1943{ 1943{
1944 struct snd_soc_codec *codec = dai->codec; 1944 struct snd_soc_codec *codec = dai->codec;
1945 struct wm8904_priv *wm8904 = codec->private_data; 1945 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1946 struct _fll_div fll_div; 1946 struct _fll_div fll_div;
1947 int ret, val; 1947 int ret, val;
1948 int clock2, fll1; 1948 int clock2, fll1;
@@ -2094,7 +2094,7 @@ static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute)
2094 2094
2095static void wm8904_sync_cache(struct snd_soc_codec *codec) 2095static void wm8904_sync_cache(struct snd_soc_codec *codec)
2096{ 2096{
2097 struct wm8904_priv *wm8904 = codec->private_data; 2097 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2098 int i; 2098 int i;
2099 2099
2100 if (!codec->cache_sync) 2100 if (!codec->cache_sync)
@@ -2121,7 +2121,7 @@ static void wm8904_sync_cache(struct snd_soc_codec *codec)
2121static int wm8904_set_bias_level(struct snd_soc_codec *codec, 2121static int wm8904_set_bias_level(struct snd_soc_codec *codec,
2122 enum snd_soc_bias_level level) 2122 enum snd_soc_bias_level level)
2123{ 2123{
2124 struct wm8904_priv *wm8904 = codec->private_data; 2124 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2125 int ret; 2125 int ret;
2126 2126
2127 switch (level) { 2127 switch (level) {
@@ -2394,7 +2394,7 @@ static int wm8904_probe(struct platform_device *pdev)
2394 goto pcm_err; 2394 goto pcm_err;
2395 } 2395 }
2396 2396
2397 wm8904_handle_pdata(codec->private_data); 2397 wm8904_handle_pdata(snd_soc_codec_get_drvdata(codec));
2398 2398
2399 wm8904_add_widgets(codec); 2399 wm8904_add_widgets(codec);
2400 2400
@@ -2439,7 +2439,7 @@ static int wm8904_register(struct wm8904_priv *wm8904,
2439 INIT_LIST_HEAD(&codec->dapm_widgets); 2439 INIT_LIST_HEAD(&codec->dapm_widgets);
2440 INIT_LIST_HEAD(&codec->dapm_paths); 2440 INIT_LIST_HEAD(&codec->dapm_paths);
2441 2441
2442 codec->private_data = wm8904; 2442 snd_soc_codec_set_drvdata(codec, wm8904);
2443 codec->name = "WM8904"; 2443 codec->name = "WM8904";
2444 codec->owner = THIS_MODULE; 2444 codec->owner = THIS_MODULE;
2445 codec->bias_level = SND_SOC_BIAS_OFF; 2445 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 31e39ffd1d8..b2f12828630 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -580,7 +580,7 @@ static int wm8940_set_dai_sysclk(struct snd_soc_dai *codec_dai,
580 int clk_id, unsigned int freq, int dir) 580 int clk_id, unsigned int freq, int dir)
581{ 581{
582 struct snd_soc_codec *codec = codec_dai->codec; 582 struct snd_soc_codec *codec = codec_dai->codec;
583 struct wm8940_priv *wm8940 = codec->private_data; 583 struct wm8940_priv *wm8940 = snd_soc_codec_get_drvdata(codec);
584 584
585 switch (freq) { 585 switch (freq) {
586 case 11289600: 586 case 11289600:
@@ -772,7 +772,7 @@ static int wm8940_register(struct wm8940_priv *wm8940,
772 INIT_LIST_HEAD(&codec->dapm_widgets); 772 INIT_LIST_HEAD(&codec->dapm_widgets);
773 INIT_LIST_HEAD(&codec->dapm_paths); 773 INIT_LIST_HEAD(&codec->dapm_paths);
774 774
775 codec->private_data = wm8940; 775 snd_soc_codec_set_drvdata(codec, wm8940);
776 codec->name = "WM8940"; 776 codec->name = "WM8940";
777 codec->owner = THIS_MODULE; 777 codec->owner = THIS_MODULE;
778 codec->bias_level = SND_SOC_BIAS_OFF; 778 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index 615dab2b62e..5f0bde56cf0 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -234,7 +234,7 @@ static struct {
234 234
235static int wm8955_configure_clocking(struct snd_soc_codec *codec) 235static int wm8955_configure_clocking(struct snd_soc_codec *codec)
236{ 236{
237 struct wm8955_priv *wm8955 = codec->private_data; 237 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
238 int i, ret, val; 238 int i, ret, val;
239 int clocking = 0; 239 int clocking = 0;
240 int srate = 0; 240 int srate = 0;
@@ -352,7 +352,7 @@ static int deemph_settings[] = { 0, 32000, 44100, 48000 };
352 352
353static int wm8955_set_deemph(struct snd_soc_codec *codec) 353static int wm8955_set_deemph(struct snd_soc_codec *codec)
354{ 354{
355 struct wm8955_priv *wm8955 = codec->private_data; 355 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
356 int val, i, best; 356 int val, i, best;
357 357
358 /* If we're using deemphasis select the nearest available sample 358 /* If we're using deemphasis select the nearest available sample
@@ -381,7 +381,7 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol,
381 struct snd_ctl_elem_value *ucontrol) 381 struct snd_ctl_elem_value *ucontrol)
382{ 382{
383 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 383 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
384 struct wm8955_priv *wm8955 = codec->private_data; 384 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
385 385
386 return wm8955->deemph; 386 return wm8955->deemph;
387} 387}
@@ -390,7 +390,7 @@ static int wm8955_put_deemph(struct snd_kcontrol *kcontrol,
390 struct snd_ctl_elem_value *ucontrol) 390 struct snd_ctl_elem_value *ucontrol)
391{ 391{
392 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 392 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
393 struct wm8955_priv *wm8955 = codec->private_data; 393 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
394 int deemph = ucontrol->value.enumerated.item[0]; 394 int deemph = ucontrol->value.enumerated.item[0];
395 395
396 if (deemph > 1) 396 if (deemph > 1)
@@ -597,7 +597,7 @@ static int wm8955_hw_params(struct snd_pcm_substream *substream,
597 struct snd_soc_dai *dai) 597 struct snd_soc_dai *dai)
598{ 598{
599 struct snd_soc_codec *codec = dai->codec; 599 struct snd_soc_codec *codec = dai->codec;
600 struct wm8955_priv *wm8955 = codec->private_data; 600 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
601 int ret; 601 int ret;
602 int wl; 602 int wl;
603 603
@@ -646,7 +646,7 @@ static int wm8955_set_sysclk(struct snd_soc_dai *dai, int clk_id,
646 unsigned int freq, int dir) 646 unsigned int freq, int dir)
647{ 647{
648 struct snd_soc_codec *codec = dai->codec; 648 struct snd_soc_codec *codec = dai->codec;
649 struct wm8955_priv *priv = codec->private_data; 649 struct wm8955_priv *priv = snd_soc_codec_get_drvdata(codec);
650 int div; 650 int div;
651 651
652 switch (clk_id) { 652 switch (clk_id) {
@@ -769,7 +769,7 @@ static int wm8955_digital_mute(struct snd_soc_dai *codec_dai, int mute)
769static int wm8955_set_bias_level(struct snd_soc_codec *codec, 769static int wm8955_set_bias_level(struct snd_soc_codec *codec,
770 enum snd_soc_bias_level level) 770 enum snd_soc_bias_level level)
771{ 771{
772 struct wm8955_priv *wm8955 = codec->private_data; 772 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
773 int ret, i; 773 int ret, i;
774 774
775 switch (level) { 775 switch (level) {
@@ -970,7 +970,7 @@ static int wm8955_register(struct wm8955_priv *wm8955,
970 INIT_LIST_HEAD(&codec->dapm_widgets); 970 INIT_LIST_HEAD(&codec->dapm_widgets);
971 INIT_LIST_HEAD(&codec->dapm_paths); 971 INIT_LIST_HEAD(&codec->dapm_paths);
972 972
973 codec->private_data = wm8955; 973 snd_soc_codec_set_drvdata(codec, wm8955);
974 codec->name = "WM8955"; 974 codec->name = "WM8955";
975 codec->owner = THIS_MODULE; 975 codec->owner = THIS_MODULE;
976 codec->bias_level = SND_SOC_BIAS_OFF; 976 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index c2960d3ec6d..eba3ac01311 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -331,7 +331,7 @@ static const struct snd_soc_dapm_route audio_paths_capless[] = {
331static int wm8960_add_widgets(struct snd_soc_codec *codec) 331static int wm8960_add_widgets(struct snd_soc_codec *codec)
332{ 332{
333 struct wm8960_data *pdata = codec->dev->platform_data; 333 struct wm8960_data *pdata = codec->dev->platform_data;
334 struct wm8960_priv *wm8960 = codec->private_data; 334 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
335 struct snd_soc_dapm_widget *w; 335 struct snd_soc_dapm_widget *w;
336 336
337 snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets, 337 snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets,
@@ -534,7 +534,7 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec,
534static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec, 534static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec,
535 enum snd_soc_bias_level level) 535 enum snd_soc_bias_level level)
536{ 536{
537 struct wm8960_priv *wm8960 = codec->private_data; 537 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
538 int reg; 538 int reg;
539 539
540 switch (level) { 540 switch (level) {
@@ -915,7 +915,7 @@ static int wm8960_register(struct wm8960_priv *wm8960,
915 INIT_LIST_HEAD(&codec->dapm_widgets); 915 INIT_LIST_HEAD(&codec->dapm_widgets);
916 INIT_LIST_HEAD(&codec->dapm_paths); 916 INIT_LIST_HEAD(&codec->dapm_paths);
917 917
918 codec->private_data = wm8960; 918 snd_soc_codec_set_drvdata(codec, wm8960);
919 codec->name = "WM8960"; 919 codec->name = "WM8960";
920 codec->owner = THIS_MODULE; 920 codec->owner = THIS_MODULE;
921 codec->bias_level = SND_SOC_BIAS_OFF; 921 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index d2342c5e042..bab393feb94 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -630,7 +630,7 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream,
630 struct snd_soc_dai *dai) 630 struct snd_soc_dai *dai)
631{ 631{
632 struct snd_soc_codec *codec = dai->codec; 632 struct snd_soc_codec *codec = dai->codec;
633 struct wm8961_priv *wm8961 = codec->private_data; 633 struct wm8961_priv *wm8961 = snd_soc_codec_get_drvdata(codec);
634 int i, best, target, fs; 634 int i, best, target, fs;
635 u16 reg; 635 u16 reg;
636 636
@@ -721,7 +721,7 @@ static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id,
721 int dir) 721 int dir)
722{ 722{
723 struct snd_soc_codec *codec = dai->codec; 723 struct snd_soc_codec *codec = dai->codec;
724 struct wm8961_priv *wm8961 = codec->private_data; 724 struct wm8961_priv *wm8961 = snd_soc_codec_get_drvdata(codec);
725 u16 reg = snd_soc_read(codec, WM8961_CLOCKING1); 725 u16 reg = snd_soc_read(codec, WM8961_CLOCKING1);
726 726
727 if (freq > 33000000) { 727 if (freq > 33000000) {
@@ -1064,7 +1064,7 @@ static int wm8961_register(struct wm8961_priv *wm8961)
1064 INIT_LIST_HEAD(&codec->dapm_widgets); 1064 INIT_LIST_HEAD(&codec->dapm_widgets);
1065 INIT_LIST_HEAD(&codec->dapm_paths); 1065 INIT_LIST_HEAD(&codec->dapm_paths);
1066 1066
1067 codec->private_data = wm8961; 1067 snd_soc_codec_set_drvdata(codec, wm8961);
1068 codec->name = "WM8961"; 1068 codec->name = "WM8961";
1069 codec->owner = THIS_MODULE; 1069 codec->owner = THIS_MODULE;
1070 codec->dai = &wm8961_dai; 1070 codec->dai = &wm8961_dai;
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index d9540d55fc8..95c9ec3862d 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -414,7 +414,7 @@ static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai,
414 int clk_id, unsigned int freq, int dir) 414 int clk_id, unsigned int freq, int dir)
415{ 415{
416 struct snd_soc_codec *codec = codec_dai->codec; 416 struct snd_soc_codec *codec = codec_dai->codec;
417 struct wm8971_priv *wm8971 = codec->private_data; 417 struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
418 418
419 switch (freq) { 419 switch (freq) {
420 case 11289600: 420 case 11289600:
@@ -493,7 +493,7 @@ static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream,
493 struct snd_soc_pcm_runtime *rtd = substream->private_data; 493 struct snd_soc_pcm_runtime *rtd = substream->private_data;
494 struct snd_soc_device *socdev = rtd->socdev; 494 struct snd_soc_device *socdev = rtd->socdev;
495 struct snd_soc_codec *codec = socdev->card->codec; 495 struct snd_soc_codec *codec = socdev->card->codec;
496 struct wm8971_priv *wm8971 = codec->private_data; 496 struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
497 u16 iface = snd_soc_read(codec, WM8971_IFACE) & 0x1f3; 497 u16 iface = snd_soc_read(codec, WM8971_IFACE) & 0x1f3;
498 u16 srate = snd_soc_read(codec, WM8971_SRATE) & 0x1c0; 498 u16 srate = snd_soc_read(codec, WM8971_SRATE) & 0x1c0;
499 int coeff = get_coeff(wm8971->sysclk, params_rate(params)); 499 int coeff = get_coeff(wm8971->sysclk, params_rate(params));
@@ -819,7 +819,7 @@ static int wm8971_probe(struct platform_device *pdev)
819 return -ENOMEM; 819 return -ENOMEM;
820 } 820 }
821 821
822 codec->private_data = wm8971; 822 snd_soc_codec_set_drvdata(codec, wm8971);
823 socdev->card->codec = codec; 823 socdev->card->codec = codec;
824 mutex_init(&codec->mutex); 824 mutex_init(&codec->mutex);
825 INIT_LIST_HEAD(&codec->dapm_widgets); 825 INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -829,7 +829,7 @@ static int wm8971_probe(struct platform_device *pdev)
829 INIT_DELAYED_WORK(&codec->delayed_work, wm8971_work); 829 INIT_DELAYED_WORK(&codec->delayed_work, wm8971_work);
830 wm8971_workq = create_workqueue("wm8971"); 830 wm8971_workq = create_workqueue("wm8971");
831 if (wm8971_workq == NULL) { 831 if (wm8971_workq == NULL) {
832 kfree(codec->private_data); 832 kfree(snd_soc_codec_get_drvdata(codec));
833 kfree(codec); 833 kfree(codec);
834 return -ENOMEM; 834 return -ENOMEM;
835 } 835 }
@@ -843,7 +843,7 @@ static int wm8971_probe(struct platform_device *pdev)
843 843
844 if (ret != 0) { 844 if (ret != 0) {
845 destroy_workqueue(wm8971_workq); 845 destroy_workqueue(wm8971_workq);
846 kfree(codec->private_data); 846 kfree(snd_soc_codec_get_drvdata(codec));
847 kfree(codec); 847 kfree(codec);
848 } 848 }
849 849
@@ -866,7 +866,7 @@ static int wm8971_remove(struct platform_device *pdev)
866 i2c_unregister_device(codec->control_data); 866 i2c_unregister_device(codec->control_data);
867 i2c_del_driver(&wm8971_i2c_driver); 867 i2c_del_driver(&wm8971_i2c_driver);
868#endif 868#endif
869 kfree(codec->private_data); 869 kfree(snd_soc_codec_get_drvdata(codec));
870 kfree(codec); 870 kfree(codec);
871 871
872 return 0; 872 return 0;
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index ee637af4737..1e4da32c407 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -676,7 +676,7 @@ static __devinit int wm8974_register(struct wm8974_priv *wm8974)
676 INIT_LIST_HEAD(&codec->dapm_widgets); 676 INIT_LIST_HEAD(&codec->dapm_widgets);
677 INIT_LIST_HEAD(&codec->dapm_paths); 677 INIT_LIST_HEAD(&codec->dapm_paths);
678 678
679 codec->private_data = wm8974; 679 snd_soc_codec_set_drvdata(codec, wm8974);
680 codec->name = "WM8974"; 680 codec->name = "WM8974";
681 codec->owner = THIS_MODULE; 681 codec->owner = THIS_MODULE;
682 codec->bias_level = SND_SOC_BIAS_OFF; 682 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 28bb59ea6ea..6866a6a80fe 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -438,7 +438,7 @@ static int wm8978_enum_mclk(unsigned int f_out, unsigned int f_mclk,
438 */ 438 */
439static int wm8978_configure_pll(struct snd_soc_codec *codec) 439static int wm8978_configure_pll(struct snd_soc_codec *codec)
440{ 440{
441 struct wm8978_priv *wm8978 = codec->private_data; 441 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
442 struct wm8978_pll_div pll_div; 442 struct wm8978_pll_div pll_div;
443 unsigned int f_opclk = wm8978->f_opclk, f_mclk = wm8978->f_mclk, 443 unsigned int f_opclk = wm8978->f_opclk, f_mclk = wm8978->f_mclk,
444 f_256fs = wm8978->f_256fs; 444 f_256fs = wm8978->f_256fs;
@@ -534,7 +534,7 @@ static int wm8978_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
534 int div_id, int div) 534 int div_id, int div)
535{ 535{
536 struct snd_soc_codec *codec = codec_dai->codec; 536 struct snd_soc_codec *codec = codec_dai->codec;
537 struct wm8978_priv *wm8978 = codec->private_data; 537 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
538 int ret = 0; 538 int ret = 0;
539 539
540 switch (div_id) { 540 switch (div_id) {
@@ -579,7 +579,7 @@ static int wm8978_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id,
579 unsigned int freq, int dir) 579 unsigned int freq, int dir)
580{ 580{
581 struct snd_soc_codec *codec = codec_dai->codec; 581 struct snd_soc_codec *codec = codec_dai->codec;
582 struct wm8978_priv *wm8978 = codec->private_data; 582 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
583 int ret = 0; 583 int ret = 0;
584 584
585 dev_dbg(codec->dev, "%s: ID %d, freq %u\n", __func__, clk_id, freq); 585 dev_dbg(codec->dev, "%s: ID %d, freq %u\n", __func__, clk_id, freq);
@@ -691,7 +691,7 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream,
691 struct snd_soc_pcm_runtime *rtd = substream->private_data; 691 struct snd_soc_pcm_runtime *rtd = substream->private_data;
692 struct snd_soc_device *socdev = rtd->socdev; 692 struct snd_soc_device *socdev = rtd->socdev;
693 struct snd_soc_codec *codec = socdev->card->codec; 693 struct snd_soc_codec *codec = socdev->card->codec;
694 struct wm8978_priv *wm8978 = codec->private_data; 694 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
695 /* Word length mask = 0x60 */ 695 /* Word length mask = 0x60 */
696 u16 iface_ctl = snd_soc_read(codec, WM8978_AUDIO_INTERFACE) & ~0x60; 696 u16 iface_ctl = snd_soc_read(codec, WM8978_AUDIO_INTERFACE) & ~0x60;
697 /* Sampling rate mask = 0xe (for filters) */ 697 /* Sampling rate mask = 0xe (for filters) */
@@ -911,7 +911,7 @@ static int wm8978_resume(struct platform_device *pdev)
911{ 911{
912 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 912 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
913 struct snd_soc_codec *codec = socdev->card->codec; 913 struct snd_soc_codec *codec = socdev->card->codec;
914 struct wm8978_priv *wm8978 = codec->private_data; 914 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
915 int i; 915 int i;
916 u16 *cache = codec->reg_cache; 916 u16 *cache = codec->reg_cache;
917 917
@@ -1019,7 +1019,7 @@ static __devinit int wm8978_register(struct wm8978_priv *wm8978)
1019 INIT_LIST_HEAD(&codec->dapm_widgets); 1019 INIT_LIST_HEAD(&codec->dapm_widgets);
1020 INIT_LIST_HEAD(&codec->dapm_paths); 1020 INIT_LIST_HEAD(&codec->dapm_paths);
1021 1021
1022 codec->private_data = wm8978; 1022 snd_soc_codec_set_drvdata(codec, wm8978);
1023 codec->name = "WM8978"; 1023 codec->name = "WM8978";
1024 codec->owner = THIS_MODULE; 1024 codec->owner = THIS_MODULE;
1025 codec->bias_level = SND_SOC_BIAS_OFF; 1025 codec->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 2862e4dced2..563cf898daf 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -494,7 +494,7 @@ static int wm8988_set_dai_sysclk(struct snd_soc_dai *codec_dai,
494 int clk_id, unsigned int freq, int dir) 494 int clk_id, unsigned int freq, int dir)
495{ 495{
496 struct snd_soc_codec *codec = codec_dai->codec; 496 struct snd_soc_codec *codec = codec_dai->codec;
497 struct wm8988_priv *wm8988 = codec->private_data; 497 struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
498 498
499 switch (freq) { 499 switch (freq) {
500 case 11289600: 500 case 11289600:
@@ -584,7 +584,7 @@ static int wm8988_pcm_startup(struct snd_pcm_substream *substream,
584 struct snd_soc_dai *dai) 584 struct snd_soc_dai *dai)
585{ 585{
586 struct snd_soc_codec *codec = dai->codec; 586 struct snd_soc_codec *codec = dai->codec;
587 struct wm8988_priv *wm8988 = codec->private_data; 587 struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
588 588
589 /* The set of sample rates that can be supported depends on the 589 /* The set of sample rates that can be supported depends on the
590 * MCLK supplied to the CODEC - enforce this. 590 * MCLK supplied to the CODEC - enforce this.
@@ -609,7 +609,7 @@ static int wm8988_pcm_hw_params(struct snd_pcm_substream *substream,
609 struct snd_soc_pcm_runtime *rtd = substream->private_data; 609 struct snd_soc_pcm_runtime *rtd = substream->private_data;
610 struct snd_soc_device *socdev = rtd->socdev; 610 struct snd_soc_device *socdev = rtd->socdev;
611 struct snd_soc_codec *codec = socdev->card->codec; 611 struct snd_soc_codec *codec = socdev->card->codec;
612 struct wm8988_priv *wm8988 = codec->private_data; 612 struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
613 u16 iface = snd_soc_read(codec, WM8988_IFACE) & 0x1f3; 613 u16 iface = snd_soc_read(codec, WM8988_IFACE) & 0x1f3;
614 u16 srate = snd_soc_read(codec, WM8988_SRATE) & 0x180; 614 u16 srate = snd_soc_read(codec, WM8988_SRATE) & 0x180;
615 int coeff; 615 int coeff;
@@ -832,7 +832,7 @@ static int wm8988_register(struct wm8988_priv *wm8988,
832 INIT_LIST_HEAD(&codec->dapm_widgets); 832 INIT_LIST_HEAD(&codec->dapm_widgets);
833 INIT_LIST_HEAD(&codec->dapm_paths); 833 INIT_LIST_HEAD(&codec->dapm_paths);
834 834
835 codec->private_data = wm8988; 835 snd_soc_codec_set_drvdata(codec, wm8988);
836 codec->name = "WM8988"; 836 codec->name = "WM8988";
837 codec->owner = THIS_MODULE; 837 codec->owner = THIS_MODULE;
838 codec->dai = &wm8988_dai; 838 codec->dai = &wm8988_dai;
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index 056b787b6ee..9a9528e9044 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -1011,7 +1011,7 @@ static int wm8990_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1011 int clk_id, unsigned int freq, int dir) 1011 int clk_id, unsigned int freq, int dir)
1012{ 1012{
1013 struct snd_soc_codec *codec = codec_dai->codec; 1013 struct snd_soc_codec *codec = codec_dai->codec;
1014 struct wm8990_priv *wm8990 = codec->private_data; 1014 struct wm8990_priv *wm8990 = snd_soc_codec_get_drvdata(codec);
1015 1015
1016 wm8990->sysclk = freq; 1016 wm8990->sysclk = freq;
1017 return 0; 1017 return 0;
@@ -1523,7 +1523,7 @@ static int wm8990_probe(struct platform_device *pdev)
1523 return -ENOMEM; 1523 return -ENOMEM;
1524 } 1524 }
1525 1525
1526 codec->private_data = wm8990; 1526 snd_soc_codec_set_drvdata(codec, wm8990);
1527 socdev->card->codec = codec; 1527 socdev->card->codec = codec;
1528 mutex_init(&codec->mutex); 1528 mutex_init(&codec->mutex);
1529 INIT_LIST_HEAD(&codec->dapm_widgets); 1529 INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -1540,7 +1540,7 @@ static int wm8990_probe(struct platform_device *pdev)
1540#endif 1540#endif
1541 1541
1542 if (ret != 0) { 1542 if (ret != 0) {
1543 kfree(codec->private_data); 1543 kfree(snd_soc_codec_get_drvdata(codec));
1544 kfree(codec); 1544 kfree(codec);
1545 } 1545 }
1546 return ret; 1546 return ret;
@@ -1560,7 +1560,7 @@ static int wm8990_remove(struct platform_device *pdev)
1560 i2c_unregister_device(codec->control_data); 1560 i2c_unregister_device(codec->control_data);
1561 i2c_del_driver(&wm8990_i2c_driver); 1561 i2c_del_driver(&wm8990_i2c_driver);
1562#endif 1562#endif
1563 kfree(codec->private_data); 1563 kfree(snd_soc_codec_get_drvdata(codec));
1564 kfree(codec); 1564 kfree(codec);
1565 1565
1566 return 0; 1566 return 0;
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index bf022f68b84..e739c5008b1 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -370,7 +370,7 @@ static int wm8993_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
370 unsigned int Fref, unsigned int Fout) 370 unsigned int Fref, unsigned int Fout)
371{ 371{
372 struct snd_soc_codec *codec = dai->codec; 372 struct snd_soc_codec *codec = dai->codec;
373 struct wm8993_priv *wm8993 = codec->private_data; 373 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
374 u16 reg1, reg4, reg5; 374 u16 reg1, reg4, reg5;
375 struct _fll_div fll_div; 375 struct _fll_div fll_div;
376 int ret; 376 int ret;
@@ -457,7 +457,7 @@ static int wm8993_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
457 457
458static int configure_clock(struct snd_soc_codec *codec) 458static int configure_clock(struct snd_soc_codec *codec)
459{ 459{
460 struct wm8993_priv *wm8993 = codec->private_data; 460 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
461 unsigned int reg; 461 unsigned int reg;
462 462
463 /* This should be done on init() for bypass paths */ 463 /* This should be done on init() for bypass paths */
@@ -716,7 +716,7 @@ static int class_w_put(struct snd_kcontrol *kcontrol,
716{ 716{
717 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 717 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
718 struct snd_soc_codec *codec = widget->codec; 718 struct snd_soc_codec *codec = widget->codec;
719 struct wm8993_priv *wm8993 = codec->private_data; 719 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
720 int ret; 720 int ret;
721 721
722 /* Turn it off if we're using the main output mixer */ 722 /* Turn it off if we're using the main output mixer */
@@ -948,7 +948,7 @@ static void wm8993_cache_restore(struct snd_soc_codec *codec)
948static int wm8993_set_bias_level(struct snd_soc_codec *codec, 948static int wm8993_set_bias_level(struct snd_soc_codec *codec,
949 enum snd_soc_bias_level level) 949 enum snd_soc_bias_level level)
950{ 950{
951 struct wm8993_priv *wm8993 = codec->private_data; 951 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
952 int ret; 952 int ret;
953 953
954 switch (level) { 954 switch (level) {
@@ -1046,7 +1046,7 @@ static int wm8993_set_sysclk(struct snd_soc_dai *codec_dai,
1046 int clk_id, unsigned int freq, int dir) 1046 int clk_id, unsigned int freq, int dir)
1047{ 1047{
1048 struct snd_soc_codec *codec = codec_dai->codec; 1048 struct snd_soc_codec *codec = codec_dai->codec;
1049 struct wm8993_priv *wm8993 = codec->private_data; 1049 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1050 1050
1051 switch (clk_id) { 1051 switch (clk_id) {
1052 case WM8993_SYSCLK_MCLK: 1052 case WM8993_SYSCLK_MCLK:
@@ -1066,7 +1066,7 @@ static int wm8993_set_dai_fmt(struct snd_soc_dai *dai,
1066 unsigned int fmt) 1066 unsigned int fmt)
1067{ 1067{
1068 struct snd_soc_codec *codec = dai->codec; 1068 struct snd_soc_codec *codec = dai->codec;
1069 struct wm8993_priv *wm8993 = codec->private_data; 1069 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1070 unsigned int aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1); 1070 unsigned int aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1);
1071 unsigned int aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4); 1071 unsigned int aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4);
1072 1072
@@ -1162,7 +1162,7 @@ static int wm8993_hw_params(struct snd_pcm_substream *substream,
1162 struct snd_soc_dai *dai) 1162 struct snd_soc_dai *dai)
1163{ 1163{
1164 struct snd_soc_codec *codec = dai->codec; 1164 struct snd_soc_codec *codec = dai->codec;
1165 struct wm8993_priv *wm8993 = codec->private_data; 1165 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1166 int ret, i, best, best_val, cur_val; 1166 int ret, i, best, best_val, cur_val;
1167 unsigned int clocking1, clocking3, aif1, aif4; 1167 unsigned int clocking1, clocking3, aif1, aif4;
1168 1168
@@ -1327,7 +1327,7 @@ static int wm8993_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
1327 unsigned int rx_mask, int slots, int slot_width) 1327 unsigned int rx_mask, int slots, int slot_width)
1328{ 1328{
1329 struct snd_soc_codec *codec = dai->codec; 1329 struct snd_soc_codec *codec = dai->codec;
1330 struct wm8993_priv *wm8993 = codec->private_data; 1330 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1331 int aif1 = 0; 1331 int aif1 = 0;
1332 int aif2 = 0; 1332 int aif2 = 0;
1333 1333
@@ -1430,7 +1430,7 @@ static int wm8993_probe(struct platform_device *pdev)
1430 1430
1431 socdev->card->codec = wm8993_codec; 1431 socdev->card->codec = wm8993_codec;
1432 codec = wm8993_codec; 1432 codec = wm8993_codec;
1433 wm8993 = codec->private_data; 1433 wm8993 = snd_soc_codec_get_drvdata(codec);
1434 1434
1435 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1435 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
1436 if (ret < 0) { 1436 if (ret < 0) {
@@ -1477,7 +1477,7 @@ static int wm8993_suspend(struct platform_device *pdev, pm_message_t state)
1477{ 1477{
1478 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1478 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1479 struct snd_soc_codec *codec = socdev->card->codec; 1479 struct snd_soc_codec *codec = socdev->card->codec;
1480 struct wm8993_priv *wm8993 = codec->private_data; 1480 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1481 int fll_fout = wm8993->fll_fout; 1481 int fll_fout = wm8993->fll_fout;
1482 int fll_fref = wm8993->fll_fref; 1482 int fll_fref = wm8993->fll_fref;
1483 int ret; 1483 int ret;
@@ -1501,7 +1501,7 @@ static int wm8993_resume(struct platform_device *pdev)
1501{ 1501{
1502 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1502 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1503 struct snd_soc_codec *codec = socdev->card->codec; 1503 struct snd_soc_codec *codec = socdev->card->codec;
1504 struct wm8993_priv *wm8993 = codec->private_data; 1504 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1505 int ret; 1505 int ret;
1506 1506
1507 wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1507 wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
@@ -1570,7 +1570,7 @@ static int wm8993_i2c_probe(struct i2c_client *i2c,
1570 codec->set_bias_level = wm8993_set_bias_level; 1570 codec->set_bias_level = wm8993_set_bias_level;
1571 codec->dai = &wm8993_dai; 1571 codec->dai = &wm8993_dai;
1572 codec->num_dai = 1; 1572 codec->num_dai = 1;
1573 codec->private_data = wm8993; 1573 snd_soc_codec_set_drvdata(codec, wm8993);
1574 1574
1575 wm8993->hubs_data.hp_startup_mode = 1; 1575 wm8993->hubs_data.hp_startup_mode = 1;
1576 wm8993->hubs_data.dcs_codes = -2; 1576 wm8993->hubs_data.dcs_codes = -2;
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index e00201e0820..29c4cfccd6b 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -1703,7 +1703,7 @@ static int wm8994_volatile(unsigned int reg)
1703static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg, 1703static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg,
1704 unsigned int value) 1704 unsigned int value)
1705{ 1705{
1706 struct wm8994_priv *wm8994 = codec->private_data; 1706 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1707 1707
1708 BUG_ON(reg > WM8994_MAX_REGISTER); 1708 BUG_ON(reg > WM8994_MAX_REGISTER);
1709 1709
@@ -1728,7 +1728,7 @@ static unsigned int wm8994_read(struct snd_soc_codec *codec,
1728 1728
1729static int configure_aif_clock(struct snd_soc_codec *codec, int aif) 1729static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
1730{ 1730{
1731 struct wm8994_priv *wm8994 = codec->private_data; 1731 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1732 int rate; 1732 int rate;
1733 int reg1 = 0; 1733 int reg1 = 0;
1734 int offset; 1734 int offset;
@@ -1780,7 +1780,7 @@ static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
1780 1780
1781static int configure_clock(struct snd_soc_codec *codec) 1781static int configure_clock(struct snd_soc_codec *codec)
1782{ 1782{
1783 struct wm8994_priv *wm8994 = codec->private_data; 1783 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1784 int old, new; 1784 int old, new;
1785 1785
1786 /* Bring up the AIF clocks first */ 1786 /* Bring up the AIF clocks first */
@@ -1877,7 +1877,7 @@ static int wm8994_put_drc_sw(struct snd_kcontrol *kcontrol,
1877 1877
1878static void wm8994_set_drc(struct snd_soc_codec *codec, int drc) 1878static void wm8994_set_drc(struct snd_soc_codec *codec, int drc)
1879{ 1879{
1880 struct wm8994_priv *wm8994 = codec->private_data; 1880 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1881 struct wm8994_pdata *pdata = wm8994->pdata; 1881 struct wm8994_pdata *pdata = wm8994->pdata;
1882 int base = wm8994_drc_base[drc]; 1882 int base = wm8994_drc_base[drc];
1883 int cfg = wm8994->drc_cfg[drc]; 1883 int cfg = wm8994->drc_cfg[drc];
@@ -1913,7 +1913,7 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol,
1913 struct snd_ctl_elem_value *ucontrol) 1913 struct snd_ctl_elem_value *ucontrol)
1914{ 1914{
1915 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 1915 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1916 struct wm8994_priv *wm8994 = codec->private_data; 1916 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1917 struct wm8994_pdata *pdata = wm8994->pdata; 1917 struct wm8994_pdata *pdata = wm8994->pdata;
1918 int drc = wm8994_get_drc(kcontrol->id.name); 1918 int drc = wm8994_get_drc(kcontrol->id.name);
1919 int value = ucontrol->value.integer.value[0]; 1919 int value = ucontrol->value.integer.value[0];
@@ -1935,7 +1935,7 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
1935 struct snd_ctl_elem_value *ucontrol) 1935 struct snd_ctl_elem_value *ucontrol)
1936{ 1936{
1937 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 1937 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1938 struct wm8994_priv *wm8994 = codec->private_data; 1938 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1939 int drc = wm8994_get_drc(kcontrol->id.name); 1939 int drc = wm8994_get_drc(kcontrol->id.name);
1940 1940
1941 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc]; 1941 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc];
@@ -1945,7 +1945,7 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
1945 1945
1946static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block) 1946static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block)
1947{ 1947{
1948 struct wm8994_priv *wm8994 = codec->private_data; 1948 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1949 struct wm8994_pdata *pdata = wm8994->pdata; 1949 struct wm8994_pdata *pdata = wm8994->pdata;
1950 int base = wm8994_retune_mobile_base[block]; 1950 int base = wm8994_retune_mobile_base[block];
1951 int iface, best, best_val, save, i, cfg; 1951 int iface, best, best_val, save, i, cfg;
@@ -2016,7 +2016,7 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
2016 struct snd_ctl_elem_value *ucontrol) 2016 struct snd_ctl_elem_value *ucontrol)
2017{ 2017{
2018 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2018 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2019 struct wm8994_priv *wm8994 = codec->private_data; 2019 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2020 struct wm8994_pdata *pdata = wm8994->pdata; 2020 struct wm8994_pdata *pdata = wm8994->pdata;
2021 int block = wm8994_get_retune_mobile_block(kcontrol->id.name); 2021 int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
2022 int value = ucontrol->value.integer.value[0]; 2022 int value = ucontrol->value.integer.value[0];
@@ -2038,7 +2038,7 @@ static int wm8994_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
2038 struct snd_ctl_elem_value *ucontrol) 2038 struct snd_ctl_elem_value *ucontrol)
2039{ 2039{
2040 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2040 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2041 struct wm8994_priv *wm8994 = codec->private_data; 2041 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2042 int block = wm8994_get_retune_mobile_block(kcontrol->id.name); 2042 int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
2043 2043
2044 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block]; 2044 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block];
@@ -2819,7 +2819,7 @@ static int wm8994_set_fll(struct snd_soc_dai *dai, int id, int src,
2819 unsigned int freq_in, unsigned int freq_out) 2819 unsigned int freq_in, unsigned int freq_out)
2820{ 2820{
2821 struct snd_soc_codec *codec = dai->codec; 2821 struct snd_soc_codec *codec = dai->codec;
2822 struct wm8994_priv *wm8994 = codec->private_data; 2822 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2823 int reg_offset, ret; 2823 int reg_offset, ret;
2824 struct fll_div fll; 2824 struct fll_div fll;
2825 u16 reg, aif1, aif2; 2825 u16 reg, aif1, aif2;
@@ -2915,7 +2915,7 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,
2915 int clk_id, unsigned int freq, int dir) 2915 int clk_id, unsigned int freq, int dir)
2916{ 2916{
2917 struct snd_soc_codec *codec = dai->codec; 2917 struct snd_soc_codec *codec = dai->codec;
2918 struct wm8994_priv *wm8994 = codec->private_data; 2918 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2919 2919
2920 switch (dai->id) { 2920 switch (dai->id) {
2921 case 1: 2921 case 1:
@@ -3181,7 +3181,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
3181 struct snd_soc_dai *dai) 3181 struct snd_soc_dai *dai)
3182{ 3182{
3183 struct snd_soc_codec *codec = dai->codec; 3183 struct snd_soc_codec *codec = dai->codec;
3184 struct wm8994_priv *wm8994 = codec->private_data; 3184 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3185 int aif1_reg; 3185 int aif1_reg;
3186 int bclk_reg; 3186 int bclk_reg;
3187 int lrclk_reg; 3187 int lrclk_reg;
@@ -3468,7 +3468,7 @@ static int wm8994_suspend(struct platform_device *pdev, pm_message_t state)
3468{ 3468{
3469 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 3469 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
3470 struct snd_soc_codec *codec = socdev->card->codec; 3470 struct snd_soc_codec *codec = socdev->card->codec;
3471 struct wm8994_priv *wm8994 = codec->private_data; 3471 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3472 int i, ret; 3472 int i, ret;
3473 3473
3474 for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) { 3474 for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) {
@@ -3489,7 +3489,7 @@ static int wm8994_resume(struct platform_device *pdev)
3489{ 3489{
3490 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 3490 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
3491 struct snd_soc_codec *codec = socdev->card->codec; 3491 struct snd_soc_codec *codec = socdev->card->codec;
3492 struct wm8994_priv *wm8994 = codec->private_data; 3492 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3493 u16 *reg_cache = codec->reg_cache; 3493 u16 *reg_cache = codec->reg_cache;
3494 int i, ret; 3494 int i, ret;
3495 3495
@@ -3684,7 +3684,7 @@ static int wm8994_probe(struct platform_device *pdev)
3684 return ret; 3684 return ret;
3685 } 3685 }
3686 3686
3687 wm8994_handle_pdata(codec->private_data); 3687 wm8994_handle_pdata(snd_soc_codec_get_drvdata(codec));
3688 3688
3689 wm_hubs_add_analogue_controls(codec); 3689 wm_hubs_add_analogue_controls(codec);
3690 snd_soc_add_controls(codec, wm8994_snd_controls, 3690 snd_soc_add_controls(codec, wm8994_snd_controls,
@@ -3735,7 +3735,7 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_wm8994);
3735int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 3735int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
3736 int micbias, int det, int shrt) 3736 int micbias, int det, int shrt)
3737{ 3737{
3738 struct wm8994_priv *wm8994 = codec->private_data; 3738 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3739 struct wm8994_micdet *micdet; 3739 struct wm8994_micdet *micdet;
3740 int reg; 3740 int reg;
3741 3741
@@ -3830,7 +3830,7 @@ static int wm8994_codec_probe(struct platform_device *pdev)
3830 INIT_LIST_HEAD(&codec->dapm_widgets); 3830 INIT_LIST_HEAD(&codec->dapm_widgets);
3831 INIT_LIST_HEAD(&codec->dapm_paths); 3831 INIT_LIST_HEAD(&codec->dapm_paths);
3832 3832
3833 codec->private_data = wm8994; 3833 snd_soc_codec_set_drvdata(codec, wm8994);
3834 codec->control_data = dev_get_drvdata(pdev->dev.parent); 3834 codec->control_data = dev_get_drvdata(pdev->dev.parent);
3835 codec->name = "WM8994"; 3835 codec->name = "WM8994";
3836 codec->owner = THIS_MODULE; 3836 codec->owner = THIS_MODULE;
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index c468497314b..87a87487d3f 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -520,7 +520,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
520static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id, 520static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id,
521 unsigned int Fref, unsigned int Fout) 521 unsigned int Fref, unsigned int Fout)
522{ 522{
523 struct wm9081_priv *wm9081 = codec->private_data; 523 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
524 u16 reg1, reg4, reg5; 524 u16 reg1, reg4, reg5;
525 struct _fll_div fll_div; 525 struct _fll_div fll_div;
526 int ret; 526 int ret;
@@ -606,7 +606,7 @@ static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id,
606 606
607static int configure_clock(struct snd_soc_codec *codec) 607static int configure_clock(struct snd_soc_codec *codec)
608{ 608{
609 struct wm9081_priv *wm9081 = codec->private_data; 609 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
610 int new_sysclk, i, target; 610 int new_sysclk, i, target;
611 unsigned int reg; 611 unsigned int reg;
612 int ret = 0; 612 int ret = 0;
@@ -701,7 +701,7 @@ static int clk_sys_event(struct snd_soc_dapm_widget *w,
701 struct snd_kcontrol *kcontrol, int event) 701 struct snd_kcontrol *kcontrol, int event)
702{ 702{
703 struct snd_soc_codec *codec = w->codec; 703 struct snd_soc_codec *codec = w->codec;
704 struct wm9081_priv *wm9081 = codec->private_data; 704 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
705 705
706 /* This should be done on init() for bypass paths */ 706 /* This should be done on init() for bypass paths */
707 switch (wm9081->sysclk_source) { 707 switch (wm9081->sysclk_source) {
@@ -872,7 +872,7 @@ static int wm9081_set_dai_fmt(struct snd_soc_dai *dai,
872 unsigned int fmt) 872 unsigned int fmt)
873{ 873{
874 struct snd_soc_codec *codec = dai->codec; 874 struct snd_soc_codec *codec = dai->codec;
875 struct wm9081_priv *wm9081 = codec->private_data; 875 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
876 unsigned int aif2 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_2); 876 unsigned int aif2 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_2);
877 877
878 aif2 &= ~(WM9081_AIF_BCLK_INV | WM9081_AIF_LRCLK_INV | 878 aif2 &= ~(WM9081_AIF_BCLK_INV | WM9081_AIF_LRCLK_INV |
@@ -964,7 +964,7 @@ static int wm9081_hw_params(struct snd_pcm_substream *substream,
964 struct snd_soc_dai *dai) 964 struct snd_soc_dai *dai)
965{ 965{
966 struct snd_soc_codec *codec = dai->codec; 966 struct snd_soc_codec *codec = dai->codec;
967 struct wm9081_priv *wm9081 = codec->private_data; 967 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
968 int ret, i, best, best_val, cur_val; 968 int ret, i, best, best_val, cur_val;
969 unsigned int clk_ctrl2, aif1, aif2, aif3, aif4; 969 unsigned int clk_ctrl2, aif1, aif2, aif3, aif4;
970 970
@@ -1138,7 +1138,7 @@ static int wm9081_set_sysclk(struct snd_soc_dai *codec_dai,
1138 int clk_id, unsigned int freq, int dir) 1138 int clk_id, unsigned int freq, int dir)
1139{ 1139{
1140 struct snd_soc_codec *codec = codec_dai->codec; 1140 struct snd_soc_codec *codec = codec_dai->codec;
1141 struct wm9081_priv *wm9081 = codec->private_data; 1141 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
1142 1142
1143 switch (clk_id) { 1143 switch (clk_id) {
1144 case WM9081_SYSCLK_MCLK: 1144 case WM9081_SYSCLK_MCLK:
@@ -1158,7 +1158,7 @@ static int wm9081_set_tdm_slot(struct snd_soc_dai *dai,
1158 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) 1158 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
1159{ 1159{
1160 struct snd_soc_codec *codec = dai->codec; 1160 struct snd_soc_codec *codec = dai->codec;
1161 struct wm9081_priv *wm9081 = codec->private_data; 1161 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
1162 unsigned int aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1); 1162 unsigned int aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1);
1163 1163
1164 aif1 &= ~(WM9081_AIFDAC_TDM_SLOT_MASK | WM9081_AIFDAC_TDM_MODE_MASK); 1164 aif1 &= ~(WM9081_AIFDAC_TDM_SLOT_MASK | WM9081_AIFDAC_TDM_MODE_MASK);
@@ -1241,7 +1241,7 @@ static int wm9081_probe(struct platform_device *pdev)
1241 1241
1242 socdev->card->codec = wm9081_codec; 1242 socdev->card->codec = wm9081_codec;
1243 codec = wm9081_codec; 1243 codec = wm9081_codec;
1244 wm9081 = codec->private_data; 1244 wm9081 = snd_soc_codec_get_drvdata(codec);
1245 1245
1246 /* register pcms */ 1246 /* register pcms */
1247 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1247 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
@@ -1338,7 +1338,7 @@ static int wm9081_register(struct wm9081_priv *wm9081,
1338 INIT_LIST_HEAD(&codec->dapm_widgets); 1338 INIT_LIST_HEAD(&codec->dapm_widgets);
1339 INIT_LIST_HEAD(&codec->dapm_paths); 1339 INIT_LIST_HEAD(&codec->dapm_paths);
1340 1340
1341 codec->private_data = wm9081; 1341 snd_soc_codec_set_drvdata(codec, wm9081);
1342 codec->name = "WM9081"; 1342 codec->name = "WM9081";
1343 codec->owner = THIS_MODULE; 1343 codec->owner = THIS_MODULE;
1344 codec->dai = &wm9081_dai; 1344 codec->dai = &wm9081_dai;
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index ceb86b4ddb2..d2244c93f58 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -763,7 +763,7 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int source)
763static int wm9713_set_pll(struct snd_soc_codec *codec, 763static int wm9713_set_pll(struct snd_soc_codec *codec,
764 int pll_id, unsigned int freq_in, unsigned int freq_out) 764 int pll_id, unsigned int freq_in, unsigned int freq_out)
765{ 765{
766 struct wm9713_priv *wm9713 = codec->private_data; 766 struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
767 u16 reg, reg2; 767 u16 reg, reg2;
768 struct _pll_div pll_div; 768 struct _pll_div pll_div;
769 769
@@ -1174,7 +1174,7 @@ static int wm9713_soc_resume(struct platform_device *pdev)
1174{ 1174{
1175 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1175 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1176 struct snd_soc_codec *codec = socdev->card->codec; 1176 struct snd_soc_codec *codec = socdev->card->codec;
1177 struct wm9713_priv *wm9713 = codec->private_data; 1177 struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
1178 int i, ret; 1178 int i, ret;
1179 u16 *cache = codec->reg_cache; 1179 u16 *cache = codec->reg_cache;
1180 1180
@@ -1227,8 +1227,9 @@ static int wm9713_soc_probe(struct platform_device *pdev)
1227 codec->reg_cache_size = sizeof(wm9713_reg); 1227 codec->reg_cache_size = sizeof(wm9713_reg);
1228 codec->reg_cache_step = 2; 1228 codec->reg_cache_step = 2;
1229 1229
1230 codec->private_data = kzalloc(sizeof(struct wm9713_priv), GFP_KERNEL); 1230 snd_soc_codec_set_drvdata(codec, kzalloc(sizeof(struct wm9713_priv),
1231 if (codec->private_data == NULL) { 1231 GFP_KERNEL));
1232 if (snd_soc_codec_get_drvdata(codec) == NULL) {
1232 ret = -ENOMEM; 1233 ret = -ENOMEM;
1233 goto priv_err; 1234 goto priv_err;
1234 } 1235 }
@@ -1279,7 +1280,7 @@ pcm_err:
1279 snd_soc_free_ac97_codec(codec); 1280 snd_soc_free_ac97_codec(codec);
1280 1281
1281codec_err: 1282codec_err:
1282 kfree(codec->private_data); 1283 kfree(snd_soc_codec_get_drvdata(codec));
1283 1284
1284priv_err: 1285priv_err:
1285 kfree(codec->reg_cache); 1286 kfree(codec->reg_cache);
@@ -1301,7 +1302,7 @@ static int wm9713_soc_remove(struct platform_device *pdev)
1301 snd_soc_dapm_free(socdev); 1302 snd_soc_dapm_free(socdev);
1302 snd_soc_free_pcms(socdev); 1303 snd_soc_free_pcms(socdev);
1303 snd_soc_free_ac97_codec(codec); 1304 snd_soc_free_ac97_codec(codec);
1304 kfree(codec->private_data); 1305 kfree(snd_soc_codec_get_drvdata(codec));
1305 kfree(codec->reg_cache); 1306 kfree(codec->reg_cache);
1306 kfree(codec); 1307 kfree(codec);
1307 return 0; 1308 return 0;
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index e1f225a3ac4..defdbd08e13 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -91,7 +91,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
91 */ 91 */
92static void calibrate_dc_servo(struct snd_soc_codec *codec) 92static void calibrate_dc_servo(struct snd_soc_codec *codec)
93{ 93{
94 struct wm_hubs_data *hubs = codec->private_data; 94 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
95 u16 reg, reg_l, reg_r, dcs_cfg; 95 u16 reg, reg_l, reg_r, dcs_cfg;
96 96
97 /* Set for 32 series updates */ 97 /* Set for 32 series updates */
@@ -154,7 +154,7 @@ static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol,
154 struct snd_ctl_elem_value *ucontrol) 154 struct snd_ctl_elem_value *ucontrol)
155{ 155{
156 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 156 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
157 struct wm_hubs_data *hubs = codec->private_data; 157 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
158 int ret; 158 int ret;
159 159
160 ret = snd_soc_put_volsw_2r(kcontrol, ucontrol); 160 ret = snd_soc_put_volsw_2r(kcontrol, ucontrol);
@@ -327,7 +327,7 @@ static int hp_supply_event(struct snd_soc_dapm_widget *w,
327 struct snd_kcontrol *kcontrol, int event) 327 struct snd_kcontrol *kcontrol, int event)
328{ 328{
329 struct snd_soc_codec *codec = w->codec; 329 struct snd_soc_codec *codec = w->codec;
330 struct wm_hubs_data *hubs = codec->private_data; 330 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
331 331
332 switch (event) { 332 switch (event) {
333 case SND_SOC_DAPM_PRE_PMU: 333 case SND_SOC_DAPM_PRE_PMU: