Skip to contentSkip to conversation

trying to add PAL support to SAA7164

PATCH New Patrick Ruckstuhl 1 participant 1 message Sep 23, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trying to add PAL support to SAA7164

Hello,

I have a saa7164 card and am using it with PAL.
To get this working I started from the patch by Julian Scheel

http://www.spinics.net/lists/linux-media/msg27603.html

I saw that some of the changes (added supported device) were already in the repository. I also tried to clean up the rest of the changes a bit but I'm a complete v4l/kernel coding beginner.

The patch applies to the current HEAD but is not yet usable as it initializes the card to PAL per default.

Is there anyone that could help me with getting this thing in a good state so that it could be added into the repository for others to use it?

Thanks and Regards,
Patrick

drivers/media/video/saa7164/saa7164-api.c +1 -1
index 8a98ab6..8142d0f 100644
@@ -631,7 +631,7 @@ int saa7164_api_set_dif(struct saa7164_port *port, u8 reg, u8 val)
 	dprintk(DBGLVL_API, "%s(nr=%d type=%d val=%x)\n", __func__,
 		port->nr, port->type, val);
 
-	if (port->nr == 0)
+	if (port->nr < 3)
 		mas = 0xd0;
 	else
 		mas = 0xe0;
drivers/media/video/saa7164/saa7164-encoder.c +21 -3
index 2fd38a0..390fa58 100644
@@ -32,7 +32,25 @@ static struct saa7164_tvnorm saa7164_tvnorms[] = {
 	}, {
 		.name      = "NTSC-JP",
 		.id        = V4L2_STD_NTSC_M_JP,
-	}
+	}, {
+                .name      = "PAL-I",
+                .id        = V4L2_STD_PAL_I,
+	}, {
+                .name      = "PAL-M",
+                .id        = V4L2_STD_PAL_M,
+	}, {
+                .name      = "PAL-N",
+                .id        = V4L2_STD_PAL_N,
+	}, {
+                .name      = "PAL-Nc",
+                .id        = V4L2_STD_PAL_Nc,
+	}, {
+                .name      = "PAL-B",
+                .id        = V4L2_STD_PAL_B,
+	}, {
+                .name      = "PAL-DK",
+                .id        = V4L2_STD_PAL_DK,
+        }
 };
 
 static const u32 saa7164_v4l2_ctrls[] = {
@@ -1362,7 +1380,7 @@ static struct video_device saa7164_mpeg_template = {
 	.ioctl_ops     = &mpeg_ioctl_ops,
 	.minor         = -1,
 	.tvnorms       = SAA7164_NORMS,
-	.current_norm  = V4L2_STD_NTSC_M,
+	.current_norm  = V4L2_STD_PAL_B,
 };
 
 static struct video_device *saa7164_encoder_alloc(
@@ -1410,7 +1428,7 @@ int saa7164_encoder_register(struct saa7164_port *port)
 
 	/* Establish encoder defaults here */
 	/* Set default TV standard */
-	port->encodernorm = saa7164_tvnorms[0];
+	port->encodernorm = saa7164_tvnorms[6];
 	port->width = 720;
 	port->mux_input = 1; /* Composite */
 	port->video_format = EU_VIDEO_FORMAT_MPEG_2;
drivers/media/video/saa7164/saa7164-reg.h +1 -1
index 2bbf815..b95aeaf 100644
@@ -181,7 +181,7 @@
 #define TU_STANDARD_AUTO_CONTROL	0x01
 #define TU_STANDARD_NONE		0x00
 #define TU_STANDARD_NTSC_M		0x01
-#define TU_STANDARD_PAL_I		0x08
+#define TU_STANDARD_PAL_I		0x04
 #define TU_STANDARD_MANUAL		0x00
 #define TU_STANDARD_AUTO		0x01
 
drivers/media/video/saa7164/saa7164-vbi.c +19 -1
index e2e0341..7c40efa 100644
@@ -28,7 +28,25 @@ static struct saa7164_tvnorm saa7164_tvnorms[] = {
 	}, {
 		.name      = "NTSC-JP",
 		.id        = V4L2_STD_NTSC_M_JP,
-	}
+	}, {
+                .name      = "PAL-I",
+                .id        = V4L2_STD_PAL_I,
+        }, {
+                .name      = "PAL-M",
+                .id        = V4L2_STD_PAL_M,
+        }, {
+                .name      = "PAL-N",
+                .id        = V4L2_STD_PAL_N,
+        }, {
+                .name      = "PAL-Nc",
+                .id        = V4L2_STD_PAL_Nc,
+        }, {
+                .name      = "PAL-B",
+                .id        = V4L2_STD_PAL_B,
+        }, {
+                .name      = "PAL-DK",
+                .id        = V4L2_STD_PAL_DK,
+        }
 };
 
 static const u32 saa7164_v4l2_ctrls[] = {
drivers/media/video/saa7164/saa7164.h +1 -1
index 742b341..adf8baf 100644
@@ -115,7 +115,7 @@
 #define DBGLVL_CPU 8192
 
 #define SAA7164_NORMS \
-	(V4L2_STD_NTSC_M |  V4L2_STD_NTSC_M_JP |  V4L2_STD_NTSC_443)
+	(V4L2_STD_NTSC_M |  V4L2_STD_NTSC_M_JP |  V4L2_STD_NTSC_443 | V4L2_STD_PAL_I | V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | V4L2_STD_PAL_B | V4L2_STD_PAL_DK)
 
 enum port_t {
 	SAA7164_MPEG_UNDEFINED = 0,