linux/drivers/gpu/ipu-v3/ipu-csi.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2012-2014 Mentor Graphics Inc.
 * Copyright (C) 2005-2009 Freescale Semiconductor, Inc.
 */
#include <linux/export.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/videodev2.h>
#include <uapi/linux/v4l2-mediabus.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/clkdev.h>

#include "ipu-prv.h"

struct ipu_csi {};

/* CSI Register Offsets */
#define CSI_SENS_CONF
#define CSI_SENS_FRM_SIZE
#define CSI_ACT_FRM_SIZE
#define CSI_OUT_FRM_CTRL
#define CSI_TST_CTRL
#define CSI_CCIR_CODE_1
#define CSI_CCIR_CODE_2
#define CSI_CCIR_CODE_3
#define CSI_MIPI_DI
#define CSI_SKIP
#define CSI_CPD_CTRL
#define CSI_CPD_RC(n)
#define CSI_CPD_RS(n)
#define CSI_CPD_GRC(n)
#define CSI_CPD_GRS(n)
#define CSI_CPD_GBC(n)
#define CSI_CPD_GBS(n)
#define CSI_CPD_BC(n)
#define CSI_CPD_BS(n)
#define CSI_CPD_OFFSET1
#define CSI_CPD_OFFSET2

/* CSI Register Fields */
#define CSI_SENS_CONF_DATA_FMT_SHIFT
#define CSI_SENS_CONF_DATA_FMT_MASK
#define CSI_SENS_CONF_DATA_FMT_RGB_YUV444
#define CSI_SENS_CONF_DATA_FMT_YUV422_YUYV
#define CSI_SENS_CONF_DATA_FMT_YUV422_UYVY
#define CSI_SENS_CONF_DATA_FMT_BAYER
#define CSI_SENS_CONF_DATA_FMT_RGB565
#define CSI_SENS_CONF_DATA_FMT_RGB555
#define CSI_SENS_CONF_DATA_FMT_RGB444
#define CSI_SENS_CONF_DATA_FMT_JPEG

#define CSI_SENS_CONF_VSYNC_POL_SHIFT
#define CSI_SENS_CONF_HSYNC_POL_SHIFT
#define CSI_SENS_CONF_DATA_POL_SHIFT
#define CSI_SENS_CONF_PIX_CLK_POL_SHIFT
#define CSI_SENS_CONF_SENS_PRTCL_MASK
#define CSI_SENS_CONF_SENS_PRTCL_SHIFT
#define CSI_SENS_CONF_PACK_TIGHT_SHIFT
#define CSI_SENS_CONF_DATA_WIDTH_SHIFT
#define CSI_SENS_CONF_EXT_VSYNC_SHIFT
#define CSI_SENS_CONF_DIVRATIO_SHIFT

#define CSI_SENS_CONF_DIVRATIO_MASK
#define CSI_SENS_CONF_DATA_DEST_SHIFT
#define CSI_SENS_CONF_DATA_DEST_MASK
#define CSI_SENS_CONF_JPEG8_EN_SHIFT
#define CSI_SENS_CONF_JPEG_EN_SHIFT
#define CSI_SENS_CONF_FORCE_EOF_SHIFT
#define CSI_SENS_CONF_DATA_EN_POL_SHIFT

#define CSI_DATA_DEST_IC
#define CSI_DATA_DEST_IDMAC

#define CSI_CCIR_ERR_DET_EN
#define CSI_HORI_DOWNSIZE_EN
#define CSI_VERT_DOWNSIZE_EN
#define CSI_TEST_GEN_MODE_EN

#define CSI_HSC_MASK
#define CSI_HSC_SHIFT
#define CSI_VSC_MASK
#define CSI_VSC_SHIFT

#define CSI_TEST_GEN_R_MASK
#define CSI_TEST_GEN_R_SHIFT
#define CSI_TEST_GEN_G_MASK
#define CSI_TEST_GEN_G_SHIFT
#define CSI_TEST_GEN_B_MASK
#define CSI_TEST_GEN_B_SHIFT

#define CSI_MAX_RATIO_SKIP_SMFC_MASK
#define CSI_MAX_RATIO_SKIP_SMFC_SHIFT
#define CSI_SKIP_SMFC_MASK
#define CSI_SKIP_SMFC_SHIFT
#define CSI_ID_2_SKIP_MASK
#define CSI_ID_2_SKIP_SHIFT

#define CSI_COLOR_FIRST_ROW_MASK
#define CSI_COLOR_FIRST_COMP_MASK

