summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorLionel Xu <Lionel.Xu@freescale.com>2011-08-11 15:48:08 +0800
committerLionel Xu <Lionel.Xu@freescale.com>2011-08-15 13:06:25 +0800
commitfdd85eb4304b1cd0d7f69b30ae2fcc68905d95b0 (patch)
treed281bf8725a27464477c00b8eac4c890df9bb724 /sound
parent52effd74feac3738103714a7c61a74592d140c85 (diff)
ENGR00154727 ESAI: Resolve i2c access problem when there is no audio card
I2c device should not probe successfully when there is no such device on the bus. This will make i2c access failure later. Signed-off-by: Lionel Xu <R63889@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/cs42888.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/sound/soc/codecs/cs42888.c b/sound/soc/codecs/cs42888.c
index 2ccc9dfbbf68..dcaa65e492e4 100644
--- a/sound/soc/codecs/cs42888.c
+++ b/sound/soc/codecs/cs42888.c
@@ -809,20 +809,6 @@ static int cs42888_probe(struct snd_soc_codec *codec)
}
msleep(1);
- /* Verify that we have a CS42888 */
- val = snd_soc_read(codec, CS42888_CHIPID);
- if (val < 0) {
- pr_err("Device with ID register %x is not a CS42888", val);
- return -ENODEV;
- }
- /* The top four bits of the chip ID should be 0000. */
- if ((val & CS42888_CHIPID_ID_MASK) != 0x00) {
- dev_err(codec->dev, "device is not a CS42888\n");
- return -ENODEV;
- }
-
- dev_info(codec->dev, "hardware revision %X\n", val & 0xF);
-
/* The I2C interface is set up, so pre-fill our register cache */
ret = cs42888_fill_cache(codec);
if (ret < 0) {
@@ -908,6 +894,23 @@ static int cs42888_i2c_probe(struct i2c_client *i2c_client,
{
struct cs42888_private *cs42888;
int ret;
+ int val;
+
+ /* Verify that we have a CS42888 */
+ val = i2c_smbus_read_byte_data(i2c_client, CS42888_CHIPID);
+ if (val < 0) {
+ pr_err("Device with ID register %x is not a CS42888", val);
+ return -ENODEV;
+ }
+ /* The top four bits of the chip ID should be 0000. */
+ if ((val & CS42888_CHIPID_ID_MASK) != 0x00) {
+ dev_err(&i2c_client->dev, "device is not a CS42888\n");
+ return -ENODEV;
+ }
+
+ dev_info(&i2c_client->dev, "found device at i2c address %X\n",
+ i2c_client->addr);
+ dev_info(&i2c_client->dev, "hardware revision %X\n", val & 0xF);
/* Allocate enough space for the snd_soc_codec structure
and our private data together. */