linux/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Driver for Renesas RZ/G2L CRU
 *
 * Copyright (C) 2022 Renesas Electronics Corp.
 *
 * Based on Renesas R-Car VIN
 * Copyright (C) 2016 Renesas Electronics Corp.
 * Copyright (C) 2011-2013 Renesas Solutions Corp.
 * Copyright (C) 2013 Cogent Embedded, Inc., <[email protected]>
 * Copyright (C) 2008 Magnus Damm
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/pm_runtime.h>

#include <media/v4l2-ioctl.h>
#include <media/videobuf2-dma-contig.h>

#include "rzg2l-cru.h"

/* HW CRU Registers Definition */

/* CRU Control Register */
#define CRUnCTRL
#define CRUnCTRL_VINSEL(x)

/* CRU Interrupt Enable Register */
#define CRUnIE
#define CRUnIE_EFE

/* CRU Interrupt Status Register */
#define CRUnINTS
#define CRUnINTS_SFS

/* CRU Reset Register */
#define CRUnRST
#define CRUnRST_VRESETN

/* Memory Bank Base Address (Lower) Register for CRU Image Data */
#define AMnMBxADDRL(x)

/* Memory Bank Base Address (Higher) Register for CRU Image Data */
#define AMnMBxADDRH(x)

/* Memory Bank Enable Register for CRU Image Data */
#define AMnMBVALID
#define AMnMBVALID_MBVALID(x)

/* Memory Bank Status Register for CRU Image Data */
#define AMnMBS
#define AMnMBS_MBSTS

/* AXI Master FIFO Pointer Register for CRU Image Data */
#define AMnFIFOPNTR
#define AMnFIFOPNTR_FIFOWPNTR
#define AMnFIFOPNTR_FIFORPNTR_Y

/* AXI Master Transfer Stop Register for CRU Image Data */
#define AMnAXISTP
#define AMnAXISTP_AXI_STOP

/* AXI Master Transfer Stop Status Register for CRU Image Data */
#define AMnAXISTPACK
#define AMnAXISTPACK_AXI_STOP_ACK

/* CRU Image Processing Enable Register */
#define ICnEN
#define ICnEN_ICEN

/* CRU Image Processing Main Control Register */
#define ICnMC
#define ICnMC_CSCTHR
#define ICnMC_INF_YUV8_422
#define ICnMC_INF_USER
#define ICnMC_VCSEL(x)
#define ICnMC_INF_MASK

/* CRU Module Status Register */
#define ICnMS
#define ICnMS_IA

/* CRU Data Output Mode Register */
#define ICnDMR
#define ICnDMR_YCMODE_UYVY

#define RZG2L_TIMEOUT_MS
#define RZG2L_RETRIES

#define RZG2L_CRU_DEFAULT_FORMAT
#define RZG2L_CRU_DEFAULT_WIDTH
#define RZG2L_CRU_DEFAULT_HEIGHT
#define RZG2L_CRU_DEFAULT_FIELD
#define RZG2L_CRU_DEFAULT_COLORSPACE

struct rzg2l_cru_buffer {};

#define to_buf_list(vb2_buffer)

/* -----------------------------------------------------------------------------
 * DMA operations
 */
static void rzg2l_cru_write(struct rzg2l_cru_dev *cru, u32 offset, u32 value)
{}

static u32 rzg2l_cru_read(struct rzg2l_cru_dev *cru, u32 offset)
{}

/* Need to hold qlock before calling */
static void return_unused_buffers(struct rzg2l_cru_dev *cru,
				  enum vb2_buffer_state state)
{}

static int rzg2l_cru_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
				 unsigned int *nplanes, unsigned int sizes[],
				 struct device *alloc_devs[])
{
	struct rzg2l_cru_dev *cru = vb2_get_drv_priv(vq);

	/* Make sure the image size is large enough. */
	if (*nplanes)
		return sizes[0] < cru->format.sizeimage ? -EINVAL : 0;

