Lines Matching refs:common

147 	struct common_obj *common;  in vpif_buffer_prepare()  local
153 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_prepare()
157 vb->width = common->width; in vpif_buffer_prepare()
158 vb->height = common->height; in vpif_buffer_prepare()
167 if (V4L2_MEMORY_USERPTR == common->memory) { in vpif_buffer_prepare()
180 if (!IS_ALIGNED((addr + common->ytop_off), 8) || in vpif_buffer_prepare()
181 !IS_ALIGNED((addr + common->ybtm_off), 8) || in vpif_buffer_prepare()
182 !IS_ALIGNED((addr + common->ctop_off), 8) || in vpif_buffer_prepare()
183 !IS_ALIGNED((addr + common->cbtm_off), 8)) in vpif_buffer_prepare()
207 struct common_obj *common; in vpif_buffer_setup() local
209 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_setup()
214 if (V4L2_MEMORY_MMAP != common->memory) in vpif_buffer_setup()
236 struct common_obj *common; in vpif_buffer_queue() local
238 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_queue()
243 list_add_tail(&vb->queue, &common->dma_queue); in vpif_buffer_queue()
262 struct common_obj *common; in vpif_buffer_release() local
264 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_release()
288 static void vpif_process_buffer_complete(struct common_obj *common) in vpif_process_buffer_complete() argument
290 do_gettimeofday(&common->cur_frm->ts); in vpif_process_buffer_complete()
291 common->cur_frm->state = VIDEOBUF_DONE; in vpif_process_buffer_complete()
292 wake_up_interruptible(&common->cur_frm->done); in vpif_process_buffer_complete()
294 common->cur_frm = common->next_frm; in vpif_process_buffer_complete()
305 static void vpif_schedule_next_buffer(struct common_obj *common) in vpif_schedule_next_buffer() argument
309 common->next_frm = list_entry(common->dma_queue.next, in vpif_schedule_next_buffer()
312 list_del(&common->next_frm->queue); in vpif_schedule_next_buffer()
313 common->next_frm->state = VIDEOBUF_ACTIVE; in vpif_schedule_next_buffer()
314 if (V4L2_MEMORY_USERPTR == common->memory) in vpif_schedule_next_buffer()
315 addr = common->next_frm->boff; in vpif_schedule_next_buffer()
317 addr = videobuf_to_dma_contig(common->next_frm); in vpif_schedule_next_buffer()
320 common->set_addr(addr + common->ytop_off, in vpif_schedule_next_buffer()
321 addr + common->ybtm_off, in vpif_schedule_next_buffer()
322 addr + common->ctop_off, in vpif_schedule_next_buffer()
323 addr + common->cbtm_off); in vpif_schedule_next_buffer()
337 struct common_obj *common; in vpif_channel_isr() local
346 field = ch->common[VPIF_VIDEO_INDEX].fmt.fmt.pix.field; in vpif_channel_isr()
349 common = &ch->common[i]; in vpif_channel_isr()
351 if (0 == common->started) in vpif_channel_isr()
357 if (list_empty(&common->dma_queue)) in vpif_channel_isr()
361 vpif_process_buffer_complete(common); in vpif_channel_isr()
365 vpif_schedule_next_buffer(common); in vpif_channel_isr()
395 if (common->cur_frm == common->next_frm) in vpif_channel_isr()
399 vpif_process_buffer_complete(common); in vpif_channel_isr()
402 if (list_empty(&common->dma_queue) || in vpif_channel_isr()
403 (common->cur_frm != common->next_frm)) in vpif_channel_isr()
406 vpif_schedule_next_buffer(common); in vpif_channel_isr()
422 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_update_std_info() local
452 common->fmt.fmt.pix.width = std_info->width; in vpif_update_std_info()
453 common->width = std_info->width; in vpif_update_std_info()
454 common->fmt.fmt.pix.height = std_info->height; in vpif_update_std_info()
455 common->height = std_info->height; in vpif_update_std_info()
456 common->fmt.fmt.pix.bytesperline = std_info->width; in vpif_update_std_info()
475 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_calculate_offsets() local
476 enum v4l2_field field = common->fmt.fmt.pix.field; in vpif_calculate_offsets()
486 vid_ch->buf_field = common->fmt.fmt.pix.field; in vpif_calculate_offsets()
488 if (V4L2_MEMORY_USERPTR == common->memory) in vpif_calculate_offsets()
489 sizeimage = common->fmt.fmt.pix.sizeimage; in vpif_calculate_offsets()
493 hpitch = common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
499 common->ytop_off = 0; in vpif_calculate_offsets()
500 common->ybtm_off = hpitch; in vpif_calculate_offsets()
501 common->ctop_off = sizeimage / 2; in vpif_calculate_offsets()
502 common->cbtm_off = sizeimage / 2 + hpitch; in vpif_calculate_offsets()
505 common->ytop_off = 0; in vpif_calculate_offsets()
506 common->ybtm_off = sizeimage / 4; in vpif_calculate_offsets()
507 common->ctop_off = sizeimage / 2; in vpif_calculate_offsets()
508 common->cbtm_off = common->ctop_off + sizeimage / 4; in vpif_calculate_offsets()
511 common->ybtm_off = 0; in vpif_calculate_offsets()
512 common->ytop_off = sizeimage / 4; in vpif_calculate_offsets()
513 common->cbtm_off = sizeimage / 2; in vpif_calculate_offsets()
514 common->ctop_off = common->cbtm_off + sizeimage / 4; in vpif_calculate_offsets()
524 common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
529 common->fmt.fmt.pix.bytesperline * 2; in vpif_calculate_offsets()
532 common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
544 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_config_format() local
548 common->fmt.fmt.pix.field = V4L2_FIELD_ANY; in vpif_config_format()
550 common->memory = V4L2_MEMORY_USERPTR; in vpif_config_format()
552 common->memory = V4L2_MEMORY_MMAP; in vpif_config_format()
554 common->fmt.fmt.pix.sizeimage in vpif_config_format()
558 common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8; in vpif_config_format()
560 common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P; in vpif_config_format()
561 common->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in vpif_config_format()
589 struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]); in vpif_check_format() local
643 if (V4L2_MEMORY_USERPTR == common->memory) in vpif_check_format()
677 pixfmt->width = common->fmt.fmt.pix.width; in vpif_check_format()
678 pixfmt->height = common->fmt.fmt.pix.height; in vpif_check_format()
691 struct common_obj *common; in vpif_config_addr() local
695 common = &(ch->common[VPIF_VIDEO_INDEX]); in vpif_config_addr()
698 common->set_addr = ch1_set_videobuf_addr; in vpif_config_addr()
700 common->set_addr = ch0_set_videobuf_addr_yc_nmux; in vpif_config_addr()
702 common->set_addr = ch0_set_videobuf_addr; in vpif_config_addr()
715 struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]); in vpif_mmap() local
719 return videobuf_mmap_mapper(&common->buffer_queue, vma); in vpif_mmap()
731 struct common_obj *common = &(channel->common[VPIF_VIDEO_INDEX]); in vpif_poll() local
735 if (common->started) in vpif_poll()
736 return videobuf_poll_stream(filep, &common->buffer_queue, wait); in vpif_poll()
751 struct common_obj *common; in vpif_open() local
762 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_open()
822 struct common_obj *common; in vpif_release() local
826 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_release()
831 common->io_usrs = 0; in vpif_release()
838 (2 == common->started)) { in vpif_release()
842 common->started = 0; in vpif_release()
844 videobuf_queue_cancel(&common->buffer_queue); in vpif_release()
845 videobuf_mmap_free(&common->buffer_queue); in vpif_release()
873 struct common_obj *common; in vpif_reqbufs() local
895 common = &ch->common[index]; in vpif_reqbufs()
897 if (0 != common->io_usrs) in vpif_reqbufs()
901 videobuf_queue_dma_contig_init(&common->buffer_queue, in vpif_reqbufs()
903 &common->irqlock, in vpif_reqbufs()
905 common->fmt.fmt.pix.field, in vpif_reqbufs()
907 &common->lock); in vpif_reqbufs()
912 common->io_usrs = 1; in vpif_reqbufs()
914 common->memory = reqbuf->memory; in vpif_reqbufs()
915 INIT_LIST_HEAD(&common->dma_queue); in vpif_reqbufs()
918 return videobuf_reqbufs(&common->buffer_queue, reqbuf); in vpif_reqbufs()
932 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_querybuf() local
936 if (common->fmt.type != buf->type) in vpif_querybuf()
939 if (common->memory != V4L2_MEMORY_MMAP) { in vpif_querybuf()
944 return videobuf_querybuf(&common->buffer_queue, buf); in vpif_querybuf()
958 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_qbuf() local
967 if (common->fmt.type != tbuf.type) { in vpif_qbuf()
977 if (!(list_empty(&common->dma_queue)) || in vpif_qbuf()
978 (common->cur_frm != common->next_frm) || in vpif_qbuf()
979 !common->started || in vpif_qbuf()
980 (common->started && (0 == ch->field_id))) in vpif_qbuf()
981 return videobuf_qbuf(&common->buffer_queue, buf); in vpif_qbuf()
984 mutex_lock(&common->buffer_queue.vb_lock); in vpif_qbuf()
985 buf1 = common->buffer_queue.bufs[tbuf.index]; in vpif_qbuf()
1005 vpif_buffer_release(&common->buffer_queue, buf1); in vpif_qbuf()
1015 ret = vpif_buffer_prepare(&common->buffer_queue, buf1, in vpif_qbuf()
1016 common->buffer_queue.field); in vpif_qbuf()
1024 if (V4L2_MEMORY_USERPTR == common->memory) in vpif_qbuf()
1029 common->next_frm = buf1; in vpif_qbuf()
1030 common->set_addr(addr + common->ytop_off, in vpif_qbuf()
1031 addr + common->ybtm_off, in vpif_qbuf()
1032 addr + common->ctop_off, in vpif_qbuf()
1033 addr + common->cbtm_off); in vpif_qbuf()
1036 list_add_tail(&buf1->stream, &common->buffer_queue.stream); in vpif_qbuf()
1037 mutex_unlock(&common->buffer_queue.vb_lock); in vpif_qbuf()
1041 mutex_unlock(&common->buffer_queue.vb_lock); in vpif_qbuf()
1055 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_dqbuf() local
1059 return videobuf_dqbuf(&common->buffer_queue, buf, in vpif_dqbuf()
1076 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_streamon() local
1098 if (common->started) { in vpif_streamon()
1104 oth_ch->common[VPIF_VIDEO_INDEX].started && in vpif_streamon()
1107 (2 == oth_ch->common[VPIF_VIDEO_INDEX].started))) { in vpif_streamon()
1112 ret = vpif_check_format(ch, &common->fmt.fmt.pix, 0); in vpif_streamon()
1126 ret = videobuf_streamon(&common->buffer_queue); in vpif_streamon()
1133 if (list_empty(&common->dma_queue)) { in vpif_streamon()
1140 common->cur_frm = list_entry(common->dma_queue.next, in vpif_streamon()
1142 common->next_frm = common->cur_frm; in vpif_streamon()
1145 list_del(&common->cur_frm->queue); in vpif_streamon()
1147 common->cur_frm->state = VIDEOBUF_ACTIVE; in vpif_streamon()
1150 common->started = 1; in vpif_streamon()
1152 if (V4L2_MEMORY_USERPTR == common->memory) in vpif_streamon()
1153 addr = common->cur_frm->boff; in vpif_streamon()
1155 addr = videobuf_to_dma_contig(common->cur_frm); in vpif_streamon()
1161 ((common->fmt.fmt.pix.field != V4L2_FIELD_NONE) && in vpif_streamon()
1162 (common->fmt.fmt.pix.field != V4L2_FIELD_ANY))) || in vpif_streamon()
1164 (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) { in vpif_streamon()
1186 common->started = ret; in vpif_streamon()
1189 common->set_addr(addr + common->ytop_off, in vpif_streamon()
1190 addr + common->ybtm_off, in vpif_streamon()
1191 addr + common->ctop_off, in vpif_streamon()
1192 addr + common->cbtm_off); in vpif_streamon()
1204 (common->started == 2)) { in vpif_streamon()
1213 videobuf_streamoff(&common->buffer_queue); in vpif_streamon()
1229 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_streamoff() local
1246 if (!common->started) { in vpif_streamoff()
1260 common->started = 0; in vpif_streamoff()
1268 return videobuf_streamoff(&common->buffer_queue); in vpif_streamoff()
1383 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_std() local
1388 if (common->started) { in vpif_s_std()
1485 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_input() local
1493 if (common->started) { in vpif_s_input()
1610 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_g_fmt_vid_cap() local
1613 if (common->fmt.type != fmt->type) in vpif_g_fmt_vid_cap()
1617 *fmt = common->fmt; in vpif_g_fmt_vid_cap()
1632 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_fmt_vid_cap() local
1639 if (common->started) { in vpif_s_fmt_vid_cap()
1665 common->fmt = *fmt; in vpif_s_fmt_vid_cap()
1731 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_cropcap() local
1738 crop->bounds.height = common->height; in vpif_cropcap()
1739 crop->bounds.width = common->width; in vpif_cropcap()
1786 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_dv_preset() local
1789 if (common->started) { in vpif_s_dv_preset()
1809 if (mutex_lock_interruptible(&common->lock)) in vpif_s_dv_preset()
1828 mutex_unlock(&common->lock); in vpif_s_dv_preset()
2168 struct common_obj *common; in vpif_probe() local
2225 common = &(ch->common[VPIF_VIDEO_INDEX]); in vpif_probe()
2226 spin_lock_init(&common->irqlock); in vpif_probe()
2227 mutex_init(&common->lock); in vpif_probe()
2228 ch->video_dev->lock = &common->lock; in vpif_probe()