ASoC: Support separate left and right channel dcs_codes values
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 1 Aug 2011 04:10:16 +0000 (13:10 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 1 Aug 2011 13:14:49 +0000 (22:14 +0900)
Some devices can have performance optimized by setting different offsets
for left and right channels.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
sound/soc/codecs/wm8993.c
sound/soc/codecs/wm8994.c
sound/soc/codecs/wm_hubs.c
sound/soc/codecs/wm_hubs.h

index 6e85b8869af7171882d5476137ed63004402bef1..f014e5676d20dd6e5f12a5b6024fc0b9710df820 100644 (file)
@@ -1433,7 +1433,8 @@ static int wm8993_probe(struct snd_soc_codec *codec)
        int ret, i, val;
 
        wm8993->hubs_data.hp_startup_mode = 1;
-       wm8993->hubs_data.dcs_codes = -2;
+       wm8993->hubs_data.dcs_codes_l = -2;
+       wm8993->hubs_data.dcs_codes_r = -2;
        wm8993->hubs_data.series_startup = 1;
 
        ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C);
index c0956899d5b5e31b0089e52b898a140243cdcd8c..fb5c96163610f4c599c57c90320505c6aaaed88d 100644 (file)
@@ -2973,7 +2973,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
                switch (wm8994->revision) {
                case 2:
                case 3:
-                       wm8994->hubs.dcs_codes = -5;
+                       wm8994->hubs.dcs_codes_l = -5;
+                       wm8994->hubs.dcs_codes_r = -5;
                        wm8994->hubs.hp_startup_mode = 1;
                        wm8994->hubs.dcs_readback_mode = 1;
                        wm8994->hubs.series_startup = 1;
index 84a84f4eed95cde8d773235fc367f06d589d1ff4..26e21d01e1373b7668ae18cfe3fb499b8809f2b9 100644 (file)
@@ -179,18 +179,19 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
        dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r);
 
        /* Apply correction to DC servo result */
-       if (hubs->dcs_codes) {
-               dev_dbg(codec->dev, "Applying %d code DC servo correction\n",
-                       hubs->dcs_codes);
+       if (hubs->dcs_codes_l || hubs->dcs_codes_r) {
+               dev_dbg(codec->dev,
+                       "Applying %d/%d code DC servo correction\n",
+                       hubs->dcs_codes_l, hubs->dcs_codes_r);
 
                /* HPOUT1R */
                offset = reg_r;
-               offset += hubs->dcs_codes;
+               offset += hubs->dcs_codes_r;
                dcs_cfg = (u8)offset << WM8993_DCS_DAC_WR_VAL_1_SHIFT;
 
                /* HPOUT1L */
                offset = reg_l;
-               offset += hubs->dcs_codes;
+               offset += hubs->dcs_codes_l;
                dcs_cfg |= (u8)offset;
 
                dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg);
@@ -228,7 +229,7 @@ static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol,
 
        /* If we're applying an offset correction then updating the
         * callibration would be likely to introduce further offsets. */
-       if (hubs->dcs_codes || hubs->no_series_update)
+       if (hubs->dcs_codes_l || hubs->dcs_codes_r || hubs->no_series_update)
                return ret;
 
        /* Only need to do this if the outputs are active */
index 676b1252ab910559a07bc3738051a67e60e765c8..c674c7a502a64e1d02889edfa839522686afdf9b 100644 (file)
@@ -23,7 +23,8 @@ extern const unsigned int wm_hubs_spkmix_tlv[];
 
 /* This *must* be the first element of the codec->private_data struct */
 struct wm_hubs_data {
-       int dcs_codes;
+       int dcs_codes_l;
+       int dcs_codes_r;
        int dcs_readback_mode;
        int hp_startup_mode;
        int series_startup;