From c7b93d42d9943b40774d9f3405f89dd74740e2ee Mon Sep 17 00:00:00 2001 From: Nikesh Oswal Date: Wed, 14 Mar 2012 17:48:09 +0530 Subject: asoc: codecs: max98088: check for revision id check for revision id, it must be 0x40 as per the datasheet, if its not 0x40 then dont allow the card to register by failing in the codec probe. This functionality will be required when the same board support multiple codecs. Also register the irq only after validating the codec. Change-Id: I8553b85d534428c7137ec2d03e2f814b898609a6 Signed-off-by: Nikesh Oswal Reviewed-on: http://git-master/r/90061 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Peterson --- sound/soc/codecs/max98088.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'sound/soc/codecs') diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index cee6354656e7..e2ad10d2deaa 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -2073,6 +2073,15 @@ static int max98088_probe(struct snd_soc_codec *codec) max98088->mic1pre = 0; max98088->mic2pre = 0; + ret = snd_soc_read(codec, M98088_REG_FF_REV_ID); + if (ret != 0x40) { + dev_err(codec->dev, "Failed to read device revision: %d\n", + ret); + ret = -ENODEV; + goto err_access; + } + dev_info(codec->dev, "revision %c\n", ret + 'A'); + if (max98088->irq) { /* register an audio interrupt */ ret = request_threaded_irq(max98088->irq, NULL, @@ -2085,14 +2094,6 @@ static int max98088_probe(struct snd_soc_codec *codec) } } - ret = snd_soc_read(codec, M98088_REG_FF_REV_ID); - if (ret < 0) { - dev_err(codec->dev, "Failed to read device revision: %d\n", - ret); - goto err_access; - } - dev_info(codec->dev, "revision %c\n", ret + 'A'); - snd_soc_write(codec, M98088_REG_51_PWR_SYS, M98088_PWRSV); /* initialize registers cache to hardware default */ -- cgit v1.2.3