]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.drivers/0018-Staging-go7007-v4l-fixes.patch
Revert "Move xen patchset to new version's subdir."
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.drivers / 0018-Staging-go7007-v4l-fixes.patch
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
5 Patch-mainline: 2.6.28
6
7 Fix up some of the v4l issues that were recently changed to make the
8 go7007 driver a bit cleaner.
9
10
11 From: Ross Cohen <rcohen@snurgle.org>
12 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 ---
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(-)
25
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
30 @@ -31,7 +31,7 @@
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>
38
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
43 @@ -26,8 +26,7 @@
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,
54 case VIDIOC_S_STD:
55 {
56 v4l2_std_id *std = arg;
57 - int norm;
58
59 if (go->streaming)
60 return -EBUSY;
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;
74 } else
75 return -EINVAL;
76 if (go->i2c_adapter_online)
77 i2c_clients_command(&go->i2c_adapter,
78 - DECODER_SET_NORM, &norm);
79 + VIDIOC_S_STD, std);
80 set_capture_size(go, NULL, 0);
81 return 0;
82 }
83 @@ -933,7 +928,7 @@ static int go7007_do_ioctl(struct inode *inode, struct file *file,
84 return -EBUSY;
85 go->input = *input;
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 = {
93
94 static struct video_device go7007_template = {
95 .name = "go7007",
96 + .vfl_type = VID_TYPE_CAPTURE,
97 .fops = &go7007_fops,
98 .minor = -1,
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");
112
113 struct go7007_snd {
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
119 @@ -19,8 +19,7 @@
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>
126
127 #include "wis-i2c.h"
128
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
133 @@ -19,8 +19,7 @@
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>
141
142 #include "wis-i2c.h"
143 @@ -124,7 +123,7 @@ static int wis_saa7113_command(struct i2c_client *client,
144 struct wis_saa7113 *dec = i2c_get_clientdata(client);
145
146 switch (cmd) {
147 - case DECODER_SET_INPUT:
148 + case VIDIOC_S_INPUT:
149 {
150 int *input = arg;
151
152 @@ -133,23 +132,19 @@ static int wis_saa7113_command(struct i2c_client *client,
153 *input < 6 ? 0x40 : 0x80);
154 break;
155 }
156 - case DECODER_SET_NORM:
157 + case VIDIOC_S_STD:
158 {
159 - int *input = arg;
160 + v4l2_std_id *input = arg;
161 dec->norm = *input;
162 - switch (dec->norm) {
163 - case VIDEO_MODE_PAL:
164 - write_reg(client, 0x0e, 0x01);
165 - write_reg(client, 0x10, 0x48);
166 - break;
167 - case VIDEO_MODE_NTSC:
168 + if (dec->norm & V4L2_STD_NTSC) {
169 write_reg(client, 0x0e, 0x01);
170 write_reg(client, 0x10, 0x40);
171 - break;
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);
179 - break;
180 }
181 break;
182 }
183 @@ -295,7 +290,7 @@ static int wis_saa7113_detect(struct i2c_adapter *adapter, int addr, int kind)
184 kfree(client);
185 return -ENOMEM;
186 }
187 - dec->norm = VIDEO_MODE_NTSC;
188 + dec->norm = V4L2_STD_NTSC;
189 dec->brightness = 128;
190 dec->contrast = 71;
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
196 @@ -19,8 +19,7 @@
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>
204
205 #include "wis-i2c.h"
206 @@ -204,7 +203,7 @@ static int wis_saa7115_command(struct i2c_client *client,
207 struct wis_saa7115 *dec = i2c_get_clientdata(client);
208
209 switch (cmd) {
210 - case DECODER_SET_INPUT:
211 + case VIDIOC_S_INPUT:
212 {
213 int *input = arg;
214
215 @@ -222,7 +221,7 @@ static int wis_saa7115_command(struct i2c_client *client,
216 int h_scaling_increment = (704 / h_integer_scaler) *
217 1024 / res->width;
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;
222 u8 regs[] = {
223 0x88, 0xc0,
224 @@ -262,20 +261,20 @@ static int wis_saa7115_command(struct i2c_client *client,
225 write_regs(client, regs);
226 break;
227 }
228 - case DECODER_SET_NORM:
229 + case VIDIOC_S_STD:
230 {
231 - int *input = arg;
232 + v4l2_std_id *input = arg;
233 u8 regs[] = {
234 0x88, 0xc0,
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,
247 0x88, 0xf0,
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,
252 0, 0,
253 };
254 write_regs(client, regs);
255 @@ -424,7 +423,7 @@ static int wis_saa7115_detect(struct i2c_adapter *adapter, int addr, int kind)
256 kfree(client);
257 return -ENOMEM;
258 }
259 - dec->norm = VIDEO_MODE_NTSC;
260 + dec->norm = V4L2_STD_NTSC;
261 dec->brightness = 128;
262 dec->contrast = 64;
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
268 @@ -19,9 +19,10 @@
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>
277
278 #include "wis-i2c.h"
279
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
284 @@ -19,8 +19,7 @@
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>
292
293 #include "wis-i2c.h"
294 @@ -159,20 +158,20 @@ static int wis_tw2804_command(struct i2c_client *client,
295 }
296
297 switch (cmd) {
298 - case DECODER_SET_NORM:
299 + case VIDIOC_S_STD:
300 {
301 - int *input = arg;
302 + v4l2_std_id *input = arg;
303 u8 regs[] = {
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,
324 0xff, 0xff,
325 };
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)
328 return -ENOMEM;
329 }
330 dec->channel = -1;
331 - dec->norm = VIDEO_MODE_NTSC;
332 + dec->norm = V4L2_STD_NTSC;
333 dec->brightness = 128;
334 dec->contrast = 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
340 @@ -19,8 +19,7 @@
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>
348
349 #include "wis-i2c.h"
350 @@ -106,7 +105,7 @@ static int wis_tw9903_command(struct i2c_client *client,
351 struct wis_tw9903 *dec = i2c_get_clientdata(client);
352
353 switch (cmd) {
354 - case DECODER_SET_INPUT:
355 + case VIDIOC_S_INPUT:
356 {
357 int *input = arg;
358
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)
365 / res->height;
366 u8 regs[] = {
367 0x0d, vscale & 0xff,
368 @@ -134,14 +133,14 @@ static int wis_tw9903_command(struct i2c_client *client,
369 break;
370 }
371 #endif
372 - case DECODER_SET_NORM:
373 + case VIDIOC_S_STD:
374 {
375 - int *input = arg;
376 + v4l2_std_id *input = arg;
377 u8 regs[] = {
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,
386 0, 0,
387 };
388 write_regs(client, regs);
389 @@ -297,7 +296,7 @@ static int wis_tw9903_detect(struct i2c_adapter *adapter, int addr, int kind)
390 kfree(client);
391 return -ENOMEM;
392 }
393 - dec->norm = VIDEO_MODE_NTSC;
394 + dec->norm = V4L2_STD_NTSC;
395 dec->brightness = 0;
396 dec->contrast = 0x60;
397 dec->hue = 0;
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
402 @@ -19,7 +19,7 @@
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>
410
411 --
412 1.6.0.2
413