Skip to content

Commit

Permalink
ASoC: max98090: Add check for CODEC type
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tushar Behera authored and Mark Brown committed Jul 4, 2014
1 parent 053e69d commit 978b641
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sound/soc/codecs/max98090.c
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,7 @@ static int max98090_probe(struct snd_soc_codec *codec)
{
struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
struct max98090_cdata *cdata;
enum max98090_type devtype;
int ret = 0;

dev_dbg(codec->dev, "max98090_probe\n");
Expand Down Expand Up @@ -2250,16 +2251,21 @@ static int max98090_probe(struct snd_soc_codec *codec)
}

if ((ret >= M98090_REVA) && (ret <= M98090_REVA + 0x0f)) {
max98090->devtype = MAX98090;
devtype = MAX98090;
dev_info(codec->dev, "MAX98090 REVID=0x%02x\n", ret);
} else if ((ret >= M98091_REVA) && (ret <= M98091_REVA + 0x0f)) {
max98090->devtype = MAX98091;
devtype = MAX98091;
dev_info(codec->dev, "MAX98091 REVID=0x%02x\n", ret);
} else {
max98090->devtype = MAX98090;
devtype = MAX98090;
dev_err(codec->dev, "Unrecognized revision 0x%02x\n", ret);
}

if (max98090->devtype != devtype) {
dev_warn(codec->dev, "Mismatch in DT specified CODEC type.\n");
max98090->devtype = devtype;
}

max98090->jack_state = M98090_JACK_STATE_NO_HEADSET;

INIT_DELAYED_WORK(&max98090->jack_work, max98090_jack_work);
Expand Down

0 comments on commit 978b641

Please sign in to comment.