Re: WARNING: msp34xx penguin on i2c bus ..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, 29 Nov 2002, Gerd Knorr wrote:

> > Something went wrong ;(  DO NOT try that msp3400 patch.
>
> Whoops.  I just merged these bits.  So anyone who has very recent
> stuff from http://bytesex.org/snapshots/ should take care too.
>
Silly me, I got modules mixed up and really didn't try recovery with the
original code. That patch really didn't work at all.

I had to break the reset message in three parts.
Patch attached for the brave.

-- 
  Kyösti Mälkki
  kmalkki@xxxxxxxxx
--- linux-2.4.19.orig/drivers/media/video/msp3400.c	Tue Jul  9 23:03:10 2002
+++ linux-2.4.19/drivers/media/video/msp3400.c	Fri Nov 29 21:46:05 2002
@@ -145,14 +145,38 @@
 /* ----------------------------------------------------------------------- */
 /* functions for talking to the MSP3400C Sound processor                   */
 
+#ifdef I2C_M_IGNORE_NAK
+#define _IGNORE_NAK I2C_M_IGNORE_NAK
+#else
+#define _IGNORE_NAK 0x1000
+#endif
+
 static int msp3400c_reset(struct i2c_client *client)
 {
+	/* reset and read revision code */
         static char reset_off[3] = { 0x00, 0x80, 0x00 };
         static char reset_on[3]  = { 0x00, 0x00, 0x00 };
+        static char write[3] = { I2C_MSP3400C_DFP + 1, 0x00, 0x1e };
+        char read[2];
+        struct i2c_msg reset[2] = {
+                { client->addr, _IGNORE_NAK, 3, reset_off },
+                { client->addr, _IGNORE_NAK, 3, reset_on }
+	};
+        struct i2c_msg test[2] = {
+                { client->addr, 0,        3, write },
+                { client->addr, I2C_M_RD, 2, read  }
+        };
 
-        i2c_master_send(client,reset_off,3);  /* XXX ignore errors here */
-        if (3 != i2c_master_send(client,reset_on, 3)) {
-		printk(KERN_ERR "msp3400: chip reset failed, penguin on i2c bus?\n");
+	/* We cannot send reset_off, _on and test in a single transfer here.
+	 * It would leave msp in reset mode.
+	 */
+ 	if ( (1 != i2c_transfer(client->adapter,&reset[0],1)) ||
+	     (1 != i2c_transfer(client->adapter,&reset[1],1)) ||
+	     (2 != i2c_transfer(client->adapter,test,2)) ) {
+#ifndef I2C_M_IGNORE_NAK
+		printk(KERN_ERR "msp3400: i2c-2.7.0+ required for chip reset, tried it anyway\n");
+#endif
+  		printk(KERN_ERR "msp3400: chip reset failed, penguin on i2c bus?\n");
                 return -1;
 	}
         return 0;

[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux