patch-2.4.2 linux/drivers/media/video/msp3400.c

Next file: linux/drivers/media/video/planb.c
Previous file: linux/drivers/media/video/i2c-old.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.1/linux/drivers/media/video/msp3400.c linux/drivers/media/video/msp3400.c
@@ -42,7 +42,7 @@
 #include <linux/timer.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/videodev.h>
 #include <asm/semaphore.h>
@@ -90,6 +90,7 @@
 	int nicam_on;
 	int acb;
 	int main, second;	/* sound carrier */
+	int scart;              /* input is scart */
 
 	int muted;
 	int left, right;	/* volume */
@@ -733,6 +734,8 @@
 
 		if (VIDEO_MODE_RADIO == msp->norm)
 			continue;  /* nothing to do */
+		if (msp->scart)
+			continue;  /* nothing to do */
 	
 		msp->active = 1;
 
@@ -749,6 +752,10 @@
 			goto done;
 		
 	restart:
+		if (msp->scart)
+			continue;
+		if (VIDEO_MODE_RADIO == msp->norm)
+			continue;
 		msp->restart = 0;
 		msp3400c_setvolume(client, msp->muted, 0, 0);
 		msp3400c_setmode(client, MSP_MODE_AM_DETECT /* +1 */ );
@@ -912,7 +919,7 @@
 	msp->thread = NULL;
 
 	if(msp->notify != NULL)
-		up_and_exit(msp->notify, 0);
+		up(msp->notify);
 	return 0;
 }
 
@@ -982,6 +989,9 @@
 		if (msp->rmmod || signal_pending(current))
 			goto done;
 
+		if (msp->scart)
+			continue;
+		
 		msp->active = 1;
 
 		if (msp->watch_stereo) {
@@ -997,6 +1007,8 @@
 			goto done;
 
 	restart:
+		if (msp->scart)
+			continue;
 		msp->restart = 0;
 		del_timer(&msp->wake_stereo);
 		msp->watch_stereo = 0;
@@ -1004,11 +1016,6 @@
 		/* put into sane state (and mute) */
 		msp3400c_reset(client);
 
-		/* set various prescales */
-		msp3400c_write(client, I2C_MSP3400C_DFP, 0x0d, 0x1900); /* scart */
-		msp3400c_write(client, I2C_MSP3400C_DFP, 0x0e, 0x2403); /* FM */
-		msp3400c_write(client, I2C_MSP3400C_DFP, 0x10, 0x5a00); /* nicam */
-
 		/* start autodetect */
 		switch (msp->norm) {
 		case VIDEO_MODE_PAL:
@@ -1081,6 +1088,11 @@
 			msp3400c_write(client, I2C_MSP3400C_DEM, 0x20, val);
 		}
 
+		/* set various prescales */
+		msp3400c_write(client, I2C_MSP3400C_DFP, 0x0d, 0x1900); /* scart */
+		msp3400c_write(client, I2C_MSP3400C_DFP, 0x0e, 0x2403); /* FM */
+		msp3400c_write(client, I2C_MSP3400C_DFP, 0x10, 0x5a00); /* nicam */
+
 		/* set stereo */
 		switch (val) {
 		case 0x0008: /* B/G NICAM */
@@ -1320,19 +1332,25 @@
 
 	case AUDC_SET_INPUT:
 #if 1
+		dprintk(KERN_DEBUG "msp34xx: AUDC_SET_INPUT(%d)\n",*sarg);
 		/* hauppauge 44xxx scart switching */
+		msp->scart = 0;
 		switch (*sarg) {
 		case AUDIO_RADIO:
 			msp3400c_set_scart(client,SCART_IN2,0);
 			break;
 		case AUDIO_EXTERN:
+			msp->scart   = 1;
 			msp3400c_set_scart(client,SCART_IN1,0);
+			msp3400c_write(client,I2C_MSP3400C_DFP,0x0008,0x0220);
 			break;
 		default:
 			if (*sarg & AUDIO_MUTE)
 				msp3400c_set_scart(client,SCART_MUTE,0);
 			break;
 		}
+		if (msp->active)
+			msp->restart = 1;
 #endif
 		break;
 
@@ -1344,8 +1362,6 @@
 		if (msp->simple) {
 			/* the thread will do for us */
 			msp3400c_setvolume(client,msp->muted,0,0);
-			if (msp->active)
-				msp->restart = 1;
 			wake_up_interruptible(&msp->wq);
 		} else {
 			/* set msp3400 to FM radio mode */
@@ -1353,6 +1369,8 @@
 			msp3400c_setcarrier(client, MSP_CARRIER(10.7),MSP_CARRIER(10.7));
 			msp3400c_setvolume(client,msp->muted,msp->left,msp->right);			
 		}
+		if (msp->active)
+			msp->restart = 1;
 		break;
 
 	/* --- v4l ioctls --- */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)