/* MIPI CSI-2 data types */
#define MIPI_DT_YUV420
#define MIPI_DT_YUV420_LEGACY
#define MIPI_DT_YUV422
#define MIPI_DT_RGB444
#define MIPI_DT_RGB555
#define MIPI_DT_RGB565
#define MIPI_DT_RGB666
#define MIPI_DT_RGB888
#define MIPI_DT_RAW6
#define MIPI_DT_RAW7
#define MIPI_DT_RAW8
#define MIPI_DT_RAW10
#define MIPI_DT_RAW12
#define MIPI_DT_RAW14

/*
 * Bitfield of CSI bus signal polarities and modes.
 */
struct ipu_csi_bus_config {};

/*
 * Enumeration of CSI data bus widths.
 */
enum ipu_csi_data_width {};

/*
 * Enumeration of CSI clock modes.
 */
enum ipu_csi_clk_mode {};

static inline u32 ipu_csi_read(struct ipu_csi *csi, unsigned offset)
{}

static inline void ipu_csi_write(struct ipu_csi *csi, u32 value,
				 unsigned offset)
{}

/*
 * Set mclk division ratio for generating test mode mclk. Only used
 * for test generator.
 */
static int ipu_csi_set_testgen_mclk(struct ipu_csi *csi, u32 pixel_clk,
					u32 ipu_clk)
{}

/*
 * Find the CSI data format and data width for the given V4L2 media
 * bus pixel format code.
 */
static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code,
				enum v4l2_mbus_type mbus_type)
{}

/* translate alternate field mode based on given standard */
static inline enum v4l2_field
ipu_csi_translate_field(enum v4l2_field field, v4l2_std_id std)
{}

/*
 * Fill a CSI bus config struct from mbus_config and mbus_framefmt.
 */
static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
			    const struct v4l2_mbus_config *mbus_cfg,
			    const struct v4l2_mbus_framefmt *mbus_fmt)
{}

static int
ipu_csi_set_bt_interlaced_codes(struct ipu_csi *csi,
				const struct v4l2_mbus_framefmt *infmt,
				const struct v4l2_mbus_framefmt *outfmt,
				v4l2_std_id std)
{}


int ipu_csi_init_interface(struct ipu_csi *csi,
			   const struct v4l2_mbus_config *mbus_cfg,
			   const struct v4l2_mbus_framefmt *infmt,
			   const struct v4l2_mbus_framefmt *outfmt)
{}
EXPORT_SYMBOL_GPL();

bool ipu_csi_is_interlaced(struct ipu_csi *csi)
{}
EXPORT_SYMBOL_GPL();

void ipu_csi_get_window(struct ipu_csi *csi, struct v4l2_rect *w)
{}
EXPORT_SYMBOL_GPL();

void ipu_csi_set_window(struct ipu_csi *csi, struct v4l2_rect *w)
{}
EXPORT_SYMBOL_GPL();

void ipu_csi_set_downsize(struct ipu_csi *csi, bool horiz, bool vert)
{}
EXPORT_SYMBOL_GPL();

void ipu_csi_set_test_generator(struct ipu_csi *csi, bool active,
				u32 r_value, u32 g_value, u32 b_value,
				u32 pix_clk)
{}
EXPORT_SYMBOL_GPL();

int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
			      struct v4l2_mbus_framefmt *mbus_fmt)
{}
EXPORT_SYMBOL_GPL();

int ipu_csi_set_skip_smfc(struct ipu_csi *csi, u32 skip,
			  u32 max_ratio, u32 id)
{}
EXPORT_SYMBOL_GPL();

int ipu_csi_set_dest(struct ipu_csi *csi, enum ipu_csi_dest csi_dest)
{}
EXPORT_SYMBOL_GPL();

int ipu_csi_enable(struct ipu_csi *csi)
{}
EXPORT_SYMBOL_GPL();

int ipu_csi_disable(struct ipu_csi *csi)
{}
EXPORT_SYMBOL_GPL();

struct ipu_csi *ipu_csi_get(struct ipu_soc *ipu, int id)
{}
EXPORT_SYMBOL_GPL();

void ipu_csi_put(struct ipu_csi *csi)
{}
EXPORT_SYMBOL_GPL();

int ipu_csi_init(struct ipu_soc *ipu, struct device *dev, int id,
		 unsigned long base, u32 module, struct clk *clk_ipu)
{}

void ipu_csi_exit(struct ipu_soc *ipu, int id)
{}

void ipu_csi_dump(struct ipu_csi *csi)
{}
EXPORT_SYMBOL_GPL();