#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"
#define CRUnCTRL …
#define CRUnCTRL_VINSEL(x) …
#define CRUnIE …
#define CRUnIE_EFE …
#define CRUnINTS …
#define CRUnINTS_SFS …
#define CRUnRST …
#define CRUnRST_VRESETN …
#define AMnMBxADDRL(x) …
#define AMnMBxADDRH(x) …
#define AMnMBVALID …
#define AMnMBVALID_MBVALID(x) …
#define AMnMBS …
#define AMnMBS_MBSTS …
#define AMnFIFOPNTR …
#define AMnFIFOPNTR_FIFOWPNTR …
#define AMnFIFOPNTR_FIFORPNTR_Y …
#define AMnAXISTP …
#define AMnAXISTP_AXI_STOP …
#define AMnAXISTPACK …
#define AMnAXISTPACK_AXI_STOP_ACK …
#define ICnEN …
#define ICnEN_ICEN …
#define ICnMC …
#define ICnMC_CSCTHR …
#define ICnMC_INF_YUV8_422 …
#define ICnMC_INF_USER …
#define ICnMC_VCSEL(x) …
#define ICnMC_INF_MASK …
#define ICnMS …
#define ICnMS_IA …
#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) …
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)
{ … }
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);
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)
{ … }
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)
{ … }
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 = …;
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)
{ … }