aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-06-22 10:57:31 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:11:51 -0400
commit37f89f9542c3945bddf46efc15a1b1e349af3f88 (patch)
tree5020c56d1b73c13e8e1a7425f55c703745cf12ca
parent21575c13125f2ef790e192e2c70e446c6cfe0d7d (diff)
V4L/DVB (8104): cx18/ivtv: ioctl debugging improvements
Completely rely on the video_ioctl2 debugging facilities rather than doing it ourselves. Fill in some missing fields in ivtv with VIDIOC_G_FBUF. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/cx18/cx18-controls.c16
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c87
-rw-r--r--drivers/media/video/cx18/cx18-streams.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-controls.c16
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c21
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c4
-rw-r--r--drivers/media/video/ivtv/ivtvfb.c3
7 files changed, 33 insertions, 118 deletions
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c
index 6eae75f4ee7c..01ba9ca37d09 100644
--- a/drivers/media/video/cx18/cx18-controls.c
+++ b/drivers/media/video/cx18/cx18-controls.c
@@ -56,8 +56,6 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
56 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 56 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
57 const char *name; 57 const char *name;
58 58
59 CX18_DEBUG_IOCTL("VIDIOC_QUERYCTRL(%08x)\n", qctrl->id);
60
61 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); 59 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
62 if (qctrl->id == 0) 60 if (qctrl->id == 0)
63 return -EINVAL; 61 return -EINVAL;
@@ -94,10 +92,8 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
94 92
95int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) 93int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
96{ 94{
97 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
98 struct v4l2_queryctrl qctrl; 95 struct v4l2_queryctrl qctrl;
99 96
100 CX18_DEBUG_IOCTL("VIDIOC_QUERYMENU\n");
101 qctrl.id = qmenu->id; 97 qctrl.id = qmenu->id;
102 cx18_queryctrl(file, fh, &qctrl); 98 cx18_queryctrl(file, fh, &qctrl);
103 return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); 99 return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
@@ -108,14 +104,11 @@ int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
108 struct cx18_open_id *id = fh; 104 struct cx18_open_id *id = fh;
109 struct cx18 *cx = id->cx; 105 struct cx18 *cx = id->cx;
110 int ret; 106 int ret;
111 s32 v = vctrl->value;
112 107
113 ret = v4l2_prio_check(&cx->prio, &id->prio); 108 ret = v4l2_prio_check(&cx->prio, &id->prio);
114 if (ret) 109 if (ret)
115 return ret; 110 return ret;
116 111
117 CX18_DEBUG_IOCTL("VIDIOC_S_CTRL(%08x, %x)\n", vctrl->id, v);
118
119 switch (vctrl->id) { 112 switch (vctrl->id) {
120 /* Standard V4L2 controls */ 113 /* Standard V4L2 controls */
121 case V4L2_CID_BRIGHTNESS: 114 case V4L2_CID_BRIGHTNESS:
@@ -133,7 +126,7 @@ int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
133 return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl); 126 return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl);
134 127
135 default: 128 default:
136 CX18_DEBUG_IOCTL("invalid control %x\n", vctrl->id); 129 CX18_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id);
137 return -EINVAL; 130 return -EINVAL;
138 } 131 }
139 return 0; 132 return 0;
@@ -143,8 +136,6 @@ int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
143{ 136{
144 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 137 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
145 138
146 CX18_DEBUG_IOCTL("VIDIOC_G_CTRL(%08x)\n", vctrl->id);
147
148 switch (vctrl->id) { 139 switch (vctrl->id) {
149 /* Standard V4L2 controls */ 140 /* Standard V4L2 controls */
150 case V4L2_CID_BRIGHTNESS: 141 case V4L2_CID_BRIGHTNESS:
@@ -161,7 +152,7 @@ int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
161 case V4L2_CID_AUDIO_LOUDNESS: 152 case V4L2_CID_AUDIO_LOUDNESS:
162 return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl); 153 return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl);
163 default: 154 default:
164 CX18_DEBUG_IOCTL("invalid control %x\n", vctrl->id); 155 CX18_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id);
165 return -EINVAL; 156 return -EINVAL;
166 } 157 }
167 return 0; 158 return 0;
@@ -227,7 +218,6 @@ int cx18_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
227 } 218 }
228 return err; 219 return err;
229 } 220 }
230 CX18_DEBUG_IOCTL("VIDIOC_G_EXT_CTRLS\n");
231 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) 221 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
232 return cx2341x_ext_ctrls(&cx->params, 0, c, VIDIOC_G_EXT_CTRLS); 222 return cx2341x_ext_ctrls(&cx->params, 0, c, VIDIOC_G_EXT_CTRLS);
233 return -EINVAL; 223 return -EINVAL;
@@ -260,7 +250,6 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
260 } 250 }
261 return err; 251 return err;
262 } 252 }
263 CX18_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n");
264 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { 253 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
265 struct cx2341x_mpeg_params p = cx->params; 254 struct cx2341x_mpeg_params p = cx->params;
266 int err = cx2341x_ext_ctrls(&p, atomic_read(&cx->ana_capturing), 255 int err = cx2341x_ext_ctrls(&p, atomic_read(&cx->ana_capturing),
@@ -296,7 +285,6 @@ int cx18_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
296{ 285{
297 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 286 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
298 287
299 CX18_DEBUG_IOCTL("VIDIOC_TRY_EXT_CTRLS\n");
300 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) 288 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
301 return cx2341x_ext_ctrls(&cx->params, 289 return cx2341x_ext_ctrls(&cx->params,
302 atomic_read(&cx->ana_capturing), 290 atomic_read(&cx->ana_capturing),
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index cfda54d022e0..7231f60a180b 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -165,8 +165,6 @@ static int cx18_g_fmt_vbi_cap(struct file *file, void *fh,
165 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 165 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
166 struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi; 166 struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi;
167 167
168 CX18_DEBUG_IOCTL("VIDIOC_G_FMT: V4L2_BUF_TYPE_VBI_CAPTURE\n");
169
170 vbifmt->sampling_rate = 27000000; 168 vbifmt->sampling_rate = 27000000;
171 vbifmt->offset = 248; 169 vbifmt->offset = 248;
172 vbifmt->samples_per_line = cx->vbi.raw_decoder_line_size - 4; 170 vbifmt->samples_per_line = cx->vbi.raw_decoder_line_size - 4;
@@ -195,8 +193,6 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh,
195 int w = fmt->fmt.pix.width; 193 int w = fmt->fmt.pix.width;
196 int h = fmt->fmt.pix.height; 194 int h = fmt->fmt.pix.height;
197 195
198 CX18_DEBUG_IOCTL("VIDIOC_TRY_FMT: V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
199
200 w = min(w, 720); 196 w = min(w, 720);
201 w = max(w, 1); 197 w = max(w, 1);
202 h = min(h, cx->is_50hz ? 576 : 480); 198 h = min(h, cx->is_50hz ? 576 : 480);
@@ -210,10 +206,6 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh,
210static int cx18_try_fmt_vbi_cap(struct file *file, void *fh, 206static int cx18_try_fmt_vbi_cap(struct file *file, void *fh,
211 struct v4l2_format *fmt) 207 struct v4l2_format *fmt)
212{ 208{
213 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
214
215 CX18_DEBUG_IOCTL("VIDIOC_TRY_FMT: V4L2_BUF_TYPE_VBI_CAPTURE\n");
216
217 return cx18_g_fmt_vbi_cap(file, fh, fmt); 209 return cx18_g_fmt_vbi_cap(file, fh, fmt);
218} 210}
219 211
@@ -236,8 +228,6 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
236 if (ret) 228 if (ret)
237 return ret; 229 return ret;
238 230
239 CX18_DEBUG_IOCTL("VIDIOC_S_FMT: V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
240
241 ret = cx18_try_fmt_vid_cap(file, fh, fmt); 231 ret = cx18_try_fmt_vid_cap(file, fh, fmt);
242 if (ret) 232 if (ret)
243 return ret; 233 return ret;
@@ -265,8 +255,6 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *fh,
265 if (ret) 255 if (ret)
266 return ret; 256 return ret;
267 257
268 CX18_DEBUG_IOCTL("VIDIOC_S_FMT: V4L2_BUF_TYPE_VBI_CAPTURE\n");
269
270 if (id->type == CX18_ENC_STREAM_TYPE_VBI && 258 if (id->type == CX18_ENC_STREAM_TYPE_VBI &&
271 cx->vbi.sliced_in->service_set && 259 cx->vbi.sliced_in->service_set &&
272 atomic_read(&cx->ana_capturing) > 0) 260 atomic_read(&cx->ana_capturing) > 0)
@@ -288,8 +276,6 @@ static int cx18_g_chip_ident(struct file *file, void *fh,
288{ 276{
289 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 277 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
290 278
291 CX18_DEBUG_IOCTL("VIDIOC_G_CHIP_IDENT\n");
292
293 chip->ident = V4L2_IDENT_NONE; 279 chip->ident = V4L2_IDENT_NONE;
294 chip->revision = 0; 280 chip->revision = 0;
295 if (chip->match_type == V4L2_CHIP_MATCH_HOST) { 281 if (chip->match_type == V4L2_CHIP_MATCH_HOST) {
@@ -311,8 +297,6 @@ static int cx18_g_register(struct file *file, void *fh,
311{ 297{
312 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 298 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
313 299
314 CX18_DEBUG_IOCTL("VIDIOC_DBG_G_REGISTER\n");
315
316 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 300 if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
317 return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg); 301 return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg);
318 if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 302 if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
@@ -327,8 +311,6 @@ static int cx18_s_register(struct file *file, void *fh,
327{ 311{
328 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 312 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
329 313
330 CX18_DEBUG_IOCTL("VIDIOC_DBG_S_REGISTER\n");
331
332 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 314 if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
333 return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg); 315 return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg);
334 if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 316 if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
@@ -342,8 +324,6 @@ static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p)
342{ 324{
343 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 325 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
344 326
345 CX18_DEBUG_IOCTL("VIDIOC_G_PRIORITY\n");
346
347 *p = v4l2_prio_max(&cx->prio); 327 *p = v4l2_prio_max(&cx->prio);
348 return 0; 328 return 0;
349} 329}
@@ -353,8 +333,6 @@ static int cx18_s_priority(struct file *file, void *fh, enum v4l2_priority prio)
353 struct cx18_open_id *id = fh; 333 struct cx18_open_id *id = fh;
354 struct cx18 *cx = id->cx; 334 struct cx18 *cx = id->cx;
355 335
356 CX18_DEBUG_IOCTL("VIDIOC_S_PRIORITY\n");
357
358 return v4l2_prio_change(&cx->prio, &id->prio, prio); 336 return v4l2_prio_change(&cx->prio, &id->prio, prio);
359} 337}
360 338
@@ -363,8 +341,6 @@ static int cx18_querycap(struct file *file, void *fh,
363{ 341{
364 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 342 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
365 343
366 CX18_DEBUG_IOCTL("VIDIOC_QUERYCAP\n");
367
368 strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); 344 strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
369 strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); 345 strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
370 strlcpy(vcap->bus_info, pci_name(cx->dev), sizeof(vcap->bus_info)); 346 strlcpy(vcap->bus_info, pci_name(cx->dev), sizeof(vcap->bus_info));
@@ -377,8 +353,6 @@ static int cx18_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin)
377{ 353{
378 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 354 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
379 355
380 CX18_DEBUG_IOCTL("VIDIOC_ENUMAUDIO\n");
381
382 return cx18_get_audio_input(cx, vin->index, vin); 356 return cx18_get_audio_input(cx, vin->index, vin);
383} 357}
384 358
@@ -386,8 +360,6 @@ static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vin)
386{ 360{
387 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 361 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
388 362
389 CX18_DEBUG_IOCTL("VIDIOC_G_AUDIO\n");
390
391 vin->index = cx->audio_input; 363 vin->index = cx->audio_input;
392 return cx18_get_audio_input(cx, vin->index, vin); 364 return cx18_get_audio_input(cx, vin->index, vin);
393} 365}
@@ -396,8 +368,6 @@ static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout)
396{ 368{
397 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 369 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
398 370
399 CX18_DEBUG_IOCTL("VIDIOC_S_AUDIO\n");
400
401 if (vout->index >= cx->nof_audio_inputs) 371 if (vout->index >= cx->nof_audio_inputs)
402 return -EINVAL; 372 return -EINVAL;
403 cx->audio_input = vout->index; 373 cx->audio_input = vout->index;
@@ -409,8 +379,6 @@ static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin)
409{ 379{
410 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 380 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
411 381
412 CX18_DEBUG_IOCTL("VIDIOC_ENUMINPUT\n");
413
414 /* set it to defaults from our table */ 382 /* set it to defaults from our table */
415 return cx18_get_input(cx, vin->index, vin); 383 return cx18_get_input(cx, vin->index, vin);
416} 384}
@@ -420,8 +388,6 @@ static int cx18_cropcap(struct file *file, void *fh,
420{ 388{
421 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 389 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
422 390
423 CX18_DEBUG_IOCTL("VIDIOC_CROPCAP\n");
424
425 if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 391 if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
426 return -EINVAL; 392 return -EINVAL;
427 cropcap->bounds.top = cropcap->bounds.left = 0; 393 cropcap->bounds.top = cropcap->bounds.left = 0;
@@ -443,8 +409,6 @@ static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop)
443 if (ret) 409 if (ret)
444 return ret; 410 return ret;
445 411
446 CX18_DEBUG_IOCTL("VIDIOC_S_CROP\n");
447
448 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 412 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
449 return -EINVAL; 413 return -EINVAL;
450 return cx18_av_cmd(cx, VIDIOC_S_CROP, crop); 414 return cx18_av_cmd(cx, VIDIOC_S_CROP, crop);
@@ -454,8 +418,6 @@ static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop)
454{ 418{
455 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 419 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
456 420
457 CX18_DEBUG_IOCTL("VIDIOC_G_CROP\n");
458
459 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 421 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
460 return -EINVAL; 422 return -EINVAL;
461 return cx18_av_cmd(cx, VIDIOC_G_CROP, crop); 423 return cx18_av_cmd(cx, VIDIOC_G_CROP, crop);
@@ -473,10 +435,6 @@ static int cx18_enum_fmt_vid_cap(struct file *file, void *fh,
473 } 435 }
474 }; 436 };
475 437
476 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
477
478 CX18_DEBUG_IOCTL("VIDIOC_ENUM_FMT: V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
479
480 if (fmt->index > 1) 438 if (fmt->index > 1)
481 return -EINVAL; 439 return -EINVAL;
482 *fmt = formats[fmt->index]; 440 *fmt = formats[fmt->index];
@@ -487,8 +445,6 @@ static int cx18_g_input(struct file *file, void *fh, unsigned int *i)
487{ 445{
488 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 446 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
489 447
490 CX18_DEBUG_IOCTL("VIDIOC_G_INPUT\n");
491
492 *i = cx->active_input; 448 *i = cx->active_input;
493 return 0; 449 return 0;
494} 450}
@@ -503,8 +459,6 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp)
503 if (ret) 459 if (ret)
504 return ret; 460 return ret;
505 461
506 CX18_DEBUG_IOCTL("VIDIOC_S_INPUT\n");
507
508 if (inp < 0 || inp >= cx->nof_inputs) 462 if (inp < 0 || inp >= cx->nof_inputs)
509 return -EINVAL; 463 return -EINVAL;
510 464
@@ -534,8 +488,6 @@ static int cx18_g_frequency(struct file *file, void *fh,
534{ 488{
535 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 489 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
536 490
537 CX18_DEBUG_IOCTL("VIDIOC_G_FREQUENCY\n");
538
539 if (vf->tuner != 0) 491 if (vf->tuner != 0)
540 return -EINVAL; 492 return -EINVAL;
541 493
@@ -553,8 +505,6 @@ int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
553 if (ret) 505 if (ret)
554 return ret; 506 return ret;
555 507
556 CX18_DEBUG_IOCTL("VIDIOC_S_FREQUENCY\n");
557
558 if (vf->tuner != 0) 508 if (vf->tuner != 0)
559 return -EINVAL; 509 return -EINVAL;
560 510
@@ -569,8 +519,6 @@ static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std)
569{ 519{
570 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 520 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
571 521
572 CX18_DEBUG_IOCTL("VIDIOC_G_STD\n");
573
574 *std = cx->std; 522 *std = cx->std;
575 return 0; 523 return 0;
576} 524}
@@ -585,8 +533,6 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std)
585 if (ret) 533 if (ret)
586 return ret; 534 return ret;
587 535
588 CX18_DEBUG_IOCTL("VIDIOC_S_STD\n");
589
590 if ((*std & V4L2_STD_ALL) == 0) 536 if ((*std & V4L2_STD_ALL) == 0)
591 return -EINVAL; 537 return -EINVAL;
592 538
@@ -628,8 +574,6 @@ static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
628 if (ret) 574 if (ret)
629 return ret; 575 return ret;
630 576
631 CX18_DEBUG_IOCTL("VIDIOC_S_TUNER\n");
632
633 if (vt->index != 0) 577 if (vt->index != 0)
634 return -EINVAL; 578 return -EINVAL;
635 579
@@ -643,8 +587,6 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
643{ 587{
644 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 588 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
645 589
646 CX18_DEBUG_IOCTL("VIDIOC_G_TUNER\n");
647
648 if (vt->index != 0) 590 if (vt->index != 0)
649 return -EINVAL; 591 return -EINVAL;
650 592
@@ -679,8 +621,6 @@ static int cx18_encoder_cmd(struct file *file, void *fh,
679 struct cx18_open_id *id = fh; 621 struct cx18_open_id *id = fh;
680 struct cx18 *cx = id->cx; 622 struct cx18 *cx = id->cx;
681 623
682 CX18_DEBUG_IOCTL("VIDIOC_ENCODER_CMD:\n");
683
684 switch (enc->cmd) { 624 switch (enc->cmd) {
685 case V4L2_ENC_CMD_START: 625 case V4L2_ENC_CMD_START:
686 CX18_DEBUG_IOCTL("V4L2_ENC_CMD_START\n"); 626 CX18_DEBUG_IOCTL("V4L2_ENC_CMD_START\n");
@@ -728,8 +668,6 @@ static int cx18_try_encoder_cmd(struct file *file, void *fh,
728{ 668{
729 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 669 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
730 670
731 CX18_DEBUG_IOCTL("VIDIOC_TRY_ENCDOER_CMD:\n");
732
733 switch (enc->cmd) { 671 switch (enc->cmd) {
734 case V4L2_ENC_CMD_START: 672 case V4L2_ENC_CMD_START:
735 CX18_DEBUG_IOCTL("V4L2_ENC_CMD_START\n"); 673 CX18_DEBUG_IOCTL("V4L2_ENC_CMD_START\n");
@@ -765,7 +703,6 @@ static int cx18_log_status(struct file *file, void *fh)
765 struct v4l2_audio audin; 703 struct v4l2_audio audin;
766 int i; 704 int i;
767 705
768 CX18_DEBUG_IOCTL("VIDIOC_LOG_STATUS\n");
769 CX18_INFO("================= START STATUS CARD #%d =================\n", cx->num); 706 CX18_INFO("================= START STATUS CARD #%d =================\n", cx->num);
770 if (cx->hw_flags & CX18_HW_TVEEPROM) { 707 if (cx->hw_flags & CX18_HW_TVEEPROM) {
771 struct tveeprom tv; 708 struct tveeprom tv;
@@ -807,26 +744,13 @@ static int cx18_default(struct file *file, void *fh, int cmd, void *arg)
807 switch (cmd) { 744 switch (cmd) {
808 case VIDIOC_INT_S_AUDIO_ROUTING: { 745 case VIDIOC_INT_S_AUDIO_ROUTING: {
809 struct v4l2_routing *route = arg; 746 struct v4l2_routing *route = arg;
810 CX18_DEBUG_IOCTL("VIDIOC_INT_S_AUDIO_ROUTING (%d, %d)\n", 747
811 route->input, route->output); 748 CX18_DEBUG_IOCTL("VIDIOC_INT_S_AUDIO_ROUTING(%d, %d)\n",
749 route->input, route->output);
812 cx18_audio_set_route(cx, route); 750 cx18_audio_set_route(cx, route);
813 break; 751 break;
814 } 752 }
815 case VIDIOC_INT_RESET: {
816 u32 val = *(u32 *)arg;
817 CX18_DEBUG_IOCTL("VIDIOC_INT_RESET (%#10x)\n", val);
818 /* No op right now */
819 /* cx18_av_cmd(cx, cmd, arg) */
820 /* cx18_call_i2c_clients(cx, cmd, arg) */
821 break;
822 }
823 default: 753 default:
824 if (cx18_debug & CX18_DBGFLG_IOCTL) {
825 printk(KERN_INFO "cx18%d ioctl: unsupported cmd: ",
826 cx->num);
827 v4l_printk_ioctl(cmd);
828 printk("\n");
829 }
830 return -EINVAL; 754 return -EINVAL;
831 } 755 }
832 return 0; 756 return 0;
@@ -835,12 +759,17 @@ static int cx18_default(struct file *file, void *fh, int cmd, void *arg)
835int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 759int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
836 unsigned long arg) 760 unsigned long arg)
837{ 761{
762 struct video_device *vfd = video_devdata(filp);
838 struct cx18_open_id *id = (struct cx18_open_id *)filp->private_data; 763 struct cx18_open_id *id = (struct cx18_open_id *)filp->private_data;
839 struct cx18 *cx = id->cx; 764 struct cx18 *cx = id->cx;
840 int res; 765 int res;
841 766
842 mutex_lock(&cx->serialize_lock); 767 mutex_lock(&cx->serialize_lock);
768
769 if (cx18_debug & CX18_DBGFLG_IOCTL)
770 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
843 res = video_ioctl2(inode, filp, cmd, arg); 771 res = video_ioctl2(inode, filp, cmd, arg);
772 vfd->debug = 0;
844 mutex_unlock(&cx->serialize_lock); 773 mutex_unlock(&cx->serialize_lock);
845 return res; 774 return res;
846} 775}
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 805847370cba..f3d20509a8bd 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -190,8 +190,8 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
190 s->v4l2dev->type = 190 s->v4l2dev->type =
191 VID_TYPE_CAPTURE | VID_TYPE_TUNER | VID_TYPE_TELETEXT | 191 VID_TYPE_CAPTURE | VID_TYPE_TUNER | VID_TYPE_TELETEXT |
192 VID_TYPE_CLIPPING | VID_TYPE_SCALES | VID_TYPE_MPEG_ENCODER; 192 VID_TYPE_CLIPPING | VID_TYPE_SCALES | VID_TYPE_MPEG_ENCODER;
193 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18%d %s", 193 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18-%d",
194 cx->num, s->name); 194 cx->num);
195 195
196 s->v4l2dev->minor = minor; 196 s->v4l2dev->minor = minor;
197 s->v4l2dev->dev = &cx->dev->dev; 197 s->v4l2dev->dev = &cx->dev->dev;
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c
index 06723bac99c5..2df9b0668f1f 100644
--- a/drivers/media/video/ivtv/ivtv-controls.c
+++ b/drivers/media/video/ivtv/ivtv-controls.c
@@ -53,8 +53,6 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
53 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 53 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
54 const char *name; 54 const char *name;
55 55
56 IVTV_DEBUG_IOCTL("VIDIOC_QUERYCTRL(%08x)\n", qctrl->id);
57
58 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); 56 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
59 if (qctrl->id == 0) 57 if (qctrl->id == 0)
60 return -EINVAL; 58 return -EINVAL;
@@ -91,10 +89,8 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
91 89
92int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) 90int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
93{ 91{
94 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
95 struct v4l2_queryctrl qctrl; 92 struct v4l2_queryctrl qctrl;
96 93
97 IVTV_DEBUG_IOCTL("VIDIOC_QUERYMENU\n");
98 qctrl.id = qmenu->id; 94 qctrl.id = qmenu->id;
99 ivtv_queryctrl(file, fh, &qctrl); 95 ivtv_queryctrl(file, fh, &qctrl);
100 return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); 96 return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
@@ -103,9 +99,6 @@ int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
103int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) 99int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
104{ 100{
105 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 101 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
106 s32 v = vctrl->value;
107
108 IVTV_DEBUG_IOCTL("VIDIOC_S_CTRL(%08x, %x)\n", vctrl->id, v);
109 102
110 switch (vctrl->id) { 103 switch (vctrl->id) {
111 /* Standard V4L2 controls */ 104 /* Standard V4L2 controls */
@@ -124,7 +117,7 @@ int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
124 return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl); 117 return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl);
125 118
126 default: 119 default:
127 IVTV_DEBUG_IOCTL("invalid control %x\n", vctrl->id); 120 IVTV_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id);
128 return -EINVAL; 121 return -EINVAL;
129 } 122 }
130 return 0; 123 return 0;
@@ -134,8 +127,6 @@ int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
134{ 127{
135 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 128 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
136 129
137 IVTV_DEBUG_IOCTL("VIDIOC_G_CTRL(%08x)\n", vctrl->id);
138
139 switch (vctrl->id) { 130 switch (vctrl->id) {
140 /* Standard V4L2 controls */ 131 /* Standard V4L2 controls */
141 case V4L2_CID_BRIGHTNESS: 132 case V4L2_CID_BRIGHTNESS:
@@ -152,7 +143,7 @@ int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
152 case V4L2_CID_AUDIO_LOUDNESS: 143 case V4L2_CID_AUDIO_LOUDNESS:
153 return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl); 144 return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl);
154 default: 145 default:
155 IVTV_DEBUG_IOCTL("invalid control %x\n", vctrl->id); 146 IVTV_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id);
156 return -EINVAL; 147 return -EINVAL;
157 } 148 }
158 return 0; 149 return 0;
@@ -219,7 +210,6 @@ int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
219 } 210 }
220 return err; 211 return err;
221 } 212 }
222 IVTV_DEBUG_IOCTL("VIDIOC_G_EXT_CTRLS\n");
223 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) 213 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
224 return cx2341x_ext_ctrls(&itv->params, 0, c, VIDIOC_G_EXT_CTRLS); 214 return cx2341x_ext_ctrls(&itv->params, 0, c, VIDIOC_G_EXT_CTRLS);
225 return -EINVAL; 215 return -EINVAL;
@@ -246,7 +236,6 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
246 } 236 }
247 return err; 237 return err;
248 } 238 }
249 IVTV_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n");
250 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { 239 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
251 static u32 freqs[3] = { 44100, 48000, 32000 }; 240 static u32 freqs[3] = { 44100, 48000, 32000 };
252 struct cx2341x_mpeg_params p = itv->params; 241 struct cx2341x_mpeg_params p = itv->params;
@@ -286,7 +275,6 @@ int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
286{ 275{
287 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 276 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
288 277
289 IVTV_DEBUG_IOCTL("VIDIOC_TRY_EXT_CTRLS\n");
290 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) 278 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
291 return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS); 279 return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS);
292 return -EINVAL; 280 return -EINVAL;
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index aa222056dd47..8d602cb6ba68 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -1336,6 +1336,8 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
1336 1336
1337 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) 1337 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1338 return -EINVAL; 1338 return -EINVAL;
1339 if (!itv->osd_video_pbase)
1340 return -EINVAL;
1339 1341
1340 fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY | 1342 fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY |
1341 V4L2_FBUF_CAP_GLOBAL_ALPHA; 1343 V4L2_FBUF_CAP_GLOBAL_ALPHA;
@@ -1349,11 +1351,15 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
1349 fb->fmt.height = itv->osd_rect.height; 1351 fb->fmt.height = itv->osd_rect.height;
1350 fb->fmt.field = V4L2_FIELD_INTERLACED; 1352 fb->fmt.field = V4L2_FIELD_INTERLACED;
1351 fb->fmt.bytesperline = fb->fmt.width; 1353 fb->fmt.bytesperline = fb->fmt.width;
1354 fb->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M;
1355 fb->fmt.field = V4L2_FIELD_INTERLACED;
1356 fb->fmt.priv = 0;
1352 if (fb->fmt.pixelformat != V4L2_PIX_FMT_PAL8) 1357 if (fb->fmt.pixelformat != V4L2_PIX_FMT_PAL8)
1353 fb->fmt.bytesperline *= 2; 1358 fb->fmt.bytesperline *= 2;
1354 if (fb->fmt.pixelformat == V4L2_PIX_FMT_RGB32 || 1359 if (fb->fmt.pixelformat == V4L2_PIX_FMT_RGB32 ||
1355 fb->fmt.pixelformat == V4L2_PIX_FMT_YUV32) 1360 fb->fmt.pixelformat == V4L2_PIX_FMT_YUV32)
1356 fb->fmt.bytesperline *= 2; 1361 fb->fmt.bytesperline *= 2;
1362 fb->fmt.sizeimage = fb->fmt.bytesperline * fb->fmt.height;
1357 fb->base = (void *)itv->osd_video_pbase; 1363 fb->base = (void *)itv->osd_video_pbase;
1358 fb->flags = 0; 1364 fb->flags = 0;
1359 1365
@@ -1396,6 +1402,8 @@ static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
1396 1402
1397 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) 1403 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1398 return -EINVAL; 1404 return -EINVAL;
1405 if (!itv->osd_video_pbase)
1406 return -EINVAL;
1399 1407
1400 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; 1408 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
1401 itv->osd_local_alpha_state = 1409 itv->osd_local_alpha_state =
@@ -1744,6 +1752,7 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg)
1744static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp, 1752static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp,
1745 unsigned int cmd, unsigned long arg) 1753 unsigned int cmd, unsigned long arg)
1746{ 1754{
1755 struct video_device *vfd = video_devdata(filp);
1747 struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; 1756 struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
1748 int ret; 1757 int ret;
1749 1758
@@ -1812,13 +1821,11 @@ static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct f
1812 return ret; 1821 return ret;
1813 } 1822 }
1814 1823
1815 if (ivtv_debug & IVTV_DBGFLG_IOCTL) { 1824 if (ivtv_debug & IVTV_DBGFLG_IOCTL)
1816 printk(KERN_INFO "ivtv%d ioctl: ", itv->num); 1825 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
1817 v4l_printk_ioctl(cmd); 1826 ret = video_ioctl2(inode, filp, cmd, arg);
1818 printk("\n"); 1827 vfd->debug = 0;
1819 } 1828 return ret;
1820
1821 return video_ioctl2(inode, filp, cmd, arg);
1822} 1829}
1823 1830
1824int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 1831int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index f8883b487f4a..8e3addd45090 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -213,8 +213,8 @@ static int ivtv_prep_dev(struct ivtv *itv, int type)
213 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { 213 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
214 s->v4l2dev->type |= VID_TYPE_MPEG_DECODER; 214 s->v4l2dev->type |= VID_TYPE_MPEG_DECODER;
215 } 215 }
216 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d %s", 216 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d",
217 itv->num, s->name); 217 itv->num);
218 218
219 s->v4l2dev->minor = minor; 219 s->v4l2dev->minor = minor;
220 s->v4l2dev->dev = &itv->dev->dev; 220 s->v4l2dev->dev = &itv->dev->dev;
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c
index e8dbee443946..14f93341f061 100644
--- a/drivers/media/video/ivtv/ivtvfb.c
+++ b/drivers/media/video/ivtv/ivtvfb.c
@@ -789,6 +789,9 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
789 else 789 else
790 var->pixclock = pixclock; 790 var->pixclock = pixclock;
791 791
792 itv->osd_rect.width = var->xres;
793 itv->osd_rect.height = var->yres;
794
792 IVTVFB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n", 795 IVTVFB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n",
793 var->xres, var->yres, 796 var->xres, var->yres,
794 var->xres_virtual, var->yres_virtual, 797 var->xres_virtual, var->yres_virtual,