#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/pm_runtime.h>
#include <media/i2c/ov2659.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-subdev.h>
#define DRIVER_NAME …
#define REG_SOFTWARE_STANDBY …
#define REG_SOFTWARE_RESET …
#define REG_IO_CTRL00 …
#define REG_IO_CTRL01 …
#define REG_IO_CTRL02 …
#define REG_OUTPUT_VALUE00 …
#define REG_OUTPUT_VALUE01 …
#define REG_OUTPUT_VALUE02 …
#define REG_OUTPUT_SELECT00 …
#define REG_OUTPUT_SELECT01 …
#define REG_OUTPUT_SELECT02 …
#define REG_OUTPUT_DRIVE …
#define REG_INPUT_READOUT00 …
#define REG_INPUT_READOUT01 …
#define REG_INPUT_READOUT02 …
#define REG_SC_PLL_CTRL0 …
#define REG_SC_PLL_CTRL1 …
#define REG_SC_PLL_CTRL2 …
#define REG_SC_PLL_CTRL3 …
#define REG_SC_CHIP_ID_H …
#define REG_SC_CHIP_ID_L …
#define REG_SC_PWC …
#define REG_SC_CLKRST0 …
#define REG_SC_CLKRST1 …
#define REG_SC_CLKRST2 …
#define REG_SC_CLKRST3 …
#define REG_SC_SUB_ID …
#define REG_SC_SCCB_ID …
#define REG_GROUP_ADDRESS_00 …
#define REG_GROUP_ADDRESS_01 …
#define REG_GROUP_ADDRESS_02 …
#define REG_GROUP_ADDRESS_03 …
#define REG_GROUP_ACCESS …
#define REG_AWB_R_GAIN_H …
#define REG_AWB_R_GAIN_L …
#define REG_AWB_G_GAIN_H …
#define REG_AWB_G_GAIN_L …
#define REG_AWB_B_GAIN_H …
#define REG_AWB_B_GAIN_L …
#define REG_AWB_MANUAL_CONTROL …
#define REG_TIMING_HS_H …
#define REG_TIMING_HS_L …
#define REG_TIMING_VS_H …
#define REG_TIMING_VS_L …
#define REG_TIMING_HW_H …
#define REG_TIMING_HW_L …
#define REG_TIMING_VH_H …
#define REG_TIMING_VH_L …
#define REG_TIMING_DVPHO_H …
#define REG_TIMING_DVPHO_L …
#define REG_TIMING_DVPVO_H …
#define REG_TIMING_DVPVO_L …
#define REG_TIMING_HTS_H …
#define REG_TIMING_HTS_L …
#define REG_TIMING_VTS_H …
#define REG_TIMING_VTS_L …
#define REG_TIMING_HOFFS_H …
#define REG_TIMING_HOFFS_L …
#define REG_TIMING_VOFFS_H …
#define REG_TIMING_VOFFS_L …
#define REG_TIMING_XINC …
#define REG_TIMING_YINC …
#define REG_TIMING_VERT_FORMAT …
#define REG_TIMING_HORIZ_FORMAT …
#define REG_FORMAT_CTRL00 …
#define REG_VFIFO_READ_START_H …
#define REG_VFIFO_READ_START_L …
#define REG_DVP_CTRL02 …
#define REG_ISP_CTRL00 …
#define REG_ISP_CTRL01 …
#define REG_ISP_CTRL02 …
#define REG_LENC_RED_X0_H …
#define REG_LENC_RED_X0_L …
#define REG_LENC_RED_Y0_H …
#define REG_LENC_RED_Y0_L …
#define REG_LENC_RED_A1 …
#define REG_LENC_RED_B1 …
#define REG_LENC_RED_A2_B2 …
#define REG_LENC_GREEN_X0_H …
#define REG_LENC_GREEN_X0_L …
#define REG_LENC_GREEN_Y0_H …
#define REG_LENC_GREEN_Y0_L …
#define REG_LENC_GREEN_A1 …
#define REG_LENC_GREEN_B1 …
#define REG_LENC_GREEN_A2_B2 …
#define REG_LENC_BLUE_X0_H …
#define REG_LENC_BLUE_X0_L …
#define REG_LENC_BLUE_Y0_H …
#define REG_LENC_BLUE_Y0_L …
#define REG_LENC_BLUE_A1 …
#define REG_LENC_BLUE_B1 …
#define REG_LENC_BLUE_A2_B2 …
#define REG_AWB_CTRL00 …
#define REG_AWB_CTRL01 …
#define REG_AWB_CTRL02 …
#define REG_AWB_CTRL03 …
#define REG_AWB_CTRL04 …
#define REG_AWB_LOCAL_LIMIT …
#define REG_AWB_CTRL12 …
#define REG_AWB_CTRL13 …
#define REG_AWB_CTRL14 …
#define REG_SHARPENMT_THRESH1 …
#define REG_SHARPENMT_THRESH2 …
#define REG_SHARPENMT_OFFSET1 …
#define REG_SHARPENMT_OFFSET2 …
#define REG_DENOISE_THRESH1 …
#define REG_DENOISE_THRESH2 …
#define REG_DENOISE_OFFSET1 …
#define REG_DENOISE_OFFSET2 …
#define REG_SHARPEN_THRESH1 …
#define REG_SHARPEN_THRESH2 …
#define REG_CIP_CTRL00 …
#define REG_CIP_CTRL01 …
#define REG_CMX_SIGN …
#define REG_CMX_MISC_CTRL …
#define REG_PRE_ISP_CTRL00 …
#define TEST_PATTERN_ENABLE …
#define VERTICAL_COLOR_BAR_MASK …
#define REG_NULL …
#define OV265X_ID(_msb, _lsb) …
#define OV2659_ID …
struct sensor_register { … };
struct ov2659_framesize { … };
struct ov2659_pll_ctrl { … };
struct ov2659_pixfmt { … };
struct pll_ctrl_reg { … };
struct ov2659 { … };
static const struct sensor_register ov2659_init_regs[] = …;
static struct sensor_register ov2659_720p[] = …;
static struct sensor_register ov2659_uxga[] = …;
static struct sensor_register ov2659_sxga[] = …;
static struct sensor_register ov2659_xga[] = …;
static struct sensor_register ov2659_svga[] = …;
static struct sensor_register ov2659_vga[] = …;
static struct sensor_register ov2659_qvga[] = …;
static const struct pll_ctrl_reg ctrl3[] = …;
static const struct pll_ctrl_reg ctrl1[] = …;
static const struct ov2659_framesize ov2659_framesizes[] = …;
static struct sensor_register ov2659_format_yuyv[] = …;
static struct sensor_register ov2659_format_uyvy[] = …;
static struct sensor_register ov2659_format_bggr[] = …;
static struct sensor_register ov2659_format_rgb565[] = …;
static const struct ov2659_pixfmt ov2659_formats[] = …;
static inline struct ov2659 *to_ov2659(struct v4l2_subdev *sd)
{ … }
static int ov2659_write(struct i2c_client *client, u16 reg, u8 val)
{ … }
static int ov2659_read(struct i2c_client *client, u16 reg, u8 *val)
{ … }
static int ov2659_write_array(struct i2c_client *client,
const struct sensor_register *regs)
{ … }
static void ov2659_pll_calc_params(struct ov2659 *ov2659)
{ … }
static int ov2659_set_pixel_clock(struct ov2659 *ov2659)
{
struct i2c_client *client = ov2659->client;
struct sensor_register pll_regs[] = {
{REG_SC_PLL_CTRL1, ov2659->pll.ctrl1},
{REG_SC_PLL_CTRL2, ov2659->pll.ctrl2},
{REG_SC_PLL_CTRL3, ov2659->pll.ctrl3},
{REG_NULL, 0x00},
};
dev_dbg(&client->dev, "%s\n", __func__);
return ov2659_write_array(client, pll_regs);
};
static void ov2659_get_default_format(struct v4l2_mbus_framefmt *format)
{ … }
static void ov2659_set_streaming(struct ov2659 *ov2659, int on)
{ … }
static int ov2659_init(struct v4l2_subdev *sd, u32 val)
{ … }
static int ov2659_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int ov2659_enum_frame_sizes(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{ … }
static int ov2659_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static void __ov2659_try_frame_size(struct v4l2_mbus_framefmt *mf,
const struct ov2659_framesize **size)
{ … }
static int ov2659_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int ov2659_set_frame_size(struct ov2659 *ov2659)
{ … }
static int ov2659_set_format(struct ov2659 *ov2659)
{ … }
static int ov2659_s_stream(struct v4l2_subdev *sd, int on)
{ … }
static int ov2659_set_test_pattern(struct ov2659 *ov2659, int value)
{ … }
static int ov2659_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops ov2659_ctrl_ops = …;
static const char * const ov2659_test_pattern_menu[] = …;
static int ov2659_power_off(struct device *dev)
{ … }
static int ov2659_power_on(struct device *dev)
{ … }
static int ov2659_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{ … }
static const struct v4l2_subdev_core_ops ov2659_subdev_core_ops = …;
static const struct v4l2_subdev_video_ops ov2659_subdev_video_ops = …;
static const struct v4l2_subdev_pad_ops ov2659_subdev_pad_ops = …;
static const struct v4l2_subdev_ops ov2659_subdev_ops = …;
static const struct v4l2_subdev_internal_ops ov2659_subdev_internal_ops = …;
static int ov2659_detect(struct v4l2_subdev *sd)
{ … }
static struct ov2659_platform_data *
ov2659_get_pdata(struct i2c_client *client)
{ … }
static int ov2659_probe(struct i2c_client *client)
{ … }
static void ov2659_remove(struct i2c_client *client)
{ … }
static const struct dev_pm_ops ov2659_pm_ops = …;
static const struct i2c_device_id ov2659_id[] = …;
MODULE_DEVICE_TABLE(i2c, ov2659_id);
#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id ov2659_of_match[] = …;
MODULE_DEVICE_TABLE(of, ov2659_of_match);
#endif
static struct i2c_driver ov2659_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;