Lines Matching refs:common
77 struct common_obj *common; in vpif_buffer_prepare() local
82 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_prepare()
84 vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage); in vpif_buffer_prepare()
88 vb->v4l2_buf.field = common->fmt.fmt.pix.field; in vpif_buffer_prepare()
91 if (!IS_ALIGNED((addr + common->ytop_off), 8) || in vpif_buffer_prepare()
92 !IS_ALIGNED((addr + common->ybtm_off), 8) || in vpif_buffer_prepare()
93 !IS_ALIGNED((addr + common->ctop_off), 8) || in vpif_buffer_prepare()
94 !IS_ALIGNED((addr + common->cbtm_off), 8)) { in vpif_buffer_prepare()
120 struct common_obj *common; in vpif_buffer_queue_setup() local
122 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_queue_setup()
126 if (fmt && fmt->fmt.pix.sizeimage < common->fmt.fmt.pix.sizeimage) in vpif_buffer_queue_setup()
133 sizes[0] = fmt ? fmt->fmt.pix.sizeimage : common->fmt.fmt.pix.sizeimage; in vpif_buffer_queue_setup()
134 alloc_ctxs[0] = common->alloc_ctx; in vpif_buffer_queue_setup()
150 struct common_obj *common; in vpif_buffer_queue() local
153 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_queue()
157 spin_lock_irqsave(&common->irqlock, flags); in vpif_buffer_queue()
159 list_add_tail(&buf->list, &common->dma_queue); in vpif_buffer_queue()
160 spin_unlock_irqrestore(&common->irqlock, flags); in vpif_buffer_queue()
173 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_start_streaming() local
179 spin_lock_irqsave(&common->irqlock, flags); in vpif_start_streaming()
211 common->cur_frm = common->next_frm = list_entry(common->dma_queue.next, in vpif_start_streaming()
214 list_del(&common->cur_frm->list); in vpif_start_streaming()
215 spin_unlock_irqrestore(&common->irqlock, flags); in vpif_start_streaming()
217 addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0); in vpif_start_streaming()
219 common->set_addr(addr + common->ytop_off, in vpif_start_streaming()
220 addr + common->ybtm_off, in vpif_start_streaming()
221 addr + common->ctop_off, in vpif_start_streaming()
222 addr + common->cbtm_off); in vpif_start_streaming()
244 list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) { in vpif_start_streaming()
248 spin_unlock_irqrestore(&common->irqlock, flags); in vpif_start_streaming()
263 struct common_obj *common; in vpif_stop_streaming() local
267 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_stop_streaming()
287 spin_lock_irqsave(&common->irqlock, flags); in vpif_stop_streaming()
288 if (common->cur_frm == common->next_frm) { in vpif_stop_streaming()
289 vb2_buffer_done(&common->cur_frm->vb, VB2_BUF_STATE_ERROR); in vpif_stop_streaming()
291 if (common->cur_frm != NULL) in vpif_stop_streaming()
292 vb2_buffer_done(&common->cur_frm->vb, in vpif_stop_streaming()
294 if (common->next_frm != NULL) in vpif_stop_streaming()
295 vb2_buffer_done(&common->next_frm->vb, in vpif_stop_streaming()
299 while (!list_empty(&common->dma_queue)) { in vpif_stop_streaming()
300 common->next_frm = list_entry(common->dma_queue.next, in vpif_stop_streaming()
302 list_del(&common->next_frm->list); in vpif_stop_streaming()
303 vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR); in vpif_stop_streaming()
305 spin_unlock_irqrestore(&common->irqlock, flags); in vpif_stop_streaming()
326 static void vpif_process_buffer_complete(struct common_obj *common) in vpif_process_buffer_complete() argument
328 v4l2_get_timestamp(&common->cur_frm->vb.v4l2_buf.timestamp); in vpif_process_buffer_complete()
329 vb2_buffer_done(&common->cur_frm->vb, in vpif_process_buffer_complete()
332 common->cur_frm = common->next_frm; in vpif_process_buffer_complete()
343 static void vpif_schedule_next_buffer(struct common_obj *common) in vpif_schedule_next_buffer() argument
347 spin_lock(&common->irqlock); in vpif_schedule_next_buffer()
348 common->next_frm = list_entry(common->dma_queue.next, in vpif_schedule_next_buffer()
351 list_del(&common->next_frm->list); in vpif_schedule_next_buffer()
352 spin_unlock(&common->irqlock); in vpif_schedule_next_buffer()
353 addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0); in vpif_schedule_next_buffer()
356 common->set_addr(addr + common->ytop_off, in vpif_schedule_next_buffer()
357 addr + common->ybtm_off, in vpif_schedule_next_buffer()
358 addr + common->ctop_off, in vpif_schedule_next_buffer()
359 addr + common->cbtm_off); in vpif_schedule_next_buffer()
373 struct common_obj *common; in vpif_channel_isr() local
385 common = &ch->common[i]; in vpif_channel_isr()
390 spin_lock(&common->irqlock); in vpif_channel_isr()
391 if (list_empty(&common->dma_queue)) { in vpif_channel_isr()
392 spin_unlock(&common->irqlock); in vpif_channel_isr()
395 spin_unlock(&common->irqlock); in vpif_channel_isr()
398 vpif_process_buffer_complete(common); in vpif_channel_isr()
402 vpif_schedule_next_buffer(common); in vpif_channel_isr()
432 if (common->cur_frm == common->next_frm) in vpif_channel_isr()
436 vpif_process_buffer_complete(common); in vpif_channel_isr()
439 spin_lock(&common->irqlock); in vpif_channel_isr()
440 if (list_empty(&common->dma_queue) || in vpif_channel_isr()
441 (common->cur_frm != common->next_frm)) { in vpif_channel_isr()
442 spin_unlock(&common->irqlock); in vpif_channel_isr()
445 spin_unlock(&common->irqlock); in vpif_channel_isr()
447 vpif_schedule_next_buffer(common); in vpif_channel_isr()
463 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_update_std_info() local
494 common->fmt.fmt.pix.width = std_info->width; in vpif_update_std_info()
495 common->width = std_info->width; in vpif_update_std_info()
496 common->fmt.fmt.pix.height = std_info->height; in vpif_update_std_info()
497 common->height = std_info->height; in vpif_update_std_info()
498 common->fmt.fmt.pix.sizeimage = common->height * common->width * 2; in vpif_update_std_info()
499 common->fmt.fmt.pix.bytesperline = std_info->width; in vpif_update_std_info()
504 common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; in vpif_update_std_info()
506 common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_REC709; in vpif_update_std_info()
509 common->fmt.fmt.pix.field = V4L2_FIELD_NONE; in vpif_update_std_info()
511 common->fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; in vpif_update_std_info()
514 common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8; in vpif_update_std_info()
516 common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P; in vpif_update_std_info()
518 common->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in vpif_update_std_info()
535 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_calculate_offsets() local
536 enum v4l2_field field = common->fmt.fmt.pix.field; in vpif_calculate_offsets()
546 vid_ch->buf_field = common->fmt.fmt.pix.field; in vpif_calculate_offsets()
548 sizeimage = common->fmt.fmt.pix.sizeimage; in vpif_calculate_offsets()
550 hpitch = common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
555 common->ytop_off = 0; in vpif_calculate_offsets()
556 common->ybtm_off = hpitch; in vpif_calculate_offsets()
557 common->ctop_off = sizeimage / 2; in vpif_calculate_offsets()
558 common->cbtm_off = sizeimage / 2 + hpitch; in vpif_calculate_offsets()
561 common->ytop_off = 0; in vpif_calculate_offsets()
562 common->ybtm_off = sizeimage / 4; in vpif_calculate_offsets()
563 common->ctop_off = sizeimage / 2; in vpif_calculate_offsets()
564 common->cbtm_off = common->ctop_off + sizeimage / 4; in vpif_calculate_offsets()
567 common->ybtm_off = 0; in vpif_calculate_offsets()
568 common->ytop_off = sizeimage / 4; in vpif_calculate_offsets()
569 common->cbtm_off = sizeimage / 2; in vpif_calculate_offsets()
570 common->ctop_off = common->cbtm_off + sizeimage / 4; in vpif_calculate_offsets()
580 common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
585 common->fmt.fmt.pix.bytesperline * 2; in vpif_calculate_offsets()
588 common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
612 struct common_obj *common; in vpif_config_addr() local
616 common = &(ch->common[VPIF_VIDEO_INDEX]); in vpif_config_addr()
619 common->set_addr = ch1_set_videobuf_addr; in vpif_config_addr()
621 common->set_addr = ch0_set_videobuf_addr_yc_nmux; in vpif_config_addr()
623 common->set_addr = ch0_set_videobuf_addr; in vpif_config_addr()
787 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_std() local
802 if (vb2_is_busy(&common->buffer_queue)) in vpif_s_std()
875 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_input() local
883 if (vb2_is_busy(&common->buffer_queue)) in vpif_s_input()
931 struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]); in vpif_try_fmt_vid_cap() local
946 common->fmt.fmt.pix.pixelformat = pixfmt->pixelformat; in vpif_try_fmt_vid_cap()
950 pixfmt->field = common->fmt.fmt.pix.field; in vpif_try_fmt_vid_cap()
951 pixfmt->colorspace = common->fmt.fmt.pix.colorspace; in vpif_try_fmt_vid_cap()
952 pixfmt->bytesperline = common->fmt.fmt.pix.width; in vpif_try_fmt_vid_cap()
953 pixfmt->width = common->fmt.fmt.pix.width; in vpif_try_fmt_vid_cap()
954 pixfmt->height = common->fmt.fmt.pix.height; in vpif_try_fmt_vid_cap()
973 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_g_fmt_vid_cap() local
976 if (common->fmt.type != fmt->type) in vpif_g_fmt_vid_cap()
980 *fmt = common->fmt; in vpif_g_fmt_vid_cap()
995 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_fmt_vid_cap() local
1000 if (vb2_is_busy(&common->buffer_queue)) in vpif_s_fmt_vid_cap()
1008 common->fmt = *fmt; in vpif_s_fmt_vid_cap()
1113 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_dv_timings() local
1133 if (vb2_is_busy(&common->buffer_queue)) in vpif_s_dv_timings()
1336 struct common_obj *common; in vpif_probe_complete() local
1345 common = &(ch->common[VPIF_VIDEO_INDEX]); in vpif_probe_complete()
1346 spin_lock_init(&common->irqlock); in vpif_probe_complete()
1347 mutex_init(&common->lock); in vpif_probe_complete()
1360 q = &common->buffer_queue; in vpif_probe_complete()
1369 q->lock = &common->lock; in vpif_probe_complete()
1377 common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); in vpif_probe_complete()
1378 if (IS_ERR(common->alloc_ctx)) { in vpif_probe_complete()
1380 err = PTR_ERR(common->alloc_ctx); in vpif_probe_complete()
1384 INIT_LIST_HEAD(&common->dma_queue); in vpif_probe_complete()
1395 vdev->lock = &common->lock; in vpif_probe_complete()
1410 common = &ch->common[k]; in vpif_probe_complete()
1411 vb2_dma_contig_cleanup_ctx(common->alloc_ctx); in vpif_probe_complete()
1533 struct common_obj *common; in vpif_remove() local
1544 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_remove()
1545 vb2_dma_contig_cleanup_ctx(common->alloc_ctx); in vpif_remove()
1560 struct common_obj *common; in vpif_suspend() local
1567 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_suspend()
1569 if (!vb2_start_streaming_called(&common->buffer_queue)) in vpif_suspend()
1572 mutex_lock(&common->lock); in vpif_suspend()
1583 mutex_unlock(&common->lock); in vpif_suspend()
1594 struct common_obj *common; in vpif_resume() local
1601 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_resume()
1603 if (!vb2_start_streaming_called(&common->buffer_queue)) in vpif_resume()
1606 mutex_lock(&common->lock); in vpif_resume()
1617 mutex_unlock(&common->lock); in vpif_resume()