linux/drivers/media/i2c/rj54n1cb0c.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for RJ54N1CB0C CMOS Image Sensor from Sharp
 *
 * Copyright (C) 2018, Jacopo Mondi <[email protected]>
 *
 * Copyright (C) 2009, Guennadi Liakhovetski <[email protected]>
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/v4l2-mediabus.h>
#include <linux/videodev2.h>

#include <media/i2c/rj54n1cb0c.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>

#define RJ54N1_DEV_CODE
#define RJ54N1_DEV_CODE2
#define RJ54N1_OUT_SEL
#define RJ54N1_XY_OUTPUT_SIZE_S_H
#define RJ54N1_X_OUTPUT_SIZE_S_L
#define RJ54N1_Y_OUTPUT_SIZE_S_L
#define RJ54N1_XY_OUTPUT_SIZE_P_H
#define RJ54N1_X_OUTPUT_SIZE_P_L
#define RJ54N1_Y_OUTPUT_SIZE_P_L
#define RJ54N1_LINE_LENGTH_PCK_S_H
#define RJ54N1_LINE_LENGTH_PCK_S_L
#define RJ54N1_LINE_LENGTH_PCK_P_H
#define RJ54N1_LINE_LENGTH_PCK_P_L
#define RJ54N1_RESIZE_N
#define RJ54N1_RESIZE_N_STEP
#define RJ54N1_RESIZE_STEP
#define RJ54N1_RESIZE_HOLD_H
#define RJ54N1_RESIZE_HOLD_L
#define RJ54N1_H_OBEN_OFS
#define RJ54N1_V_OBEN_OFS
#define RJ54N1_RESIZE_CONTROL
#define RJ54N1_STILL_CONTROL
#define RJ54N1_INC_USE_SEL_H
#define RJ54N1_INC_USE_SEL_L
#define RJ54N1_MIRROR_STILL_MODE
#define RJ54N1_INIT_START
#define RJ54N1_SCALE_1_2_LEV
#define RJ54N1_SCALE_4_LEV
#define RJ54N1_Y_GAIN
#define RJ54N1_APT_GAIN_UP
#define RJ54N1_RA_SEL_UL
#define RJ54N1_BYTE_SWAP
#define RJ54N1_OUT_SIGPO
#define RJ54N1_WB_SEL_WEIGHT_I
#define RJ54N1_BIT8_WB
#define RJ54N1_HCAPS_WB
#define RJ54N1_VCAPS_WB
#define RJ54N1_HCAPE_WB
#define RJ54N1_VCAPE_WB
#define RJ54N1_EXPOSURE_CONTROL
#define RJ54N1_FRAME_LENGTH_S_H
#define RJ54N1_FRAME_LENGTH_S_L
#define RJ54N1_FRAME_LENGTH_P_H
#define RJ54N1_FRAME_LENGTH_P_L
#define RJ54N1_PEAK_H
#define RJ54N1_PEAK_50
#define RJ54N1_PEAK_60
#define RJ54N1_PEAK_DIFF
#define RJ54N1_IOC
#define RJ54N1_TG_BYPASS
#define RJ54N1_PLL_L
#define RJ54N1_PLL_N
#define RJ54N1_PLL_EN
#define RJ54N1_RATIO_TG
#define RJ54N1_RATIO_T
#define RJ54N1_RATIO_R
#define RJ54N1_RAMP_TGCLK_EN
#define RJ54N1_OCLK_DSP
#define RJ54N1_RATIO_OP
#define RJ54N1_RATIO_O
#define RJ54N1_OCLK_SEL_EN
#define RJ54N1_CLK_RST
#define RJ54N1_RESET_STANDBY
#define RJ54N1_FWFLG

#define E_EXCLK
#define SOFT_STDBY
#define SEN_RSTX
#define TG_RSTX
#define DSP_RSTX

#define RESIZE_HOLD_SEL
#define RESIZE_GO

/*
 * When cropping, the camera automatically centers the cropped region, there
 * doesn't seem to be a way to specify an explicit location of the rectangle.
 */
#define RJ54N1_COLUMN_SKIP
#define RJ54N1_ROW_SKIP
#define RJ54N1_MAX_WIDTH
#define RJ54N1_MAX_HEIGHT

#define PLL_L
#define PLL_N

/* I2C addresses: 0x50, 0x51, 0x60, 0x61 */

/* RJ54N1CB0C has only one fixed colorspace per pixelcode */
struct rj54n1_datafmt {};

