public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Cc: Ross Cohen <rcohen@snurgle.org>, Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 18/23] Staging: go7007 v4l fixes
Date: Fri, 10 Oct 2008 15:42:42 -0700	[thread overview]
Message-ID: <1223678567-30143-18-git-send-email-greg@kroah.com> (raw)
In-Reply-To: <20081010224130.GA30117@kroah.com>

From: Ross Cohen <rcohen@snurgle.org>

Fix up some of the v4l issues that were recently changed to make the
go7007 driver a bit cleaner.


From: Ross Cohen <rcohen@snurgle.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/go7007/go7007-driver.c  |    2 +-
 drivers/staging/go7007/go7007-v4l2.c    |   12 ++++--------
 drivers/staging/go7007/snd-go7007.c     |    4 ++--
 drivers/staging/go7007/wis-ov7640.c     |    3 +--
 drivers/staging/go7007/wis-saa7113.c    |   25 ++++++++++---------------
 drivers/staging/go7007/wis-saa7115.c    |   29 ++++++++++++++---------------
 drivers/staging/go7007/wis-sony-tuner.c |    3 ++-
 drivers/staging/go7007/wis-tw2804.c     |   29 ++++++++++++++---------------
 drivers/staging/go7007/wis-tw9903.c     |   21 ++++++++++-----------
 drivers/staging/go7007/wis-uda1342.c    |    2 +-
 10 files changed, 59 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/go7007/go7007-driver.c b/drivers/staging/go7007/go7007-driver.c
index 5a336ff..81ae4b0 100644
--- a/drivers/staging/go7007/go7007-driver.c
+++ b/drivers/staging/go7007/go7007-driver.c
@@ -31,7 +31,7 @@
 #include <linux/semaphore.h>
 #include <linux/uaccess.h>
 #include <asm/system.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/tuner.h>
 #include <media/v4l2-common.h>
 
diff --git a/drivers/staging/go7007/go7007-v4l2.c b/drivers/staging/go7007/go7007-v4l2.c
index d54d019..94e1141 100644
--- a/drivers/staging/go7007/go7007-v4l2.c
+++ b/drivers/staging/go7007/go7007-v4l2.c
@@ -26,8 +26,7 @@
 #include <linux/time.h>
 #include <linux/vmalloc.h>
 #include <linux/pagemap.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
 #include <linux/i2c.h>
