[PATCH] v4l: 719: implement some differences in video output port
authorRobert W. Boone <rboone@rtd.com>
Wed, 9 Nov 2005 05:37:10 +0000 (21:37 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 9 Nov 2005 15:56:15 +0000 (07:56 -0800)
- Implement some differences in video output port

Signed-off-by: Robert W. Boone <rboone@rtd.com>
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>
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/saa7134/saa7134.h

index 7278150..3a4c59e 100644 (file)
@@ -2285,6 +2285,10 @@ struct saa7134_board saa7134_boards[] = {
                }},
                .mpeg           = SAA7134_MPEG_EMPRESS,
                .video_out      = CCIR656,
+               .vid_port_opts  = ( SET_T_CODE_POLARITY_NON_INVERTED |
+                                   SET_CLOCK_NOT_DELAYED |
+                                   SET_CLOCK_INVERTED |
+                                   SET_VSYNC_OFF ),
        },
        [SAA7134_BOARD_RTD_VFG7330] = {
                .name           = "RTD Embedded Technologies VFG7330",
index cd1f70f..cd5545b 100644 (file)
@@ -48,6 +48,43 @@ MODULE_PARM_DESC(noninterlaced,"video input is noninterlaced");
        printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg)
 
 /* ------------------------------------------------------------------ */
+/* Defines for Video Output Port Register at address 0x191            */
+
+/* Bit 0: VIP code T bit polarity */
+
+#define VP_T_CODE_P_NON_INVERTED       0x00
+#define VP_T_CODE_P_INVERTED           0x01
+
+/* ------------------------------------------------------------------ */
+/* Defines for Video Output Port Register at address 0x195            */
+
+/* Bit 2: Video output clock delay control */
+
+#define VP_CLK_CTRL2_NOT_DELAYED       0x00
+#define VP_CLK_CTRL2_DELAYED           0x04
+
+/* Bit 1: Video output clock invert control */
+
+#define VP_CLK_CTRL1_NON_INVERTED      0x00
+#define VP_CLK_CTRL1_INVERTED          0x02
+
+/* ------------------------------------------------------------------ */
+/* Defines for Video Output Port Register at address 0x196            */
+
+/* Bits 2 to 0: VSYNC pin video vertical sync type */
+
+#define VP_VS_TYPE_MASK                        0x07
+
+#define VP_VS_TYPE_OFF                 0x00
+#define VP_VS_TYPE_V123                        0x01
+#define VP_VS_TYPE_V_ITU               0x02
+#define VP_VS_TYPE_VGATE_L             0x03
+#define VP_VS_TYPE_RESERVED1           0x04
+#define VP_VS_TYPE_RESERVED2           0x05
+#define VP_VS_TYPE_F_ITU               0x06
+#define VP_VS_TYPE_SC_FID              0x07
+
+/* ------------------------------------------------------------------ */
 /* data structs for video                                             */
 
 static int video_out[][9] = {
@@ -2294,13 +2331,28 @@ int saa7134_video_init1(struct saa7134_dev *dev)
        if (saa7134_boards[dev->board].video_out) {
                /* enable video output */
                int vo = saa7134_boards[dev->board].video_out;
+               int video_reg;
+               unsigned int vid_port_opts = saa7134_boards[dev->board].vid_port_opts;
                saa_writeb(SAA7134_VIDEO_PORT_CTRL0, video_out[vo][0]);
-               saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_out[vo][1]);
+               video_reg = video_out[vo][1];
+               if (vid_port_opts & SET_T_CODE_POLARITY_NON_INVERTED)
+                       video_reg &= ~VP_T_CODE_P_INVERTED;
+               saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_reg);
                saa_writeb(SAA7134_VIDEO_PORT_CTRL2, video_out[vo][2]);
                saa_writeb(SAA7134_VIDEO_PORT_CTRL3, video_out[vo][3]);
                saa_writeb(SAA7134_VIDEO_PORT_CTRL4, video_out[vo][4]);
-               saa_writeb(SAA7134_VIDEO_PORT_CTRL5, video_out[vo][5]);
-               saa_writeb(SAA7134_VIDEO_PORT_CTRL6, video_out[vo][6]);
+               video_reg = video_out[vo][5];
+               if (vid_port_opts & SET_CLOCK_NOT_DELAYED)
+                       video_reg &= ~VP_CLK_CTRL2_DELAYED;
+               if (vid_port_opts & SET_CLOCK_INVERTED)
+                       video_reg |= VP_CLK_CTRL1_INVERTED;
+               saa_writeb(SAA7134_VIDEO_PORT_CTRL5, video_reg);
+               video_reg = video_out[vo][6];
+               if (vid_port_opts & SET_VSYNC_OFF) {
+                       video_reg &= ~VP_VS_TYPE_MASK;
+                       video_reg |= VP_VS_TYPE_OFF;
+               }
+               saa_writeb(SAA7134_VIDEO_PORT_CTRL6, video_reg);
                saa_writeb(SAA7134_VIDEO_PORT_CTRL7, video_out[vo][7]);
                saa_writeb(SAA7134_VIDEO_PORT_CTRL8, video_out[vo][8]);
        }
index e907d86..9dfd45b 100644 (file)
@@ -199,6 +199,14 @@ struct saa7134_format {
 #define SAA7134_MAXBOARDS 8
 #define SAA7134_INPUT_MAX 8
 
+/* ----------------------------------------------------------- */
+/* Video Output Port Register Initialization Options           */
+
+#define SET_T_CODE_POLARITY_NON_INVERTED       (1 << 0)
+#define SET_CLOCK_NOT_DELAYED                  (1 << 1)
+#define SET_CLOCK_INVERTED                     (1 << 2)
+#define SET_VSYNC_OFF                          (1 << 3)
+
 struct saa7134_input {
        char                    *name;
        unsigned int            vmux;
@@ -234,6 +242,7 @@ struct saa7134_board {
        /* peripheral I/O */
        enum saa7134_video_out  video_out;
        enum saa7134_mpeg_type  mpeg;
+       unsigned int            vid_port_opts;
 };
 
 #define card_has_radio(dev)   (NULL != saa7134_boards[dev->board].radio.name)