1 From df20d69ec968b33526461457c219ad4ba8ba8ac8 Mon Sep 17 00:00:00 2001
2 From: Ross Cohen <rcohen@snurgle.org>
3 Date: Mon, 29 Sep 2008 22:36:24 -0400
4 Subject: [PATCH 18/23] Staging: go7007 v4l fixes
7 Fix up some of the v4l issues that were recently changed to make the
8 go7007 driver a bit cleaner.
11 From: Ross Cohen <rcohen@snurgle.org>
12 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 drivers/staging/go7007/go7007-driver.c | 2 +-
15 drivers/staging/go7007/go7007-v4l2.c | 12 ++++--------
16 drivers/staging/go7007/snd-go7007.c | 4 ++--
17 drivers/staging/go7007/wis-ov7640.c | 3 +--
18 drivers/staging/go7007/wis-saa7113.c | 25 ++++++++++---------------
19 drivers/staging/go7007/wis-saa7115.c | 29 ++++++++++++++---------------
20 drivers/staging/go7007/wis-sony-tuner.c | 3 ++-
21 drivers/staging/go7007/wis-tw2804.c | 29 ++++++++++++++---------------
22 drivers/staging/go7007/wis-tw9903.c | 21 ++++++++++-----------
23 drivers/staging/go7007/wis-uda1342.c | 2 +-
24 10 files changed, 59 insertions(+), 71 deletions(-)
26 diff --git a/drivers/staging/go7007/go7007-driver.c b/drivers/staging/go7007/go7007-driver.c
27 index 5a336ff..81ae4b0 100644
28 --- a/drivers/staging/go7007/go7007-driver.c
29 +++ b/drivers/staging/go7007/go7007-driver.c
31 #include <linux/semaphore.h>
32 #include <linux/uaccess.h>
33 #include <asm/system.h>
34 -#include <linux/videodev.h>
35 +#include <linux/videodev2.h>
36 #include <media/tuner.h>
37 #include <media/v4l2-common.h>
39 diff --git a/drivers/staging/go7007/go7007-v4l2.c b/drivers/staging/go7007/go7007-v4l2.c
40 index d54d019..94e1141 100644
41 --- a/drivers/staging/go7007/go7007-v4l2.c
42 +++ b/drivers/staging/go7007/go7007-v4l2.c
44 #include <linux/time.h>
45 #include <linux/vmalloc.h>
46 #include <linux/pagemap.h>
47 -#include <linux/videodev.h>
48 -#include <linux/video_decoder.h>
49 +#include <linux/videodev2.h>
50 #include <media/v4l2-common.h>
51 #include <media/v4l2-ioctl.h>
52 #include <linux/i2c.h>
53 @@ -835,7 +834,6 @@ static int go7007_do_ioctl(struct inode *inode, struct file *file,
56 v4l2_std_id *std = arg;
61 @@ -856,20 +854,17 @@ static int go7007_do_ioctl(struct inode *inode, struct file *file,
62 if (*std & V4L2_STD_NTSC) {
63 go->standard = GO7007_STD_NTSC;
64 go->sensor_framerate = 30000;
65 - norm = VIDEO_MODE_NTSC;
66 } else if (*std & V4L2_STD_PAL) {
67 go->standard = GO7007_STD_PAL;
68 go->sensor_framerate = 25025;
69 - norm = VIDEO_MODE_PAL;
70 } else if (*std & V4L2_STD_SECAM) {
71 go->standard = GO7007_STD_PAL;
72 go->sensor_framerate = 25025;
73 - norm = VIDEO_MODE_SECAM;
76 if (go->i2c_adapter_online)
77 i2c_clients_command(&go->i2c_adapter,
78 - DECODER_SET_NORM, &norm);
80 set_capture_size(go, NULL, 0);
83 @@ -933,7 +928,7 @@ static int go7007_do_ioctl(struct inode *inode, struct file *file,
86 if (go->i2c_adapter_online) {
87 - i2c_clients_command(&go->i2c_adapter, DECODER_SET_INPUT,
88 + i2c_clients_command(&go->i2c_adapter, VIDIOC_S_INPUT,
89 &go->board_info->inputs[*input].video_input);
90 i2c_clients_command(&go->i2c_adapter, VIDIOC_S_AUDIO,
91 &go->board_info->inputs[*input].audio_input);
92 @@ -1459,6 +1454,7 @@ static struct file_operations go7007_fops = {
94 static struct video_device go7007_template = {
96 + .vfl_type = VID_TYPE_CAPTURE,
99 .release = go7007_vfl_release,
100 diff --git a/drivers/staging/go7007/snd-go7007.c b/drivers/staging/go7007/snd-go7007.c
101 index f5cac08..382740c 100644
102 --- a/drivers/staging/go7007/snd-go7007.c
103 +++ b/drivers/staging/go7007/snd-go7007.c
104 @@ -44,8 +44,8 @@ module_param_array(index, int, NULL, 0444);
105 module_param_array(id, charp, NULL, 0444);
106 module_param_array(enable, bool, NULL, 0444);
107 MODULE_PARM_DESC(index, "Index value for the go7007 audio driver");
108 -MODULE_PARM_DESC(index, "ID string for the go7007 audio driver");
109 -MODULE_PARM_DESC(index, "Enable for the go7007 audio driver");
110 +MODULE_PARM_DESC(id, "ID string for the go7007 audio driver");
111 +MODULE_PARM_DESC(enable, "Enable for the go7007 audio driver");
114 struct snd_card *card;
115 diff --git a/drivers/staging/go7007/wis-ov7640.c b/drivers/staging/go7007/wis-ov7640.c
116 index 815615a..f5f11e9 100644
117 --- a/drivers/staging/go7007/wis-ov7640.c
118 +++ b/drivers/staging/go7007/wis-ov7640.c
120 #include <linux/init.h>
121 #include <linux/version.h>
122 #include <linux/i2c.h>
123 -#include <linux/videodev.h>
124 -#include <linux/video_decoder.h>
125 +#include <linux/videodev2.h>
129 diff --git a/drivers/staging/go7007/wis-saa7113.c b/drivers/staging/go7007/wis-saa7113.c
130 index 4b14ca8..c1aff1b 100644
131 --- a/drivers/staging/go7007/wis-saa7113.c
132 +++ b/drivers/staging/go7007/wis-saa7113.c
134 #include <linux/init.h>
135 #include <linux/version.h>
136 #include <linux/i2c.h>
137 -#include <linux/videodev.h>
138 -#include <linux/video_decoder.h>
139 +#include <linux/videodev2.h>
140 #include <linux/ioctl.h>
143 @@ -124,7 +123,7 @@ static int wis_saa7113_command(struct i2c_client *client,
144 struct wis_saa7113 *dec = i2c_get_clientdata(client);
147 - case DECODER_SET_INPUT:
148 + case VIDIOC_S_INPUT:
152 @@ -133,23 +132,19 @@ static int wis_saa7113_command(struct i2c_client *client,
153 *input < 6 ? 0x40 : 0x80);
156 - case DECODER_SET_NORM:
160 + v4l2_std_id *input = arg;
162 - switch (dec->norm) {
163 - case VIDEO_MODE_PAL:
164 - write_reg(client, 0x0e, 0x01);
165 - write_reg(client, 0x10, 0x48);
167 - case VIDEO_MODE_NTSC:
168 + if (dec->norm & V4L2_STD_NTSC) {
169 write_reg(client, 0x0e, 0x01);
170 write_reg(client, 0x10, 0x40);
172 - case VIDEO_MODE_SECAM:
173 + } else if (dec->norm & V4L2_STD_PAL) {
174 + write_reg(client, 0x0e, 0x01);
175 + write_reg(client, 0x10, 0x48);
176 + } else if (dec->norm * V4L2_STD_SECAM) {
177 write_reg(client, 0x0e, 0x50);
178 write_reg(client, 0x10, 0x48);
183 @@ -295,7 +290,7 @@ static int wis_saa7113_detect(struct i2c_adapter *adapter, int addr, int kind)
187 - dec->norm = VIDEO_MODE_NTSC;
188 + dec->norm = V4L2_STD_NTSC;
189 dec->brightness = 128;
191 dec->saturation = 64;
192 diff --git a/drivers/staging/go7007/wis-saa7115.c b/drivers/staging/go7007/wis-saa7115.c
193 index bd40bf4..5c94c88 100644
194 --- a/drivers/staging/go7007/wis-saa7115.c
195 +++ b/drivers/staging/go7007/wis-saa7115.c
197 #include <linux/init.h>
198 #include <linux/version.h>
199 #include <linux/i2c.h>
200 -#include <linux/videodev.h>
201 -#include <linux/video_decoder.h>
202 +#include <linux/videodev2.h>
203 #include <linux/ioctl.h>
206 @@ -204,7 +203,7 @@ static int wis_saa7115_command(struct i2c_client *client,
207 struct wis_saa7115 *dec = i2c_get_clientdata(client);
210 - case DECODER_SET_INPUT:
211 + case VIDIOC_S_INPUT:
215 @@ -222,7 +221,7 @@ static int wis_saa7115_command(struct i2c_client *client,
216 int h_scaling_increment = (704 / h_integer_scaler) *
218 /* Fine-grained scaler only */
219 - int v_scaling_increment = (dec->norm == VIDEO_MODE_NTSC ?
220 + int v_scaling_increment = (dec->norm & V4L2_STD_NTSC ?
221 240 : 288) * 1024 / res->height;
224 @@ -262,20 +261,20 @@ static int wis_saa7115_command(struct i2c_client *client,
225 write_regs(client, regs);
228 - case DECODER_SET_NORM:
232 + v4l2_std_id *input = arg;
235 - 0x98, *input == VIDEO_MODE_NTSC ? 0x12 : 0x16,
236 - 0x9a, *input == VIDEO_MODE_NTSC ? 0xf2 : 0x20,
237 - 0x9b, *input == VIDEO_MODE_NTSC ? 0x00 : 0x01,
238 - 0xc8, *input == VIDEO_MODE_NTSC ? 0x12 : 0x16,
239 - 0xca, *input == VIDEO_MODE_NTSC ? 0xf2 : 0x20,
240 - 0xcb, *input == VIDEO_MODE_NTSC ? 0x00 : 0x01,
241 + 0x98, *input & V4L2_STD_NTSC ? 0x12 : 0x16,
242 + 0x9a, *input & V4L2_STD_NTSC ? 0xf2 : 0x20,
243 + 0x9b, *input & V4L2_STD_NTSC ? 0x00 : 0x01,
244 + 0xc8, *input & V4L2_STD_NTSC ? 0x12 : 0x16,
245 + 0xca, *input & V4L2_STD_NTSC ? 0xf2 : 0x20,
246 + 0xcb, *input & V4L2_STD_NTSC ? 0x00 : 0x01,
248 - 0x30, *input == VIDEO_MODE_NTSC ? 0x66 : 0x00,
249 - 0x31, *input == VIDEO_MODE_NTSC ? 0x90 : 0xe0,
250 + 0x30, *input & V4L2_STD_NTSC ? 0x66 : 0x00,
251 + 0x31, *input & V4L2_STD_NTSC ? 0x90 : 0xe0,
254 write_regs(client, regs);
255 @@ -424,7 +423,7 @@ static int wis_saa7115_detect(struct i2c_adapter *adapter, int addr, int kind)
259 - dec->norm = VIDEO_MODE_NTSC;
260 + dec->norm = V4L2_STD_NTSC;
261 dec->brightness = 128;
263 dec->saturation = 64;
264 diff --git a/drivers/staging/go7007/wis-sony-tuner.c b/drivers/staging/go7007/wis-sony-tuner.c
265 index 82e66d6..5997fb4 100644
266 --- a/drivers/staging/go7007/wis-sony-tuner.c
267 +++ b/drivers/staging/go7007/wis-sony-tuner.c
269 #include <linux/init.h>
270 #include <linux/version.h>
271 #include <linux/i2c.h>
272 -#include <linux/videodev.h>
273 +#include <linux/videodev2.h>
274 #include <media/tuner.h>
275 #include <media/v4l2-common.h>
276 +#include <media/v4l2-ioctl.h>
280 diff --git a/drivers/staging/go7007/wis-tw2804.c b/drivers/staging/go7007/wis-tw2804.c
281 index 69ed7bf..27fe4d0 100644
282 --- a/drivers/staging/go7007/wis-tw2804.c
283 +++ b/drivers/staging/go7007/wis-tw2804.c
285 #include <linux/init.h>
286 #include <linux/version.h>
287 #include <linux/i2c.h>
288 -#include <linux/videodev.h>
289 -#include <linux/video_decoder.h>
290 +#include <linux/videodev2.h>
291 #include <linux/ioctl.h>
294 @@ -159,20 +158,20 @@ static int wis_tw2804_command(struct i2c_client *client,
298 - case DECODER_SET_NORM:
302 + v4l2_std_id *input = arg;
304 - 0x01, *input == VIDEO_MODE_NTSC ? 0xc4 : 0x84,
305 - 0x09, *input == VIDEO_MODE_NTSC ? 0x07 : 0x04,
306 - 0x0a, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
307 - 0x0b, *input == VIDEO_MODE_NTSC ? 0x07 : 0x04,
308 - 0x0c, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
309 - 0x0d, *input == VIDEO_MODE_NTSC ? 0x40 : 0x4a,
310 - 0x16, *input == VIDEO_MODE_NTSC ? 0x00 : 0x40,
311 - 0x17, *input == VIDEO_MODE_NTSC ? 0x00 : 0x40,
312 - 0x20, *input == VIDEO_MODE_NTSC ? 0x07 : 0x0f,
313 - 0x21, *input == VIDEO_MODE_NTSC ? 0x07 : 0x0f,
314 + 0x01, *input & V4L2_STD_NTSC ? 0xc4 : 0x84,
315 + 0x09, *input & V4L2_STD_NTSC ? 0x07 : 0x04,
316 + 0x0a, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
317 + 0x0b, *input & V4L2_STD_NTSC ? 0x07 : 0x04,
318 + 0x0c, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
319 + 0x0d, *input & V4L2_STD_NTSC ? 0x40 : 0x4a,
320 + 0x16, *input & V4L2_STD_NTSC ? 0x00 : 0x40,
321 + 0x17, *input & V4L2_STD_NTSC ? 0x00 : 0x40,
322 + 0x20, *input & V4L2_STD_NTSC ? 0x07 : 0x0f,
323 + 0x21, *input & V4L2_STD_NTSC ? 0x07 : 0x0f,
326 write_regs(client, regs, dec->channel);
327 @@ -322,7 +321,7 @@ static int wis_tw2804_detect(struct i2c_adapter *adapter, int addr, int kind)
331 - dec->norm = VIDEO_MODE_NTSC;
332 + dec->norm = V4L2_STD_NTSC;
333 dec->brightness = 128;
335 dec->saturation = 128;
336 diff --git a/drivers/staging/go7007/wis-tw9903.c b/drivers/staging/go7007/wis-tw9903.c
337 index 1cdf01a..d8e4196 100644
338 --- a/drivers/staging/go7007/wis-tw9903.c
339 +++ b/drivers/staging/go7007/wis-tw9903.c
341 #include <linux/init.h>
342 #include <linux/version.h>
343 #include <linux/i2c.h>
344 -#include <linux/videodev.h>
345 -#include <linux/video_decoder.h>
346 +#include <linux/videodev2.h>
347 #include <linux/ioctl.h>
350 @@ -106,7 +105,7 @@ static int wis_tw9903_command(struct i2c_client *client,
351 struct wis_tw9903 *dec = i2c_get_clientdata(client);
354 - case DECODER_SET_INPUT:
355 + case VIDIOC_S_INPUT:
359 @@ -119,7 +118,7 @@ static int wis_tw9903_command(struct i2c_client *client,
360 struct video_decoder_resolution *res = arg;
361 /*int hscale = 256 * 720 / res->width;*/
362 int hscale = 256 * 720 / (res->width - (res->width > 704 ? 0 : 8));
363 - int vscale = 256 * (dec->norm == VIDEO_MODE_NTSC ? 240 : 288)
364 + int vscale = 256 * (dec->norm & V4L2_STD_NTSC ? 240 : 288)
368 @@ -134,14 +133,14 @@ static int wis_tw9903_command(struct i2c_client *client,
372 - case DECODER_SET_NORM:
376 + v4l2_std_id *input = arg;
378 - 0x05, *input == VIDEO_MODE_NTSC ? 0x80 : 0x00,
379 - 0x07, *input == VIDEO_MODE_NTSC ? 0x02 : 0x12,
380 - 0x08, *input == VIDEO_MODE_NTSC ? 0x14 : 0x18,
381 - 0x09, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
382 + 0x05, *input & V4L2_STD_NTSC ? 0x80 : 0x00,
383 + 0x07, *input & V4L2_STD_NTSC ? 0x02 : 0x12,
384 + 0x08, *input & V4L2_STD_NTSC ? 0x14 : 0x18,
385 + 0x09, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
388 write_regs(client, regs);
389 @@ -297,7 +296,7 @@ static int wis_tw9903_detect(struct i2c_adapter *adapter, int addr, int kind)
393 - dec->norm = VIDEO_MODE_NTSC;
394 + dec->norm = V4L2_STD_NTSC;
396 dec->contrast = 0x60;
398 diff --git a/drivers/staging/go7007/wis-uda1342.c b/drivers/staging/go7007/wis-uda1342.c
399 index 28c10bf..a0894e3 100644
400 --- a/drivers/staging/go7007/wis-uda1342.c
401 +++ b/drivers/staging/go7007/wis-uda1342.c
403 #include <linux/init.h>
404 #include <linux/version.h>
405 #include <linux/i2c.h>
406 -#include <linux/videodev.h>
407 +#include <linux/videodev2.h>
408 #include <media/tvaudio.h>
409 #include <media/v4l2-common.h>