[ALSA] Workaround for invalid signature read of CS8427
authorTakashi Iwai <tiwai@suse.de>
Thu, 20 Sep 2007 15:34:57 +0000 (17:34 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 14:51:01 +0000 (16:51 +0200)
Reading the signature of CS8427 over SPI/I2C fails on some devices
by mysterious reason.  In most cases, however, it succeeds at the
sequential read.  So, let's give a second chance to check the signature
again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/i2c/cs8427.c

index 64388cb8d6e508b9b5f24942cac2ee84285e1a8e..e601caa6ea0b9c3d32b678374bd6d5f7b05c7f5f 100644 (file)
@@ -228,6 +228,12 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
        
        snd_i2c_lock(bus);
        err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER);
+       if (err != CS8427_VER8427A) {
+               /* give second chance */
+               snd_printk(KERN_WARNING "invalid CS8427 signature 0x%x: "
+                          "let me try again...\n", err);
+               err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER);
+       }
        if (err != CS8427_VER8427A) {
                snd_i2c_unlock(bus);
                snd_printk(KERN_ERR "unable to find CS8427 signature "