aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9090.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm9090.c')
-rw-r--r--sound/soc/codecs/wm9090.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c
index f94c06057c64..41ebe0dce772 100644
--- a/sound/soc/codecs/wm9090.c
+++ b/sound/soc/codecs/wm9090.c
@@ -513,18 +513,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
513 case SND_SOC_BIAS_STANDBY: 513 case SND_SOC_BIAS_STANDBY:
514 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { 514 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
515 /* Restore the register cache */ 515 /* Restore the register cache */
516 for (i = 1; i < codec->driver->reg_cache_size; i++) { 516 snd_soc_cache_sync(codec);
517 if (reg_cache[i] == wm9090_reg_defaults[i])
518 continue;
519 if (wm9090_volatile(codec, i))
520 continue;
521
522 ret = snd_soc_write(codec, i, reg_cache[i]);
523 if (ret != 0)
524 dev_warn(codec->dev,
525 "Failed to restore register %d: %d\n",
526 i, ret);
527 }
528 } 517 }
529 518
530 /* We keep VMID off during standby since the combination of 519 /* We keep VMID off during standby since the combination of
@@ -604,7 +593,7 @@ static int wm9090_probe(struct snd_soc_codec *codec)
604} 593}
605 594
606#ifdef CONFIG_PM 595#ifdef CONFIG_PM
607static int wm9090_suspend(struct snd_soc_codec *codec, pm_message_t state) 596static int wm9090_suspend(struct snd_soc_codec *codec)
608{ 597{
609 wm9090_set_bias_level(codec, SND_SOC_BIAS_OFF); 598 wm9090_set_bias_level(codec, SND_SOC_BIAS_OFF);
610 599
@@ -647,7 +636,7 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
647 struct wm9090_priv *wm9090; 636 struct wm9090_priv *wm9090;
648 int ret; 637 int ret;
649 638
650 wm9090 = kzalloc(sizeof(*wm9090), GFP_KERNEL); 639 wm9090 = devm_kzalloc(&i2c->dev, sizeof(*wm9090), GFP_KERNEL);
651 if (wm9090 == NULL) { 640 if (wm9090 == NULL) {
652 dev_err(&i2c->dev, "Can not allocate memory\n"); 641 dev_err(&i2c->dev, "Can not allocate memory\n");
653 return -ENOMEM; 642 return -ENOMEM;
@@ -661,8 +650,6 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
661 650
662 ret = snd_soc_register_codec(&i2c->dev, 651 ret = snd_soc_register_codec(&i2c->dev,
663 &soc_codec_dev_wm9090, NULL, 0); 652 &soc_codec_dev_wm9090, NULL, 0);
664 if (ret < 0)
665 kfree(wm9090);
666 return ret; 653 return ret;
667} 654}
668 655
@@ -671,7 +658,6 @@ static int __devexit wm9090_i2c_remove(struct i2c_client *i2c)
671 struct wm9090_priv *wm9090 = i2c_get_clientdata(i2c); 658 struct wm9090_priv *wm9090 = i2c_get_clientdata(i2c);
672 659
673 snd_soc_unregister_codec(&i2c->dev); 660 snd_soc_unregister_codec(&i2c->dev);
674 kfree(wm9090);
675 661
676 return 0; 662 return 0;
677} 663}
@@ -685,7 +671,7 @@ MODULE_DEVICE_TABLE(i2c, wm9090_id);
685 671
686static struct i2c_driver wm9090_i2c_driver = { 672static struct i2c_driver wm9090_i2c_driver = {
687 .driver = { 673 .driver = {
688 .name = "wm9090-codec", 674 .name = "wm9090",
689 .owner = THIS_MODULE, 675 .owner = THIS_MODULE,
690 }, 676 },
691 .probe = wm9090_i2c_probe, 677 .probe = wm9090_i2c_probe,