#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/v4l2-mediabus.h>
#include <linux/videodev2.h>
#include <media/i2c/ov772x.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-subdev.h>
#define GAIN …
#define BLUE …
#define RED …
#define GREEN …
#define COM1 …
#define BAVG …
#define GAVG …
#define RAVG …
#define AECH …
#define COM2 …
#define PID …
#define VER …
#define COM3 …
#define COM4 …
#define COM5 …
#define COM6 …
#define AEC …
#define CLKRC …
#define COM7 …
#define COM8 …
#define COM9 …
#define COM10 …
#define REG16 …
#define HSTART …
#define HSIZE …
#define VSTART …
#define VSIZE …
#define PSHFT …
#define MIDH …
#define MIDL …
#define LAEC …
#define COM11 …
#define BDBASE …
#define DBSTEP …
#define AEW …
#define AEB …
#define VPT …
#define REG28 …
#define HOUTSIZE …
#define EXHCH …
#define EXHCL …
#define VOUTSIZE …
#define ADVFL …
#define ADVFH …
#define YAVE …
#define LUMHTH …
#define LUMLTH …
#define HREF …
#define DM_LNL …
#define DM_LNH …
#define ADOFF_B …
#define ADOFF_R …
#define ADOFF_GB …
#define ADOFF_GR …
#define OFF_B …
#define OFF_R …
#define OFF_GB …
#define OFF_GR …
#define COM12 …
#define COM13 …
#define COM14 …
#define COM15 …
#define COM16 …
#define TGT_B …
#define TGT_R …
#define TGT_GB …
#define TGT_GR …
#define LCC0 …
#define LCC1 …
#define LCC2 …
#define LCC3 …
#define LCC4 …
#define LCC5 …
#define LCC6 …
#define LC_CTR …
#define LC_XC …
#define LC_YC …
#define LC_COEF …
#define LC_RADI …
#define LC_COEFB …
#define LC_COEFR …
#define FIXGAIN …
#define AREF0 …
#define AREF1 …
#define AREF2 …
#define AREF3 …
#define AREF4 …
#define AREF5 …
#define AREF6 …
#define AREF7 …
#define UFIX …
#define VFIX …
#define AWBB_BLK …
#define AWB_CTRL0 …
#define DSP_CTRL1 …
#define DSP_CTRL2 …
#define DSP_CTRL3 …
#define DSP_CTRL4 …
#define AWB_BIAS …
#define AWB_CTRL1 …
#define AWB_CTRL2 …
#define AWB_CTRL3 …
#define AWB_CTRL4 …
#define AWB_CTRL5 …
#define AWB_CTRL6 …
#define AWB_CTRL7 …
#define AWB_CTRL8 …
#define AWB_CTRL9 …
#define AWB_CTRL10 …
#define AWB_CTRL11 …
#define AWB_CTRL12 …
#define AWB_CTRL13 …
#define AWB_CTRL14 …
#define AWB_CTRL15 …
#define AWB_CTRL16 …
#define AWB_CTRL17 …
#define AWB_CTRL18 …
#define AWB_CTRL19 …
#define AWB_CTRL20 …
#define AWB_CTRL21 …
#define GAM1 …
#define GAM2 …
#define GAM3 …
#define GAM4 …
#define GAM5 …
#define GAM6 …
#define GAM7 …
#define GAM8 …
#define GAM9 …
#define GAM10 …
#define GAM11 …
#define GAM12 …
#define GAM13 …
#define GAM14 …
#define GAM15 …
#define SLOP …
#define DNSTH …
#define EDGE_STRNGT …
#define EDGE_TRSHLD …
#define DNSOFF …
#define EDGE_UPPER …
#define EDGE_LOWER …
#define MTX1 …
#define MTX2 …
#define MTX3 …
#define MTX4 …
#define MTX5 …
#define MTX6 …
#define MTX_CTRL …
#define BRIGHT …
#define CNTRST …
#define CNTRST_CTRL …
#define UVAD_J0 …
#define UVAD_J1 …
#define SCAL0 …
#define SCAL1 …
#define SCAL2 …
#define FIFODLYM …
#define FIFODLYA …
#define SDE …
#define USAT …
#define VSAT …
#define HUE0 …
#define HUE1 …
#define HUECOS …
#define HUESIN …
#define SIGN …
#define DSPAUTO …
#define SOFT_SLEEP_MODE …
#define OCAP_1x …
#define OCAP_2x …
#define OCAP_3x …
#define OCAP_4x …
#define SWAP_MASK …
#define IMG_MASK …
#define VFLIP_IMG …
#define HFLIP_IMG …
#define SWAP_RGB …
#define SWAP_YUV …
#define SWAP_ML …
#define NOTRI_CLOCK …
#define NOTRI_DATA …
#define SCOLOR_TEST …
#define PLL_BYPASS …
#define PLL_4x …
#define PLL_6x …
#define PLL_8x …
#define AEC_FULL …
#define AEC_1p2 …
#define AEC_1p4 …
#define AEC_2p3 …
#define COM4_RESERVED …
#define AFR_ON_OFF …
#define AFR_SPPED …
#define AFR_NO_RATE …
#define AFR_1p2 …
#define AFR_1p4 …
#define AFR_1p8 …
#define AF_2x …
#define AF_4x …
#define AF_8x …
#define AF_16x …
#define AEC_NO_LIMIT …
#define CLKRC_RESERVED …
#define CLKRC_DIV(n) …
#define SCCB_RESET …
#define SLCT_MASK …
#define SLCT_VGA …
#define SLCT_QVGA …
#define ITU656_ON_OFF …
#define SENSOR_RAW …
#define FMT_MASK …
#define FMT_GBR422 …
#define FMT_RGB565 …
#define FMT_RGB555 …
#define FMT_RGB444 …
#define OFMT_MASK …
#define OFMT_YUV …
#define OFMT_P_BRAW …
#define OFMT_RGB …
#define OFMT_BRAW …
#define FAST_ALGO …
#define UNLMT_STEP …
#define BNDF_ON_OFF …
#define AEC_BND …
#define AEC_ON_OFF …
#define AGC_ON …
#define AWB_ON …
#define AEC_ON …
#define BASE_AECAGC …
#define GAIN_2x …
#define GAIN_4x …
#define GAIN_8x …
#define GAIN_16x …
#define GAIN_32x …
#define GAIN_64x …
#define GAIN_128x …
#define DROP_VSYNC …
#define DROP_HREF …
#define SGLF_ON_OFF …
#define SGLF_TRIG …
#define HREF_VSTART_SHIFT …
#define HREF_HSTART_SHIFT …
#define HREF_VSIZE_SHIFT …
#define HREF_HSIZE_SHIFT …
#define EXHCH_VSIZE_SHIFT …
#define EXHCH_HSIZE_SHIFT …
#define FIFO_ON …
#define UV_ON_OFF …
#define YUV444_2_422 …
#define CLR_MTRX_ON_OFF …
#define INTPLT_ON_OFF …
#define GMM_ON_OFF …
#define AUTO_BLK_ON_OFF …
#define AUTO_WHT_ON_OFF …
#define UV_MASK …
#define UV_ON …
#define UV_OFF …
#define CBAR_MASK …
#define CBAR_ON …
#define CBAR_OFF …
#define DSP_OFMT_YUV …
#define DSP_OFMT_RGB …
#define DSP_OFMT_RAW8 …
#define DSP_OFMT_RAW10 …
#define AWB_ACTRL …
#define DENOISE_ACTRL …
#define EDGE_ACTRL …
#define UV_ACTRL …
#define SCAL0_ACTRL …
#define SCAL1_2_ACTRL …
#define OV772X_MAX_WIDTH …
#define OV772X_MAX_HEIGHT …
#define OV7720 …
#define OV7725 …
#define VERSION(pid, ver) …
static struct { … } ov772x_pll[] = …;
struct ov772x_color_format { … };
struct ov772x_win_size { … };
struct ov772x_priv { … };
static const struct ov772x_color_format ov772x_cfmts[] = …;
static const struct ov772x_win_size ov772x_win_sizes[] = …;
static const char * const ov772x_test_pattern_menu[] = …;
static const unsigned int ov772x_frame_intervals[] = …;
static struct ov772x_priv *to_ov772x(struct v4l2_subdev *sd)
{ … }
static int ov772x_reset(struct ov772x_priv *priv)
{ … }
static int ov772x_s_stream(struct v4l2_subdev *sd, int enable)
{ … }
static unsigned int ov772x_select_fps(struct ov772x_priv *priv,
struct v4l2_fract *tpf)
{ … }
static int ov772x_set_frame_rate(struct ov772x_priv *priv,
unsigned int fps,
const struct ov772x_color_format *cfmt,
const struct ov772x_win_size *win)
{ … }
static int ov772x_get_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval *ival)
{ … }
static int ov772x_set_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval *ival)
{ … }
static int ov772x_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
#ifdef CONFIG_VIDEO_ADV_DEBUG
static int ov772x_g_register(struct v4l2_subdev *sd,
struct v4l2_dbg_register *reg)
{ … }
static int ov772x_s_register(struct v4l2_subdev *sd,
const struct v4l2_dbg_register *reg)
{ … }
#endif
static int ov772x_power_on(struct ov772x_priv *priv)
{ … }
static int ov772x_power_off(struct ov772x_priv *priv)
{ … }
static int ov772x_set_params(struct ov772x_priv *priv,
const struct ov772x_color_format *cfmt,
const struct ov772x_win_size *win);
static int ov772x_s_power(struct v4l2_subdev *sd, int on)
{ … }
static const struct ov772x_win_size *ov772x_select_win(u32 width, u32 height)
{ … }
static void ov772x_select_params(const struct v4l2_mbus_framefmt *mf,
const struct ov772x_color_format **cfmt,
const struct ov772x_win_size **win)
{ … }
static int ov772x_edgectrl(struct ov772x_priv *priv)
{ … }
static int ov772x_set_params(struct ov772x_priv *priv,
const struct ov772x_color_format *cfmt,
const struct ov772x_win_size *win)
{ … }
static int ov772x_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static int ov772x_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int ov772x_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int ov772x_video_probe(struct ov772x_priv *priv)
{ … }
static const struct v4l2_ctrl_ops ov772x_ctrl_ops = …;
static const struct v4l2_subdev_core_ops ov772x_subdev_core_ops = …;
static int ov772x_enum_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval_enum *fie)
{ … }
static int ov772x_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static const struct v4l2_subdev_video_ops ov772x_subdev_video_ops = …;
static const struct v4l2_subdev_pad_ops ov772x_subdev_pad_ops = …;
static const struct v4l2_subdev_ops ov772x_subdev_ops = …;
static int ov772x_parse_dt(struct i2c_client *client,
struct ov772x_priv *priv)
{ … }
static int ov772x_probe(struct i2c_client *client)
{ … }
static void ov772x_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id ov772x_id[] = …;
MODULE_DEVICE_TABLE(i2c, ov772x_id);
static const struct of_device_id ov772x_of_match[] = …;
MODULE_DEVICE_TABLE(of, ov772x_of_match);
static struct i2c_driver ov772x_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;