All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Brian Austin <brian.austin@cirrus.com>,
	alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
	Paul Handrigan <Paul.Handrigan@cirrus.com>
Subject: [PATCH] ASoC: cs42l52: Report correct chip id and revision
Date: Fri, 04 Apr 2014 21:08:09 +0800	[thread overview]
Message-ID: <1396616889.13903.2.camel@phoenix> (raw)

According to the datasheet:

Chip I.D and Revision Register (Address 01h)
BIT[0:2] REVID
BIT[3:7] CHIPID (CS42L52: 11100)

REVID takes 3 bits, so CS42L52_CHIP_REV_MASK should be 0x07.
While at it, also adds define for CS42L52_CHIP_REV_B1.
The CHIPID takes BIT[3:7], so this patch updates the defines and the code to
show correct chip id for this chip.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/cs42l52.c | 4 ++--
 sound/soc/codecs/cs42l52.h | 7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index f0ca6be..277df17 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -1249,7 +1249,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
 			 ret);
 
 	ret = regmap_read(cs42l52->regmap, CS42L52_CHIP, &reg);
-	devid = reg & CS42L52_CHIP_ID_MASK;
+	devid = (reg & CS42L52_CHIP_ID_MASK) >> 3;
 	if (devid != CS42L52_CHIP_ID) {
 		ret = -ENODEV;
 		dev_err(&i2c_client->dev,
@@ -1259,7 +1259,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
 	}
 
 	dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n",
-			reg & 0xFF);
+			reg & CS42L52_CHIP_REV_MASK);
 
 	/* Set Platform Data */
 	if (cs42l52->pdata.mica_diff_cfg)
diff --git a/sound/soc/codecs/cs42l52.h b/sound/soc/codecs/cs42l52.h
index 6fb8f00..ce7ce5a 100644
--- a/sound/soc/codecs/cs42l52.h
+++ b/sound/soc/codecs/cs42l52.h
@@ -32,12 +32,13 @@
 
 #define CS42L52_FIX_BITS_CTL			0x00
 #define CS42L52_CHIP				0x01
-#define CS42L52_CHIP_ID				0xE0
-#define CS42L52_CHIP_ID_MASK			0xF8
+#define CS42L52_CHIP_ID				0x1C
+#define CS42L52_CHIP_ID_MASK			(0x1F << 3)
 #define CS42L52_CHIP_REV_A0			0x00
 #define CS42L52_CHIP_REV_A1			0x01
 #define CS42L52_CHIP_REV_B0			0x02
-#define CS42L52_CHIP_REV_MASK			0x03
+#define CS42L52_CHIP_REV_B1			0x03
+#define CS42L52_CHIP_REV_MASK			0x07
 
 #define CS42L52_PWRCTL1				0x02
 #define CS42L52_PWRCTL1_PDN_ALL			0x9F
-- 
1.8.3.2

             reply	other threads:[~2014-04-04 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 13:08 Axel Lin [this message]
2014-04-04 17:00 ` [PATCH] ASoC: cs42l52: Report correct chip id and revision Brian Austin
2014-04-04 21:50   ` Brian Austin
2014-04-04 21:52     ` Brian Austin
2014-04-05  2:04     ` Axel Lin
2014-04-05 12:22       ` Austin, Brian
2014-04-05  1:59   ` Axel Lin
2014-04-05 12:48     ` Austin, Brian
2014-04-05 16:33       ` Axel Lin
2014-04-05 16:49         ` Austin, Brian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396616889.13903.2.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=Paul.Handrigan@cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=brian.austin@cirrus.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.