ASoC: Replace remaining use of *_volsw_2r with *_volsw
[pandora-kernel.git] / sound / soc / codecs / wm8580.c
index 4bbc0a7..b256727 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
+#include <linux/of_device.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -212,7 +213,7 @@ static int wm8580_out_vu(struct snd_kcontrol *kcontrol,
        reg_cache[reg] = 0;
        reg_cache[reg2] = 0;
 
-       ret = snd_soc_put_volsw_2r(kcontrol, ucontrol);
+       ret = snd_soc_put_volsw(kcontrol, ucontrol);
        if (ret < 0)
                return ret;
 
@@ -223,31 +224,19 @@ static int wm8580_out_vu(struct snd_kcontrol *kcontrol,
        return 0;
 }
 
-#define SOC_WM8580_OUT_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, \
-                                   xinvert, tlv_array)                 \
-{      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
-       .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
-               SNDRV_CTL_ELEM_ACCESS_READWRITE,  \
-       .tlv.p = (tlv_array), \
-       .info = snd_soc_info_volsw_2r, \
-       .get = snd_soc_get_volsw_2r, .put = wm8580_out_vu, \
-       .private_value = (unsigned long)&(struct soc_mixer_control) \
-               {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
-               .max = xmax, .invert = xinvert} }
-
 static const struct snd_kcontrol_new wm8580_snd_controls[] = {
-SOC_WM8580_OUT_DOUBLE_R_TLV("DAC1 Playback Volume",
-                           WM8580_DIGITAL_ATTENUATION_DACL1,
-                           WM8580_DIGITAL_ATTENUATION_DACR1,
-                           0, 0xff, 0, dac_tlv),
-SOC_WM8580_OUT_DOUBLE_R_TLV("DAC2 Playback Volume",
-                           WM8580_DIGITAL_ATTENUATION_DACL2,
-                           WM8580_DIGITAL_ATTENUATION_DACR2,
-                           0, 0xff, 0, dac_tlv),
-SOC_WM8580_OUT_DOUBLE_R_TLV("DAC3 Playback Volume",
-                           WM8580_DIGITAL_ATTENUATION_DACL3,
-                           WM8580_DIGITAL_ATTENUATION_DACR3,
-                           0, 0xff, 0, dac_tlv),
+SOC_DOUBLE_R_EXT_TLV("DAC1 Playback Volume",
+                    WM8580_DIGITAL_ATTENUATION_DACL1,
+                    WM8580_DIGITAL_ATTENUATION_DACR1,
+                    0, 0xff, 0, snd_soc_get_volsw, wm8580_out_vu, dac_tlv),
+SOC_DOUBLE_R_EXT_TLV("DAC2 Playback Volume",
+                    WM8580_DIGITAL_ATTENUATION_DACL2,
+                    WM8580_DIGITAL_ATTENUATION_DACR2,
+                    0, 0xff, 0, snd_soc_get_volsw, wm8580_out_vu, dac_tlv),
+SOC_DOUBLE_R_EXT_TLV("DAC3 Playback Volume",
+                    WM8580_DIGITAL_ATTENUATION_DACL3,
+                    WM8580_DIGITAL_ATTENUATION_DACR3,
+                    0, 0xff, 0, snd_soc_get_volsw, wm8580_out_vu, dac_tlv),
 
 SOC_SINGLE("DAC1 Deemphasis Switch", WM8580_DAC_CONTROL3, 0, 1, 0),
 SOC_SINGLE("DAC2 Deemphasis Switch", WM8580_DAC_CONTROL3, 1, 1, 0),
@@ -907,6 +896,11 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8580 = {
        .reg_cache_default = wm8580_reg,
 };
 
+static const struct of_device_id wm8580_of_match[] = {
+       { .compatible = "wlf,wm8580" },
+       { },
+};
+
 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
 static int wm8580_i2c_probe(struct i2c_client *i2c,
                            const struct i2c_device_id *id)
@@ -943,8 +937,9 @@ MODULE_DEVICE_TABLE(i2c, wm8580_i2c_id);
 
 static struct i2c_driver wm8580_i2c_driver = {
        .driver = {
-               .name = "wm8580-codec",
+               .name = "wm8580",
                .owner = THIS_MODULE,
+               .of_match_table = wm8580_of_match,
        },
        .probe =    wm8580_i2c_probe,
        .remove =   wm8580_i2c_remove,