LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: Re: [PATCH] I2C update for 2.6.6
Date: Fri, 14 May 2004 16:29:18 -0700	[thread overview]
Message-ID: <10845773583580@kroah.com> (raw)
In-Reply-To: <10845773582979@kroah.com>

ChangeSet 1.1587.15.14, 2004/05/11 13:45:12-07:00, R.S.Bultje@students.uu.nl

[PATCH] I2C: new i2c video decoder calls: saa7111 driver

Attached patch implements the i2c calls in the saa7111 driver.

The driver is still compatible with old behaviour, so the zr36067 driver
(the original user of the saa7111 module) doesn't need any changes.  I'll
probably gradually make everything use DECODER_INIT instead of 0 (that was
a nice hack back then) somewhere later.

Can I just remove '0' later on? Or are there official ABI rules for
stable kernel versions?


 drivers/media/video/saa7111.c |   59 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 54 insertions(+), 5 deletions(-)


diff -Nru a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
--- a/drivers/media/video/saa7111.c	Fri May 14 16:19:12 2004
+++ b/drivers/media/video/saa7111.c	Fri May 14 16:19:12 2004
@@ -9,6 +9,9 @@
  * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net>
  *    - moved over to linux>=2.4.x i2c protocol (1/1/2003)
  *
+ * Changes by Michael Hunold <michael@mihu.de>
+ *    - implemented DECODER_SET_GPIO, DECODER_INIT, DECODER_SET_VBI_BYPASS
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -112,7 +115,7 @@
 		u8 block_data[32];
 
 		msg.addr = client->addr;
-		msg.flags = client->flags;
+		msg.flags = 0;
 		while (len >= 2) {
 			msg.buf = (char *) block_data;
 			msg.len = 0;
@@ -142,6 +145,13 @@
 	return ret;
 }
 
+static int
+saa7111_init_decoder (struct i2c_client *client,
+	      struct video_decoder_init *init)
+{
+	return saa7111_write_block(client, init->data, init->len);
+}
+
 static inline int
 saa7111_read (struct i2c_client *client,
 	      u8                 reg)
@@ -151,7 +161,7 @@
 
 /* ----------------------------------------------------------------------- */
 
-static const unsigned char init[] = {
+static const unsigned char saa7111_i2c_init[] = {
 	0x00, 0x00,		/* 00 - ID byte */
 	0x01, 0x00,		/* 01 - reserved */
 
@@ -201,8 +211,18 @@
 	switch (cmd) {
 
 	case 0:
-		//saa7111_write_block(client, init, sizeof(init));
-		break;
+	case DECODER_INIT:
+	{
+		struct video_decoder_init *init = arg;
+		if (NULL != init)
+			return saa7111_init_decoder(client, init);
+		else {
+			struct video_decoder_init vdi;
+			vdi.data = saa7111_i2c_init;
+			vdi.len = sizeof(saa7111_i2c_init);
+			return saa7111_init_decoder(client, &vdi);
+		}
+	}
 
 	case DECODER_DUMP:
 	{
@@ -274,6 +294,32 @@
 	}
 		break;
 
+	case DECODER_SET_GPIO:
+	{
+		int *iarg = arg;
+		if (0 != *iarg) {
+			saa7111_write(client, 0x11,
+				(decoder->reg[0x11] | 0x80));
+		} else {
+			saa7111_write(client, 0x11,
+				(decoder->reg[0x11] & 0x7f));
+		}
+		break;
+	}
+
+	case DECODER_SET_VBI_BYPASS:
+	{
+		int *iarg = arg;
+		if (0 != *iarg) {
+			saa7111_write(client, 0x13,
+				(decoder->reg[0x13] & 0xf0) | 0x0a);
+		} else {
+			saa7111_write(client, 0x13,
+				(decoder->reg[0x13] & 0xf0));
+		}
+		break;
+	}
+
 	case DECODER_SET_NORM:
 	{
 		int *iarg = arg;
@@ -465,6 +511,7 @@
 	int i;
 	struct i2c_client *client;
 	struct saa7111 *decoder;
+	struct video_decoder_init vdi;
 
 	dprintk(1,
 		KERN_INFO
@@ -509,7 +556,9 @@
 		return i;
 	}
 
-	i = saa7111_write_block(client, init, sizeof(init));
+	vdi.data = saa7111_i2c_init;
+	vdi.len = sizeof(saa7111_i2c_init);
+	i = saa7111_init_decoder(client, &vdi);
 	if (i < 0) {
 		dprintk(1, KERN_ERR "%s_attach error: init status %d\n",
 			I2C_NAME(client), i);


  reply	other threads:[~2004-05-14 23:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-14 23:27 [BK PATCH] " Greg KH
2004-05-14 23:29 ` [PATCH] " Greg KH
2004-05-14 23:29   ` Greg KH
2004-05-14 23:29     ` Greg KH
2004-05-14 23:29       ` Greg KH
2004-05-14 23:29         ` Greg KH
2004-05-14 23:29           ` Greg KH
2004-05-14 23:29             ` Greg KH
2004-05-14 23:29               ` Greg KH
2004-05-14 23:29                 ` Greg KH
2004-05-14 23:29                   ` Greg KH
2004-05-14 23:29                     ` Greg KH
2004-05-14 23:29                       ` Greg KH
2004-05-14 23:29                         ` Greg KH
2004-05-14 23:29                           ` Greg KH [this message]
2004-05-14 23:29                             ` Greg KH
2004-05-14 23:29                               ` Greg KH
2004-05-14 23:29                                 ` Greg KH
2004-05-14 23:29                                   ` Greg KH

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=10845773583580@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@stimpy.netroedge.com \
    --subject='Re: [PATCH] I2C update for 2.6.6' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).