diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-09-19 05:00:54 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:06:17 -0400 |
commit | 873ecd8f8f5eed877df74e54e7c20aee9ef887e5 (patch) | |
tree | 8ed37879cf4d8e28ae6df8b59b852febf6acf658 /drivers/media | |
parent | 401e5f8d38f539765cf550fa76b684d10975840c (diff) |
V4L/DVB: cpia2: remove V4L1 support from this driver
V4L1 is deprecated and will be removed completely soon.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/cpia2/Kconfig | 2 | ||||
-rw-r--r-- | drivers/media/video/cpia2/cpia2.h | 8 | ||||
-rw-r--r-- | drivers/media/video/cpia2/cpia2_core.c | 51 | ||||
-rw-r--r-- | drivers/media/video/cpia2/cpia2_v4l.c | 332 | ||||
-rw-r--r-- | drivers/media/video/cpia2/cpia2dev.h | 4 |
5 files changed, 51 insertions, 346 deletions
diff --git a/drivers/media/video/cpia2/Kconfig b/drivers/media/video/cpia2/Kconfig index e39a96152004..66e9283f5993 100644 --- a/drivers/media/video/cpia2/Kconfig +++ b/drivers/media/video/cpia2/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_CPIA2 | 1 | config VIDEO_CPIA2 |
2 | tristate "CPiA2 Video For Linux" | 2 | tristate "CPiA2 Video For Linux" |
3 | depends on VIDEO_DEV && USB && VIDEO_V4L1 | 3 | depends on VIDEO_DEV && USB && VIDEO_V4L2 |
4 | ---help--- | 4 | ---help--- |
5 | This is the video4linux driver for cameras based on Vision's CPiA2 | 5 | This is the video4linux driver for cameras based on Vision's CPiA2 |
6 | (Colour Processor Interface ASIC), such as the Digital Blue QX5 | 6 | (Colour Processor Interface ASIC), such as the Digital Blue QX5 |
diff --git a/drivers/media/video/cpia2/cpia2.h b/drivers/media/video/cpia2/cpia2.h index 8d2dfc128821..916c13d5cf7d 100644 --- a/drivers/media/video/cpia2/cpia2.h +++ b/drivers/media/video/cpia2/cpia2.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #define __CPIA2_H__ | 32 | #define __CPIA2_H__ |
33 | 33 | ||
34 | #include <linux/version.h> | 34 | #include <linux/version.h> |
35 | #include <linux/videodev.h> | 35 | #include <linux/videodev2.h> |
36 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
37 | #include <linux/usb.h> | 37 | #include <linux/usb.h> |
38 | #include <linux/poll.h> | 38 | #include <linux/poll.h> |
@@ -43,7 +43,7 @@ | |||
43 | /* define for verbose debug output */ | 43 | /* define for verbose debug output */ |
44 | //#define _CPIA2_DEBUG_ | 44 | //#define _CPIA2_DEBUG_ |
45 | 45 | ||
46 | #define CPIA2_MAJ_VER 2 | 46 | #define CPIA2_MAJ_VER 3 |
47 | #define CPIA2_MIN_VER 0 | 47 | #define CPIA2_MIN_VER 0 |
48 | #define CPIA2_PATCH_VER 0 | 48 | #define CPIA2_PATCH_VER 0 |
49 | 49 | ||
@@ -396,8 +396,8 @@ struct camera_data { | |||
396 | /* v4l */ | 396 | /* v4l */ |
397 | int video_size; /* VIDEO_SIZE_ */ | 397 | int video_size; /* VIDEO_SIZE_ */ |
398 | struct video_device *vdev; /* v4l videodev */ | 398 | struct video_device *vdev; /* v4l videodev */ |
399 | struct video_picture vp; /* v4l camera settings */ | 399 | u32 width; |
400 | struct video_window vw; /* v4l capture area */ | 400 | u32 height; /* Its size */ |
401 | __u32 pixelformat; /* Format fourcc */ | 401 | __u32 pixelformat; /* Format fourcc */ |
402 | 402 | ||
403 | /* USB */ | 403 | /* USB */ |
diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c index 1cc0df8befff..9606bc01b803 100644 --- a/drivers/media/video/cpia2/cpia2_core.c +++ b/drivers/media/video/cpia2/cpia2_core.c | |||
@@ -1058,44 +1058,44 @@ static int set_vw_size(struct camera_data *cam, int size) | |||
1058 | DBG("Setting size to VGA\n"); | 1058 | DBG("Setting size to VGA\n"); |
1059 | cam->params.roi.width = STV_IMAGE_VGA_COLS; | 1059 | cam->params.roi.width = STV_IMAGE_VGA_COLS; |
1060 | cam->params.roi.height = STV_IMAGE_VGA_ROWS; | 1060 | cam->params.roi.height = STV_IMAGE_VGA_ROWS; |
1061 | cam->vw.width = STV_IMAGE_VGA_COLS; | 1061 | cam->width = STV_IMAGE_VGA_COLS; |
1062 | cam->vw.height = STV_IMAGE_VGA_ROWS; | 1062 | cam->height = STV_IMAGE_VGA_ROWS; |
1063 | break; | 1063 | break; |
1064 | case VIDEOSIZE_CIF: | 1064 | case VIDEOSIZE_CIF: |
1065 | DBG("Setting size to CIF\n"); | 1065 | DBG("Setting size to CIF\n"); |
1066 | cam->params.roi.width = STV_IMAGE_CIF_COLS; | 1066 | cam->params.roi.width = STV_IMAGE_CIF_COLS; |
1067 | cam->params.roi.height = STV_IMAGE_CIF_ROWS; | 1067 | cam->params.roi.height = STV_IMAGE_CIF_ROWS; |
1068 | cam->vw.width = STV_IMAGE_CIF_COLS; | 1068 | cam->width = STV_IMAGE_CIF_COLS; |
1069 | cam->vw.height = STV_IMAGE_CIF_ROWS; | 1069 | cam->height = STV_IMAGE_CIF_ROWS; |
1070 | break; | 1070 | break; |
1071 | case VIDEOSIZE_QVGA: | 1071 | case VIDEOSIZE_QVGA: |
1072 | DBG("Setting size to QVGA\n"); | 1072 | DBG("Setting size to QVGA\n"); |
1073 | cam->params.roi.width = STV_IMAGE_QVGA_COLS; | 1073 | cam->params.roi.width = STV_IMAGE_QVGA_COLS; |
1074 | cam->params.roi.height = STV_IMAGE_QVGA_ROWS; | 1074 | cam->params.roi.height = STV_IMAGE_QVGA_ROWS; |
1075 | cam->vw.width = STV_IMAGE_QVGA_COLS; | 1075 | cam->width = STV_IMAGE_QVGA_COLS; |
1076 | cam->vw.height = STV_IMAGE_QVGA_ROWS; | 1076 | cam->height = STV_IMAGE_QVGA_ROWS; |
1077 | break; | 1077 | break; |
1078 | case VIDEOSIZE_288_216: | 1078 | case VIDEOSIZE_288_216: |
1079 | cam->params.roi.width = 288; | 1079 | cam->params.roi.width = 288; |
1080 | cam->params.roi.height = 216; | 1080 | cam->params.roi.height = 216; |
1081 | cam->vw.width = 288; | 1081 | cam->width = 288; |
1082 | cam->vw.height = 216; | 1082 | cam->height = 216; |
1083 | break; | 1083 | break; |
1084 | case VIDEOSIZE_256_192: | 1084 | case VIDEOSIZE_256_192: |
1085 | cam->vw.width = 256; | 1085 | cam->width = 256; |
1086 | cam->vw.height = 192; | 1086 | cam->height = 192; |
1087 | cam->params.roi.width = 256; | 1087 | cam->params.roi.width = 256; |
1088 | cam->params.roi.height = 192; | 1088 | cam->params.roi.height = 192; |
1089 | break; | 1089 | break; |
1090 | case VIDEOSIZE_224_168: | 1090 | case VIDEOSIZE_224_168: |
1091 | cam->vw.width = 224; | 1091 | cam->width = 224; |
1092 | cam->vw.height = 168; | 1092 | cam->height = 168; |
1093 | cam->params.roi.width = 224; | 1093 | cam->params.roi.width = 224; |
1094 | cam->params.roi.height = 168; | 1094 | cam->params.roi.height = 168; |
1095 | break; | 1095 | break; |
1096 | case VIDEOSIZE_192_144: | 1096 | case VIDEOSIZE_192_144: |
1097 | cam->vw.width = 192; | 1097 | cam->width = 192; |
1098 | cam->vw.height = 144; | 1098 | cam->height = 144; |
1099 | cam->params.roi.width = 192; | 1099 | cam->params.roi.width = 192; |
1100 | cam->params.roi.height = 144; | 1100 | cam->params.roi.height = 144; |
1101 | break; | 1101 | break; |
@@ -1103,8 +1103,8 @@ static int set_vw_size(struct camera_data *cam, int size) | |||
1103 | DBG("Setting size to QCIF\n"); | 1103 | DBG("Setting size to QCIF\n"); |
1104 | cam->params.roi.width = STV_IMAGE_QCIF_COLS; | 1104 | cam->params.roi.width = STV_IMAGE_QCIF_COLS; |
1105 | cam->params.roi.height = STV_IMAGE_QCIF_ROWS; | 1105 | cam->params.roi.height = STV_IMAGE_QCIF_ROWS; |
1106 | cam->vw.width = STV_IMAGE_QCIF_COLS; | 1106 | cam->width = STV_IMAGE_QCIF_COLS; |
1107 | cam->vw.height = STV_IMAGE_QCIF_ROWS; | 1107 | cam->height = STV_IMAGE_QCIF_ROWS; |
1108 | break; | 1108 | break; |
1109 | default: | 1109 | default: |
1110 | retval = -EINVAL; | 1110 | retval = -EINVAL; |
@@ -2224,23 +2224,8 @@ static void reset_camera_struct(struct camera_data *cam) | |||
2224 | cam->params.roi.height = STV_IMAGE_CIF_ROWS; | 2224 | cam->params.roi.height = STV_IMAGE_CIF_ROWS; |
2225 | } | 2225 | } |
2226 | 2226 | ||
2227 | /*** | 2227 | cam->width = cam->params.roi.width; |
2228 | * Fill in the v4l structures. video_cap is filled in inside the VIDIOCCAP | 2228 | cam->height = cam->params.roi.height; |
2229 | * Ioctl. Here, just do the window and picture stucts. | ||
2230 | ***/ | ||
2231 | cam->vp.palette = (u16) VIDEO_PALETTE_RGB24; /* Is this right? */ | ||
2232 | cam->vp.brightness = (u16) cam->params.color_params.brightness * 256; | ||
2233 | cam->vp.colour = (u16) cam->params.color_params.saturation * 256; | ||
2234 | cam->vp.contrast = (u16) cam->params.color_params.contrast * 256; | ||
2235 | |||
2236 | cam->vw.x = 0; | ||
2237 | cam->vw.y = 0; | ||
2238 | cam->vw.width = cam->params.roi.width; | ||
2239 | cam->vw.height = cam->params.roi.height; | ||
2240 | cam->vw.flags = 0; | ||
2241 | cam->vw.clipcount = 0; | ||
2242 | |||
2243 | return; | ||
2244 | } | 2229 | } |
2245 | 2230 | ||
2246 | /****************************************************************************** | 2231 | /****************************************************************************** |
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 5520789854da..46b433bbf2c1 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/videodev.h> | 40 | #include <linux/videodev2.h> |
41 | #include <linux/stringify.h> | 41 | #include <linux/stringify.h> |
42 | #include <media/v4l2-ioctl.h> | 42 | #include <media/v4l2-ioctl.h> |
43 | 43 | ||
@@ -391,113 +391,6 @@ static unsigned int cpia2_v4l_poll(struct file *filp, struct poll_table_struct * | |||
391 | } | 391 | } |
392 | 392 | ||
393 | 393 | ||
394 | /****************************************************************************** | ||
395 | * | ||
396 | * ioctl_cap_query | ||
397 | * | ||
398 | *****************************************************************************/ | ||
399 | static int ioctl_cap_query(void *arg, struct camera_data *cam) | ||
400 | { | ||
401 | struct video_capability *vc; | ||
402 | int retval = 0; | ||
403 | vc = arg; | ||
404 | |||
405 | if (cam->params.pnp_id.product == 0x151) | ||
406 | strcpy(vc->name, "QX5 Microscope"); | ||
407 | else | ||
408 | strcpy(vc->name, "CPiA2 Camera"); | ||
409 | |||
410 | vc->type = VID_TYPE_CAPTURE | VID_TYPE_MJPEG_ENCODER; | ||
411 | vc->channels = 1; | ||
412 | vc->audios = 0; | ||
413 | vc->minwidth = 176; /* VIDEOSIZE_QCIF */ | ||
414 | vc->minheight = 144; | ||
415 | switch (cam->params.version.sensor_flags) { | ||
416 | case CPIA2_VP_SENSOR_FLAGS_500: | ||
417 | vc->maxwidth = STV_IMAGE_VGA_COLS; | ||
418 | vc->maxheight = STV_IMAGE_VGA_ROWS; | ||
419 | break; | ||
420 | case CPIA2_VP_SENSOR_FLAGS_410: | ||
421 | vc->maxwidth = STV_IMAGE_CIF_COLS; | ||
422 | vc->maxheight = STV_IMAGE_CIF_ROWS; | ||
423 | break; | ||
424 | default: | ||
425 | return -EINVAL; | ||
426 | } | ||
427 | |||
428 | return retval; | ||
429 | } | ||
430 | |||
431 | /****************************************************************************** | ||
432 | * | ||
433 | * ioctl_get_channel | ||
434 | * | ||
435 | *****************************************************************************/ | ||
436 | static int ioctl_get_channel(void *arg) | ||
437 | { | ||
438 | int retval = 0; | ||
439 | struct video_channel *v; | ||
440 | v = arg; | ||
441 | |||
442 | if (v->channel != 0) | ||
443 | return -EINVAL; | ||
444 | |||
445 | v->channel = 0; | ||
446 | strcpy(v->name, "Camera"); | ||
447 | v->tuners = 0; | ||
448 | v->flags = 0; | ||
449 | v->type = VIDEO_TYPE_CAMERA; | ||
450 | v->norm = 0; | ||
451 | |||
452 | return retval; | ||
453 | } | ||
454 | |||
455 | /****************************************************************************** | ||
456 | * | ||
457 | * ioctl_set_channel | ||
458 | * | ||
459 | *****************************************************************************/ | ||
460 | static int ioctl_set_channel(void *arg) | ||
461 | { | ||
462 | struct video_channel *v; | ||
463 | int retval = 0; | ||
464 | v = arg; | ||
465 | |||
466 | if (retval == 0 && v->channel != 0) | ||
467 | retval = -EINVAL; | ||
468 | |||
469 | return retval; | ||
470 | } | ||
471 | |||
472 | /****************************************************************************** | ||
473 | * | ||
474 | * ioctl_set_image_prop | ||
475 | * | ||
476 | *****************************************************************************/ | ||
477 | static int ioctl_set_image_prop(void *arg, struct camera_data *cam) | ||
478 | { | ||
479 | struct video_picture *vp; | ||
480 | int retval = 0; | ||
481 | vp = arg; | ||
482 | |||
483 | /* brightness, color, contrast need no check 0-65535 */ | ||
484 | memcpy(&cam->vp, vp, sizeof(*vp)); | ||
485 | |||
486 | /* update cam->params.colorParams */ | ||
487 | cam->params.color_params.brightness = vp->brightness / 256; | ||
488 | cam->params.color_params.saturation = vp->colour / 256; | ||
489 | cam->params.color_params.contrast = vp->contrast / 256; | ||
490 | |||
491 | DBG("Requested params: bright 0x%X, sat 0x%X, contrast 0x%X\n", | ||
492 | cam->params.color_params.brightness, | ||
493 | cam->params.color_params.saturation, | ||
494 | cam->params.color_params.contrast); | ||
495 | |||
496 | cpia2_set_color_params(cam); | ||
497 | |||
498 | return retval; | ||
499 | } | ||
500 | |||
501 | static int sync(struct camera_data *cam, int frame_nr) | 394 | static int sync(struct camera_data *cam, int frame_nr) |
502 | { | 395 | { |
503 | struct framebuf *frame = &cam->buffers[frame_nr]; | 396 | struct framebuf *frame = &cam->buffers[frame_nr]; |
@@ -526,61 +419,10 @@ static int sync(struct camera_data *cam, int frame_nr) | |||
526 | 419 | ||
527 | /****************************************************************************** | 420 | /****************************************************************************** |
528 | * | 421 | * |
529 | * ioctl_set_window_size | ||
530 | * | ||
531 | *****************************************************************************/ | ||
532 | static int ioctl_set_window_size(void *arg, struct camera_data *cam, | ||
533 | struct cpia2_fh *fh) | ||
534 | { | ||
535 | /* copy_from_user, check validity, copy to internal structure */ | ||
536 | struct video_window *vw; | ||
537 | int frame, err; | ||
538 | vw = arg; | ||
539 | |||
540 | if (vw->clipcount != 0) /* clipping not supported */ | ||
541 | return -EINVAL; | ||
542 | |||
543 | if (vw->clips != NULL) /* clipping not supported */ | ||
544 | return -EINVAL; | ||
545 | |||
546 | /* Ensure that only this process can change the format. */ | ||
547 | err = v4l2_prio_change(&cam->prio, &fh->prio, V4L2_PRIORITY_RECORD); | ||
548 | if(err != 0) | ||
549 | return err; | ||
550 | |||
551 | cam->pixelformat = V4L2_PIX_FMT_JPEG; | ||
552 | |||
553 | /* Be sure to supply the Huffman tables, this isn't MJPEG */ | ||
554 | cam->params.compression.inhibit_htables = 0; | ||
555 | |||
556 | /* we set the video window to something smaller or equal to what | ||
557 | * is requested by the user??? | ||
558 | */ | ||
559 | DBG("Requested width = %d, height = %d\n", vw->width, vw->height); | ||
560 | if (vw->width != cam->vw.width || vw->height != cam->vw.height) { | ||
561 | cam->vw.width = vw->width; | ||
562 | cam->vw.height = vw->height; | ||
563 | cam->params.roi.width = vw->width; | ||
564 | cam->params.roi.height = vw->height; | ||
565 | cpia2_set_format(cam); | ||
566 | } | ||
567 | |||
568 | for (frame = 0; frame < cam->num_frames; ++frame) { | ||
569 | if (cam->buffers[frame].status == FRAME_READING) | ||
570 | if ((err = sync(cam, frame)) < 0) | ||
571 | return err; | ||
572 | |||
573 | cam->buffers[frame].status = FRAME_EMPTY; | ||
574 | } | ||
575 | |||
576 | return 0; | ||
577 | } | ||
578 | |||
579 | /****************************************************************************** | ||
580 | * | ||
581 | * ioctl_get_mbuf | 422 | * ioctl_get_mbuf |
582 | * | 423 | * |
583 | *****************************************************************************/ | 424 | *****************************************************************************/ |
425 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
584 | static int ioctl_get_mbuf(void *arg, struct camera_data *cam) | 426 | static int ioctl_get_mbuf(void *arg, struct camera_data *cam) |
585 | { | 427 | { |
586 | struct video_mbuf *vm; | 428 | struct video_mbuf *vm; |
@@ -595,66 +437,7 @@ static int ioctl_get_mbuf(void *arg, struct camera_data *cam) | |||
595 | 437 | ||
596 | return 0; | 438 | return 0; |
597 | } | 439 | } |
598 | 440 | #endif | |
599 | /****************************************************************************** | ||
600 | * | ||
601 | * ioctl_mcapture | ||
602 | * | ||
603 | *****************************************************************************/ | ||
604 | static int ioctl_mcapture(void *arg, struct camera_data *cam, | ||
605 | struct cpia2_fh *fh) | ||
606 | { | ||
607 | struct video_mmap *vm; | ||
608 | int video_size, err; | ||
609 | vm = arg; | ||
610 | |||
611 | if (vm->frame < 0 || vm->frame >= cam->num_frames) | ||
612 | return -EINVAL; | ||
613 | |||
614 | /* set video size */ | ||
615 | video_size = cpia2_match_video_size(vm->width, vm->height); | ||
616 | if (cam->video_size < 0) { | ||
617 | return -EINVAL; | ||
618 | } | ||
619 | |||
620 | /* Ensure that only this process can change the format. */ | ||
621 | err = v4l2_prio_change(&cam->prio, &fh->prio, V4L2_PRIORITY_RECORD); | ||
622 | if(err != 0) | ||
623 | return err; | ||
624 | |||
625 | if (video_size != cam->video_size) { | ||
626 | cam->video_size = video_size; | ||
627 | cam->params.roi.width = vm->width; | ||
628 | cam->params.roi.height = vm->height; | ||
629 | cpia2_set_format(cam); | ||
630 | } | ||
631 | |||
632 | if (cam->buffers[vm->frame].status == FRAME_READING) | ||
633 | if ((err=sync(cam, vm->frame)) < 0) | ||
634 | return err; | ||
635 | |||
636 | cam->buffers[vm->frame].status = FRAME_EMPTY; | ||
637 | |||
638 | return cpia2_usb_stream_start(cam,cam->params.camera_state.stream_mode); | ||
639 | } | ||
640 | |||
641 | /****************************************************************************** | ||
642 | * | ||
643 | * ioctl_sync | ||
644 | * | ||
645 | *****************************************************************************/ | ||
646 | static int ioctl_sync(void *arg, struct camera_data *cam) | ||
647 | { | ||
648 | int frame; | ||
649 | |||
650 | frame = *(int*)arg; | ||
651 | |||
652 | if (frame < 0 || frame >= cam->num_frames) | ||
653 | return -EINVAL; | ||
654 | |||
655 | return sync(cam, frame); | ||
656 | } | ||
657 | |||
658 | 441 | ||
659 | /****************************************************************************** | 442 | /****************************************************************************** |
660 | * | 443 | * |
@@ -897,10 +680,10 @@ static int ioctl_set_fmt(void *arg,struct camera_data *cam, struct cpia2_fh *fh) | |||
897 | */ | 680 | */ |
898 | DBG("Requested width = %d, height = %d\n", | 681 | DBG("Requested width = %d, height = %d\n", |
899 | f->fmt.pix.width, f->fmt.pix.height); | 682 | f->fmt.pix.width, f->fmt.pix.height); |
900 | if (f->fmt.pix.width != cam->vw.width || | 683 | if (f->fmt.pix.width != cam->width || |
901 | f->fmt.pix.height != cam->vw.height) { | 684 | f->fmt.pix.height != cam->height) { |
902 | cam->vw.width = f->fmt.pix.width; | 685 | cam->width = f->fmt.pix.width; |
903 | cam->vw.height = f->fmt.pix.height; | 686 | cam->height = f->fmt.pix.height; |
904 | cam->params.roi.width = f->fmt.pix.width; | 687 | cam->params.roi.width = f->fmt.pix.width; |
905 | cam->params.roi.height = f->fmt.pix.height; | 688 | cam->params.roi.height = f->fmt.pix.height; |
906 | cpia2_set_format(cam); | 689 | cpia2_set_format(cam); |
@@ -932,8 +715,8 @@ static int ioctl_get_fmt(void *arg,struct camera_data *cam) | |||
932 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 715 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
933 | return -EINVAL; | 716 | return -EINVAL; |
934 | 717 | ||
935 | f->fmt.pix.width = cam->vw.width; | 718 | f->fmt.pix.width = cam->width; |
936 | f->fmt.pix.height = cam->vw.height; | 719 | f->fmt.pix.height = cam->height; |
937 | f->fmt.pix.pixelformat = cam->pixelformat; | 720 | f->fmt.pix.pixelformat = cam->pixelformat; |
938 | f->fmt.pix.field = V4L2_FIELD_NONE; | 721 | f->fmt.pix.field = V4L2_FIELD_NONE; |
939 | f->fmt.pix.bytesperline = 0; | 722 | f->fmt.pix.bytesperline = 0; |
@@ -962,12 +745,12 @@ static int ioctl_cropcap(void *arg,struct camera_data *cam) | |||
962 | 745 | ||
963 | c->bounds.left = 0; | 746 | c->bounds.left = 0; |
964 | c->bounds.top = 0; | 747 | c->bounds.top = 0; |
965 | c->bounds.width = cam->vw.width; | 748 | c->bounds.width = cam->width; |
966 | c->bounds.height = cam->vw.height; | 749 | c->bounds.height = cam->height; |
967 | c->defrect.left = 0; | 750 | c->defrect.left = 0; |
968 | c->defrect.top = 0; | 751 | c->defrect.top = 0; |
969 | c->defrect.width = cam->vw.width; | 752 | c->defrect.width = cam->width; |
970 | c->defrect.height = cam->vw.height; | 753 | c->defrect.height = cam->height; |
971 | c->pixelaspect.numerator = 1; | 754 | c->pixelaspect.numerator = 1; |
972 | c->pixelaspect.denominator = 1; | 755 | c->pixelaspect.denominator = 1; |
973 | 756 | ||
@@ -1587,8 +1370,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1587 | 1370 | ||
1588 | /* Priority check */ | 1371 | /* Priority check */ |
1589 | switch (cmd) { | 1372 | switch (cmd) { |
1590 | case VIDIOCSWIN: | ||
1591 | case VIDIOCMCAPTURE: | ||
1592 | case VIDIOC_S_FMT: | 1373 | case VIDIOC_S_FMT: |
1593 | { | 1374 | { |
1594 | struct cpia2_fh *fh = file->private_data; | 1375 | struct cpia2_fh *fh = file->private_data; |
@@ -1599,8 +1380,8 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1599 | } | 1380 | } |
1600 | break; | 1381 | break; |
1601 | } | 1382 | } |
1383 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1602 | case VIDIOCGMBUF: | 1384 | case VIDIOCGMBUF: |
1603 | case VIDIOCSYNC: | ||
1604 | { | 1385 | { |
1605 | struct cpia2_fh *fh = file->private_data; | 1386 | struct cpia2_fh *fh = file->private_data; |
1606 | if(fh->prio != V4L2_PRIORITY_RECORD) { | 1387 | if(fh->prio != V4L2_PRIORITY_RECORD) { |
@@ -1609,68 +1390,21 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1609 | } | 1390 | } |
1610 | break; | 1391 | break; |
1611 | } | 1392 | } |
1393 | #endif | ||
1612 | default: | 1394 | default: |
1613 | break; | 1395 | break; |
1614 | } | 1396 | } |
1615 | 1397 | ||
1616 | switch (cmd) { | 1398 | switch (cmd) { |
1617 | case VIDIOCGCAP: /* query capabilities */ | ||
1618 | retval = ioctl_cap_query(arg, cam); | ||
1619 | break; | ||
1620 | |||
1621 | case VIDIOCGCHAN: /* get video source - we are a camera, nothing else */ | ||
1622 | retval = ioctl_get_channel(arg); | ||
1623 | break; | ||
1624 | case VIDIOCSCHAN: /* set video source - we are a camera, nothing else */ | ||
1625 | retval = ioctl_set_channel(arg); | ||
1626 | break; | ||
1627 | case VIDIOCGPICT: /* image properties */ | ||
1628 | memcpy(arg, &cam->vp, sizeof(struct video_picture)); | ||
1629 | break; | ||
1630 | case VIDIOCSPICT: | ||
1631 | retval = ioctl_set_image_prop(arg, cam); | ||
1632 | break; | ||
1633 | case VIDIOCGWIN: /* get/set capture window */ | ||
1634 | memcpy(arg, &cam->vw, sizeof(struct video_window)); | ||
1635 | break; | ||
1636 | case VIDIOCSWIN: | ||
1637 | retval = ioctl_set_window_size(arg, cam, file->private_data); | ||
1638 | break; | ||
1639 | case VIDIOCGMBUF: /* mmap interface */ | ||
1640 | retval = ioctl_get_mbuf(arg, cam); | ||
1641 | break; | ||
1642 | case VIDIOCMCAPTURE: | ||
1643 | retval = ioctl_mcapture(arg, cam, file->private_data); | ||
1644 | break; | ||
1645 | case VIDIOCSYNC: | ||
1646 | retval = ioctl_sync(arg, cam); | ||
1647 | break; | ||
1648 | /* pointless to implement overlay with this camera */ | ||
1649 | case VIDIOCCAPTURE: | ||
1650 | case VIDIOCGFBUF: | ||
1651 | case VIDIOCSFBUF: | ||
1652 | case VIDIOCKEY: | ||
1653 | retval = -EINVAL; | ||
1654 | break; | ||
1655 | |||
1656 | /* tuner interface - we have none */ | ||
1657 | case VIDIOCGTUNER: | ||
1658 | case VIDIOCSTUNER: | ||
1659 | case VIDIOCGFREQ: | ||
1660 | case VIDIOCSFREQ: | ||
1661 | retval = -EINVAL; | ||
1662 | break; | ||
1663 | |||
1664 | /* audio interface - we have none */ | ||
1665 | case VIDIOCGAUDIO: | ||
1666 | case VIDIOCSAUDIO: | ||
1667 | retval = -EINVAL; | ||
1668 | break; | ||
1669 | |||
1670 | /* CPIA2 extension to Video4Linux API */ | 1399 | /* CPIA2 extension to Video4Linux API */ |
1671 | case CPIA2_IOC_SET_GPIO: | 1400 | case CPIA2_IOC_SET_GPIO: |
1672 | retval = ioctl_set_gpio(arg, cam); | 1401 | retval = ioctl_set_gpio(arg, cam); |
1673 | break; | 1402 | break; |
1403 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1404 | case VIDIOCGMBUF: /* mmap interface */ | ||
1405 | retval = ioctl_get_mbuf(arg, cam); | ||
1406 | break; | ||
1407 | #endif | ||
1674 | case VIDIOC_QUERYCAP: | 1408 | case VIDIOC_QUERYCAP: |
1675 | retval = ioctl_querycap(arg,cam); | 1409 | retval = ioctl_querycap(arg,cam); |
1676 | break; | 1410 | break; |
@@ -1874,21 +1608,8 @@ static int cpia2_mmap(struct file *file, struct vm_area_struct *area) | |||
1874 | *****************************************************************************/ | 1608 | *****************************************************************************/ |
1875 | static void reset_camera_struct_v4l(struct camera_data *cam) | 1609 | static void reset_camera_struct_v4l(struct camera_data *cam) |
1876 | { | 1610 | { |
1877 | /*** | 1611 | cam->width = cam->params.roi.width; |
1878 | * Fill in the v4l structures. video_cap is filled in inside the VIDIOCCAP | 1612 | cam->height = cam->params.roi.height; |
1879 | * Ioctl. Here, just do the window and picture stucts. | ||
1880 | ***/ | ||
1881 | cam->vp.palette = (u16) VIDEO_PALETTE_RGB24; /* Is this right? */ | ||
1882 | cam->vp.brightness = (u16) cam->params.color_params.brightness * 256; | ||
1883 | cam->vp.colour = (u16) cam->params.color_params.saturation * 256; | ||
1884 | cam->vp.contrast = (u16) cam->params.color_params.contrast * 256; | ||
1885 | |||
1886 | cam->vw.x = 0; | ||
1887 | cam->vw.y = 0; | ||
1888 | cam->vw.width = cam->params.roi.width; | ||
1889 | cam->vw.height = cam->params.roi.height; | ||
1890 | cam->vw.flags = 0; | ||
1891 | cam->vw.clipcount = 0; | ||
1892 | 1613 | ||
1893 | cam->frame_size = buffer_size; | 1614 | cam->frame_size = buffer_size; |
1894 | cam->num_frames = num_buffers; | 1615 | cam->num_frames = num_buffers; |
@@ -1902,13 +1623,12 @@ static void reset_camera_struct_v4l(struct camera_data *cam) | |||
1902 | 1623 | ||
1903 | cam->pixelformat = V4L2_PIX_FMT_JPEG; | 1624 | cam->pixelformat = V4L2_PIX_FMT_JPEG; |
1904 | v4l2_prio_init(&cam->prio); | 1625 | v4l2_prio_init(&cam->prio); |
1905 | return; | ||
1906 | } | 1626 | } |
1907 | 1627 | ||
1908 | /*** | 1628 | /*** |
1909 | * The v4l video device structure initialized for this device | 1629 | * The v4l video device structure initialized for this device |
1910 | ***/ | 1630 | ***/ |
1911 | static const struct v4l2_file_operations fops_template = { | 1631 | static const struct v4l2_file_operations cpia2_fops = { |
1912 | .owner = THIS_MODULE, | 1632 | .owner = THIS_MODULE, |
1913 | .open = cpia2_open, | 1633 | .open = cpia2_open, |
1914 | .release = cpia2_close, | 1634 | .release = cpia2_close, |
@@ -1920,9 +1640,9 @@ static const struct v4l2_file_operations fops_template = { | |||
1920 | 1640 | ||
1921 | static struct video_device cpia2_template = { | 1641 | static struct video_device cpia2_template = { |
1922 | /* I could not find any place for the old .initialize initializer?? */ | 1642 | /* I could not find any place for the old .initialize initializer?? */ |
1923 | .name= "CPiA2 Camera", | 1643 | .name = "CPiA2 Camera", |
1924 | .fops= &fops_template, | 1644 | .fops = &cpia2_fops, |
1925 | .release= video_device_release, | 1645 | .release = video_device_release, |
1926 | }; | 1646 | }; |
1927 | 1647 | ||
1928 | /****************************************************************************** | 1648 | /****************************************************************************** |
diff --git a/drivers/media/video/cpia2/cpia2dev.h b/drivers/media/video/cpia2/cpia2dev.h index d58097ce0d5e..f66691fe5a35 100644 --- a/drivers/media/video/cpia2/cpia2dev.h +++ b/drivers/media/video/cpia2/cpia2dev.h | |||
@@ -29,14 +29,14 @@ | |||
29 | #ifndef CPIA2_DEV_HEADER | 29 | #ifndef CPIA2_DEV_HEADER |
30 | #define CPIA2_DEV_HEADER | 30 | #define CPIA2_DEV_HEADER |
31 | 31 | ||
32 | #include <linux/videodev.h> | 32 | #include <linux/videodev2.h> |
33 | 33 | ||
34 | /*** | 34 | /*** |
35 | * The following defines are ioctl numbers based on video4linux private ioctls, | 35 | * The following defines are ioctl numbers based on video4linux private ioctls, |
36 | * which can range from 192 (BASE_VIDIOCPRIVATE) to 255. All of these take int | 36 | * which can range from 192 (BASE_VIDIOCPRIVATE) to 255. All of these take int |
37 | * args | 37 | * args |
38 | */ | 38 | */ |
39 | #define CPIA2_IOC_SET_GPIO _IOW('v', BASE_VIDIOCPRIVATE + 17, __u32) | 39 | #define CPIA2_IOC_SET_GPIO _IOW('v', BASE_VIDIOC_PRIVATE + 17, __u32) |
40 | 40 | ||
41 | /* V4L2 driver specific controls */ | 41 | /* V4L2 driver specific controls */ |
42 | #define CPIA2_CID_TARGET_KB (V4L2_CID_PRIVATE_BASE+0) | 42 | #define CPIA2_CID_TARGET_KB (V4L2_CID_PRIVATE_BASE+0) |