aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTushar Behera <tushar.b@samsung.com>2014-07-04 05:12:16 -0400
committerMark Brown <broonie@linaro.org>2014-07-04 15:30:27 -0400
commit978b641f9563019a24032d5dee8a75963cd248ff (patch)
tree90d9b77bb83225d887775a6972f1ee1330bfeeaa
parent053e69d57cc6253b19ea661f929c8c1b6a907bff (diff)
ASoC: max98090: Add check for CODEC type
CODEC type (MAX98090/MAX98091) can be specified from device-tree file, it can also be obtained from the CODEC during runtime. Add an explicit check to figure out if both are matching, else print a message warning about the same. Signed-off-by: Tushar Behera <tushar.b@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/codecs/max98090.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index c00b36872dfe..2c2c5b22f60f 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2215,6 +2215,7 @@ static int max98090_probe(struct snd_soc_codec *codec)
2215{ 2215{
2216 struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec); 2216 struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
2217 struct max98090_cdata *cdata; 2217 struct max98090_cdata *cdata;
2218 enum max98090_type devtype;
2218 int ret = 0; 2219 int ret = 0;
2219 2220
2220 dev_dbg(codec->dev, "max98090_probe\n"); 2221 dev_dbg(codec->dev, "max98090_probe\n");
@@ -2250,16 +2251,21 @@ static int max98090_probe(struct snd_soc_codec *codec)
2250 } 2251 }
2251 2252
2252 if ((ret >= M98090_REVA) && (ret <= M98090_REVA + 0x0f)) { 2253 if ((ret >= M98090_REVA) && (ret <= M98090_REVA + 0x0f)) {
2253 max98090->devtype = MAX98090; 2254 devtype = MAX98090;
2254 dev_info(codec->dev, "MAX98090 REVID=0x%02x\n", ret); 2255 dev_info(codec->dev, "MAX98090 REVID=0x%02x\n", ret);
2255 } else if ((ret >= M98091_REVA) && (ret <= M98091_REVA + 0x0f)) { 2256 } else if ((ret >= M98091_REVA) && (ret <= M98091_REVA + 0x0f)) {
2256 max98090->devtype = MAX98091; 2257 devtype = MAX98091;
2257 dev_info(codec->dev, "MAX98091 REVID=0x%02x\n", ret); 2258 dev_info(codec->dev, "MAX98091 REVID=0x%02x\n", ret);
2258 } else { 2259 } else {
2259 max98090->devtype = MAX98090; 2260 devtype = MAX98090;
2260 dev_err(codec->dev, "Unrecognized revision 0x%02x\n", ret); 2261 dev_err(codec->dev, "Unrecognized revision 0x%02x\n", ret);
2261 } 2262 }
2262 2263
2264 if (max98090->devtype != devtype) {
2265 dev_warn(codec->dev, "Mismatch in DT specified CODEC type.\n");
2266 max98090->devtype = devtype;
2267 }
2268
2263 max98090->jack_state = M98090_JACK_STATE_NO_HEADSET; 2269 max98090->jack_state = M98090_JACK_STATE_NO_HEADSET;
2264 2270
2265 INIT_DELAYED_WORK(&max98090->jack_work, max98090_jack_work); 2271 INIT_DELAYED_WORK(&max98090->jack_work, max98090_jack_work);