@@ -835,7 +834,6 @@ static int go7007_do_ioctl(struct inode *inode, struct file *file,
 	case VIDIOC_S_STD:
 	{
 		v4l2_std_id *std = arg;
-		int norm;
 
 		if (go->streaming)
 			return -EBUSY;
@@ -856,20 +854,17 @@ static int go7007_do_ioctl(struct inode *inode, struct file *file,
 		if (*std & V4L2_STD_NTSC) {
 			go->standard = GO7007_STD_NTSC;
 			go->sensor_framerate = 30000;
-			norm = VIDEO_MODE_NTSC;
 		} else if (*std & V4L2_STD_PAL) {
 			go->standard = GO7007_STD_PAL;
 			go->sensor_framerate = 25025;
-			norm = VIDEO_MODE_PAL;
 		} else if (*std & V4L2_STD_SECAM) {
 			go->standard = GO7007_STD_PAL;
 			go->sensor_framerate = 25025;
-			norm = VIDEO_MODE_SECAM;
 		} else
 			return -EINVAL;
 		if (go->i2c_adapter_online)
 			i2c_clients_command(&go->i2c_adapter,
-						DECODER_SET_NORM, &norm);
+					    VIDIOC_S_STD, std);
 		set_capture_size(go, NULL, 0);
 		return 0;
 	}
@@ -933,7 +928,7 @@ static int go7007_do_ioctl(struct inode *inode, struct file *file,
 			return -EBUSY;
 		go->input = *input;
 		if (go->i2c_adapter_online) {
-			i2c_clients_command(&go->i2c_adapter, DECODER_SET_INPUT,
+			i2c_clients_command(&go->i2c_adapter, VIDIOC_S_INPUT,
 				&go->board_info->inputs[*input].video_input);
 			i2c_clients_command(&go->i2c_adapter, VIDIOC_S_AUDIO,
 				&go->board_info->inputs[*input].audio_input);
@@ -1459,6 +1454,7 @@ static struct file_operations go7007_fops = {
 
 static struct video_device go7007_template = {
 	.name		= "go7007",
+	.vfl_type	= VID_TYPE_CAPTURE,
 	.fops		= &go7007_fops,
 	.minor		= -1,
 	.release	= go7007_vfl_release,
diff --git a/drivers/staging/go7007/snd-go7007.c b/drivers/staging/go7007/snd-go7007.c
index f5cac08..382740c 100644
--- a/drivers/staging/go7007/snd-go7007.c
+++ b/drivers/staging/go7007/snd-go7007.c
@@ -44,8 +44,8 @@ module_param_array(index, int, NULL, 0444);
 module_param_array(id, charp, NULL, 0444);
 module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for the go7007 audio driver");
-MODULE_PARM_DESC(index, "ID string for the go7007 audio driver");
-MODULE_PARM_DESC(index, "Enable for the go7007 audio driver");
+MODULE_PARM_DESC(id, "ID string for the go7007 audio driver");
+MODULE_PARM_DESC(enable, "Enable for the go7007 audio driver");
 
 struct go7007_snd {
 	struct snd_card *card;
diff --git a/drivers/staging/go7007/wis-ov7640.c b/drivers/staging/go7007/wis-ov7640.c
index 815615a..f5f11e9 100644
--- a/drivers/staging/go7007/wis-ov7640.c
+++ b/drivers/staging/go7007/wis-ov7640.c
@@ -19,8 +19,7 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 
 #include "wis-i2c.h"
 
diff --git a/drivers/staging/go7007/wis-saa7113.c b/drivers/staging/go7007/wis-saa7113.c
index 4b14ca8..c1aff1b 100644
--- a/drivers/staging/go7007/wis-saa7113.c
+++ b/drivers/staging/go7007/wis-saa7113.c
@@ -19,8 +19,7 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <linux/ioctl.h>
 
 #include "wis-i2c.h"
@@ -124,7 +123,7 @@ static int wis_saa7113_command(struct i2c_client *client,
 	struct wis_saa7113 *dec = i2c_get_clientdata(client);
 
 	switch (cmd) {
-	case DECODER_SET_INPUT:
+	case VIDIOC_S_INPUT:
 	{
 		int *input = arg;
 
@@ -133,23 +132,19 @@ static int wis_saa7113_command(struct i2c_client *client,
 				*input < 6 ? 0x40 : 0x80);
 		break;
 	}
-	case DECODER_SET_NORM:
+	case VIDIOC_S_STD:
 	{
-		int *input = arg;
+		v4l2_std_id *input = arg;
 		dec->norm = *input;
-		switch (dec->norm) {
-		case VIDEO_MODE_PAL:
-			write_reg(client, 0x0e, 0x01);
-			write_reg(client, 0x10, 0x48);
-			break;
-		case VIDEO_MODE_NTSC:
+		if (dec->norm & V4L2_STD_NTSC) {
 			write_reg(client, 0x0e, 0x01);
 			write_reg(client, 0x10, 0x40);
-			break;
-		case VIDEO_MODE_SECAM:
+		} else if (dec->norm & V4L2_STD_PAL) {
+			write_reg(client, 0x0e, 0x01);
+			write_reg(client, 0x10, 0x48);
+		} else if (dec->norm * V4L2_STD_SECAM) {
 			write_reg(client, 0x0e, 0x50);
 			write_reg(client, 0x10, 0x48);
-			break;
 		}
 		break;
 	}
@@ -295,7 +290,7 @@ static int wis_saa7113_detect(struct i2c_adapter *adapter, int addr, int kind)
 		kfree(client);
 		return -ENOMEM;
 	}
-	dec->norm = VIDEO_MODE_NTSC;
+	dec->norm = V4L2_STD_NTSC;
 	dec->brightness = 128;
 	dec->contrast = 71;
 	dec->saturation = 64;
diff --git a/drivers/staging/go7007/wis-saa7115.c b/drivers/staging/go7007/wis-saa7115.c
index bd40bf4..5c94c88 100644
--- a/drivers/staging/go7007/wis-saa7115.c
+++ b/drivers/staging/go7007/wis-saa7115.c
@@ -19,8 +19,7 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <linux/ioctl.h>
 
 #include "wis-i2c.h"
@@ -204,7 +203,7 @@ static int wis_saa7115_command(struct i2c_client *client,
 	struct wis_saa7115 *dec = i2c_get_clientdata(client);
 
 	switch (cmd) {
-	case DECODER_SET_INPUT:
+	case VIDIOC_S_INPUT:
 	{
 		int *input = arg;
 
@@ -222,7 +221,7 @@ static int wis_saa7115_command(struct i2c_client *client,
 		int h_scaling_increment = (704 / h_integer_scaler) *
 					1024 / res->width;
 		/* Fine-grained scaler only */
-		int v_scaling_increment = (dec->norm == VIDEO_MODE_NTSC ?
+		int v_scaling_increment = (dec->norm & V4L2_STD_NTSC ?
 				240 : 288) * 1024 / res->height;
 		u8 regs[] = {
 			0x88,	0xc0,
@@ -262,20 +261,20 @@ static int wis_saa7115_command(struct i2c_client *client,
 		write_regs(client, regs);
 		break;
 	}
-	case DECODER_SET_NORM:
+	case VIDIOC_S_STD:
 	{
-		int *input = arg;
+		v4l2_std_id *input = arg;
 		u8 regs[] = {
 			0x88,	0xc0,
-			0x98,	*input == VIDEO_MODE_NTSC ? 0x12 : 0x16,
-			0x9a,	*input == VIDEO_MODE_NTSC ? 0xf2 : 0x20,
-			0x9b,	*input == VIDEO_MODE_NTSC ? 0x00 : 0x01,
-			0xc8,	*input == VIDEO_MODE_NTSC ? 0x12 : 0x16,
-			0xca,	*input == VIDEO_MODE_NTSC ? 0xf2 : 0x20,
-			0xcb,	*input == VIDEO_MODE_NTSC ? 0x00 : 0x01,
+			0x98,	*input & V4L2_STD_NTSC ? 0x12 : 0x16,
+			0x9a,	*input & V4L2_STD_NTSC ? 0xf2 : 0x20,
+			0x9b,	*input & V4L2_STD_NTSC ? 0x00 : 0x01,
+			0xc8,	*input & V4L2_STD_NTSC ? 0x12 : 0x16,
+			0xca,	*input & V4L2_STD_NTSC ? 0xf2 : 0x20,
+			0xcb,	*input & V4L2_STD_NTSC ? 0x00 : 0x01,
 			0x88,	0xf0,
-			0x30,	*input == VIDEO_MODE_NTSC ? 0x66 : 0x00,
-			0x31,	*input == VIDEO_MODE_NTSC ? 0x90 : 0xe0,
+			0x30,	*input & V4L2_STD_NTSC ? 0x66 : 0x00,
+			0x31,	*input & V4L2_STD_NTSC ? 0x90 : 0xe0,
 			0,	0,
 		};
 		write_regs(client, regs);
@@ -424,7 +423,7 @@ static int wis_saa7115_detect(struct i2c_adapter *adapter, int addr, int kind)
 		kfree(client);
 		return -ENOMEM;
 	}
-	dec->norm = VIDEO_MODE_NTSC;
+	dec->norm = V4L2_STD_NTSC;
 	dec->brightness = 128;
 	dec->contrast = 64;
 	dec->saturation = 64;
diff --git a/drivers/staging/go7007/wis-sony-tuner.c b/drivers/staging/go7007/wis-sony-tuner.c
index 82e66d6..5997fb4 100644
--- a/drivers/staging/go7007/wis-sony-tuner.c
+++ b/drivers/staging/go7007/wis-sony-tuner.c
@@ -19,9 +19,10 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/tuner.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 
 #include "wis-i2c.h"
 
diff --git a/drivers/staging/go7007/wis-tw2804.c b/drivers/staging/go7007/wis-tw2804.c
index 69ed7bf..27fe4d0 100644
--- a/drivers/staging/go7007/wis-tw2804.c
+++ b/drivers/staging/go7007/wis-tw2804.c
@@ -19,8 +19,7 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <linux/ioctl.h>
 
 #include "wis-i2c.h"
@@ -159,20 +158,20 @@ static int wis_tw2804_command(struct i2c_client *client,
 	}
 
 	switch (cmd) {
-	case DECODER_SET_NORM:
+	case VIDIOC_S_STD:
 	{
-		int *input = arg;
+		v4l2_std_id *input = arg;
 		u8 regs[] = {
-			0x01, *input == VIDEO_MODE_NTSC ? 0xc4 : 0x84,
-			0x09, *input == VIDEO_MODE_NTSC ? 0x07 : 0x04,
-			0x0a, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
-			0x0b, *input == VIDEO_MODE_NTSC ? 0x07 : 0x04,
-			0x0c, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
-			0x0d, *input == VIDEO_MODE_NTSC ? 0x40 : 0x4a,
-			0x16, *input == VIDEO_MODE_NTSC ? 0x00 : 0x40,
-			0x17, *input == VIDEO_MODE_NTSC ? 0x00 : 0x40,
-			0x20, *input == VIDEO_MODE_NTSC ? 0x07 : 0x0f,
-			0x21, *input == VIDEO_MODE_NTSC ? 0x07 : 0x0f,
+			0x01, *input & V4L2_STD_NTSC ? 0xc4 : 0x84,
+			0x09, *input & V4L2_STD_NTSC ? 0x07 : 0x04,
+			0x0a, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
+			0x0b, *input & V4L2_STD_NTSC ? 0x07 : 0x04,
+			0x0c, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
+			0x0d, *input & V4L2_STD_NTSC ? 0x40 : 0x4a,
+			0x16, *input & V4L2_STD_NTSC ? 0x00 : 0x40,
+			0x17, *input & V4L2_STD_NTSC ? 0x00 : 0x40,
+			0x20, *input & V4L2_STD_NTSC ? 0x07 : 0x0f,
+			0x21, *input & V4L2_STD_NTSC ? 0x07 : 0x0f,
 			0xff,	0xff,
 		};
 		write_regs(client, regs, dec->channel);
@@ -322,7 +321,7 @@ static int wis_tw2804_detect(struct i2c_adapter *adapter, int addr, int kind)
 		return -ENOMEM;
 	}
 	dec->channel = -1;
-	dec->norm = VIDEO_MODE_NTSC;
+	dec->norm = V4L2_STD_NTSC;
 	dec->brightness = 128;
 	dec->contrast = 128;
 	dec->saturation = 128;
diff --git a/drivers/staging/go7007/wis-tw9903.c b/drivers/staging/go7007/wis-tw9903.c
index 1cdf01a..d8e4196 100644
--- a/drivers/staging/go7007/wis-tw9903.c
+++ b/drivers/staging/go7007/wis-tw9903.c
@@ -19,8 +19,7 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <linux/ioctl.h>
 
 #include "wis-i2c.h"
@@ -106,7 +105,7 @@ static int wis_tw9903_command(struct i2c_client *client,
 	struct wis_tw9903 *dec = i2c_get_clientdata(client);
 
 	switch (cmd) {
-	case DECODER_SET_INPUT:
+	case VIDIOC_S_INPUT:
 	{
 		int *input = arg;
 
@@ -119,7 +118,7 @@ static int wis_tw9903_command(struct i2c_client *client,
 		struct video_decoder_resolution *res = arg;
 		/*int hscale = 256 * 720 / res->width;*/
 		int hscale = 256 * 720 / (res->width - (res->width > 704 ? 0 : 8));
-		int vscale = 256 * (dec->norm == VIDEO_MODE_NTSC ?  240 : 288)
+		int vscale = 256 * (dec->norm & V4L2_STD_NTSC ?  240 : 288)
 				/ res->height;
 		u8 regs[] = {
 			0x0d, vscale & 0xff,
@@ -134,14 +133,14 @@ static int wis_tw9903_command(struct i2c_client *client,
 		break;
 	}
 #endif
-	case DECODER_SET_NORM:
+	case VIDIOC_S_STD:
 	{
-		int *input = arg;
+		v4l2_std_id *input = arg;
 		u8 regs[] = {
-			0x05, *input == VIDEO_MODE_NTSC ? 0x80 : 0x00,
-			0x07, *input == VIDEO_MODE_NTSC ? 0x02 : 0x12,
-			0x08, *input == VIDEO_MODE_NTSC ? 0x14 : 0x18,
-			0x09, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
+			0x05, *input & V4L2_STD_NTSC ? 0x80 : 0x00,
+			0x07, *input & V4L2_STD_NTSC ? 0x02 : 0x12,
+			0x08, *input & V4L2_STD_NTSC ? 0x14 : 0x18,
+			0x09, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
 			0,	0,
 		};
 		write_regs(client, regs);
@@ -297,7 +296,7 @@ static int wis_tw9903_detect(struct i2c_adapter *adapter, int addr, int kind)
 		kfree(client);
 		return -ENOMEM;
 	}
-	dec->norm = VIDEO_MODE_NTSC;
+	dec->norm = V4L2_STD_NTSC;
 	dec->brightness = 0;
 	dec->contrast = 0x60;
 	dec->hue = 0;
diff --git a/drivers/staging/go7007/wis-uda1342.c b/drivers/staging/go7007/wis-uda1342.c
index 28c10bf..a0894e3 100644
--- a/drivers/staging/go7007/wis-uda1342.c
+++ b/drivers/staging/go7007/wis-uda1342.c
@@ -19,7 +19,7 @@
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/tvaudio.h>
 #include <media/v4l2-common.h>
 
-- 
1.6.0.2


  parent reply	other threads:[~2008-10-10 22:59 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-10 22:41 [GIT PATCH] STAGING patches for 2.6.28 Greg KH
2008-10-10 22:42 ` [PATCH 01/23] Staging: add TAINT_CRAP for all drivers/staging code Greg KH
2008-10-10 22:42 ` [PATCH 02/23] Staging: add TAINT_CRAP flag to drivers/staging modules Greg KH
2008-10-10 22:42 ` [PATCH 03/23] Staging: add Kconfig entries and Makefile infrastructure Greg KH
2008-10-10 22:42 ` [PATCH 04/23] Staging: add MAINTAINERS entry Greg KH
2008-10-10 22:42 ` [PATCH 05/23] Staging: add et131x network driver Greg KH
2008-10-10 22:42 ` [PATCH 09/23] Staging: add me4000 pci data collection driver Greg KH
2008-10-15  8:41   ` Andrew Morton
2008-10-10 22:42 ` [PATCH 10/23] Staging: add the go7007 video driver Greg KH
2008-10-10 22:42 ` [PATCH 11/23] Staging: USB/IP: add common functions needed Greg KH
2008-10-10 22:42 ` [PATCH 12/23] Staging: USB/IP: add client driver Greg KH
2008-10-10 22:42 ` [PATCH 13/23] Staging: USB/IP: add host driver Greg KH
2008-10-10 22:42 ` [PATCH 14/23] Staging: add w35und wifi driver Greg KH
2008-10-18 20:55   ` Geert Uytterhoeven
2008-10-10 22:42 ` [PATCH 16/23] Staging: add echo cancelation module Greg KH
2008-10-10 23:08   ` Mike Frysinger
2008-10-10 23:12     ` Greg KH
2008-10-11  6:33   ` Tzafrir Cohen
2008-10-11 15:39     ` Greg KH
2008-10-11 15:39     ` Greg KH
2008-10-10 22:42 ` [PATCH 17/23] Staging: Fix gcc warnings in sxg Greg KH
2008-10-10 22:42 ` Greg KH [this message]
2008-10-10 22:42 ` [PATCH 19/23] Staging: SLICOSS: lots of checkpatch fixes Greg KH
2008-10-10 22:42 ` [PATCH 20/23] Staging: SLICOSS: Fix warnings due to static usage Greg KH
2008-10-10 22:42 ` [PATCH 21/23] Staging: SLICOSS: Fix remaining type names Greg KH
2008-10-10 22:42 ` [PATCH 22/23] Staging: SLICOSS: Call pci_release_regions at driver exit Greg KH
2008-10-10 22:42 ` [PATCH 23/23] Staging: Lindent sxg.c Greg KH
2008-10-13 21:36 ` [GIT PATCH] STAGING patches for 2.6.28 Greg KH
2008-10-13 21:38   ` [PATCH 24/25] Staging: workaround build system bug Greg KH
2008-10-13 21:38   ` [PATCH 25/25] staging: at76_usb wireless driver Greg KH
2008-10-13 21:49     ` Pavel Roskin
2008-10-13 21:51       ` Greg KH
2008-10-13 21:58         ` Pavel Roskin
2008-10-13 22:06           ` Greg KH
2008-10-17 20:34   ` [GIT PATCH] STAGING patches for 2.6.28 Linus Torvalds
2008-10-17 21:38     ` Greg KH
2008-10-17 22:00       ` 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=1223678567-30143-18-git-send-email-greg@kroah.com \
    --to=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rcohen@snurgle.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