/* Find a data format by a pixel code in an array */
static const struct rj54n1_datafmt *rj54n1_find_datafmt(
	u32 code, const struct rj54n1_datafmt *fmt,
	int n)
{}

static const struct rj54n1_datafmt rj54n1_colour_fmts[] =;

struct rj54n1_clock_div {};

struct rj54n1 {};

struct rj54n1_reg_val {};

static const struct rj54n1_reg_val bank_4[] =;

static const struct rj54n1_reg_val bank_5[] =;

static const struct rj54n1_reg_val bank_7[] =;

static const struct rj54n1_reg_val bank_8[] =;

static const struct rj54n1_reg_val bank_10[] =;

/* Clock dividers - these are default register values, divider = register + 1 */
static const struct rj54n1_clock_div clk_div =;

static struct rj54n1 *to_rj54n1(const struct i2c_client *client)
{}

static int reg_read(struct i2c_client *client, const u16 reg)
{}

static int reg_write(struct i2c_client *client, const u16 reg,
		     const u8 data)
{}

static int reg_set(struct i2c_client *client, const u16 reg,
		   const u8 data, const u8 mask)
{}

static int reg_write_multiple(struct i2c_client *client,
			      const struct rj54n1_reg_val *rv, const int n)
{}

static int rj54n1_enum_mbus_code(struct v4l2_subdev *sd,
		struct v4l2_subdev_state *sd_state,
		struct v4l2_subdev_mbus_code_enum *code)
{}

static int rj54n1_s_stream(struct v4l2_subdev *sd, int enable)
{}

static int rj54n1_set_rect(struct i2c_client *client,
			   u16 reg_x, u16 reg_y, u16 reg_xy,
			   u32 width, u32 height)
{}

/*
 * Some commands, specifically certain initialisation sequences, require
 * a commit operation.
 */
static int rj54n1_commit(struct i2c_client *client)
{}

static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h,
			       s32 *out_w, s32 *out_h);

static int rj54n1_set_selection(struct v4l2_subdev *sd,
				struct v4l2_subdev_state *sd_state,
				struct v4l2_subdev_selection *sel)
{}

static int rj54n1_get_selection(struct v4l2_subdev *sd,
				struct v4l2_subdev_state *sd_state,
				struct v4l2_subdev_selection *sel)
{}

static int rj54n1_get_fmt(struct v4l2_subdev *sd,
		struct v4l2_subdev_state *sd_state,
		struct v4l2_subdev_format *format)
{}

/*
 * The actual geometry configuration routine. It scales the input window into
 * the output one, updates the window sizes and returns an error or the resize
 * coefficient on success. Note: we only use the "Fixed Scaling" on this camera.
 */
static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h,
			       s32 *out_w, s32 *out_h)
{}

static int rj54n1_set_clock(struct i2c_client *client)
{}

static int rj54n1_reg_init(struct i2c_client *client)
{}

static int rj54n1_set_fmt(struct v4l2_subdev *sd,
		struct v4l2_subdev_state *sd_state,
		struct v4l2_subdev_format *format)
{}

#ifdef CONFIG_VIDEO_ADV_DEBUG
static int rj54n1_g_register(struct v4l2_subdev *sd,
			     struct v4l2_dbg_register *reg)
{}

static int rj54n1_s_register(struct v4l2_subdev *sd,
			     const struct v4l2_dbg_register *reg)
{}
#endif

static int rj54n1_s_power(struct v4l2_subdev *sd, int on)
{}

static int rj54n1_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops rj54n1_ctrl_ops =;

static const struct v4l2_subdev_core_ops rj54n1_subdev_core_ops =;

static const struct v4l2_subdev_video_ops rj54n1_subdev_video_ops =;

static const struct v4l2_subdev_pad_ops rj54n1_subdev_pad_ops =;

static const struct v4l2_subdev_ops rj54n1_subdev_ops =;

/*
 * Interface active, can use i2c. If it fails, it can indeed mean, that
 * this wasn't our capture interface, so, we wait for the right one
 */
static int rj54n1_video_probe(struct i2c_client *client,
			      struct rj54n1_pdata *priv)
{}

static int rj54n1_probe(struct i2c_client *client)
{}

static void rj54n1_remove(struct i2c_client *client)
{}

static const struct i2c_device_id rj54n1_id[] =;
MODULE_DEVICE_TABLE(i2c, rj54n1_id);

static struct i2c_driver rj54n1_i2c_driver =;

module_i2c_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();