• Home
  • Raw
  • Download

Lines Matching refs:cam

72 	struct camera_data *cam = video_drvdata(file);  in cpia2_open()  local
75 if (mutex_lock_interruptible(&cam->v4l2_lock)) in cpia2_open()
82 if (cpia2_allocate_buffers(cam)) { in cpia2_open()
89 if (cpia2_reset_camera(cam) < 0) { in cpia2_open()
95 cam->APP_len = 0; in cpia2_open()
96 cam->COM_len = 0; in cpia2_open()
99 cpia2_dbg_dump_registers(cam); in cpia2_open()
101 mutex_unlock(&cam->v4l2_lock); in cpia2_open()
113 struct camera_data *cam = video_get_drvdata(dev); in cpia2_close() local
115 mutex_lock(&cam->v4l2_lock); in cpia2_close()
116 if (video_is_registered(&cam->vdev) && v4l2_fh_is_singular_file(file)) { in cpia2_close()
117 cpia2_usb_stream_stop(cam); in cpia2_close()
120 cpia2_save_camera_state(cam); in cpia2_close()
122 cpia2_set_low_power(cam); in cpia2_close()
123 cpia2_free_buffers(cam); in cpia2_close()
126 if (cam->stream_fh == file->private_data) { in cpia2_close()
127 cam->stream_fh = NULL; in cpia2_close()
128 cam->mmapped = 0; in cpia2_close()
130 mutex_unlock(&cam->v4l2_lock); in cpia2_close()
142 struct camera_data *cam = video_drvdata(file); in cpia2_v4l_read() local
146 if (!cam) in cpia2_v4l_read()
149 if (mutex_lock_interruptible(&cam->v4l2_lock)) in cpia2_v4l_read()
151 ret = cpia2_read(cam, buf, count, noblock); in cpia2_v4l_read()
152 mutex_unlock(&cam->v4l2_lock); in cpia2_v4l_read()
163 struct camera_data *cam = video_drvdata(filp); in cpia2_v4l_poll() local
166 mutex_lock(&cam->v4l2_lock); in cpia2_v4l_poll()
167 res = cpia2_poll(cam, filp, wait); in cpia2_v4l_poll()
168 mutex_unlock(&cam->v4l2_lock); in cpia2_v4l_poll()
172 static int sync(struct camera_data *cam, int frame_nr) in sync() argument
174 struct framebuf *frame = &cam->buffers[frame_nr]; in sync()
180 if (!cam->streaming) { in sync()
186 mutex_unlock(&cam->v4l2_lock); in sync()
187 wait_event_interruptible(cam->wq_stream, in sync()
188 !cam->streaming || in sync()
190 mutex_lock(&cam->v4l2_lock); in sync()
193 if (!video_is_registered(&cam->vdev)) in sync()
208 struct camera_data *cam = video_drvdata(file); in cpia2_querycap() local
212 if (cam->params.pnp_id.product == 0x151) in cpia2_querycap()
216 switch (cam->params.pnp_id.device_type) { in cpia2_querycap()
227 switch (cam->params.version.sensor_flags) { in cpia2_querycap()
248 if (usb_make_path(cam->dev, vc->bus_info, sizeof(vc->bus_info)) < 0) in cpia2_querycap()
313 struct camera_data *cam = video_drvdata(file); in cpia2_try_fmt_vid_cap() local
321 f->fmt.pix.sizeimage = cam->frame_size; in cpia2_try_fmt_vid_cap()
374 struct camera_data *cam = video_drvdata(file); in cpia2_s_fmt_vid_cap() local
381 cam->pixelformat = f->fmt.pix.pixelformat; in cpia2_s_fmt_vid_cap()
386 cam->params.compression.inhibit_htables = 0; in cpia2_s_fmt_vid_cap()
394 if (f->fmt.pix.width != cam->width || in cpia2_s_fmt_vid_cap()
395 f->fmt.pix.height != cam->height) { in cpia2_s_fmt_vid_cap()
396 cam->width = f->fmt.pix.width; in cpia2_s_fmt_vid_cap()
397 cam->height = f->fmt.pix.height; in cpia2_s_fmt_vid_cap()
398 cam->params.roi.width = f->fmt.pix.width; in cpia2_s_fmt_vid_cap()
399 cam->params.roi.height = f->fmt.pix.height; in cpia2_s_fmt_vid_cap()
400 cpia2_set_format(cam); in cpia2_s_fmt_vid_cap()
403 for (frame = 0; frame < cam->num_frames; ++frame) { in cpia2_s_fmt_vid_cap()
404 if (cam->buffers[frame].status == FRAME_READING) in cpia2_s_fmt_vid_cap()
405 if ((err = sync(cam, frame)) < 0) in cpia2_s_fmt_vid_cap()
408 cam->buffers[frame].status = FRAME_EMPTY; in cpia2_s_fmt_vid_cap()
425 struct camera_data *cam = video_drvdata(file); in cpia2_g_fmt_vid_cap() local
427 f->fmt.pix.width = cam->width; in cpia2_g_fmt_vid_cap()
428 f->fmt.pix.height = cam->height; in cpia2_g_fmt_vid_cap()
429 f->fmt.pix.pixelformat = cam->pixelformat; in cpia2_g_fmt_vid_cap()
432 f->fmt.pix.sizeimage = cam->frame_size; in cpia2_g_fmt_vid_cap()
450 struct camera_data *cam = video_drvdata(file); in cpia2_g_selection() local
460 s->r.width = cam->width; in cpia2_g_selection()
461 s->r.height = cam->height; in cpia2_g_selection()
485 struct camera_data *cam = video_drvdata(file); in cpia2_g_parm() local
493 cap->readbuffers = cam->num_frames; in cpia2_g_parm()
495 if (cam->params.vp_params.frame_rate == framerate_controls[i].value) { in cpia2_g_parm()
504 struct camera_data *cam = video_drvdata(file); in cpia2_s_parm() local
516 if (cam->params.pnp_id.device_type == DEVICE_STV_672 && in cpia2_s_parm()
517 cam->params.version.sensor_flags == CPIA2_VP_SENSOR_FLAGS_500) in cpia2_s_parm()
531 return cpia2_set_fps(cam, framerate_controls[i].value); in cpia2_s_parm()
566 struct camera_data *cam = video_drvdata(file); in cpia2_enum_frameintervals() local
575 if (cam->params.pnp_id.device_type == DEVICE_STV_672 && in cpia2_enum_frameintervals()
576 cam->params.version.sensor_flags == CPIA2_VP_SENSOR_FLAGS_500) in cpia2_enum_frameintervals()
601 struct camera_data *cam = in cpia2_s_ctrl() local
613 cpia2_set_brightness(cam, ctrl->val); in cpia2_s_ctrl()
616 cpia2_set_contrast(cam, ctrl->val); in cpia2_s_ctrl()
619 cpia2_set_saturation(cam, ctrl->val); in cpia2_s_ctrl()
622 cpia2_set_property_mirror(cam, ctrl->val); in cpia2_s_ctrl()
625 cpia2_set_property_flip(cam, ctrl->val); in cpia2_s_ctrl()
628 return cpia2_set_flicker_mode(cam, flicker_table[ctrl->val]); in cpia2_s_ctrl()
630 return cpia2_set_gpio(cam, (cam->top_light->val << 6) | in cpia2_s_ctrl()
631 (cam->bottom_light->val << 7)); in cpia2_s_ctrl()
633 cam->params.compression.inhibit_htables = in cpia2_s_ctrl()
637 cam->params.vc_params.quality = ctrl->val; in cpia2_s_ctrl()
640 cam->params.camera_state.stream_mode = ctrl->val; in cpia2_s_ctrl()
659 struct camera_data *cam = video_drvdata(file); in cpia2_g_jpegcomp() local
666 if (!cam->params.compression.inhibit_htables) in cpia2_g_jpegcomp()
669 parms->APPn = cam->APPn; in cpia2_g_jpegcomp()
670 parms->APP_len = cam->APP_len; in cpia2_g_jpegcomp()
671 if (cam->APP_len > 0) { in cpia2_g_jpegcomp()
672 memcpy(parms->APP_data, cam->APP_data, cam->APP_len); in cpia2_g_jpegcomp()
676 parms->COM_len = cam->COM_len; in cpia2_g_jpegcomp()
677 if (cam->COM_len > 0) { in cpia2_g_jpegcomp()
678 memcpy(parms->COM_data, cam->COM_data, cam->COM_len); in cpia2_g_jpegcomp()
700 struct camera_data *cam = video_drvdata(file); in cpia2_s_jpegcomp() local
705 cam->params.compression.inhibit_htables = in cpia2_s_jpegcomp()
710 parms->APP_len <= sizeof(cam->APP_data) && in cpia2_s_jpegcomp()
712 cam->APPn = parms->APPn; in cpia2_s_jpegcomp()
713 cam->APP_len = parms->APP_len; in cpia2_s_jpegcomp()
714 memcpy(cam->APP_data, parms->APP_data, parms->APP_len); in cpia2_s_jpegcomp()
721 cam->APP_len = 0; in cpia2_s_jpegcomp()
726 parms->COM_len <= sizeof(cam->COM_data)) { in cpia2_s_jpegcomp()
727 cam->COM_len = parms->COM_len; in cpia2_s_jpegcomp()
728 memcpy(cam->COM_data, parms->COM_data, parms->COM_len); in cpia2_s_jpegcomp()
749 struct camera_data *cam = video_drvdata(file); in cpia2_reqbufs() local
755 DBG("REQBUFS requested:%d returning:%d\n", req->count, cam->num_frames); in cpia2_reqbufs()
756 req->count = cam->num_frames; in cpia2_reqbufs()
772 struct camera_data *cam = video_drvdata(file); in cpia2_querybuf() local
775 buf->index >= cam->num_frames) in cpia2_querybuf()
778 buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer; in cpia2_querybuf()
779 buf->length = cam->frame_size; in cpia2_querybuf()
783 if (cam->mmapped) in cpia2_querybuf()
790 switch (cam->buffers[buf->index].status) { in cpia2_querybuf()
798 buf->bytesused = cam->buffers[buf->index].length; in cpia2_querybuf()
799 v4l2_buffer_set_timestamp(buf, cam->buffers[buf->index].ts); in cpia2_querybuf()
800 buf->sequence = cam->buffers[buf->index].seq; in cpia2_querybuf()
822 struct camera_data *cam = video_drvdata(file); in cpia2_qbuf() local
826 buf->index >= cam->num_frames) in cpia2_qbuf()
831 if (cam->buffers[buf->index].status == FRAME_READY) in cpia2_qbuf()
832 cam->buffers[buf->index].status = FRAME_EMPTY; in cpia2_qbuf()
845 static int find_earliest_filled_buffer(struct camera_data *cam) in find_earliest_filled_buffer() argument
850 for (i = 0; i < cam->num_frames; i++) { in find_earliest_filled_buffer()
851 if (cam->buffers[i].status == FRAME_READY) { in find_earliest_filled_buffer()
856 if (cam->buffers[i].ts < cam->buffers[found].ts) in find_earliest_filled_buffer()
874 struct camera_data *cam = video_drvdata(file); in cpia2_dqbuf() local
881 frame = find_earliest_filled_buffer(cam); in cpia2_dqbuf()
888 struct framebuf *cb = cam->curbuff; in cpia2_dqbuf()
890 mutex_unlock(&cam->v4l2_lock); in cpia2_dqbuf()
891 wait_event_interruptible(cam->wq_stream, in cpia2_dqbuf()
892 !video_is_registered(&cam->vdev) || in cpia2_dqbuf()
893 (cb = cam->curbuff)->status == FRAME_READY); in cpia2_dqbuf()
894 mutex_lock(&cam->v4l2_lock); in cpia2_dqbuf()
897 if (!video_is_registered(&cam->vdev)) in cpia2_dqbuf()
903 buf->bytesused = cam->buffers[buf->index].length; in cpia2_dqbuf()
907 v4l2_buffer_set_timestamp(buf, cam->buffers[buf->index].ts); in cpia2_dqbuf()
908 buf->sequence = cam->buffers[buf->index].seq; in cpia2_dqbuf()
909 buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer; in cpia2_dqbuf()
910 buf->length = cam->frame_size; in cpia2_dqbuf()
916 cam->buffers[buf->index].status, buf->sequence, buf->bytesused); in cpia2_dqbuf()
923 struct camera_data *cam = video_drvdata(file); in cpia2_streamon() local
926 DBG("VIDIOC_STREAMON, streaming=%d\n", cam->streaming); in cpia2_streamon()
927 if (!cam->mmapped || type != V4L2_BUF_TYPE_VIDEO_CAPTURE) in cpia2_streamon()
930 if (!cam->streaming) { in cpia2_streamon()
931 ret = cpia2_usb_stream_start(cam, in cpia2_streamon()
932 cam->params.camera_state.stream_mode); in cpia2_streamon()
934 v4l2_ctrl_grab(cam->usb_alt, true); in cpia2_streamon()
941 struct camera_data *cam = video_drvdata(file); in cpia2_streamoff() local
944 DBG("VIDIOC_STREAMOFF, streaming=%d\n", cam->streaming); in cpia2_streamoff()
945 if (!cam->mmapped || type != V4L2_BUF_TYPE_VIDEO_CAPTURE) in cpia2_streamoff()
948 if (cam->streaming) { in cpia2_streamoff()
949 ret = cpia2_usb_stream_stop(cam); in cpia2_streamoff()
951 v4l2_ctrl_grab(cam->usb_alt, false); in cpia2_streamoff()
963 struct camera_data *cam = video_drvdata(file); in cpia2_mmap() local
966 if (mutex_lock_interruptible(&cam->v4l2_lock)) in cpia2_mmap()
968 retval = cpia2_remap_buffer(cam, area); in cpia2_mmap()
971 cam->stream_fh = file->private_data; in cpia2_mmap()
972 mutex_unlock(&cam->v4l2_lock); in cpia2_mmap()
982 static void reset_camera_struct_v4l(struct camera_data *cam) in reset_camera_struct_v4l() argument
984 cam->width = cam->params.roi.width; in reset_camera_struct_v4l()
985 cam->height = cam->params.roi.height; in reset_camera_struct_v4l()
987 cam->frame_size = buffer_size; in reset_camera_struct_v4l()
988 cam->num_frames = num_buffers; in reset_camera_struct_v4l()
991 cam->params.flicker_control.flicker_mode_req = flicker_mode; in reset_camera_struct_v4l()
994 cam->params.camera_state.stream_mode = alternate; in reset_camera_struct_v4l()
996 cam->pixelformat = V4L2_PIX_FMT_JPEG; in reset_camera_struct_v4l()
1048 struct camera_data *cam = in cpia2_camera_release() local
1051 v4l2_ctrl_handler_free(&cam->hdl); in cpia2_camera_release()
1052 v4l2_device_unregister(&cam->v4l2_dev); in cpia2_camera_release()
1053 kfree(cam); in cpia2_camera_release()
1065 int cpia2_register_camera(struct camera_data *cam) in cpia2_register_camera() argument
1067 struct v4l2_ctrl_handler *hdl = &cam->hdl; in cpia2_register_camera()
1082 cam->params.pnp_id.device_type == DEVICE_STV_672 ? 1 : 0, in cpia2_register_camera()
1098 cam->usb_alt = v4l2_ctrl_new_custom(hdl, &cpia2_usb_alt, NULL); in cpia2_register_camera()
1100 if (cam->params.pnp_id.device_type != DEVICE_STV_672) in cpia2_register_camera()
1104 if (cam->params.pnp_id.device_type == DEVICE_STV_672) in cpia2_register_camera()
1110 if (cam->params.pnp_id.product == 0x151) { in cpia2_register_camera()
1111 cam->top_light = v4l2_ctrl_new_std(hdl, &cpia2_ctrl_ops, in cpia2_register_camera()
1114 cam->bottom_light = v4l2_ctrl_new_std(hdl, &cpia2_ctrl_ops, in cpia2_register_camera()
1117 v4l2_ctrl_cluster(2, &cam->top_light); in cpia2_register_camera()
1126 cam->vdev = cpia2_template; in cpia2_register_camera()
1127 video_set_drvdata(&cam->vdev, cam); in cpia2_register_camera()
1128 cam->vdev.lock = &cam->v4l2_lock; in cpia2_register_camera()
1129 cam->vdev.ctrl_handler = hdl; in cpia2_register_camera()
1130 cam->vdev.v4l2_dev = &cam->v4l2_dev; in cpia2_register_camera()
1131 cam->vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | in cpia2_register_camera()
1134 reset_camera_struct_v4l(cam); in cpia2_register_camera()
1137 if (video_register_device(&cam->vdev, VFL_TYPE_VIDEO, video_nr) < 0) { in cpia2_register_camera()
1150 void cpia2_unregister_camera(struct camera_data *cam) in cpia2_unregister_camera() argument
1152 video_unregister_device(&cam->vdev); in cpia2_unregister_camera()