public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Ruckstuhl <patrick@tario.org>
To: linux-media@vger.kernel.org
Subject: [PATCH] trying to add PAL support to SAA7164
Date: Fri, 23 Sep 2011 21:08:34 +0200	[thread overview]
Message-ID: <20110923190834.GA1263@dagobah> (raw)

[-- Attachment #1: pal patch for saa7164 --]
[-- Type: text/plain, Size: 646 bytes --]

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

[-- Attachment #2: pal.patch --]
[-- Type: text/x-diff, Size: 4188 bytes --]

diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c
index 8a98ab6..8142d0f 100644
--- a/drivers/media/video/saa7164/saa7164-api.c
+++ b/drivers/media/video/saa7164/saa7164-api.c
@@ -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;
diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c
index 2fd38a0..390fa58 100644
--- a/drivers/media/video/saa7164/saa7164-encoder.c
+++ b/drivers/media/video/saa7164/saa7164-encoder.c
@@ -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;
diff --git a/drivers/media/video/saa7164/saa7164-reg.h b/drivers/media/video/saa7164/saa7164-reg.h
index 2bbf815..b95aeaf 100644
--- a/drivers/media/video/saa7164/saa7164-reg.h
+++ b/drivers/media/video/saa7164/saa7164-reg.h
@@ -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
 
diff --git a/drivers/media/video/saa7164/saa7164-vbi.c b/drivers/media/video/saa7164/saa7164-vbi.c
index e2e0341..7c40efa 100644
--- a/drivers/media/video/saa7164/saa7164-vbi.c
+++ b/drivers/media/video/saa7164/saa7164-vbi.c
@@ -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[] = {
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
index 742b341..adf8baf 100644
--- a/drivers/media/video/saa7164/saa7164.h
+++ b/drivers/media/video/saa7164/saa7164.h
@@ -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,

                 reply	other threads:[~2011-09-23 19:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110923190834.GA1263@dagobah \
    --to=patrick@tario.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox