Lines Matching refs:common

72 	struct common_obj *common;  in vpif_buffer_prepare()  local
74 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_prepare()
76 vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage); in vpif_buffer_prepare()
80 vb->v4l2_buf.field = common->fmt.fmt.pix.field; in vpif_buffer_prepare()
85 if (!ISALIGNED(addr + common->ytop_off) || in vpif_buffer_prepare()
86 !ISALIGNED(addr + common->ybtm_off) || in vpif_buffer_prepare()
87 !ISALIGNED(addr + common->ctop_off) || in vpif_buffer_prepare()
88 !ISALIGNED(addr + common->cbtm_off)) { in vpif_buffer_prepare()
115 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_queue_setup() local
117 if (fmt && fmt->fmt.pix.sizeimage < common->fmt.fmt.pix.sizeimage) in vpif_buffer_queue_setup()
124 sizes[0] = fmt ? fmt->fmt.pix.sizeimage : common->fmt.fmt.pix.sizeimage; in vpif_buffer_queue_setup()
125 alloc_ctxs[0] = common->alloc_ctx; in vpif_buffer_queue_setup()
143 struct common_obj *common; in vpif_buffer_queue() local
146 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_buffer_queue()
149 spin_lock_irqsave(&common->irqlock, flags); in vpif_buffer_queue()
150 list_add_tail(&buf->list, &common->dma_queue); in vpif_buffer_queue()
151 spin_unlock_irqrestore(&common->irqlock, flags); in vpif_buffer_queue()
164 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_start_streaming() local
170 spin_lock_irqsave(&common->irqlock, flags); in vpif_start_streaming()
193 common->next_frm = common->cur_frm = in vpif_start_streaming()
194 list_entry(common->dma_queue.next, in vpif_start_streaming()
197 list_del(&common->cur_frm->list); in vpif_start_streaming()
198 spin_unlock_irqrestore(&common->irqlock, flags); in vpif_start_streaming()
200 addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0); in vpif_start_streaming()
201 common->set_addr((addr + common->ytop_off), in vpif_start_streaming()
202 (addr + common->ybtm_off), in vpif_start_streaming()
203 (addr + common->ctop_off), in vpif_start_streaming()
204 (addr + common->cbtm_off)); in vpif_start_streaming()
230 list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) { in vpif_start_streaming()
234 spin_unlock_irqrestore(&common->irqlock, flags); in vpif_start_streaming()
249 struct common_obj *common; in vpif_stop_streaming() local
252 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_stop_streaming()
265 spin_lock_irqsave(&common->irqlock, flags); in vpif_stop_streaming()
266 if (common->cur_frm == common->next_frm) { in vpif_stop_streaming()
267 vb2_buffer_done(&common->cur_frm->vb, VB2_BUF_STATE_ERROR); in vpif_stop_streaming()
269 if (common->cur_frm != NULL) in vpif_stop_streaming()
270 vb2_buffer_done(&common->cur_frm->vb, in vpif_stop_streaming()
272 if (common->next_frm != NULL) in vpif_stop_streaming()
273 vb2_buffer_done(&common->next_frm->vb, in vpif_stop_streaming()
277 while (!list_empty(&common->dma_queue)) { in vpif_stop_streaming()
278 common->next_frm = list_entry(common->dma_queue.next, in vpif_stop_streaming()
280 list_del(&common->next_frm->list); in vpif_stop_streaming()
281 vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR); in vpif_stop_streaming()
283 spin_unlock_irqrestore(&common->irqlock, flags); in vpif_stop_streaming()
296 static void process_progressive_mode(struct common_obj *common) in process_progressive_mode() argument
300 spin_lock(&common->irqlock); in process_progressive_mode()
302 common->next_frm = list_entry(common->dma_queue.next, in process_progressive_mode()
305 list_del(&common->next_frm->list); in process_progressive_mode()
306 spin_unlock(&common->irqlock); in process_progressive_mode()
309 addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0); in process_progressive_mode()
310 common->set_addr(addr + common->ytop_off, in process_progressive_mode()
311 addr + common->ybtm_off, in process_progressive_mode()
312 addr + common->ctop_off, in process_progressive_mode()
313 addr + common->cbtm_off); in process_progressive_mode()
316 static void process_interlaced_mode(int fid, struct common_obj *common) in process_interlaced_mode() argument
321 if (common->cur_frm == common->next_frm) in process_interlaced_mode()
327 v4l2_get_timestamp(&common->cur_frm->vb.v4l2_buf.timestamp); in process_interlaced_mode()
329 vb2_buffer_done(&common->cur_frm->vb, in process_interlaced_mode()
332 common->cur_frm = common->next_frm; in process_interlaced_mode()
335 spin_lock(&common->irqlock); in process_interlaced_mode()
336 if (list_empty(&common->dma_queue) in process_interlaced_mode()
337 || (common->cur_frm != common->next_frm)) { in process_interlaced_mode()
338 spin_unlock(&common->irqlock); in process_interlaced_mode()
341 spin_unlock(&common->irqlock); in process_interlaced_mode()
346 process_progressive_mode(common); in process_interlaced_mode()
358 struct common_obj *common; in vpif_channel_isr() local
368 common = &ch->common[i]; in vpif_channel_isr()
372 spin_lock(&common->irqlock); in vpif_channel_isr()
373 if (list_empty(&common->dma_queue)) { in vpif_channel_isr()
374 spin_unlock(&common->irqlock); in vpif_channel_isr()
377 spin_unlock(&common->irqlock); in vpif_channel_isr()
383 v4l2_get_timestamp(&common->cur_frm->vb. in vpif_channel_isr()
385 vb2_buffer_done(&common->cur_frm->vb, in vpif_channel_isr()
388 common->cur_frm = common->next_frm; in vpif_channel_isr()
392 process_progressive_mode(common); in vpif_channel_isr()
415 process_interlaced_mode(fid, common); in vpif_channel_isr()
452 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_update_resolution() local
465 common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P; in vpif_update_resolution()
466 common->fmt.fmt.pix.width = std_info->width; in vpif_update_resolution()
467 common->fmt.fmt.pix.height = std_info->height; in vpif_update_resolution()
469 common->fmt.fmt.pix.width, common->fmt.fmt.pix.height); in vpif_update_resolution()
472 common->height = std_info->height; in vpif_update_resolution()
473 common->width = std_info->width; in vpif_update_resolution()
474 common->fmt.fmt.pix.sizeimage = common->height * common->width * 2; in vpif_update_resolution()
477 common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; in vpif_update_resolution()
479 common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_REC709; in vpif_update_resolution()
482 common->fmt.fmt.pix.field = V4L2_FIELD_NONE; in vpif_update_resolution()
484 common->fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; in vpif_update_resolution()
495 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_calculate_offsets() local
497 enum v4l2_field field = common->fmt.fmt.pix.field; in vpif_calculate_offsets()
501 if (V4L2_FIELD_ANY == common->fmt.fmt.pix.field) { in vpif_calculate_offsets()
507 vid_ch->buf_field = common->fmt.fmt.pix.field; in vpif_calculate_offsets()
510 sizeimage = common->fmt.fmt.pix.sizeimage; in vpif_calculate_offsets()
512 hpitch = common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
515 common->ytop_off = 0; in vpif_calculate_offsets()
516 common->ybtm_off = hpitch; in vpif_calculate_offsets()
517 common->ctop_off = sizeimage / 2; in vpif_calculate_offsets()
518 common->cbtm_off = sizeimage / 2 + hpitch; in vpif_calculate_offsets()
520 common->ytop_off = 0; in vpif_calculate_offsets()
521 common->ybtm_off = sizeimage / 4; in vpif_calculate_offsets()
522 common->ctop_off = sizeimage / 2; in vpif_calculate_offsets()
523 common->cbtm_off = common->ctop_off + sizeimage / 4; in vpif_calculate_offsets()
525 common->ybtm_off = 0; in vpif_calculate_offsets()
526 common->ytop_off = sizeimage / 4; in vpif_calculate_offsets()
527 common->cbtm_off = sizeimage / 2; in vpif_calculate_offsets()
528 common->ctop_off = common->cbtm_off + sizeimage / 4; in vpif_calculate_offsets()
540 common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
545 common->fmt.fmt.pix.bytesperline * 2; in vpif_calculate_offsets()
548 common->fmt.fmt.pix.bytesperline; in vpif_calculate_offsets()
556 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_config_addr() local
559 common->set_addr = ch3_set_videobuf_addr; in vpif_config_addr()
562 common->set_addr = ch2_set_videobuf_addr_yc_nmux; in vpif_config_addr()
564 common->set_addr = ch2_set_videobuf_addr; in vpif_config_addr()
609 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_g_fmt_vid_out() local
612 if (common->fmt.type != fmt->type) in vpif_g_fmt_vid_out()
617 *fmt = common->fmt; in vpif_g_fmt_vid_out()
626 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_try_fmt_vid_out() local
634 pixfmt->pixelformat = common->fmt.fmt.pix.pixelformat; in vpif_try_fmt_vid_out()
639 pixfmt->colorspace = common->fmt.fmt.pix.colorspace; in vpif_try_fmt_vid_out()
640 pixfmt->field = common->fmt.fmt.pix.field; in vpif_try_fmt_vid_out()
641 pixfmt->bytesperline = common->fmt.fmt.pix.width; in vpif_try_fmt_vid_out()
642 pixfmt->width = common->fmt.fmt.pix.width; in vpif_try_fmt_vid_out()
643 pixfmt->height = common->fmt.fmt.pix.height; in vpif_try_fmt_vid_out()
654 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_fmt_vid_out() local
658 if (vb2_is_busy(&common->buffer_queue)) in vpif_s_fmt_vid_out()
666 common->fmt.fmt.pix = *pixfmt; in vpif_s_fmt_vid_out()
669 common->fmt = *fmt; in vpif_s_fmt_vid_out()
678 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_std() local
691 if (vb2_is_busy(&common->buffer_queue)) in vpif_s_std()
705 common->fmt.fmt.pix.bytesperline = common->fmt.fmt.pix.width; in vpif_s_std()
842 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_output() local
844 if (vb2_is_busy(&common->buffer_queue)) in vpif_s_output()
911 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_s_dv_timings() local
927 if (vb2_is_busy(&common->buffer_queue)) in vpif_s_dv_timings()
1134 struct common_obj *common; in vpif_probe_complete() local
1144 common = &ch->common[k]; in vpif_probe_complete()
1145 spin_lock_init(&common->irqlock); in vpif_probe_complete()
1146 mutex_init(&common->lock); in vpif_probe_complete()
1147 common->set_addr = NULL; in vpif_probe_complete()
1148 common->ytop_off = 0; in vpif_probe_complete()
1149 common->ybtm_off = 0; in vpif_probe_complete()
1150 common->ctop_off = 0; in vpif_probe_complete()
1151 common->cbtm_off = 0; in vpif_probe_complete()
1152 common->cur_frm = NULL; in vpif_probe_complete()
1153 common->next_frm = NULL; in vpif_probe_complete()
1154 memset(&common->fmt, 0, sizeof(common->fmt)); in vpif_probe_complete()
1163 ch->common[VPIF_VIDEO_INDEX].fmt.type = in vpif_probe_complete()
1177 q = &common->buffer_queue; in vpif_probe_complete()
1186 q->lock = &common->lock; in vpif_probe_complete()
1193 common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); in vpif_probe_complete()
1194 if (IS_ERR(common->alloc_ctx)) { in vpif_probe_complete()
1196 err = PTR_ERR(common->alloc_ctx); in vpif_probe_complete()
1200 INIT_LIST_HEAD(&common->dma_queue); in vpif_probe_complete()
1215 vdev->lock = &common->lock; in vpif_probe_complete()
1228 common = &ch->common[k]; in vpif_probe_complete()
1229 vb2_dma_contig_cleanup_ctx(common->alloc_ctx); in vpif_probe_complete()
1339 struct common_obj *common; in vpif_remove() local
1350 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_remove()
1351 vb2_dma_contig_cleanup_ctx(common->alloc_ctx); in vpif_remove()
1363 struct common_obj *common; in vpif_suspend() local
1370 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_suspend()
1372 if (!vb2_start_streaming_called(&common->buffer_queue)) in vpif_suspend()
1375 mutex_lock(&common->lock); in vpif_suspend()
1386 mutex_unlock(&common->lock); in vpif_suspend()
1395 struct common_obj *common; in vpif_resume() local
1402 common = &ch->common[VPIF_VIDEO_INDEX]; in vpif_resume()
1404 if (!vb2_start_streaming_called(&common->buffer_queue)) in vpif_resume()
1407 mutex_lock(&common->lock); in vpif_resume()
1418 mutex_unlock(&common->lock); in vpif_resume()