diff options
Diffstat (limited to 'sound/soc/codecs/wm8993.c')
-rw-r--r-- | sound/soc/codecs/wm8993.c | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index d1a142f48b09..2b40c93601ed 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -934,28 +934,6 @@ static const struct snd_soc_dapm_route routes[] = { | |||
934 | { "Right Headphone Mux", "DAC", "DACR" }, | 934 | { "Right Headphone Mux", "DAC", "DACR" }, |
935 | }; | 935 | }; |
936 | 936 | ||
937 | static void wm8993_cache_restore(struct snd_soc_codec *codec) | ||
938 | { | ||
939 | u16 *cache = codec->reg_cache; | ||
940 | int i; | ||
941 | |||
942 | if (!codec->cache_sync) | ||
943 | return; | ||
944 | |||
945 | /* Reenable hardware writes */ | ||
946 | codec->cache_only = 0; | ||
947 | |||
948 | /* Restore the register settings */ | ||
949 | for (i = 1; i < WM8993_MAX_REGISTER; i++) { | ||
950 | if (cache[i] == wm8993_reg_defaults[i]) | ||
951 | continue; | ||
952 | snd_soc_write(codec, i, cache[i]); | ||
953 | } | ||
954 | |||
955 | /* We're in sync again */ | ||
956 | codec->cache_sync = 0; | ||
957 | } | ||
958 | |||
959 | static int wm8993_set_bias_level(struct snd_soc_codec *codec, | 937 | static int wm8993_set_bias_level(struct snd_soc_codec *codec, |
960 | enum snd_soc_bias_level level) | 938 | enum snd_soc_bias_level level) |
961 | { | 939 | { |
@@ -979,7 +957,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec, | |||
979 | if (ret != 0) | 957 | if (ret != 0) |
980 | return ret; | 958 | return ret; |
981 | 959 | ||
982 | wm8993_cache_restore(codec); | 960 | snd_soc_cache_sync(codec); |
983 | 961 | ||
984 | /* Tune DC servo configuration */ | 962 | /* Tune DC servo configuration */ |
985 | snd_soc_write(codec, 0x44, 3); | 963 | snd_soc_write(codec, 0x44, 3); |
@@ -1394,7 +1372,7 @@ out: | |||
1394 | return 0; | 1372 | return 0; |
1395 | } | 1373 | } |
1396 | 1374 | ||
1397 | static struct snd_soc_dai_ops wm8993_ops = { | 1375 | static const struct snd_soc_dai_ops wm8993_ops = { |
1398 | .set_sysclk = wm8993_set_sysclk, | 1376 | .set_sysclk = wm8993_set_sysclk, |
1399 | .set_fmt = wm8993_set_dai_fmt, | 1377 | .set_fmt = wm8993_set_dai_fmt, |
1400 | .hw_params = wm8993_hw_params, | 1378 | .hw_params = wm8993_hw_params, |
@@ -1544,7 +1522,7 @@ static int wm8993_remove(struct snd_soc_codec *codec) | |||
1544 | } | 1522 | } |
1545 | 1523 | ||
1546 | #ifdef CONFIG_PM | 1524 | #ifdef CONFIG_PM |
1547 | static int wm8993_suspend(struct snd_soc_codec *codec, pm_message_t state) | 1525 | static int wm8993_suspend(struct snd_soc_codec *codec) |
1548 | { | 1526 | { |
1549 | struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); | 1527 | struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); |
1550 | int fll_fout = wm8993->fll_fout; | 1528 | int fll_fout = wm8993->fll_fout; |
@@ -1613,7 +1591,8 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, | |||
1613 | struct wm8993_priv *wm8993; | 1591 | struct wm8993_priv *wm8993; |
1614 | int ret; | 1592 | int ret; |
1615 | 1593 | ||
1616 | wm8993 = kzalloc(sizeof(struct wm8993_priv), GFP_KERNEL); | 1594 | wm8993 = devm_kzalloc(&i2c->dev, sizeof(struct wm8993_priv), |
1595 | GFP_KERNEL); | ||
1617 | if (wm8993 == NULL) | 1596 | if (wm8993 == NULL) |
1618 | return -ENOMEM; | 1597 | return -ENOMEM; |
1619 | 1598 | ||
@@ -1621,8 +1600,6 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, | |||
1621 | 1600 | ||
1622 | ret = snd_soc_register_codec(&i2c->dev, | 1601 | ret = snd_soc_register_codec(&i2c->dev, |
1623 | &soc_codec_dev_wm8993, &wm8993_dai, 1); | 1602 | &soc_codec_dev_wm8993, &wm8993_dai, 1); |
1624 | if (ret < 0) | ||
1625 | kfree(wm8993); | ||
1626 | return ret; | 1603 | return ret; |
1627 | } | 1604 | } |
1628 | 1605 | ||
@@ -1641,7 +1618,7 @@ MODULE_DEVICE_TABLE(i2c, wm8993_i2c_id); | |||
1641 | 1618 | ||
1642 | static struct i2c_driver wm8993_i2c_driver = { | 1619 | static struct i2c_driver wm8993_i2c_driver = { |
1643 | .driver = { | 1620 | .driver = { |
1644 | .name = "wm8993-codec", | 1621 | .name = "wm8993", |
1645 | .owner = THIS_MODULE, | 1622 | .owner = THIS_MODULE, |
1646 | }, | 1623 | }, |
1647 | .probe = wm8993_i2c_probe, | 1624 | .probe = wm8993_i2c_probe, |