Lines Matching full:cru
3 * Driver for Renesas RZ/G2L CRU
21 #include "rzg2l-cru.h"
23 /* HW CRU Registers Definition */
25 /* CRU Control Register */
29 /* CRU Interrupt Enable Register */
33 /* CRU Interrupt Status Register */
37 /* CRU Reset Register */
41 /* Memory Bank Base Address (Lower) Register for CRU Image Data */
44 /* Memory Bank Base Address (Higher) Register for CRU Image Data */
47 /* Memory Bank Enable Register for CRU Image Data */
51 /* Memory Bank Status Register for CRU Image Data */
55 /* AXI Master FIFO Pointer Register for CRU Image Data */
60 /* AXI Master Transfer Stop Register for CRU Image Data */
64 /* AXI Master Transfer Stop Status Register for CRU Image Data */
68 /* CRU Image Processing Enable Register */
72 /* CRU Image Processing Main Control Register */
80 /* CRU Module Status Register */
84 /* CRU Data Output Mode Register */
108 static void rzg2l_cru_write(struct rzg2l_cru_dev *cru, u32 offset, u32 value) in rzg2l_cru_write() argument
110 iowrite32(value, cru->base + offset); in rzg2l_cru_write()
113 static u32 rzg2l_cru_read(struct rzg2l_cru_dev *cru, u32 offset) in rzg2l_cru_read() argument
115 return ioread32(cru->base + offset); in rzg2l_cru_read()
119 static void return_unused_buffers(struct rzg2l_cru_dev *cru, in return_unused_buffers() argument
126 spin_lock_irqsave(&cru->qlock, flags); in return_unused_buffers()
127 for (i = 0; i < cru->num_buf; i++) { in return_unused_buffers()
128 if (cru->queue_buf[i]) { in return_unused_buffers()
129 vb2_buffer_done(&cru->queue_buf[i]->vb2_buf, in return_unused_buffers()
131 cru->queue_buf[i] = NULL; in return_unused_buffers()
135 list_for_each_entry_safe(buf, node, &cru->buf_list, list) { in return_unused_buffers()
139 spin_unlock_irqrestore(&cru->qlock, flags); in return_unused_buffers()
146 struct rzg2l_cru_dev *cru = vb2_get_drv_priv(vq); in rzg2l_cru_queue_setup() local
150 return sizes[0] < cru->format.sizeimage ? -EINVAL : 0; in rzg2l_cru_queue_setup()
153 sizes[0] = cru->format.sizeimage; in rzg2l_cru_queue_setup()
160 struct rzg2l_cru_dev *cru = vb2_get_drv_priv(vb->vb2_queue); in rzg2l_cru_buffer_prepare() local
161 unsigned long size = cru->format.sizeimage; in rzg2l_cru_buffer_prepare()
164 dev_err(cru->dev, "buffer too small (%lu < %lu)\n", in rzg2l_cru_buffer_prepare()
177 struct rzg2l_cru_dev *cru = vb2_get_drv_priv(vb->vb2_queue); in rzg2l_cru_buffer_queue() local
180 spin_lock_irqsave(&cru->qlock, flags); in rzg2l_cru_buffer_queue()
182 list_add_tail(to_buf_list(vbuf), &cru->buf_list); in rzg2l_cru_buffer_queue()
184 spin_unlock_irqrestore(&cru->qlock, flags); in rzg2l_cru_buffer_queue()
187 static int rzg2l_cru_mc_validate_format(struct rzg2l_cru_dev *cru, in rzg2l_cru_mc_validate_format() argument
220 if (fmt.format.width != cru->format.width || in rzg2l_cru_mc_validate_format()
221 fmt.format.height != cru->format.height) in rzg2l_cru_mc_validate_format()
227 static void rzg2l_cru_set_slot_addr(struct rzg2l_cru_dev *cru, in rzg2l_cru_set_slot_addr() argument
238 rzg2l_cru_write(cru, AMnMBxADDRL(slot), addr); in rzg2l_cru_set_slot_addr()
239 rzg2l_cru_write(cru, AMnMBxADDRH(slot), 0); in rzg2l_cru_set_slot_addr()
248 static void rzg2l_cru_fill_hw_slot(struct rzg2l_cru_dev *cru, int slot) in rzg2l_cru_fill_hw_slot() argument
255 if (WARN_ON(cru->queue_buf[slot])) in rzg2l_cru_fill_hw_slot()
258 dev_dbg(cru->dev, "Filling HW slot: %d\n", slot); in rzg2l_cru_fill_hw_slot()
260 if (list_empty(&cru->buf_list)) { in rzg2l_cru_fill_hw_slot()
261 cru->queue_buf[slot] = NULL; in rzg2l_cru_fill_hw_slot()
262 phys_addr = cru->scratch_phys; in rzg2l_cru_fill_hw_slot()
265 buf = list_entry(cru->buf_list.next, in rzg2l_cru_fill_hw_slot()
269 cru->queue_buf[slot] = vbuf; in rzg2l_cru_fill_hw_slot()
275 rzg2l_cru_set_slot_addr(cru, slot, phys_addr); in rzg2l_cru_fill_hw_slot()
278 static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru) in rzg2l_cru_initialize_axi() argument
286 rzg2l_cru_write(cru, AMnMBVALID, AMnMBVALID_MBVALID(cru->num_buf - 1)); in rzg2l_cru_initialize_axi()
288 for (slot = 0; slot < cru->num_buf; slot++) in rzg2l_cru_initialize_axi()
289 rzg2l_cru_fill_hw_slot(cru, slot); in rzg2l_cru_initialize_axi()
292 static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv, in rzg2l_cru_csi2_setup() argument
308 icnmc |= (rzg2l_cru_read(cru, ICnMC) & ~ICnMC_INF_MASK); in rzg2l_cru_csi2_setup()
311 icnmc |= ICnMC_VCSEL(cru->csi.channel); in rzg2l_cru_csi2_setup()
313 rzg2l_cru_write(cru, ICnMC, icnmc); in rzg2l_cru_csi2_setup()
316 static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, in rzg2l_cru_initialize_image_conv() argument
323 rzg2l_cru_csi2_setup(cru, &input_is_yuv, ip_sd_fmt); in rzg2l_cru_initialize_image_conv()
326 switch (cru->format.pixelformat) { in rzg2l_cru_initialize_image_conv()
332 dev_err(cru->dev, "Invalid pixelformat (0x%x)\n", in rzg2l_cru_initialize_image_conv()
333 cru->format.pixelformat); in rzg2l_cru_initialize_image_conv()
339 rzg2l_cru_write(cru, ICnMC, in rzg2l_cru_initialize_image_conv()
340 rzg2l_cru_read(cru, ICnMC) | ICnMC_CSCTHR); in rzg2l_cru_initialize_image_conv()
342 rzg2l_cru_write(cru, ICnMC, in rzg2l_cru_initialize_image_conv()
343 rzg2l_cru_read(cru, ICnMC) & (~ICnMC_CSCTHR)); in rzg2l_cru_initialize_image_conv()
346 rzg2l_cru_write(cru, ICnDMR, icndmr); in rzg2l_cru_initialize_image_conv()
351 void rzg2l_cru_stop_image_processing(struct rzg2l_cru_dev *cru) in rzg2l_cru_stop_image_processing() argument
358 spin_lock_irqsave(&cru->qlock, flags); in rzg2l_cru_stop_image_processing()
361 rzg2l_cru_write(cru, CRUnIE, 0); in rzg2l_cru_stop_image_processing()
362 rzg2l_cru_write(cru, CRUnINTS, 0x001F0F0F); in rzg2l_cru_stop_image_processing()
365 rzg2l_cru_write(cru, ICnEN, 0); in rzg2l_cru_stop_image_processing()
368 while ((rzg2l_cru_read(cru, ICnMS) & ICnMS_IA) && retries++ < RZG2L_RETRIES) { in rzg2l_cru_stop_image_processing()
369 spin_unlock_irqrestore(&cru->qlock, flags); in rzg2l_cru_stop_image_processing()
371 spin_lock_irqsave(&cru->qlock, flags); in rzg2l_cru_stop_image_processing()
374 icnms = rzg2l_cru_read(cru, ICnMS) & ICnMS_IA; in rzg2l_cru_stop_image_processing()
376 dev_err(cru->dev, "Failed stop HW, something is seriously broken\n"); in rzg2l_cru_stop_image_processing()
378 cru->state = RZG2L_CRU_DMA_STOPPED; in rzg2l_cru_stop_image_processing()
382 amnfifopntr = rzg2l_cru_read(cru, AMnFIFOPNTR); in rzg2l_cru_stop_image_processing()
395 dev_err(cru->dev, "Failed to empty FIFO\n"); in rzg2l_cru_stop_image_processing()
398 rzg2l_cru_write(cru, AMnAXISTP, AMnAXISTP_AXI_STOP); in rzg2l_cru_stop_image_processing()
402 if (rzg2l_cru_read(cru, AMnAXISTPACK) & in rzg2l_cru_stop_image_processing()
411 dev_err(cru->dev, "Failed to stop AXI bus\n"); in rzg2l_cru_stop_image_processing()
414 rzg2l_cru_write(cru, AMnAXISTP, 0); in rzg2l_cru_stop_image_processing()
416 /* Reset the CRU (AXI-master) */ in rzg2l_cru_stop_image_processing()
417 reset_control_assert(cru->aresetn); in rzg2l_cru_stop_image_processing()
420 rzg2l_cru_write(cru, CRUnRST, 0); in rzg2l_cru_stop_image_processing()
422 spin_unlock_irqrestore(&cru->qlock, flags); in rzg2l_cru_stop_image_processing()
425 int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru) in rzg2l_cru_start_image_processing() argument
427 struct v4l2_mbus_framefmt *fmt = rzg2l_cru_ip_get_src_fmt(cru); in rzg2l_cru_start_image_processing()
431 spin_lock_irqsave(&cru->qlock, flags); in rzg2l_cru_start_image_processing()
434 rzg2l_cru_write(cru, CRUnCTRL, CRUnCTRL_VINSEL(0)); in rzg2l_cru_start_image_processing()
437 rzg2l_cru_write(cru, CRUnRST, CRUnRST_VRESETN); in rzg2l_cru_start_image_processing()
440 rzg2l_cru_write(cru, CRUnIE, 0); in rzg2l_cru_start_image_processing()
441 rzg2l_cru_write(cru, CRUnINTS, 0x001f000f); in rzg2l_cru_start_image_processing()
444 rzg2l_cru_initialize_axi(cru); in rzg2l_cru_start_image_processing()
447 ret = rzg2l_cru_initialize_image_conv(cru, fmt); in rzg2l_cru_start_image_processing()
449 spin_unlock_irqrestore(&cru->qlock, flags); in rzg2l_cru_start_image_processing()
454 rzg2l_cru_write(cru, CRUnIE, CRUnIE_EFE); in rzg2l_cru_start_image_processing()
457 rzg2l_cru_write(cru, ICnEN, ICnEN_ICEN); in rzg2l_cru_start_image_processing()
459 spin_unlock_irqrestore(&cru->qlock, flags); in rzg2l_cru_start_image_processing()
464 static int rzg2l_cru_set_stream(struct rzg2l_cru_dev *cru, int on) in rzg2l_cru_set_stream() argument
471 pad = media_pad_remote_pad_first(&cru->pad); in rzg2l_cru_set_stream()
490 video_device_pipeline_stop(&cru->vdev); in rzg2l_cru_set_stream()
495 ret = rzg2l_cru_mc_validate_format(cru, sd, pad); in rzg2l_cru_set_stream()
499 pipe = media_entity_pipeline(&sd->entity) ? : &cru->vdev.pipe; in rzg2l_cru_set_stream()
500 ret = video_device_pipeline_start(&cru->vdev, pipe); in rzg2l_cru_set_stream()
518 video_device_pipeline_stop(&cru->vdev); in rzg2l_cru_set_stream()
523 static void rzg2l_cru_stop_streaming(struct rzg2l_cru_dev *cru) in rzg2l_cru_stop_streaming() argument
525 cru->state = RZG2L_CRU_DMA_STOPPING; in rzg2l_cru_stop_streaming()
527 rzg2l_cru_set_stream(cru, 0); in rzg2l_cru_stop_streaming()
532 struct rzg2l_cru_dev *cru = data; in rzg2l_cru_irq() local
539 spin_lock_irqsave(&cru->qlock, flags); in rzg2l_cru_irq()
541 irq_status = rzg2l_cru_read(cru, CRUnINTS); in rzg2l_cru_irq()
547 rzg2l_cru_write(cru, CRUnINTS, rzg2l_cru_read(cru, CRUnINTS)); in rzg2l_cru_irq()
550 if (cru->state == RZG2L_CRU_DMA_STOPPED) { in rzg2l_cru_irq()
551 dev_dbg(cru->dev, "IRQ while state stopped\n"); in rzg2l_cru_irq()
556 if (cru->state == RZG2L_CRU_DMA_STOPPING) { in rzg2l_cru_irq()
558 dev_dbg(cru->dev, "IRQ while state stopping\n"); in rzg2l_cru_irq()
563 amnmbs = rzg2l_cru_read(cru, AMnMBS); in rzg2l_cru_irq()
571 slot = cru->num_buf - 1; in rzg2l_cru_irq()
579 if (cru->state == RZG2L_CRU_DMA_STARTING) { in rzg2l_cru_irq()
581 dev_dbg(cru->dev, "Starting sync slot: %d\n", slot); in rzg2l_cru_irq()
585 dev_dbg(cru->dev, "Capture start synced!\n"); in rzg2l_cru_irq()
586 cru->state = RZG2L_CRU_DMA_RUNNING; in rzg2l_cru_irq()
590 if (cru->queue_buf[slot]) { in rzg2l_cru_irq()
591 cru->queue_buf[slot]->field = cru->format.field; in rzg2l_cru_irq()
592 cru->queue_buf[slot]->sequence = cru->sequence; in rzg2l_cru_irq()
593 cru->queue_buf[slot]->vb2_buf.timestamp = ktime_get_ns(); in rzg2l_cru_irq()
594 vb2_buffer_done(&cru->queue_buf[slot]->vb2_buf, in rzg2l_cru_irq()
596 cru->queue_buf[slot] = NULL; in rzg2l_cru_irq()
599 dev_dbg(cru->dev, "Dropping frame %u\n", cru->sequence); in rzg2l_cru_irq()
602 cru->sequence++; in rzg2l_cru_irq()
605 rzg2l_cru_fill_hw_slot(cru, slot); in rzg2l_cru_irq()
608 spin_unlock_irqrestore(&cru->qlock, flags); in rzg2l_cru_irq()
615 struct rzg2l_cru_dev *cru = vb2_get_drv_priv(vq); in rzg2l_cru_start_streaming_vq() local
618 ret = pm_runtime_resume_and_get(cru->dev); in rzg2l_cru_start_streaming_vq()
622 ret = clk_prepare_enable(cru->vclk); in rzg2l_cru_start_streaming_vq()
627 ret = reset_control_deassert(cru->aresetn); in rzg2l_cru_start_streaming_vq()
629 dev_err(cru->dev, "failed to deassert aresetn\n"); in rzg2l_cru_start_streaming_vq()
633 ret = reset_control_deassert(cru->presetn); in rzg2l_cru_start_streaming_vq()
635 reset_control_assert(cru->aresetn); in rzg2l_cru_start_streaming_vq()
636 dev_err(cru->dev, "failed to deassert presetn\n"); in rzg2l_cru_start_streaming_vq()
640 ret = request_irq(cru->image_conv_irq, rzg2l_cru_irq, in rzg2l_cru_start_streaming_vq()
641 IRQF_SHARED, KBUILD_MODNAME, cru); in rzg2l_cru_start_streaming_vq()
643 dev_err(cru->dev, "failed to request irq\n"); in rzg2l_cru_start_streaming_vq()
648 cru->scratch = dma_alloc_coherent(cru->dev, cru->format.sizeimage, in rzg2l_cru_start_streaming_vq()
649 &cru->scratch_phys, GFP_KERNEL); in rzg2l_cru_start_streaming_vq()
650 if (!cru->scratch) { in rzg2l_cru_start_streaming_vq()
651 return_unused_buffers(cru, VB2_BUF_STATE_QUEUED); in rzg2l_cru_start_streaming_vq()
652 dev_err(cru->dev, "Failed to allocate scratch buffer\n"); in rzg2l_cru_start_streaming_vq()
657 cru->sequence = 0; in rzg2l_cru_start_streaming_vq()
659 ret = rzg2l_cru_set_stream(cru, 1); in rzg2l_cru_start_streaming_vq()
661 return_unused_buffers(cru, VB2_BUF_STATE_QUEUED); in rzg2l_cru_start_streaming_vq()
665 cru->state = RZG2L_CRU_DMA_STARTING; in rzg2l_cru_start_streaming_vq()
666 dev_dbg(cru->dev, "Starting to capture\n"); in rzg2l_cru_start_streaming_vq()
671 dma_free_coherent(cru->dev, cru->format.sizeimage, cru->scratch, in rzg2l_cru_start_streaming_vq()
672 cru->scratch_phys); in rzg2l_cru_start_streaming_vq()
674 free_irq(cru->image_conv_irq, cru); in rzg2l_cru_start_streaming_vq()
677 reset_control_assert(cru->presetn); in rzg2l_cru_start_streaming_vq()
680 reset_control_assert(cru->aresetn); in rzg2l_cru_start_streaming_vq()
683 clk_disable_unprepare(cru->vclk); in rzg2l_cru_start_streaming_vq()
686 pm_runtime_put_sync(cru->dev); in rzg2l_cru_start_streaming_vq()
693 struct rzg2l_cru_dev *cru = vb2_get_drv_priv(vq); in rzg2l_cru_stop_streaming_vq() local
695 rzg2l_cru_stop_streaming(cru); in rzg2l_cru_stop_streaming_vq()
698 dma_free_coherent(cru->dev, cru->format.sizeimage, in rzg2l_cru_stop_streaming_vq()
699 cru->scratch, cru->scratch_phys); in rzg2l_cru_stop_streaming_vq()
701 free_irq(cru->image_conv_irq, cru); in rzg2l_cru_stop_streaming_vq()
702 return_unused_buffers(cru, VB2_BUF_STATE_ERROR); in rzg2l_cru_stop_streaming_vq()
704 reset_control_assert(cru->presetn); in rzg2l_cru_stop_streaming_vq()
705 clk_disable_unprepare(cru->vclk); in rzg2l_cru_stop_streaming_vq()
706 pm_runtime_put_sync(cru->dev); in rzg2l_cru_stop_streaming_vq()
719 void rzg2l_cru_dma_unregister(struct rzg2l_cru_dev *cru) in rzg2l_cru_dma_unregister() argument
721 mutex_destroy(&cru->lock); in rzg2l_cru_dma_unregister()
723 v4l2_device_unregister(&cru->v4l2_dev); in rzg2l_cru_dma_unregister()
724 vb2_queue_release(&cru->queue); in rzg2l_cru_dma_unregister()
727 int rzg2l_cru_dma_register(struct rzg2l_cru_dev *cru) in rzg2l_cru_dma_register() argument
729 struct vb2_queue *q = &cru->queue; in rzg2l_cru_dma_register()
734 ret = v4l2_device_register(cru->dev, &cru->v4l2_dev); in rzg2l_cru_dma_register()
738 mutex_init(&cru->lock); in rzg2l_cru_dma_register()
739 INIT_LIST_HEAD(&cru->buf_list); in rzg2l_cru_dma_register()
741 spin_lock_init(&cru->qlock); in rzg2l_cru_dma_register()
743 cru->state = RZG2L_CRU_DMA_STOPPED; in rzg2l_cru_dma_register()
746 cru->queue_buf[i] = NULL; in rzg2l_cru_dma_register()
751 q->lock = &cru->lock; in rzg2l_cru_dma_register()
752 q->drv_priv = cru; in rzg2l_cru_dma_register()
758 q->dev = cru->dev; in rzg2l_cru_dma_register()
762 dev_err(cru->dev, "failed to initialize VB2 queue\n"); in rzg2l_cru_dma_register()
769 mutex_destroy(&cru->lock); in rzg2l_cru_dma_register()
770 v4l2_device_unregister(&cru->v4l2_dev); in rzg2l_cru_dma_register()
813 static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru, in rzg2l_cru_format_align() argument
832 /* Limit to CRU capabilities */ in rzg2l_cru_format_align()
839 dev_dbg(cru->dev, "Format %ux%u bpl: %u size: %u\n", in rzg2l_cru_format_align()
843 static void rzg2l_cru_try_format(struct rzg2l_cru_dev *cru, in rzg2l_cru_try_format() argument
858 rzg2l_cru_format_align(cru, pix); in rzg2l_cru_try_format()
873 struct rzg2l_cru_dev *cru = video_drvdata(file); in rzg2l_cru_try_fmt_vid_cap() local
875 rzg2l_cru_try_format(cru, &f->fmt.pix); in rzg2l_cru_try_fmt_vid_cap()
883 struct rzg2l_cru_dev *cru = video_drvdata(file); in rzg2l_cru_s_fmt_vid_cap() local
885 if (vb2_is_busy(&cru->queue)) in rzg2l_cru_s_fmt_vid_cap()
888 rzg2l_cru_try_format(cru, &f->fmt.pix); in rzg2l_cru_s_fmt_vid_cap()
890 cru->format = f->fmt.pix; in rzg2l_cru_s_fmt_vid_cap()
898 struct rzg2l_cru_dev *cru = video_drvdata(file); in rzg2l_cru_g_fmt_vid_cap() local
900 f->fmt.pix = cru->format; in rzg2l_cru_g_fmt_vid_cap()
940 struct rzg2l_cru_dev *cru = video_drvdata(file); in rzg2l_cru_open() local
943 ret = mutex_lock_interruptible(&cru->lock); in rzg2l_cru_open()
947 file->private_data = cru; in rzg2l_cru_open()
952 mutex_unlock(&cru->lock); in rzg2l_cru_open()
957 mutex_unlock(&cru->lock); in rzg2l_cru_open()
964 struct rzg2l_cru_dev *cru = video_drvdata(file); in rzg2l_cru_release() local
967 mutex_lock(&cru->lock); in rzg2l_cru_release()
972 mutex_unlock(&cru->lock); in rzg2l_cru_release()
987 static void rzg2l_cru_v4l2_init(struct rzg2l_cru_dev *cru) in rzg2l_cru_v4l2_init() argument
989 struct video_device *vdev = &cru->vdev; in rzg2l_cru_v4l2_init()
991 vdev->v4l2_dev = &cru->v4l2_dev; in rzg2l_cru_v4l2_init()
992 vdev->queue = &cru->queue; in rzg2l_cru_v4l2_init()
993 snprintf(vdev->name, sizeof(vdev->name), "CRU output"); in rzg2l_cru_v4l2_init()
995 vdev->lock = &cru->lock; in rzg2l_cru_v4l2_init()
1002 cru->format.pixelformat = RZG2L_CRU_DEFAULT_FORMAT; in rzg2l_cru_v4l2_init()
1003 cru->format.width = RZG2L_CRU_DEFAULT_WIDTH; in rzg2l_cru_v4l2_init()
1004 cru->format.height = RZG2L_CRU_DEFAULT_HEIGHT; in rzg2l_cru_v4l2_init()
1005 cru->format.field = RZG2L_CRU_DEFAULT_FIELD; in rzg2l_cru_v4l2_init()
1006 cru->format.colorspace = RZG2L_CRU_DEFAULT_COLORSPACE; in rzg2l_cru_v4l2_init()
1007 rzg2l_cru_format_align(cru, &cru->format); in rzg2l_cru_v4l2_init()
1010 void rzg2l_cru_video_unregister(struct rzg2l_cru_dev *cru) in rzg2l_cru_video_unregister() argument
1012 media_device_unregister(&cru->mdev); in rzg2l_cru_video_unregister()
1013 video_unregister_device(&cru->vdev); in rzg2l_cru_video_unregister()
1016 int rzg2l_cru_video_register(struct rzg2l_cru_dev *cru) in rzg2l_cru_video_register() argument
1018 struct video_device *vdev = &cru->vdev; in rzg2l_cru_video_register()
1021 if (video_is_registered(&cru->vdev)) { in rzg2l_cru_video_register()
1024 entity = &cru->vdev.entity; in rzg2l_cru_video_register()
1026 entity->graph_obj.mdev = &cru->mdev; in rzg2l_cru_video_register()
1030 rzg2l_cru_v4l2_init(cru); in rzg2l_cru_video_register()
1031 video_set_drvdata(vdev, cru); in rzg2l_cru_video_register()
1034 dev_err(cru->dev, "Failed to register video device\n"); in rzg2l_cru_video_register()
1038 ret = media_device_register(&cru->mdev); in rzg2l_cru_video_register()
1040 video_unregister_device(&cru->vdev); in rzg2l_cru_video_register()