aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8955.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8955.c')
-rw-r--r--sound/soc/codecs/wm8955.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index f89ad6c9a80b..2ac35b0be86a 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -42,8 +42,6 @@ static const char *wm8955_supply_names[WM8955_NUM_SUPPLIES] = {
42struct wm8955_priv { 42struct wm8955_priv {
43 enum snd_soc_control_type control_type; 43 enum snd_soc_control_type control_type;
44 44
45 u16 reg_cache[WM8955_MAX_REGISTER + 1];
46
47 unsigned int mclk_rate; 45 unsigned int mclk_rate;
48 46
49 int deemph; 47 int deemph;
@@ -380,7 +378,8 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol,
380 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 378 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
381 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); 379 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
382 380
383 return wm8955->deemph; 381 ucontrol->value.enumerated.item[0] = wm8955->deemph;
382 return 0;
384} 383}
385 384
386static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, 385static int wm8955_put_deemph(struct snd_kcontrol *kcontrol,
@@ -767,6 +766,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
767 enum snd_soc_bias_level level) 766 enum snd_soc_bias_level level)
768{ 767{
769 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); 768 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
769 u16 *reg_cache = codec->reg_cache;
770 int ret, i; 770 int ret, i;
771 771
772 switch (level) { 772 switch (level) {
@@ -799,14 +799,14 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
799 /* Sync back cached values if they're 799 /* Sync back cached values if they're
800 * different from the hardware default. 800 * different from the hardware default.
801 */ 801 */
802 for (i = 0; i < ARRAY_SIZE(wm8955->reg_cache); i++) { 802 for (i = 0; i < codec->driver->reg_cache_size; i++) {
803 if (i == WM8955_RESET) 803 if (i == WM8955_RESET)
804 continue; 804 continue;
805 805
806 if (wm8955->reg_cache[i] == wm8955_reg[i]) 806 if (reg_cache[i] == wm8955_reg[i])
807 continue; 807 continue;
808 808
809 snd_soc_write(codec, i, wm8955->reg_cache[i]); 809 snd_soc_write(codec, i, reg_cache[i]);
810 } 810 }
811 811
812 /* Enable VREF and VMID */ 812 /* Enable VREF and VMID */
@@ -901,6 +901,7 @@ static int wm8955_probe(struct snd_soc_codec *codec)
901{ 901{
902 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); 902 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
903 struct wm8955_pdata *pdata = dev_get_platdata(codec->dev); 903 struct wm8955_pdata *pdata = dev_get_platdata(codec->dev);
904 u16 *reg_cache = codec->reg_cache;
904 int ret, i; 905 int ret, i;
905 906
906 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8955->control_type); 907 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8955->control_type);
@@ -933,25 +934,25 @@ static int wm8955_probe(struct snd_soc_codec *codec)
933 } 934 }
934 935
935 /* Change some default settings - latch VU and enable ZC */ 936 /* Change some default settings - latch VU and enable ZC */
936 wm8955->reg_cache[WM8955_LEFT_DAC_VOLUME] |= WM8955_LDVU; 937 reg_cache[WM8955_LEFT_DAC_VOLUME] |= WM8955_LDVU;
937 wm8955->reg_cache[WM8955_RIGHT_DAC_VOLUME] |= WM8955_RDVU; 938 reg_cache[WM8955_RIGHT_DAC_VOLUME] |= WM8955_RDVU;
938 wm8955->reg_cache[WM8955_LOUT1_VOLUME] |= WM8955_LO1VU | WM8955_LO1ZC; 939 reg_cache[WM8955_LOUT1_VOLUME] |= WM8955_LO1VU | WM8955_LO1ZC;
939 wm8955->reg_cache[WM8955_ROUT1_VOLUME] |= WM8955_RO1VU | WM8955_RO1ZC; 940 reg_cache[WM8955_ROUT1_VOLUME] |= WM8955_RO1VU | WM8955_RO1ZC;
940 wm8955->reg_cache[WM8955_LOUT2_VOLUME] |= WM8955_LO2VU | WM8955_LO2ZC; 941 reg_cache[WM8955_LOUT2_VOLUME] |= WM8955_LO2VU | WM8955_LO2ZC;
941 wm8955->reg_cache[WM8955_ROUT2_VOLUME] |= WM8955_RO2VU | WM8955_RO2ZC; 942 reg_cache[WM8955_ROUT2_VOLUME] |= WM8955_RO2VU | WM8955_RO2ZC;
942 wm8955->reg_cache[WM8955_MONOOUT_VOLUME] |= WM8955_MOZC; 943 reg_cache[WM8955_MONOOUT_VOLUME] |= WM8955_MOZC;
943 944
944 /* Also enable adaptive bass boost by default */ 945 /* Also enable adaptive bass boost by default */
945 wm8955->reg_cache[WM8955_BASS_CONTROL] |= WM8955_BB; 946 reg_cache[WM8955_BASS_CONTROL] |= WM8955_BB;
946 947
947 /* Set platform data values */ 948 /* Set platform data values */
948 if (pdata) { 949 if (pdata) {
949 if (pdata->out2_speaker) 950 if (pdata->out2_speaker)
950 wm8955->reg_cache[WM8955_ADDITIONAL_CONTROL_2] 951 reg_cache[WM8955_ADDITIONAL_CONTROL_2]
951 |= WM8955_ROUT2INV; 952 |= WM8955_ROUT2INV;
952 953
953 if (pdata->monoin_diff) 954 if (pdata->monoin_diff)
954 wm8955->reg_cache[WM8955_MONO_OUT_MIX_1] 955 reg_cache[WM8955_MONO_OUT_MIX_1]
955 |= WM8955_DMEN; 956 |= WM8955_DMEN;
956 } 957 }
957 958
@@ -1002,6 +1003,7 @@ static __devinit int wm8955_i2c_probe(struct i2c_client *i2c,
1002 return -ENOMEM; 1003 return -ENOMEM;
1003 1004
1004 i2c_set_clientdata(i2c, wm8955); 1005 i2c_set_clientdata(i2c, wm8955);
1006 wm8955->control_type = SND_SOC_I2C;
1005 1007
1006 ret = snd_soc_register_codec(&i2c->dev, 1008 ret = snd_soc_register_codec(&i2c->dev,
1007 &soc_codec_dev_wm8955, &wm8955_dai, 1); 1009 &soc_codec_dev_wm8955, &wm8955_dai, 1);