ASoC: codecs: Fix headset detection
Ravindra Lokhande [Wed, 28 Aug 2013 10:36:17 +0000 (15:36 +0530)]
Ceres ERS and FFD has different headset jack. ERS has closed jack
whereas FFD has open jack. Max97236 fails to detect headset for both.
Added code to check board id and use respective jack detection.

Bug 1332257

Change-Id: I64fd45504a090c08e5465c84fec1826367e828c4
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-on: http://git-master/r/267264
(cherry picked from commit 21459e02e3c0ff2d0f5697c99bdad7ddf1295246)
Reviewed-on: http://git-master/r/269585
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>

sound/soc/codecs/max97236.c
sound/soc/codecs/max98090.c

index 8dc2df5..afa7036 100644 (file)
 
 #include <linux/version.h>
 
+#include <mach/../../board.h>
+#include <mach/../../tegra-board-id.h>
+
+static struct board_info board_info;
+
 #define DEBUG
 #define EXTMIC_METHOD
 #define EXTMIC_METHOD_TEST
@@ -589,6 +594,14 @@ static int max97236_jacksw_active(struct max97236_priv *max97236)
 #endif
        int ret;
 
+       /* Overwrite above code using board id */
+       if ((board_info.board_id == BOARD_E1680) ||
+               (board_info.board_id == BOARD_E1681)) {
+               test_value = 4;
+       } else { /* FFD */
+               test_value = 0;
+       }
+
        regmap_read(max97236->regmap, M97236_REG_00_STATUS1, &reg);
        ret = (reg & M97236_JACKSW_MASK) == test_value;
 
@@ -1003,6 +1016,13 @@ int max97236_mic_detect(struct snd_soc_codec *codec,
 #else
                test_value = 0;
 #endif
+               /* Overwrite above code using board id */
+               if ((board_info.board_id == BOARD_E1680) ||
+                       (board_info.board_id == BOARD_E1681)) {
+                       test_value = 4;
+               } else { /* FFD */
+                       test_value = 0;
+               }
 
                if ((reg & M97236_JACKSW_MASK) == test_value) {
                        schedule_delayed_work(&max97236->jack_work,
@@ -1266,6 +1286,8 @@ static int max97236_i2c_probe(struct i2c_client *i2c,
        if (ret < 0)
                regmap_exit(max97236->regmap);
 
+       tegra_get_board_info(&board_info);
+
 err_enable:
        return ret;
 }
index 430d649..1f848c6 100644 (file)
@@ -2665,8 +2665,6 @@ static int max98090_dai_digital_mute(struct snd_soc_dai *codec_dai, int mute)
        struct snd_soc_codec *codec = codec_dai->codec;
        int regval;
 
-       dev_info(codec->dev, "max98090_dai_digital_mute\n");
-
        regval = mute ? M98090_DAI_LVL_DVM_MASK : 0;
        snd_soc_update_bits(codec, M98090_REG_27_DAI_LVL,
                M98090_DAI_LVL_DVM_MASK, regval);