[PATCH] v4l: 663: add new rtd cards

- Add new RTD cards

Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index b264305..82b5f7c 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -70,3 +70,5 @@
  69 -> Philips EUROPA V3 reference design       [1131:2004]
  70 -> Compro Videomate DVB-T300                [185b:c900]
  71 -> Compro Videomate DVB-T200                [185b:c901]
+ 72 -> RTD Embedded Technologies VFG7350        [1435:7350]
+ 73 -> RTD Embedded Technologies VFG7330        [1435:7330]
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 8291ed7..8bb2faf 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2251,6 +2251,74 @@
 			.amux   = LINE1,
 		}},
 	},
+ 	[SAA7134_BOARD_RTD_VFG7350] = {
+ 		.name		= "RTD Embedded Technologies VFG7350",
+ 		.audio_clock	= 0x00200000,
+ 		.tuner_type	= TUNER_ABSENT,
+ 		.radio_type	= UNSET,
+ 		.tuner_addr	= ADDR_UNSET,
+ 		.radio_addr	= ADDR_UNSET,
+ 		.inputs		= {{
+ 			.name   = "Composite 0",
+ 			.vmux   = 0,
+ 			.amux   = LINE1,
+ 		},{
+ 			.name   = "Composite 1",
+ 			.vmux   = 1,
+ 			.amux   = LINE2,
+ 		},{
+ 			.name   = "Composite 2",
+ 			.vmux   = 2,
+ 			.amux   = LINE1,
+ 		},{
+ 			.name   = "Composite 3",
+ 			.vmux   = 3,
+ 			.amux   = LINE2,
+ 		},{
+ 			.name   = "S-Video 0",
+ 			.vmux   = 8,
+ 			.amux   = LINE1,
+ 		},{
+ 			.name   = "S-Video 1",
+ 			.vmux   = 9,
+ 			.amux   = LINE2,
+ 		}},
+ 		.mpeg           = SAA7134_MPEG_EMPRESS,
+ 		.video_out      = CCIR656,
+ 	},
+ 	[SAA7134_BOARD_RTD_VFG7330] = {
+ 		.name		= "RTD Embedded Technologies VFG7330",
+ 		.audio_clock	= 0x00200000,
+ 		.tuner_type	= TUNER_ABSENT,
+ 		.radio_type	= UNSET,
+ 		.tuner_addr	= ADDR_UNSET,
+ 		.radio_addr	= ADDR_UNSET,
+ 		.inputs		= {{
+ 			.name   = "Composite 0",
+ 			.vmux   = 0,
+ 			.amux   = LINE1,
+ 		},{
+ 			.name   = "Composite 1",
+ 			.vmux   = 1,
+ 			.amux   = LINE2,
+ 		},{
+ 			.name   = "Composite 2",
+ 			.vmux   = 2,
+ 			.amux   = LINE1,
+ 		},{
+ 			.name   = "Composite 3",
+ 			.vmux   = 3,
+ 			.amux   = LINE2,
+ 		},{
+ 			.name   = "S-Video 0",
+ 			.vmux   = 8,
+ 			.amux   = LINE1,
+ 		},{
+ 			.name   = "S-Video 1",
+ 			.vmux   = 9,
+ 			.amux   = LINE2,
+ 		}},
+ 	},
 };
 
 const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -2639,6 +2707,18 @@
 		.subdevice    = 0xc901,
 		.driver_data  = SAA7134_BOARD_VIDEOMATE_DVBT_200,
 	},{
+ 		.vendor       = PCI_VENDOR_ID_PHILIPS,
+ 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+ 		.subvendor    = 0x1435,
+ 		.subdevice    = 0x7350,
+ 		.driver_data  = SAA7134_BOARD_RTD_VFG7350,
+	},{
+ 		.vendor       = PCI_VENDOR_ID_PHILIPS,
+ 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+ 		.subvendor    = 0x1435,
+ 		.subdevice    = 0x7330,
+ 		.driver_data  = SAA7134_BOARD_RTD_VFG7330,
+ 	},{
 		/* --- boards without eeprom + subsystem ID --- */
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -2758,6 +2838,17 @@
 		saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff);
 		msleep(1);
 		break;
+	case SAA7134_BOARD_RTD_VFG7350:
+
+		/*
+		 * Make sure Production Test Register at offset 0x1D1 is cleared
+		 * to take chip out of test mode.  Clearing bit 4 (TST_EN_AOUT)
+		 * prevents pin 105 from remaining low; keeping pin 105 low
+		 * continually resets the SAA6752 chip.
+		 */
+
+		saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00);
+		break;
 	}
 	return 0;
 }
diff --git a/drivers/media/video/saa7134/saa7134-reg.h b/drivers/media/video/saa7134/saa7134-reg.h
index ae0c7a1..fce4f18 100644
--- a/drivers/media/video/saa7134/saa7134-reg.h
+++ b/drivers/media/video/saa7134/saa7134-reg.h
@@ -348,6 +348,7 @@
 
 /* test modes */
 #define SAA7134_SPECIAL_MODE                    0x1d0
+#define SAA7134_PRODUCTION_TEST_MODE            0x1d1
 
 /* audio -- saa7133 + saa7135 only */
 #define SAA7135_DSP_RWSTATE                     0x580
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 35e5e85..d395403 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1666,6 +1666,7 @@
 	case VIDIOC_QUERYCAP:
 	{
 		struct v4l2_capability *cap = arg;
+		unsigned int tuner_type = dev->tuner_type;
 
 		memset(cap,0,sizeof(*cap));
                 strcpy(cap->driver, "saa7134");
@@ -1677,9 +1678,13 @@
 			V4L2_CAP_VIDEO_CAPTURE |
 			V4L2_CAP_VIDEO_OVERLAY |
 			V4L2_CAP_VBI_CAPTURE |
-			V4L2_CAP_TUNER |
 			V4L2_CAP_READWRITE |
-			V4L2_CAP_STREAMING;
+			V4L2_CAP_STREAMING |
+			V4L2_CAP_TUNER;
+
+		if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET))
+			cap->capabilities &= ~V4L2_CAP_TUNER;
+
 		return 0;
 	}
 
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 69a2ceb..ad8e89d 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -192,6 +192,8 @@
 #define SAA7134_BOARD_PHILIPS_EUROPA  69
 #define SAA7134_BOARD_VIDEOMATE_DVBT_300 70
 #define SAA7134_BOARD_VIDEOMATE_DVBT_200 71
+#define SAA7134_BOARD_RTD_VFG7350 72
+#define SAA7134_BOARD_RTD_VFG7330 73
 
 #define SAA7134_MAXBOARDS 8
 #define SAA7134_INPUT_MAX 8