]> Pileus Git - ~andy/linux/blobdiff - sound/soc/codecs/wm8993.c
Merge branch 'topic/misc' into for-linus
[~andy/linux] / sound / soc / codecs / wm8993.c
index eec8e143511665a538c6950a4f679ad217aad827..2b40c93601ed493a11bf0222dd5ba0c09754355b 100644 (file)
@@ -512,7 +512,7 @@ static const DECLARE_TLV_DB_SCALE(drc_comp_threash, -4500, 75, 0);
 static const DECLARE_TLV_DB_SCALE(drc_comp_amp, -2250, 75, 0);
 static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0);
 static const unsigned int drc_max_tlv[] = {
-       TLV_DB_RANGE_HEAD(4),
+       TLV_DB_RANGE_HEAD(2),
        0, 2, TLV_DB_SCALE_ITEM(1200, 600, 0),
        3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0),
 };
@@ -934,28 +934,6 @@ static const struct snd_soc_dapm_route routes[] = {
        { "Right Headphone Mux", "DAC", "DACR" },
 };
 
-static void wm8993_cache_restore(struct snd_soc_codec *codec)
-{
-       u16 *cache = codec->reg_cache;
-       int i;
-
-       if (!codec->cache_sync)
-               return;
-
-       /* Reenable hardware writes */
-       codec->cache_only = 0;
-
-       /* Restore the register settings */
-       for (i = 1; i < WM8993_MAX_REGISTER; i++) {
-               if (cache[i] == wm8993_reg_defaults[i])
-                       continue;
-               snd_soc_write(codec, i, cache[i]);
-       }
-
-       /* We're in sync again */
-       codec->cache_sync = 0;
-}
-
 static int wm8993_set_bias_level(struct snd_soc_codec *codec,
                                 enum snd_soc_bias_level level)
 {
@@ -979,7 +957,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec,
                        if (ret != 0)
                                return ret;
 
-                       wm8993_cache_restore(codec);
+                       snd_soc_cache_sync(codec);
 
                        /* Tune DC servo configuration */
                        snd_soc_write(codec, 0x44, 3);
@@ -1394,7 +1372,7 @@ out:
        return 0;
 }
 
-static struct snd_soc_dai_ops wm8993_ops = {
+static const struct snd_soc_dai_ops wm8993_ops = {
        .set_sysclk = wm8993_set_sysclk,
        .set_fmt = wm8993_set_dai_fmt,
        .hw_params = wm8993_hw_params,
@@ -1544,7 +1522,7 @@ static int wm8993_remove(struct snd_soc_codec *codec)
 }
 
 #ifdef CONFIG_PM
-static int wm8993_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int wm8993_suspend(struct snd_soc_codec *codec)
 {
        struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        int fll_fout = wm8993->fll_fout;
@@ -1613,7 +1591,8 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
        struct wm8993_priv *wm8993;
        int ret;
 
-       wm8993 = kzalloc(sizeof(struct wm8993_priv), GFP_KERNEL);
+       wm8993 = devm_kzalloc(&i2c->dev, sizeof(struct wm8993_priv),
+                             GFP_KERNEL);
        if (wm8993 == NULL)
                return -ENOMEM;
 
@@ -1621,8 +1600,6 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
 
        ret = snd_soc_register_codec(&i2c->dev,
                        &soc_codec_dev_wm8993, &wm8993_dai, 1);
-       if (ret < 0)
-               kfree(wm8993);
        return ret;
 }
 
@@ -1641,7 +1618,7 @@ MODULE_DEVICE_TABLE(i2c, wm8993_i2c_id);
 
 static struct i2c_driver wm8993_i2c_driver = {
        .driver = {
-               .name = "wm8993-codec",
+               .name = "wm8993",
                .owner = THIS_MODULE,
        },
        .probe =    wm8993_i2c_probe,