	*nplanes = 1;
	sizes[0] = cru->format.sizeimage;

	return 0;
};

static int rzg2l_cru_buffer_prepare(struct vb2_buffer *vb)
{}

static void rzg2l_cru_buffer_queue(struct vb2_buffer *vb)
{}

static int rzg2l_cru_mc_validate_format(struct rzg2l_cru_dev *cru,
					struct v4l2_subdev *sd,
					struct media_pad *pad)
{}

static void rzg2l_cru_set_slot_addr(struct rzg2l_cru_dev *cru,
				    int slot, dma_addr_t addr)
{}

/*
 * Moves a buffer from the queue to the HW slot. If no buffer is
 * available use the scratch buffer. The scratch buffer is never
 * returned to userspace, its only function is to enable the capture
 * loop to keep running.
 */
static void rzg2l_cru_fill_hw_slot(struct rzg2l_cru_dev *cru, int slot)
{}

static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru)
{}

static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv,
				 struct v4l2_mbus_framefmt *ip_sd_fmt)
{}

static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru,
					   struct v4l2_mbus_framefmt *ip_sd_fmt)
{}

void rzg2l_cru_stop_image_processing(struct rzg2l_cru_dev *cru)
{}

int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru)
{}

static int rzg2l_cru_set_stream(struct rzg2l_cru_dev *cru, int on)
{}

static void rzg2l_cru_stop_streaming(struct rzg2l_cru_dev *cru)
{}

static irqreturn_t rzg2l_cru_irq(int irq, void *data)
{}

static int rzg2l_cru_start_streaming_vq(struct vb2_queue *vq, unsigned int count)
{}

static void rzg2l_cru_stop_streaming_vq(struct vb2_queue *vq)
{}

static const struct vb2_ops rzg2l_cru_qops =;

void rzg2l_cru_dma_unregister(struct rzg2l_cru_dev *cru)
{}

int rzg2l_cru_dma_register(struct rzg2l_cru_dev *cru)
{}

/* -----------------------------------------------------------------------------
 * V4L2 stuff
 */

static const struct v4l2_format_info rzg2l_cru_formats[] =;

const struct v4l2_format_info *rzg2l_cru_format_from_pixel(u32 format)
{}

static u32 rzg2l_cru_format_bytesperline(struct v4l2_pix_format *pix)
{}

static u32 rzg2l_cru_format_sizeimage(struct v4l2_pix_format *pix)
{}

static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru,
				   struct v4l2_pix_format *pix)
{}

static void rzg2l_cru_try_format(struct rzg2l_cru_dev *cru,
				 struct v4l2_pix_format *pix)
{}

static int rzg2l_cru_querycap(struct file *file, void *priv,
			      struct v4l2_capability *cap)
{}

static int rzg2l_cru_try_fmt_vid_cap(struct file *file, void *priv,
				     struct v4l2_format *f)
{}

static int rzg2l_cru_s_fmt_vid_cap(struct file *file, void *priv,
				   struct v4l2_format *f)
{}

static int rzg2l_cru_g_fmt_vid_cap(struct file *file, void *priv,
				   struct v4l2_format *f)
{}

static int rzg2l_cru_enum_fmt_vid_cap(struct file *file, void *priv,
				      struct v4l2_fmtdesc *f)
{}

static const struct v4l2_ioctl_ops rzg2l_cru_ioctl_ops =;

/* -----------------------------------------------------------------------------
 * Media controller file operations
 */

static int rzg2l_cru_open(struct file *file)
{}

static int rzg2l_cru_release(struct file *file)
{}

static const struct v4l2_file_operations rzg2l_cru_fops =;

static void rzg2l_cru_v4l2_init(struct rzg2l_cru_dev *cru)
{}

void rzg2l_cru_video_unregister(struct rzg2l_cru_dev *cru)
{}

int rzg2l_cru_video_register(struct rzg2l_cru_dev *cru)
{}