diff options
author | Douglas Schilling Landgraf <dougsland@gmail.com> | 2008-04-10 01:07:14 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:45 -0400 |
commit | 6ec6e0ced1bb9d85e29302e76f5340e3e49bd0b9 (patch) | |
tree | ce572650e7df85d5c027f4ce4b0b73dd68a97b10 /drivers | |
parent | 130ca945d83637046bde4943629f011e22831fd3 (diff) |
V4L/DVB (7666): meye: Replace meye_do_ioctl to use video_ioctl2
Convert meye to use video_ioctl2
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/meye.c | 1365 |
1 files changed, 655 insertions, 710 deletions
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 61c980193c10..e7ccbc895d7a 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c | |||
@@ -42,15 +42,10 @@ | |||
42 | #include <linux/meye.h> | 42 | #include <linux/meye.h> |
43 | 43 | ||
44 | MODULE_AUTHOR("Stelian Pop <stelian@popies.net>"); | 44 | MODULE_AUTHOR("Stelian Pop <stelian@popies.net>"); |
45 | MODULE_DESCRIPTION("v4l/v4l2 driver for the MotionEye camera"); | 45 | MODULE_DESCRIPTION("v4l2 driver for the MotionEye camera"); |
46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
47 | MODULE_VERSION(MEYE_DRIVER_VERSION); | 47 | MODULE_VERSION(MEYE_DRIVER_VERSION); |
48 | 48 | ||
49 | /* force usage of V4L1 API */ | ||
50 | static int forcev4l1; /* = 0 */ | ||
51 | module_param(forcev4l1, int, 0644); | ||
52 | MODULE_PARM_DESC(forcev4l1, "force use of V4L1 instead of V4L2"); | ||
53 | |||
54 | /* number of grab buffers */ | 49 | /* number of grab buffers */ |
55 | static unsigned int gbuffers = 2; | 50 | static unsigned int gbuffers = 2; |
56 | module_param(gbuffers, int, 0444); | 51 | module_param(gbuffers, int, 0444); |
@@ -876,803 +871,735 @@ static int meye_release(struct inode *inode, struct file *file) | |||
876 | return 0; | 871 | return 0; |
877 | } | 872 | } |
878 | 873 | ||
879 | static int meye_do_ioctl(struct inode *inode, struct file *file, | 874 | static int meyeioc_g_params(struct meye_params *p) |
880 | unsigned int cmd, void *arg) | ||
881 | { | 875 | { |
882 | switch (cmd) { | 876 | *p = meye.params; |
877 | return 0; | ||
878 | } | ||
883 | 879 | ||
884 | case VIDIOCGCAP: { | 880 | static int meyeioc_s_params(struct meye_params *jp) |
885 | struct video_capability *b = arg; | 881 | { |
886 | strcpy(b->name,meye.video_dev->name); | 882 | if (jp->subsample > 1) |
887 | b->type = VID_TYPE_CAPTURE; | 883 | return -EINVAL; |
888 | b->channels = 1; | ||
889 | b->audios = 0; | ||
890 | b->maxwidth = 640; | ||
891 | b->maxheight = 480; | ||
892 | b->minwidth = 320; | ||
893 | b->minheight = 240; | ||
894 | break; | ||
895 | } | ||
896 | 884 | ||
897 | case VIDIOCGCHAN: { | 885 | if (jp->quality > 10) |
898 | struct video_channel *v = arg; | 886 | return -EINVAL; |
899 | v->flags = 0; | ||
900 | v->tuners = 0; | ||
901 | v->type = VIDEO_TYPE_CAMERA; | ||
902 | if (v->channel != 0) | ||
903 | return -EINVAL; | ||
904 | strcpy(v->name,"Camera"); | ||
905 | break; | ||
906 | } | ||
907 | 887 | ||
908 | case VIDIOCSCHAN: { | 888 | if (jp->sharpness > 63 || jp->agc > 63 || jp->picture > 63) |
909 | struct video_channel *v = arg; | 889 | return -EINVAL; |
910 | if (v->channel != 0) | ||
911 | return -EINVAL; | ||
912 | break; | ||
913 | } | ||
914 | 890 | ||
915 | case VIDIOCGPICT: { | 891 | if (jp->framerate > 31) |
916 | struct video_picture *p = arg; | 892 | return -EINVAL; |
917 | *p = meye.picture; | ||
918 | break; | ||
919 | } | ||
920 | 893 | ||
921 | case VIDIOCSPICT: { | 894 | mutex_lock(&meye.lock); |
922 | struct video_picture *p = arg; | ||
923 | if (p->depth != 16) | ||
924 | return -EINVAL; | ||
925 | if (p->palette != VIDEO_PALETTE_YUV422 && p->palette != VIDEO_PALETTE_YUYV) | ||
926 | return -EINVAL; | ||
927 | mutex_lock(&meye.lock); | ||
928 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERABRIGHTNESS, | ||
929 | p->brightness >> 10); | ||
930 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAHUE, | ||
931 | p->hue >> 10); | ||
932 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERACOLOR, | ||
933 | p->colour >> 10); | ||
934 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERACONTRAST, | ||
935 | p->contrast >> 10); | ||
936 | meye.picture = *p; | ||
937 | mutex_unlock(&meye.lock); | ||
938 | break; | ||
939 | } | ||
940 | 895 | ||
941 | case VIDIOCSYNC: { | 896 | if (meye.params.subsample != jp->subsample || |
942 | int *i = arg; | 897 | meye.params.quality != jp->quality) |
943 | int unused; | 898 | mchip_hic_stop(); /* need restart */ |
899 | |||
900 | meye.params = *jp; | ||
901 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERASHARPNESS, | ||
902 | meye.params.sharpness); | ||
903 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, | ||
904 | meye.params.agc); | ||
905 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, | ||
906 | meye.params.picture); | ||
907 | mutex_unlock(&meye.lock); | ||
944 | 908 | ||
945 | if (*i < 0 || *i >= gbuffers) | 909 | return 0; |
946 | return -EINVAL; | 910 | } |
947 | 911 | ||
948 | mutex_lock(&meye.lock); | 912 | static int meyeioc_qbuf_capt(int *nb) |
913 | { | ||
914 | if (!meye.grab_fbuffer) | ||
915 | return -EINVAL; | ||
949 | 916 | ||
950 | switch (meye.grab_buffer[*i].state) { | 917 | if (*nb >= gbuffers) |
918 | return -EINVAL; | ||
951 | 919 | ||
952 | case MEYE_BUF_UNUSED: | 920 | if (*nb < 0) { |
953 | mutex_unlock(&meye.lock); | 921 | /* stop capture */ |
954 | return -EINVAL; | 922 | mchip_hic_stop(); |
955 | case MEYE_BUF_USING: | 923 | return 0; |
956 | if (file->f_flags & O_NONBLOCK) { | ||
957 | mutex_unlock(&meye.lock); | ||
958 | return -EAGAIN; | ||
959 | } | ||
960 | if (wait_event_interruptible(meye.proc_list, | ||
961 | (meye.grab_buffer[*i].state != MEYE_BUF_USING))) { | ||
962 | mutex_unlock(&meye.lock); | ||
963 | return -EINTR; | ||
964 | } | ||
965 | /* fall through */ | ||
966 | case MEYE_BUF_DONE: | ||
967 | meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; | ||
968 | kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int)); | ||
969 | } | ||
970 | mutex_unlock(&meye.lock); | ||
971 | break; | ||
972 | } | 924 | } |
973 | 925 | ||
974 | case VIDIOCMCAPTURE: { | 926 | if (meye.grab_buffer[*nb].state != MEYE_BUF_UNUSED) |
975 | struct video_mmap *vm = arg; | 927 | return -EBUSY; |
976 | int restart = 0; | ||
977 | |||
978 | if (vm->frame >= gbuffers || vm->frame < 0) | ||
979 | return -EINVAL; | ||
980 | if (vm->format != VIDEO_PALETTE_YUV422 && vm->format != VIDEO_PALETTE_YUYV) | ||
981 | return -EINVAL; | ||
982 | if (vm->height * vm->width * 2 > gbufsize) | ||
983 | return -EINVAL; | ||
984 | if (!meye.grab_fbuffer) | ||
985 | return -EINVAL; | ||
986 | if (meye.grab_buffer[vm->frame].state != MEYE_BUF_UNUSED) | ||
987 | return -EBUSY; | ||
988 | |||
989 | mutex_lock(&meye.lock); | ||
990 | if (vm->width == 640 && vm->height == 480) { | ||
991 | if (meye.params.subsample) { | ||
992 | meye.params.subsample = 0; | ||
993 | restart = 1; | ||
994 | } | ||
995 | } else if (vm->width == 320 && vm->height == 240) { | ||
996 | if (!meye.params.subsample) { | ||
997 | meye.params.subsample = 1; | ||
998 | restart = 1; | ||
999 | } | ||
1000 | } else { | ||
1001 | mutex_unlock(&meye.lock); | ||
1002 | return -EINVAL; | ||
1003 | } | ||
1004 | 928 | ||
1005 | if (restart || meye.mchip_mode != MCHIP_HIC_MODE_CONT_OUT) | 929 | mutex_lock(&meye.lock); |
1006 | mchip_continuous_start(); | ||
1007 | meye.grab_buffer[vm->frame].state = MEYE_BUF_USING; | ||
1008 | kfifo_put(meye.grabq, (unsigned char *)&vm->frame, sizeof(int)); | ||
1009 | mutex_unlock(&meye.lock); | ||
1010 | break; | ||
1011 | } | ||
1012 | 930 | ||
1013 | case VIDIOCGMBUF: { | 931 | if (meye.mchip_mode != MCHIP_HIC_MODE_CONT_COMP) |
1014 | struct video_mbuf *vm = arg; | 932 | mchip_cont_compression_start(); |
1015 | int i; | ||
1016 | 933 | ||
1017 | memset(vm, 0 , sizeof(*vm)); | 934 | meye.grab_buffer[*nb].state = MEYE_BUF_USING; |
1018 | vm->size = gbufsize * gbuffers; | 935 | kfifo_put(meye.grabq, (unsigned char *)nb, sizeof(int)); |
1019 | vm->frames = gbuffers; | 936 | mutex_unlock(&meye.lock); |
1020 | for (i = 0; i < gbuffers; i++) | ||
1021 | vm->offsets[i] = i * gbufsize; | ||
1022 | break; | ||
1023 | } | ||
1024 | 937 | ||
1025 | case MEYEIOC_G_PARAMS: { | 938 | return 0; |
1026 | struct meye_params *p = arg; | 939 | } |
1027 | *p = meye.params; | ||
1028 | break; | ||
1029 | } | ||
1030 | 940 | ||
1031 | case MEYEIOC_S_PARAMS: { | 941 | static int meyeioc_sync(struct file *file, void *fh, int *i) |
1032 | struct meye_params *jp = arg; | 942 | { |
1033 | if (jp->subsample > 1) | 943 | int unused; |
1034 | return -EINVAL; | ||
1035 | if (jp->quality > 10) | ||
1036 | return -EINVAL; | ||
1037 | if (jp->sharpness > 63 || jp->agc > 63 || jp->picture > 63) | ||
1038 | return -EINVAL; | ||
1039 | if (jp->framerate > 31) | ||
1040 | return -EINVAL; | ||
1041 | mutex_lock(&meye.lock); | ||
1042 | if (meye.params.subsample != jp->subsample || | ||
1043 | meye.params.quality != jp->quality) | ||
1044 | mchip_hic_stop(); /* need restart */ | ||
1045 | meye.params = *jp; | ||
1046 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERASHARPNESS, | ||
1047 | meye.params.sharpness); | ||
1048 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, | ||
1049 | meye.params.agc); | ||
1050 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, | ||
1051 | meye.params.picture); | ||
1052 | mutex_unlock(&meye.lock); | ||
1053 | break; | ||
1054 | } | ||
1055 | 944 | ||
1056 | case MEYEIOC_QBUF_CAPT: { | 945 | if (*i < 0 || *i >= gbuffers) |
1057 | int *nb = arg; | 946 | return -EINVAL; |
1058 | 947 | ||
1059 | if (!meye.grab_fbuffer) | 948 | mutex_lock(&meye.lock); |
1060 | return -EINVAL; | 949 | switch (meye.grab_buffer[*i].state) { |
1061 | if (*nb >= gbuffers) | 950 | |
1062 | return -EINVAL; | 951 | case MEYE_BUF_UNUSED: |
1063 | if (*nb < 0) { | ||
1064 | /* stop capture */ | ||
1065 | mchip_hic_stop(); | ||
1066 | return 0; | ||
1067 | } | ||
1068 | if (meye.grab_buffer[*nb].state != MEYE_BUF_UNUSED) | ||
1069 | return -EBUSY; | ||
1070 | mutex_lock(&meye.lock); | ||
1071 | if (meye.mchip_mode != MCHIP_HIC_MODE_CONT_COMP) | ||
1072 | mchip_cont_compression_start(); | ||
1073 | meye.grab_buffer[*nb].state = MEYE_BUF_USING; | ||
1074 | kfifo_put(meye.grabq, (unsigned char *)nb, sizeof(int)); | ||
1075 | mutex_unlock(&meye.lock); | 952 | mutex_unlock(&meye.lock); |
1076 | break; | 953 | return -EINVAL; |
954 | case MEYE_BUF_USING: | ||
955 | if (file->f_flags & O_NONBLOCK) { | ||
956 | mutex_unlock(&meye.lock); | ||
957 | return -EAGAIN; | ||
958 | } | ||
959 | if (wait_event_interruptible(meye.proc_list, | ||
960 | (meye.grab_buffer[*i].state != MEYE_BUF_USING))) { | ||
961 | mutex_unlock(&meye.lock); | ||
962 | return -EINTR; | ||
963 | } | ||
964 | /* fall through */ | ||
965 | case MEYE_BUF_DONE: | ||
966 | meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; | ||
967 | kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int)); | ||
1077 | } | 968 | } |
969 | *i = meye.grab_buffer[*i].size; | ||
970 | mutex_unlock(&meye.lock); | ||
971 | return 0; | ||
972 | } | ||
1078 | 973 | ||
1079 | case MEYEIOC_SYNC: { | 974 | static int meyeioc_stillcapt(void) |
1080 | int *i = arg; | 975 | { |
1081 | int unused; | 976 | if (!meye.grab_fbuffer) |
977 | return -EINVAL; | ||
1082 | 978 | ||
1083 | if (*i < 0 || *i >= gbuffers) | 979 | if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) |
1084 | return -EINVAL; | 980 | return -EBUSY; |
1085 | 981 | ||
1086 | mutex_lock(&meye.lock); | 982 | mutex_lock(&meye.lock); |
1087 | switch (meye.grab_buffer[*i].state) { | 983 | meye.grab_buffer[0].state = MEYE_BUF_USING; |
984 | mchip_take_picture(); | ||
1088 | 985 | ||
1089 | case MEYE_BUF_UNUSED: | 986 | mchip_get_picture(meye.grab_fbuffer, |
1090 | mutex_unlock(&meye.lock); | 987 | mchip_hsize() * mchip_vsize() * 2); |
1091 | return -EINVAL; | ||
1092 | case MEYE_BUF_USING: | ||
1093 | if (file->f_flags & O_NONBLOCK) { | ||
1094 | mutex_unlock(&meye.lock); | ||
1095 | return -EAGAIN; | ||
1096 | } | ||
1097 | if (wait_event_interruptible(meye.proc_list, | ||
1098 | (meye.grab_buffer[*i].state != MEYE_BUF_USING))) { | ||
1099 | mutex_unlock(&meye.lock); | ||
1100 | return -EINTR; | ||
1101 | } | ||
1102 | /* fall through */ | ||
1103 | case MEYE_BUF_DONE: | ||
1104 | meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; | ||
1105 | kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int)); | ||
1106 | } | ||
1107 | *i = meye.grab_buffer[*i].size; | ||
1108 | mutex_unlock(&meye.lock); | ||
1109 | break; | ||
1110 | } | ||
1111 | 988 | ||
1112 | case MEYEIOC_STILLCAPT: { | 989 | meye.grab_buffer[0].state = MEYE_BUF_DONE; |
990 | mutex_unlock(&meye.lock); | ||
1113 | 991 | ||
1114 | if (!meye.grab_fbuffer) | 992 | return 0; |
1115 | return -EINVAL; | 993 | } |
1116 | if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) | 994 | |
1117 | return -EBUSY; | 995 | static int meyeioc_stilljcapt(int *len) |
1118 | mutex_lock(&meye.lock); | 996 | { |
1119 | meye.grab_buffer[0].state = MEYE_BUF_USING; | 997 | if (!meye.grab_fbuffer) |
998 | return -EINVAL; | ||
999 | |||
1000 | if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) | ||
1001 | return -EBUSY; | ||
1002 | |||
1003 | mutex_lock(&meye.lock); | ||
1004 | meye.grab_buffer[0].state = MEYE_BUF_USING; | ||
1005 | *len = -1; | ||
1006 | |||
1007 | while (*len == -1) { | ||
1120 | mchip_take_picture(); | 1008 | mchip_take_picture(); |
1121 | mchip_get_picture( | 1009 | *len = mchip_compress_frame(meye.grab_fbuffer, gbufsize); |
1122 | meye.grab_fbuffer, | ||
1123 | mchip_hsize() * mchip_vsize() * 2); | ||
1124 | meye.grab_buffer[0].state = MEYE_BUF_DONE; | ||
1125 | mutex_unlock(&meye.lock); | ||
1126 | break; | ||
1127 | } | 1010 | } |
1128 | 1011 | ||
1129 | case MEYEIOC_STILLJCAPT: { | 1012 | meye.grab_buffer[0].state = MEYE_BUF_DONE; |
1130 | int *len = arg; | 1013 | mutex_unlock(&meye.lock); |
1131 | 1014 | return 0; | |
1132 | if (!meye.grab_fbuffer) | 1015 | } |
1133 | return -EINVAL; | ||
1134 | if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) | ||
1135 | return -EBUSY; | ||
1136 | mutex_lock(&meye.lock); | ||
1137 | meye.grab_buffer[0].state = MEYE_BUF_USING; | ||
1138 | *len = -1; | ||
1139 | while (*len == -1) { | ||
1140 | mchip_take_picture(); | ||
1141 | *len = mchip_compress_frame(meye.grab_fbuffer, gbufsize); | ||
1142 | } | ||
1143 | meye.grab_buffer[0].state = MEYE_BUF_DONE; | ||
1144 | mutex_unlock(&meye.lock); | ||
1145 | break; | ||
1146 | } | ||
1147 | 1016 | ||
1148 | case VIDIOC_QUERYCAP: { | 1017 | static int vidioc_querycap(struct file *file, void *fh, |
1149 | struct v4l2_capability *cap = arg; | 1018 | struct v4l2_capability *cap) |
1019 | { | ||
1020 | memset(cap, 0, sizeof(*cap)); | ||
1021 | strcpy(cap->driver, "meye"); | ||
1022 | strcpy(cap->card, "meye"); | ||
1023 | sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev)); | ||
1150 | 1024 | ||
1151 | if (forcev4l1) | 1025 | cap->version = (MEYE_DRIVER_MAJORVERSION << 8) + |
1152 | return -EINVAL; | 1026 | MEYE_DRIVER_MINORVERSION; |
1153 | 1027 | ||
1154 | memset(cap, 0, sizeof(*cap)); | 1028 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | |
1155 | strcpy(cap->driver, "meye"); | 1029 | V4L2_CAP_STREAMING; |
1156 | strcpy(cap->card, "meye"); | 1030 | |
1157 | sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev)); | 1031 | return 0; |
1158 | cap->version = (MEYE_DRIVER_MAJORVERSION << 8) + | 1032 | } |
1159 | MEYE_DRIVER_MINORVERSION; | 1033 | |
1160 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | | 1034 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) |
1161 | V4L2_CAP_STREAMING; | 1035 | { |
1162 | break; | 1036 | if (i->index != 0) |
1163 | } | 1037 | return -EINVAL; |
1164 | 1038 | ||
1165 | case VIDIOC_ENUMINPUT: { | 1039 | memset(i, 0, sizeof(*i)); |
1166 | struct v4l2_input *i = arg; | 1040 | i->index = 0; |
1041 | strcpy(i->name, "Camera"); | ||
1042 | i->type = V4L2_INPUT_TYPE_CAMERA; | ||
1167 | 1043 | ||
1168 | if (i->index != 0) | 1044 | return 0; |
1169 | return -EINVAL; | 1045 | } |
1170 | memset(i, 0, sizeof(*i)); | 1046 | |
1171 | i->index = 0; | 1047 | static int vidioc_g_input(struct file *file, void *fh, unsigned int *i) |
1172 | strcpy(i->name, "Camera"); | 1048 | { |
1173 | i->type = V4L2_INPUT_TYPE_CAMERA; | 1049 | *i = 0; |
1050 | return 0; | ||
1051 | } | ||
1052 | |||
1053 | static int vidioc_s_input(struct file *file, void *fh, unsigned int i) | ||
1054 | { | ||
1055 | if (i != 0) | ||
1056 | return -EINVAL; | ||
1057 | |||
1058 | return 0; | ||
1059 | } | ||
1060 | |||
1061 | static int vidioc_queryctrl(struct file *file, void *fh, | ||
1062 | struct v4l2_queryctrl *c) | ||
1063 | { | ||
1064 | switch (c->id) { | ||
1065 | |||
1066 | case V4L2_CID_BRIGHTNESS: | ||
1067 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1068 | strcpy(c->name, "Brightness"); | ||
1069 | c->minimum = 0; | ||
1070 | c->maximum = 63; | ||
1071 | c->step = 1; | ||
1072 | c->default_value = 32; | ||
1073 | c->flags = 0; | ||
1074 | break; | ||
1075 | case V4L2_CID_HUE: | ||
1076 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1077 | strcpy(c->name, "Hue"); | ||
1078 | c->minimum = 0; | ||
1079 | c->maximum = 63; | ||
1080 | c->step = 1; | ||
1081 | c->default_value = 32; | ||
1082 | c->flags = 0; | ||
1083 | break; | ||
1084 | case V4L2_CID_CONTRAST: | ||
1085 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1086 | strcpy(c->name, "Contrast"); | ||
1087 | c->minimum = 0; | ||
1088 | c->maximum = 63; | ||
1089 | c->step = 1; | ||
1090 | c->default_value = 32; | ||
1091 | c->flags = 0; | ||
1092 | break; | ||
1093 | case V4L2_CID_SATURATION: | ||
1094 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1095 | strcpy(c->name, "Saturation"); | ||
1096 | c->minimum = 0; | ||
1097 | c->maximum = 63; | ||
1098 | c->step = 1; | ||
1099 | c->default_value = 32; | ||
1100 | c->flags = 0; | ||
1101 | break; | ||
1102 | case V4L2_CID_AGC: | ||
1103 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1104 | strcpy(c->name, "Agc"); | ||
1105 | c->minimum = 0; | ||
1106 | c->maximum = 63; | ||
1107 | c->step = 1; | ||
1108 | c->default_value = 48; | ||
1109 | c->flags = 0; | ||
1174 | break; | 1110 | break; |
1111 | case V4L2_CID_MEYE_SHARPNESS: | ||
1112 | case V4L2_CID_SHARPNESS: | ||
1113 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1114 | strcpy(c->name, "Sharpness"); | ||
1115 | c->minimum = 0; | ||
1116 | c->maximum = 63; | ||
1117 | c->step = 1; | ||
1118 | c->default_value = 32; | ||
1119 | |||
1120 | /* Continue to report legacy private SHARPNESS ctrl but | ||
1121 | * say it is disabled in preference to ctrl in the spec | ||
1122 | */ | ||
1123 | c->flags = (c->id == V4L2_CID_SHARPNESS) ? 0 : | ||
1124 | V4L2_CTRL_FLAG_DISABLED; | ||
1125 | break; | ||
1126 | case V4L2_CID_PICTURE: | ||
1127 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1128 | strcpy(c->name, "Picture"); | ||
1129 | c->minimum = 0; | ||
1130 | c->maximum = 63; | ||
1131 | c->step = 1; | ||
1132 | c->default_value = 0; | ||
1133 | c->flags = 0; | ||
1134 | break; | ||
1135 | case V4L2_CID_JPEGQUAL: | ||
1136 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1137 | strcpy(c->name, "JPEG quality"); | ||
1138 | c->minimum = 0; | ||
1139 | c->maximum = 10; | ||
1140 | c->step = 1; | ||
1141 | c->default_value = 8; | ||
1142 | c->flags = 0; | ||
1143 | break; | ||
1144 | case V4L2_CID_FRAMERATE: | ||
1145 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1146 | strcpy(c->name, "Framerate"); | ||
1147 | c->minimum = 0; | ||
1148 | c->maximum = 31; | ||
1149 | c->step = 1; | ||
1150 | c->default_value = 0; | ||
1151 | c->flags = 0; | ||
1152 | break; | ||
1153 | default: | ||
1154 | return -EINVAL; | ||
1175 | } | 1155 | } |
1176 | 1156 | ||
1177 | case VIDIOC_G_INPUT: { | 1157 | return 0; |
1178 | int *i = arg; | 1158 | } |
1179 | 1159 | ||
1180 | *i = 0; | 1160 | static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) |
1161 | { | ||
1162 | mutex_lock(&meye.lock); | ||
1163 | switch (c->id) { | ||
1164 | case V4L2_CID_BRIGHTNESS: | ||
1165 | sony_pic_camera_command( | ||
1166 | SONY_PIC_COMMAND_SETCAMERABRIGHTNESS, c->value); | ||
1167 | meye.picture.brightness = c->value << 10; | ||
1168 | break; | ||
1169 | case V4L2_CID_HUE: | ||
1170 | sony_pic_camera_command( | ||
1171 | SONY_PIC_COMMAND_SETCAMERAHUE, c->value); | ||
1172 | meye.picture.hue = c->value << 10; | ||
1173 | break; | ||
1174 | case V4L2_CID_CONTRAST: | ||
1175 | sony_pic_camera_command( | ||
1176 | SONY_PIC_COMMAND_SETCAMERACONTRAST, c->value); | ||
1177 | meye.picture.contrast = c->value << 10; | ||
1178 | break; | ||
1179 | case V4L2_CID_SATURATION: | ||
1180 | sony_pic_camera_command( | ||
1181 | SONY_PIC_COMMAND_SETCAMERACOLOR, c->value); | ||
1182 | meye.picture.colour = c->value << 10; | ||
1183 | break; | ||
1184 | case V4L2_CID_AGC: | ||
1185 | sony_pic_camera_command( | ||
1186 | SONY_PIC_COMMAND_SETCAMERAAGC, c->value); | ||
1187 | meye.params.agc = c->value; | ||
1188 | break; | ||
1189 | case V4L2_CID_SHARPNESS: | ||
1190 | case V4L2_CID_MEYE_SHARPNESS: | ||
1191 | sony_pic_camera_command( | ||
1192 | SONY_PIC_COMMAND_SETCAMERASHARPNESS, c->value); | ||
1193 | meye.params.sharpness = c->value; | ||
1194 | break; | ||
1195 | case V4L2_CID_PICTURE: | ||
1196 | sony_pic_camera_command( | ||
1197 | SONY_PIC_COMMAND_SETCAMERAPICTURE, c->value); | ||
1198 | meye.params.picture = c->value; | ||
1199 | break; | ||
1200 | case V4L2_CID_JPEGQUAL: | ||
1201 | meye.params.quality = c->value; | ||
1202 | break; | ||
1203 | case V4L2_CID_FRAMERATE: | ||
1204 | meye.params.framerate = c->value; | ||
1181 | break; | 1205 | break; |
1206 | default: | ||
1207 | mutex_unlock(&meye.lock); | ||
1208 | return -EINVAL; | ||
1182 | } | 1209 | } |
1210 | mutex_unlock(&meye.lock); | ||
1183 | 1211 | ||
1184 | case VIDIOC_S_INPUT: { | 1212 | return 0; |
1185 | int *i = arg; | 1213 | } |
1186 | 1214 | ||
1187 | if (*i != 0) | 1215 | static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *c) |
1188 | return -EINVAL; | 1216 | { |
1217 | mutex_lock(&meye.lock); | ||
1218 | switch (c->id) { | ||
1219 | case V4L2_CID_BRIGHTNESS: | ||
1220 | c->value = meye.picture.brightness >> 10; | ||
1221 | break; | ||
1222 | case V4L2_CID_HUE: | ||
1223 | c->value = meye.picture.hue >> 10; | ||
1224 | break; | ||
1225 | case V4L2_CID_CONTRAST: | ||
1226 | c->value = meye.picture.contrast >> 10; | ||
1227 | break; | ||
1228 | case V4L2_CID_SATURATION: | ||
1229 | c->value = meye.picture.colour >> 10; | ||
1230 | break; | ||
1231 | case V4L2_CID_AGC: | ||
1232 | c->value = meye.params.agc; | ||
1233 | break; | ||
1234 | case V4L2_CID_SHARPNESS: | ||
1235 | case V4L2_CID_MEYE_SHARPNESS: | ||
1236 | c->value = meye.params.sharpness; | ||
1189 | break; | 1237 | break; |
1238 | case V4L2_CID_PICTURE: | ||
1239 | c->value = meye.params.picture; | ||
1240 | break; | ||
1241 | case V4L2_CID_JPEGQUAL: | ||
1242 | c->value = meye.params.quality; | ||
1243 | break; | ||
1244 | case V4L2_CID_FRAMERATE: | ||
1245 | c->value = meye.params.framerate; | ||
1246 | break; | ||
1247 | default: | ||
1248 | mutex_unlock(&meye.lock); | ||
1249 | return -EINVAL; | ||
1190 | } | 1250 | } |
1251 | mutex_unlock(&meye.lock); | ||
1191 | 1252 | ||
1192 | case VIDIOC_QUERYCTRL: { | 1253 | return 0; |
1193 | struct v4l2_queryctrl *c = arg; | 1254 | } |
1194 | 1255 | ||
1195 | switch (c->id) { | 1256 | static int vidioc_enum_fmt_cap(struct file *file, void *fh, |
1257 | struct v4l2_fmtdesc *f) | ||
1258 | { | ||
1259 | if (f->index > 1) | ||
1260 | return -EINVAL; | ||
1196 | 1261 | ||
1197 | case V4L2_CID_BRIGHTNESS: | 1262 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1198 | c->type = V4L2_CTRL_TYPE_INTEGER; | 1263 | return -EINVAL; |
1199 | strcpy(c->name, "Brightness"); | 1264 | |
1200 | c->minimum = 0; | 1265 | if (f->index == 0) { |
1201 | c->maximum = 63; | 1266 | /* standard YUV 422 capture */ |
1202 | c->step = 1; | 1267 | memset(f, 0, sizeof(*f)); |
1203 | c->default_value = 32; | 1268 | f->index = 0; |
1204 | c->flags = 0; | 1269 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1205 | break; | 1270 | f->flags = 0; |
1206 | case V4L2_CID_HUE: | 1271 | strcpy(f->description, "YUV422"); |
1207 | c->type = V4L2_CTRL_TYPE_INTEGER; | 1272 | f->pixelformat = V4L2_PIX_FMT_YUYV; |
1208 | strcpy(c->name, "Hue"); | 1273 | } else { |
1209 | c->minimum = 0; | 1274 | /* compressed MJPEG capture */ |
1210 | c->maximum = 63; | 1275 | memset(f, 0, sizeof(*f)); |
1211 | c->step = 1; | 1276 | f->index = 1; |
1212 | c->default_value = 32; | 1277 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1213 | c->flags = 0; | 1278 | f->flags = V4L2_FMT_FLAG_COMPRESSED; |
1214 | break; | 1279 | strcpy(f->description, "MJPEG"); |
1215 | case V4L2_CID_CONTRAST: | 1280 | f->pixelformat = V4L2_PIX_FMT_MJPEG; |
1216 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1217 | strcpy(c->name, "Contrast"); | ||
1218 | c->minimum = 0; | ||
1219 | c->maximum = 63; | ||
1220 | c->step = 1; | ||
1221 | c->default_value = 32; | ||
1222 | c->flags = 0; | ||
1223 | break; | ||
1224 | case V4L2_CID_SATURATION: | ||
1225 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1226 | strcpy(c->name, "Saturation"); | ||
1227 | c->minimum = 0; | ||
1228 | c->maximum = 63; | ||
1229 | c->step = 1; | ||
1230 | c->default_value = 32; | ||
1231 | c->flags = 0; | ||
1232 | break; | ||
1233 | case V4L2_CID_AGC: | ||
1234 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1235 | strcpy(c->name, "Agc"); | ||
1236 | c->minimum = 0; | ||
1237 | c->maximum = 63; | ||
1238 | c->step = 1; | ||
1239 | c->default_value = 48; | ||
1240 | c->flags = 0; | ||
1241 | break; | ||
1242 | case V4L2_CID_MEYE_SHARPNESS: | ||
1243 | case V4L2_CID_SHARPNESS: | ||
1244 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1245 | strcpy(c->name, "Sharpness"); | ||
1246 | c->minimum = 0; | ||
1247 | c->maximum = 63; | ||
1248 | c->step = 1; | ||
1249 | c->default_value = 32; | ||
1250 | |||
1251 | /* Continue to report legacy private SHARPNESS ctrl but | ||
1252 | * say it is disabled in preference to ctrl in the spec | ||
1253 | */ | ||
1254 | c->flags = (c->id == V4L2_CID_SHARPNESS) ? 0 : | ||
1255 | V4L2_CTRL_FLAG_DISABLED; | ||
1256 | break; | ||
1257 | case V4L2_CID_PICTURE: | ||
1258 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1259 | strcpy(c->name, "Picture"); | ||
1260 | c->minimum = 0; | ||
1261 | c->maximum = 63; | ||
1262 | c->step = 1; | ||
1263 | c->default_value = 0; | ||
1264 | c->flags = 0; | ||
1265 | break; | ||
1266 | case V4L2_CID_JPEGQUAL: | ||
1267 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1268 | strcpy(c->name, "JPEG quality"); | ||
1269 | c->minimum = 0; | ||
1270 | c->maximum = 10; | ||
1271 | c->step = 1; | ||
1272 | c->default_value = 8; | ||
1273 | c->flags = 0; | ||
1274 | break; | ||
1275 | case V4L2_CID_FRAMERATE: | ||
1276 | c->type = V4L2_CTRL_TYPE_INTEGER; | ||
1277 | strcpy(c->name, "Framerate"); | ||
1278 | c->minimum = 0; | ||
1279 | c->maximum = 31; | ||
1280 | c->step = 1; | ||
1281 | c->default_value = 0; | ||
1282 | c->flags = 0; | ||
1283 | break; | ||
1284 | default: | ||
1285 | return -EINVAL; | ||
1286 | } | ||
1287 | break; | ||
1288 | } | 1281 | } |
1289 | 1282 | ||
1290 | case VIDIOC_S_CTRL: { | 1283 | return 0; |
1291 | struct v4l2_control *c = arg; | 1284 | } |
1292 | 1285 | ||
1293 | mutex_lock(&meye.lock); | 1286 | static int vidioc_try_fmt_cap(struct file *file, void *fh, |
1294 | switch (c->id) { | 1287 | struct v4l2_format *f) |
1295 | case V4L2_CID_BRIGHTNESS: | 1288 | { |
1296 | sony_pic_camera_command( | 1289 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1297 | SONY_PIC_COMMAND_SETCAMERABRIGHTNESS, c->value); | 1290 | return -EINVAL; |
1298 | meye.picture.brightness = c->value << 10; | 1291 | |
1299 | break; | 1292 | if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && |
1300 | case V4L2_CID_HUE: | 1293 | f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) |
1301 | sony_pic_camera_command( | 1294 | return -EINVAL; |
1302 | SONY_PIC_COMMAND_SETCAMERAHUE, c->value); | 1295 | |
1303 | meye.picture.hue = c->value << 10; | 1296 | if (f->fmt.pix.field != V4L2_FIELD_ANY && |
1304 | break; | 1297 | f->fmt.pix.field != V4L2_FIELD_NONE) |
1305 | case V4L2_CID_CONTRAST: | 1298 | return -EINVAL; |
1306 | sony_pic_camera_command( | 1299 | |
1307 | SONY_PIC_COMMAND_SETCAMERACONTRAST, c->value); | 1300 | f->fmt.pix.field = V4L2_FIELD_NONE; |
1308 | meye.picture.contrast = c->value << 10; | 1301 | |
1309 | break; | 1302 | if (f->fmt.pix.width <= 320) { |
1310 | case V4L2_CID_SATURATION: | 1303 | f->fmt.pix.width = 320; |
1311 | sony_pic_camera_command( | 1304 | f->fmt.pix.height = 240; |
1312 | SONY_PIC_COMMAND_SETCAMERACOLOR, c->value); | 1305 | } else { |
1313 | meye.picture.colour = c->value << 10; | 1306 | f->fmt.pix.width = 640; |
1314 | break; | 1307 | f->fmt.pix.height = 480; |
1315 | case V4L2_CID_AGC: | ||
1316 | sony_pic_camera_command( | ||
1317 | SONY_PIC_COMMAND_SETCAMERAAGC, c->value); | ||
1318 | meye.params.agc = c->value; | ||
1319 | break; | ||
1320 | case V4L2_CID_SHARPNESS: | ||
1321 | case V4L2_CID_MEYE_SHARPNESS: | ||
1322 | sony_pic_camera_command( | ||
1323 | SONY_PIC_COMMAND_SETCAMERASHARPNESS, c->value); | ||
1324 | meye.params.sharpness = c->value; | ||
1325 | break; | ||
1326 | case V4L2_CID_PICTURE: | ||
1327 | sony_pic_camera_command( | ||
1328 | SONY_PIC_COMMAND_SETCAMERAPICTURE, c->value); | ||
1329 | meye.params.picture = c->value; | ||
1330 | break; | ||
1331 | case V4L2_CID_JPEGQUAL: | ||
1332 | meye.params.quality = c->value; | ||
1333 | break; | ||
1334 | case V4L2_CID_FRAMERATE: | ||
1335 | meye.params.framerate = c->value; | ||
1336 | break; | ||
1337 | default: | ||
1338 | mutex_unlock(&meye.lock); | ||
1339 | return -EINVAL; | ||
1340 | } | ||
1341 | mutex_unlock(&meye.lock); | ||
1342 | break; | ||
1343 | } | 1308 | } |
1344 | 1309 | ||
1345 | case VIDIOC_G_CTRL: { | 1310 | f->fmt.pix.bytesperline = f->fmt.pix.width * 2; |
1346 | struct v4l2_control *c = arg; | 1311 | f->fmt.pix.sizeimage = f->fmt.pix.height * |
1312 | f->fmt.pix.bytesperline; | ||
1313 | f->fmt.pix.colorspace = 0; | ||
1314 | f->fmt.pix.priv = 0; | ||
1347 | 1315 | ||
1348 | mutex_lock(&meye.lock); | 1316 | return 0; |
1349 | switch (c->id) { | 1317 | } |
1350 | case V4L2_CID_BRIGHTNESS: | 1318 | |
1351 | c->value = meye.picture.brightness >> 10; | 1319 | static int vidioc_g_fmt_cap(struct file *file, void *fh, struct v4l2_format *f) |
1352 | break; | 1320 | { |
1353 | case V4L2_CID_HUE: | 1321 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1354 | c->value = meye.picture.hue >> 10; | 1322 | return -EINVAL; |
1355 | break; | 1323 | |
1356 | case V4L2_CID_CONTRAST: | 1324 | memset(&f->fmt.pix, 0, sizeof(struct v4l2_pix_format)); |
1357 | c->value = meye.picture.contrast >> 10; | 1325 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1358 | break; | 1326 | |
1359 | case V4L2_CID_SATURATION: | 1327 | switch (meye.mchip_mode) { |
1360 | c->value = meye.picture.colour >> 10; | 1328 | case MCHIP_HIC_MODE_CONT_OUT: |
1361 | break; | 1329 | default: |
1362 | case V4L2_CID_AGC: | 1330 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; |
1363 | c->value = meye.params.agc; | 1331 | break; |
1364 | break; | 1332 | case MCHIP_HIC_MODE_CONT_COMP: |
1365 | case V4L2_CID_SHARPNESS: | 1333 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG; |
1366 | case V4L2_CID_MEYE_SHARPNESS: | ||
1367 | c->value = meye.params.sharpness; | ||
1368 | break; | ||
1369 | case V4L2_CID_PICTURE: | ||
1370 | c->value = meye.params.picture; | ||
1371 | break; | ||
1372 | case V4L2_CID_JPEGQUAL: | ||
1373 | c->value = meye.params.quality; | ||
1374 | break; | ||
1375 | case V4L2_CID_FRAMERATE: | ||
1376 | c->value = meye.params.framerate; | ||
1377 | break; | ||
1378 | default: | ||
1379 | mutex_unlock(&meye.lock); | ||
1380 | return -EINVAL; | ||
1381 | } | ||
1382 | mutex_unlock(&meye.lock); | ||
1383 | break; | 1334 | break; |
1384 | } | 1335 | } |
1385 | 1336 | ||
1386 | case VIDIOC_ENUM_FMT: { | 1337 | f->fmt.pix.field = V4L2_FIELD_NONE; |
1387 | struct v4l2_fmtdesc *f = arg; | 1338 | f->fmt.pix.width = mchip_hsize(); |
1388 | 1339 | f->fmt.pix.height = mchip_vsize(); | |
1389 | if (f->index > 1) | 1340 | f->fmt.pix.bytesperline = f->fmt.pix.width * 2; |
1390 | return -EINVAL; | 1341 | f->fmt.pix.sizeimage = f->fmt.pix.height * |
1391 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1342 | f->fmt.pix.bytesperline; |
1392 | return -EINVAL; | 1343 | f->fmt.pix.colorspace = 0; |
1393 | if (f->index == 0) { | 1344 | f->fmt.pix.priv = 0; |
1394 | /* standard YUV 422 capture */ | 1345 | |
1395 | memset(f, 0, sizeof(*f)); | 1346 | return 0; |
1396 | f->index = 0; | 1347 | } |
1397 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1348 | |
1398 | f->flags = 0; | 1349 | static int vidioc_s_fmt_cap(struct file *file, void *fh, struct v4l2_format *f) |
1399 | strcpy(f->description, "YUV422"); | 1350 | { |
1400 | f->pixelformat = V4L2_PIX_FMT_YUYV; | 1351 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1401 | } else { | 1352 | return -EINVAL; |
1402 | /* compressed MJPEG capture */ | 1353 | |
1403 | memset(f, 0, sizeof(*f)); | 1354 | if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && |
1404 | f->index = 1; | 1355 | f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) |
1405 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1356 | return -EINVAL; |
1406 | f->flags = V4L2_FMT_FLAG_COMPRESSED; | 1357 | |
1407 | strcpy(f->description, "MJPEG"); | 1358 | if (f->fmt.pix.field != V4L2_FIELD_ANY && |
1408 | f->pixelformat = V4L2_PIX_FMT_MJPEG; | 1359 | f->fmt.pix.field != V4L2_FIELD_NONE) |
1409 | } | 1360 | return -EINVAL; |
1410 | break; | 1361 | |
1362 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
1363 | mutex_lock(&meye.lock); | ||
1364 | |||
1365 | if (f->fmt.pix.width <= 320) { | ||
1366 | f->fmt.pix.width = 320; | ||
1367 | f->fmt.pix.height = 240; | ||
1368 | meye.params.subsample = 1; | ||
1369 | } else { | ||
1370 | f->fmt.pix.width = 640; | ||
1371 | f->fmt.pix.height = 480; | ||
1372 | meye.params.subsample = 0; | ||
1411 | } | 1373 | } |
1412 | 1374 | ||
1413 | case VIDIOC_TRY_FMT: { | 1375 | switch (f->fmt.pix.pixelformat) { |
1414 | struct v4l2_format *f = arg; | 1376 | case V4L2_PIX_FMT_YUYV: |
1415 | 1377 | meye.mchip_mode = MCHIP_HIC_MODE_CONT_OUT; | |
1416 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1378 | break; |
1417 | return -EINVAL; | 1379 | case V4L2_PIX_FMT_MJPEG: |
1418 | if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && | 1380 | meye.mchip_mode = MCHIP_HIC_MODE_CONT_COMP; |
1419 | f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) | ||
1420 | return -EINVAL; | ||
1421 | if (f->fmt.pix.field != V4L2_FIELD_ANY && | ||
1422 | f->fmt.pix.field != V4L2_FIELD_NONE) | ||
1423 | return -EINVAL; | ||
1424 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
1425 | if (f->fmt.pix.width <= 320) { | ||
1426 | f->fmt.pix.width = 320; | ||
1427 | f->fmt.pix.height = 240; | ||
1428 | } else { | ||
1429 | f->fmt.pix.width = 640; | ||
1430 | f->fmt.pix.height = 480; | ||
1431 | } | ||
1432 | f->fmt.pix.bytesperline = f->fmt.pix.width * 2; | ||
1433 | f->fmt.pix.sizeimage = f->fmt.pix.height * | ||
1434 | f->fmt.pix.bytesperline; | ||
1435 | f->fmt.pix.colorspace = 0; | ||
1436 | f->fmt.pix.priv = 0; | ||
1437 | break; | 1381 | break; |
1438 | } | 1382 | } |
1439 | 1383 | ||
1440 | case VIDIOC_G_FMT: { | 1384 | mutex_unlock(&meye.lock); |
1441 | struct v4l2_format *f = arg; | 1385 | f->fmt.pix.bytesperline = f->fmt.pix.width * 2; |
1386 | f->fmt.pix.sizeimage = f->fmt.pix.height * | ||
1387 | f->fmt.pix.bytesperline; | ||
1388 | f->fmt.pix.colorspace = 0; | ||
1389 | f->fmt.pix.priv = 0; | ||
1442 | 1390 | ||
1443 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1391 | return 0; |
1444 | return -EINVAL; | 1392 | } |
1445 | memset(&f->fmt.pix, 0, sizeof(struct v4l2_pix_format)); | ||
1446 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1447 | switch (meye.mchip_mode) { | ||
1448 | case MCHIP_HIC_MODE_CONT_OUT: | ||
1449 | default: | ||
1450 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; | ||
1451 | break; | ||
1452 | case MCHIP_HIC_MODE_CONT_COMP: | ||
1453 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG; | ||
1454 | break; | ||
1455 | } | ||
1456 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
1457 | f->fmt.pix.width = mchip_hsize(); | ||
1458 | f->fmt.pix.height = mchip_vsize(); | ||
1459 | f->fmt.pix.bytesperline = f->fmt.pix.width * 2; | ||
1460 | f->fmt.pix.sizeimage = f->fmt.pix.height * | ||
1461 | f->fmt.pix.bytesperline; | ||
1462 | f->fmt.pix.colorspace = 0; | ||
1463 | f->fmt.pix.priv = 0; | ||
1464 | break; | ||
1465 | } | ||
1466 | 1393 | ||
1467 | case VIDIOC_S_FMT: { | 1394 | static int vidioc_reqbufs(struct file *file, void *fh, |
1468 | struct v4l2_format *f = arg; | 1395 | struct v4l2_requestbuffers *req) |
1469 | 1396 | { | |
1470 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1397 | int i; |
1471 | return -EINVAL; | ||
1472 | if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && | ||
1473 | f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) | ||
1474 | return -EINVAL; | ||
1475 | if (f->fmt.pix.field != V4L2_FIELD_ANY && | ||
1476 | f->fmt.pix.field != V4L2_FIELD_NONE) | ||
1477 | return -EINVAL; | ||
1478 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
1479 | mutex_lock(&meye.lock); | ||
1480 | if (f->fmt.pix.width <= 320) { | ||
1481 | f->fmt.pix.width = 320; | ||
1482 | f->fmt.pix.height = 240; | ||
1483 | meye.params.subsample = 1; | ||
1484 | } else { | ||
1485 | f->fmt.pix.width = 640; | ||
1486 | f->fmt.pix.height = 480; | ||
1487 | meye.params.subsample = 0; | ||
1488 | } | ||
1489 | switch (f->fmt.pix.pixelformat) { | ||
1490 | case V4L2_PIX_FMT_YUYV: | ||
1491 | meye.mchip_mode = MCHIP_HIC_MODE_CONT_OUT; | ||
1492 | break; | ||
1493 | case V4L2_PIX_FMT_MJPEG: | ||
1494 | meye.mchip_mode = MCHIP_HIC_MODE_CONT_COMP; | ||
1495 | break; | ||
1496 | } | ||
1497 | mutex_unlock(&meye.lock); | ||
1498 | f->fmt.pix.bytesperline = f->fmt.pix.width * 2; | ||
1499 | f->fmt.pix.sizeimage = f->fmt.pix.height * | ||
1500 | f->fmt.pix.bytesperline; | ||
1501 | f->fmt.pix.colorspace = 0; | ||
1502 | f->fmt.pix.priv = 0; | ||
1503 | 1398 | ||
1504 | break; | 1399 | if (req->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1505 | } | 1400 | return -EINVAL; |
1506 | 1401 | ||
1507 | case VIDIOC_REQBUFS: { | 1402 | if (req->memory != V4L2_MEMORY_MMAP) |
1508 | struct v4l2_requestbuffers *req = arg; | 1403 | return -EINVAL; |
1509 | int i; | ||
1510 | 1404 | ||
1511 | if (req->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1405 | if (meye.grab_fbuffer && req->count == gbuffers) { |
1512 | return -EINVAL; | 1406 | /* already allocated, no modifications */ |
1513 | if (req->memory != V4L2_MEMORY_MMAP) | 1407 | return 0; |
1514 | return -EINVAL; | ||
1515 | if (meye.grab_fbuffer && req->count == gbuffers) { | ||
1516 | /* already allocated, no modifications */ | ||
1517 | break; | ||
1518 | } | ||
1519 | mutex_lock(&meye.lock); | ||
1520 | if (meye.grab_fbuffer) { | ||
1521 | for (i = 0; i < gbuffers; i++) | ||
1522 | if (meye.vma_use_count[i]) { | ||
1523 | mutex_unlock(&meye.lock); | ||
1524 | return -EINVAL; | ||
1525 | } | ||
1526 | rvfree(meye.grab_fbuffer, gbuffers * gbufsize); | ||
1527 | meye.grab_fbuffer = NULL; | ||
1528 | } | ||
1529 | gbuffers = max(2, min((int)req->count, MEYE_MAX_BUFNBRS)); | ||
1530 | req->count = gbuffers; | ||
1531 | meye.grab_fbuffer = rvmalloc(gbuffers * gbufsize); | ||
1532 | if (!meye.grab_fbuffer) { | ||
1533 | printk(KERN_ERR "meye: v4l framebuffer allocation" | ||
1534 | " failed\n"); | ||
1535 | mutex_unlock(&meye.lock); | ||
1536 | return -ENOMEM; | ||
1537 | } | ||
1538 | for (i = 0; i < gbuffers; i++) | ||
1539 | meye.vma_use_count[i] = 0; | ||
1540 | mutex_unlock(&meye.lock); | ||
1541 | break; | ||
1542 | } | 1408 | } |
1543 | 1409 | ||
1544 | case VIDIOC_QUERYBUF: { | 1410 | mutex_lock(&meye.lock); |
1545 | struct v4l2_buffer *buf = arg; | 1411 | if (meye.grab_fbuffer) { |
1546 | int index = buf->index; | 1412 | for (i = 0; i < gbuffers; i++) |
1547 | 1413 | if (meye.vma_use_count[i]) { | |
1548 | if (index < 0 || index >= gbuffers) | 1414 | mutex_unlock(&meye.lock); |
1549 | return -EINVAL; | 1415 | return -EINVAL; |
1550 | memset(buf, 0, sizeof(*buf)); | 1416 | } |
1551 | buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1417 | rvfree(meye.grab_fbuffer, gbuffers * gbufsize); |
1552 | buf->index = index; | 1418 | meye.grab_fbuffer = NULL; |
1553 | buf->bytesused = meye.grab_buffer[index].size; | ||
1554 | buf->flags = V4L2_BUF_FLAG_MAPPED; | ||
1555 | if (meye.grab_buffer[index].state == MEYE_BUF_USING) | ||
1556 | buf->flags |= V4L2_BUF_FLAG_QUEUED; | ||
1557 | if (meye.grab_buffer[index].state == MEYE_BUF_DONE) | ||
1558 | buf->flags |= V4L2_BUF_FLAG_DONE; | ||
1559 | buf->field = V4L2_FIELD_NONE; | ||
1560 | buf->timestamp = meye.grab_buffer[index].timestamp; | ||
1561 | buf->sequence = meye.grab_buffer[index].sequence; | ||
1562 | buf->memory = V4L2_MEMORY_MMAP; | ||
1563 | buf->m.offset = index * gbufsize; | ||
1564 | buf->length = gbufsize; | ||
1565 | break; | ||
1566 | } | 1419 | } |
1567 | 1420 | ||
1568 | case VIDIOC_QBUF: { | 1421 | gbuffers = max(2, min((int)req->count, MEYE_MAX_BUFNBRS)); |
1569 | struct v4l2_buffer *buf = arg; | 1422 | req->count = gbuffers; |
1570 | 1423 | meye.grab_fbuffer = rvmalloc(gbuffers * gbufsize); | |
1571 | if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1424 | |
1572 | return -EINVAL; | 1425 | if (!meye.grab_fbuffer) { |
1573 | if (buf->memory != V4L2_MEMORY_MMAP) | 1426 | printk(KERN_ERR "meye: v4l framebuffer allocation" |
1574 | return -EINVAL; | 1427 | " failed\n"); |
1575 | if (buf->index < 0 || buf->index >= gbuffers) | ||
1576 | return -EINVAL; | ||
1577 | if (meye.grab_buffer[buf->index].state != MEYE_BUF_UNUSED) | ||
1578 | return -EINVAL; | ||
1579 | mutex_lock(&meye.lock); | ||
1580 | buf->flags |= V4L2_BUF_FLAG_QUEUED; | ||
1581 | buf->flags &= ~V4L2_BUF_FLAG_DONE; | ||
1582 | meye.grab_buffer[buf->index].state = MEYE_BUF_USING; | ||
1583 | kfifo_put(meye.grabq, (unsigned char *)&buf->index, sizeof(int)); | ||
1584 | mutex_unlock(&meye.lock); | 1428 | mutex_unlock(&meye.lock); |
1585 | break; | 1429 | return -ENOMEM; |
1586 | } | 1430 | } |
1587 | 1431 | ||
1588 | case VIDIOC_DQBUF: { | 1432 | for (i = 0; i < gbuffers; i++) |
1589 | struct v4l2_buffer *buf = arg; | 1433 | meye.vma_use_count[i] = 0; |
1590 | int reqnr; | ||
1591 | 1434 | ||
1592 | if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1435 | mutex_unlock(&meye.lock); |
1593 | return -EINVAL; | ||
1594 | if (buf->memory != V4L2_MEMORY_MMAP) | ||
1595 | return -EINVAL; | ||
1596 | 1436 | ||
1597 | mutex_lock(&meye.lock); | 1437 | return 0; |
1598 | if (kfifo_len(meye.doneq) == 0 && file->f_flags & O_NONBLOCK) { | 1438 | } |
1599 | mutex_unlock(&meye.lock); | 1439 | |
1600 | return -EAGAIN; | 1440 | static int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf) |
1601 | } | 1441 | { |
1602 | if (wait_event_interruptible(meye.proc_list, | 1442 | int index = buf->index; |
1603 | kfifo_len(meye.doneq) != 0) < 0) { | 1443 | |
1604 | mutex_unlock(&meye.lock); | 1444 | if (index < 0 || index >= gbuffers) |
1605 | return -EINTR; | 1445 | return -EINVAL; |
1606 | } | 1446 | |
1607 | if (!kfifo_get(meye.doneq, (unsigned char *)&reqnr, | 1447 | memset(buf, 0, sizeof(*buf)); |
1608 | sizeof(int))) { | 1448 | |
1609 | mutex_unlock(&meye.lock); | 1449 | buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1610 | return -EBUSY; | 1450 | buf->index = index; |
1611 | } | 1451 | buf->bytesused = meye.grab_buffer[index].size; |
1612 | if (meye.grab_buffer[reqnr].state != MEYE_BUF_DONE) { | 1452 | buf->flags = V4L2_BUF_FLAG_MAPPED; |
1613 | mutex_unlock(&meye.lock); | 1453 | |
1614 | return -EINVAL; | 1454 | if (meye.grab_buffer[index].state == MEYE_BUF_USING) |
1615 | } | 1455 | buf->flags |= V4L2_BUF_FLAG_QUEUED; |
1616 | buf->index = reqnr; | 1456 | |
1617 | buf->bytesused = meye.grab_buffer[reqnr].size; | 1457 | if (meye.grab_buffer[index].state == MEYE_BUF_DONE) |
1618 | buf->flags = V4L2_BUF_FLAG_MAPPED; | 1458 | buf->flags |= V4L2_BUF_FLAG_DONE; |
1619 | buf->field = V4L2_FIELD_NONE; | 1459 | |
1620 | buf->timestamp = meye.grab_buffer[reqnr].timestamp; | 1460 | buf->field = V4L2_FIELD_NONE; |
1621 | buf->sequence = meye.grab_buffer[reqnr].sequence; | 1461 | buf->timestamp = meye.grab_buffer[index].timestamp; |
1622 | buf->memory = V4L2_MEMORY_MMAP; | 1462 | buf->sequence = meye.grab_buffer[index].sequence; |
1623 | buf->m.offset = reqnr * gbufsize; | 1463 | buf->memory = V4L2_MEMORY_MMAP; |
1624 | buf->length = gbufsize; | 1464 | buf->m.offset = index * gbufsize; |
1625 | meye.grab_buffer[reqnr].state = MEYE_BUF_UNUSED; | 1465 | buf->length = gbufsize; |
1466 | |||
1467 | return 0; | ||
1468 | } | ||
1469 | |||
1470 | static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | ||
1471 | { | ||
1472 | if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1473 | return -EINVAL; | ||
1474 | |||
1475 | if (buf->memory != V4L2_MEMORY_MMAP) | ||
1476 | return -EINVAL; | ||
1477 | |||
1478 | if (buf->index < 0 || buf->index >= gbuffers) | ||
1479 | return -EINVAL; | ||
1480 | |||
1481 | if (meye.grab_buffer[buf->index].state != MEYE_BUF_UNUSED) | ||
1482 | return -EINVAL; | ||
1483 | |||
1484 | mutex_lock(&meye.lock); | ||
1485 | buf->flags |= V4L2_BUF_FLAG_QUEUED; | ||
1486 | buf->flags &= ~V4L2_BUF_FLAG_DONE; | ||
1487 | meye.grab_buffer[buf->index].state = MEYE_BUF_USING; | ||
1488 | kfifo_put(meye.grabq, (unsigned char *)&buf->index, sizeof(int)); | ||
1489 | mutex_unlock(&meye.lock); | ||
1490 | |||
1491 | return 0; | ||
1492 | } | ||
1493 | |||
1494 | static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | ||
1495 | { | ||
1496 | int reqnr; | ||
1497 | |||
1498 | if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1499 | return -EINVAL; | ||
1500 | |||
1501 | if (buf->memory != V4L2_MEMORY_MMAP) | ||
1502 | return -EINVAL; | ||
1503 | |||
1504 | mutex_lock(&meye.lock); | ||
1505 | |||
1506 | if (kfifo_len(meye.doneq) == 0 && file->f_flags & O_NONBLOCK) { | ||
1626 | mutex_unlock(&meye.lock); | 1507 | mutex_unlock(&meye.lock); |
1627 | break; | 1508 | return -EAGAIN; |
1628 | } | 1509 | } |
1629 | 1510 | ||
1630 | case VIDIOC_STREAMON: { | 1511 | if (wait_event_interruptible(meye.proc_list, |
1631 | mutex_lock(&meye.lock); | 1512 | kfifo_len(meye.doneq) != 0) < 0) { |
1632 | switch (meye.mchip_mode) { | ||
1633 | case MCHIP_HIC_MODE_CONT_OUT: | ||
1634 | mchip_continuous_start(); | ||
1635 | break; | ||
1636 | case MCHIP_HIC_MODE_CONT_COMP: | ||
1637 | mchip_cont_compression_start(); | ||
1638 | break; | ||
1639 | default: | ||
1640 | mutex_unlock(&meye.lock); | ||
1641 | return -EINVAL; | ||
1642 | } | ||
1643 | mutex_unlock(&meye.lock); | 1513 | mutex_unlock(&meye.lock); |
1644 | break; | 1514 | return -EINTR; |
1645 | } | 1515 | } |
1646 | 1516 | ||
1647 | case VIDIOC_STREAMOFF: { | 1517 | if (!kfifo_get(meye.doneq, (unsigned char *)&reqnr, |
1648 | int i; | 1518 | sizeof(int))) { |
1519 | mutex_unlock(&meye.lock); | ||
1520 | return -EBUSY; | ||
1521 | } | ||
1649 | 1522 | ||
1650 | mutex_lock(&meye.lock); | 1523 | if (meye.grab_buffer[reqnr].state != MEYE_BUF_DONE) { |
1651 | mchip_hic_stop(); | ||
1652 | kfifo_reset(meye.grabq); | ||
1653 | kfifo_reset(meye.doneq); | ||
1654 | for (i = 0; i < MEYE_MAX_BUFNBRS; i++) | ||
1655 | meye.grab_buffer[i].state = MEYE_BUF_UNUSED; | ||
1656 | mutex_unlock(&meye.lock); | 1524 | mutex_unlock(&meye.lock); |
1657 | break; | 1525 | return -EINVAL; |
1658 | } | 1526 | } |
1659 | 1527 | ||
1660 | /* | 1528 | buf->index = reqnr; |
1661 | * XXX what about private snapshot ioctls ? | 1529 | buf->bytesused = meye.grab_buffer[reqnr].size; |
1662 | * Do they need to be converted to V4L2 ? | 1530 | buf->flags = V4L2_BUF_FLAG_MAPPED; |
1663 | */ | 1531 | buf->field = V4L2_FIELD_NONE; |
1532 | buf->timestamp = meye.grab_buffer[reqnr].timestamp; | ||
1533 | buf->sequence = meye.grab_buffer[reqnr].sequence; | ||
1534 | buf->memory = V4L2_MEMORY_MMAP; | ||
1535 | buf->m.offset = reqnr * gbufsize; | ||
1536 | buf->length = gbufsize; | ||
1537 | meye.grab_buffer[reqnr].state = MEYE_BUF_UNUSED; | ||
1538 | mutex_unlock(&meye.lock); | ||
1539 | |||
1540 | return 0; | ||
1541 | } | ||
1664 | 1542 | ||
1543 | static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) | ||
1544 | { | ||
1545 | mutex_lock(&meye.lock); | ||
1546 | |||
1547 | switch (meye.mchip_mode) { | ||
1548 | case MCHIP_HIC_MODE_CONT_OUT: | ||
1549 | mchip_continuous_start(); | ||
1550 | break; | ||
1551 | case MCHIP_HIC_MODE_CONT_COMP: | ||
1552 | mchip_cont_compression_start(); | ||
1553 | break; | ||
1665 | default: | 1554 | default: |
1666 | return -ENOIOCTLCMD; | 1555 | mutex_unlock(&meye.lock); |
1556 | return -EINVAL; | ||
1667 | } | 1557 | } |
1668 | 1558 | ||
1559 | mutex_unlock(&meye.lock); | ||
1560 | |||
1669 | return 0; | 1561 | return 0; |
1670 | } | 1562 | } |
1671 | 1563 | ||
1672 | static int meye_ioctl(struct inode *inode, struct file *file, | 1564 | static int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) |
1673 | unsigned int cmd, unsigned long arg) | ||
1674 | { | 1565 | { |
1675 | return video_usercopy(inode, file, cmd, arg, meye_do_ioctl); | 1566 | mutex_lock(&meye.lock); |
1567 | mchip_hic_stop(); | ||
1568 | kfifo_reset(meye.grabq); | ||
1569 | kfifo_reset(meye.doneq); | ||
1570 | |||
1571 | for (i = 0; i < MEYE_MAX_BUFNBRS; i++) | ||
1572 | meye.grab_buffer[i].state = MEYE_BUF_UNUSED; | ||
1573 | |||
1574 | mutex_unlock(&meye.lock); | ||
1575 | return 0; | ||
1576 | } | ||
1577 | |||
1578 | static int vidioc_default(struct file *file, void *fh, int cmd, void *arg) | ||
1579 | { | ||
1580 | switch (cmd) { | ||
1581 | case MEYEIOC_G_PARAMS: | ||
1582 | return meyeioc_g_params((struct meye_params *) arg); | ||
1583 | |||
1584 | case MEYEIOC_S_PARAMS: | ||
1585 | return meyeioc_s_params((struct meye_params *) arg); | ||
1586 | |||
1587 | case MEYEIOC_QBUF_CAPT: | ||
1588 | return meyeioc_qbuf_capt((int *) arg); | ||
1589 | |||
1590 | case MEYEIOC_SYNC: | ||
1591 | return meyeioc_sync(file, fh, (int *) arg); | ||
1592 | |||
1593 | case MEYEIOC_STILLCAPT: | ||
1594 | return meyeioc_stillcapt(); | ||
1595 | |||
1596 | case MEYEIOC_STILLJCAPT: | ||
1597 | return meyeioc_stilljcapt((int *) arg); | ||
1598 | |||
1599 | default: | ||
1600 | return -EINVAL; | ||
1601 | } | ||
1602 | |||
1676 | } | 1603 | } |
1677 | 1604 | ||
1678 | static unsigned int meye_poll(struct file *file, poll_table *wait) | 1605 | static unsigned int meye_poll(struct file *file, poll_table *wait) |
@@ -1760,7 +1687,7 @@ static const struct file_operations meye_fops = { | |||
1760 | .open = meye_open, | 1687 | .open = meye_open, |
1761 | .release = meye_release, | 1688 | .release = meye_release, |
1762 | .mmap = meye_mmap, | 1689 | .mmap = meye_mmap, |
1763 | .ioctl = meye_ioctl, | 1690 | .ioctl = video_ioctl2, |
1764 | #ifdef CONFIG_COMPAT | 1691 | #ifdef CONFIG_COMPAT |
1765 | .compat_ioctl = v4l_compat_ioctl32, | 1692 | .compat_ioctl = v4l_compat_ioctl32, |
1766 | #endif | 1693 | #endif |
@@ -1775,6 +1702,24 @@ static struct video_device meye_template = { | |||
1775 | .fops = &meye_fops, | 1702 | .fops = &meye_fops, |
1776 | .release = video_device_release, | 1703 | .release = video_device_release, |
1777 | .minor = -1, | 1704 | .minor = -1, |
1705 | .vidioc_querycap = vidioc_querycap, | ||
1706 | .vidioc_enum_input = vidioc_enum_input, | ||
1707 | .vidioc_g_input = vidioc_g_input, | ||
1708 | .vidioc_s_input = vidioc_s_input, | ||
1709 | .vidioc_queryctrl = vidioc_queryctrl, | ||
1710 | .vidioc_s_ctrl = vidioc_s_ctrl, | ||
1711 | .vidioc_g_ctrl = vidioc_g_ctrl, | ||
1712 | .vidioc_enum_fmt_cap = vidioc_enum_fmt_cap, | ||
1713 | .vidioc_try_fmt_cap = vidioc_try_fmt_cap, | ||
1714 | .vidioc_g_fmt_cap = vidioc_g_fmt_cap, | ||
1715 | .vidioc_s_fmt_cap = vidioc_s_fmt_cap, | ||
1716 | .vidioc_reqbufs = vidioc_reqbufs, | ||
1717 | .vidioc_querybuf = vidioc_querybuf, | ||
1718 | .vidioc_qbuf = vidioc_qbuf, | ||
1719 | .vidioc_dqbuf = vidioc_dqbuf, | ||
1720 | .vidioc_streamon = vidioc_streamon, | ||
1721 | .vidioc_streamoff = vidioc_streamoff, | ||
1722 | .vidioc_default = vidioc_default, | ||
1778 | }; | 1723 | }; |
1779 | 1724 | ||
1780 | #ifdef CONFIG_PM | 1725 | #ifdef CONFIG_PM |