#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/v4l2-mediabus.h>
#include <linux/module.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-subdev.h>
#define MT9V111_CHIP_ID_HIGH …
#define MT9V111_CHIP_ID_LOW …
#define MT9V111_R01_ADDR_SPACE …
#define MT9V111_R01_IFP …
#define MT9V111_R01_CORE …
#define MT9V111_IFP_R06_OPMODE_CTRL …
#define MT9V111_IFP_R06_OPMODE_CTRL_AWB_EN …
#define MT9V111_IFP_R06_OPMODE_CTRL_AE_EN …
#define MT9V111_IFP_R07_IFP_RESET …
#define MT9V111_IFP_R07_IFP_RESET_MASK …
#define MT9V111_IFP_R08_OUTFMT_CTRL …
#define MT9V111_IFP_R08_OUTFMT_CTRL_FLICKER …
#define MT9V111_IFP_R08_OUTFMT_CTRL_PCLK …
#define MT9V111_IFP_R3A_OUTFMT_CTRL2 …
#define MT9V111_IFP_R3A_OUTFMT_CTRL2_SWAP_CBCR …
#define MT9V111_IFP_R3A_OUTFMT_CTRL2_SWAP_YC …
#define MT9V111_IFP_R3A_OUTFMT_CTRL2_SWAP_MASK …
#define MT9V111_IFP_RA5_HPAN …
#define MT9V111_IFP_RA6_HZOOM …
#define MT9V111_IFP_RA7_HOUT …
#define MT9V111_IFP_RA8_VPAN …
#define MT9V111_IFP_RA9_VZOOM …
#define MT9V111_IFP_RAA_VOUT …
#define MT9V111_IFP_DECIMATION_MASK …
#define MT9V111_IFP_DECIMATION_FREEZE …
#define MT9V111_CORE_R03_WIN_HEIGHT …
#define MT9V111_CORE_R03_WIN_V_OFFS …
#define MT9V111_CORE_R04_WIN_WIDTH …
#define MT9V111_CORE_R04_WIN_H_OFFS …
#define MT9V111_CORE_R05_HBLANK …
#define MT9V111_CORE_R05_MIN_HBLANK …
#define MT9V111_CORE_R05_MAX_HBLANK …
#define MT9V111_CORE_R05_DEF_HBLANK …
#define MT9V111_CORE_R06_VBLANK …
#define MT9V111_CORE_R06_MIN_VBLANK …
#define MT9V111_CORE_R06_MAX_VBLANK …
#define MT9V111_CORE_R06_DEF_VBLANK …
#define MT9V111_CORE_R07_OUT_CTRL …
#define MT9V111_CORE_R07_OUT_CTRL_SAMPLE …
#define MT9V111_CORE_R09_PIXEL_INT …
#define MT9V111_CORE_R09_PIXEL_INT_MASK …
#define MT9V111_CORE_R0D_CORE_RESET …
#define MT9V111_CORE_R0D_CORE_RESET_MASK …
#define MT9V111_CORE_RFF_CHIP_VER …
#define MT9V111_PIXEL_ARRAY_WIDTH …
#define MT9V111_PIXEL_ARRAY_HEIGHT …
#define MT9V111_MAX_CLKIN …
static const struct v4l2_mbus_framefmt mt9v111_def_fmt = …;
struct mt9v111_dev { … };
#define sd_to_mt9v111(__sd) …
static struct mt9v111_mbus_fmt { … } mt9v111_formats[] = …;
static u32 mt9v111_frame_intervals[] = …;
static struct v4l2_rect mt9v111_frame_sizes[] = …;
static int __mt9v111_read(struct i2c_client *c, u8 reg, u16 *val)
{ … }
static int __mt9v111_write(struct i2c_client *c, u8 reg, u16 val)
{ … }
static int __mt9v111_addr_space_select(struct i2c_client *c, u16 addr_space)
{ … }
static int mt9v111_read(struct i2c_client *c, u8 addr_space, u8 reg, u16 *val)
{ … }
static int mt9v111_write(struct i2c_client *c, u8 addr_space, u8 reg, u16 val)
{ … }
static int mt9v111_update(struct i2c_client *c, u8 addr_space, u8 reg,
u16 mask, u16 val)
{ … }
static int __mt9v111_power_on(struct v4l2_subdev *sd)
{ … }
static int __mt9v111_power_off(struct v4l2_subdev *sd)
{ … }
static int __mt9v111_hw_reset(struct mt9v111_dev *mt9v111)
{ … }
static int __mt9v111_sw_reset(struct mt9v111_dev *mt9v111)
{ … }
static int mt9v111_calc_frame_rate(struct mt9v111_dev *mt9v111,
struct v4l2_fract *tpf)
{ … }
static int mt9v111_hw_config(struct mt9v111_dev *mt9v111)
{ … }
static int mt9v111_s_power(struct v4l2_subdev *sd, int on)
{ … }
static int mt9v111_s_stream(struct v4l2_subdev *subdev, int enable)
{ … }
static int mt9v111_set_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval *ival)
{ … }
static int mt9v111_get_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval *ival)
{ … }
static struct v4l2_mbus_framefmt *__mt9v111_get_pad_format(
struct mt9v111_dev *mt9v111,
struct v4l2_subdev_state *sd_state,
unsigned int pad,
enum v4l2_subdev_format_whence which)
{ … }
static int mt9v111_enum_mbus_code(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int mt9v111_enum_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval_enum *fie)
{ … }
static int mt9v111_enum_frame_size(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{ … }
static int mt9v111_get_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int mt9v111_set_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int mt9v111_init_state(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state)
{ … }
static const struct v4l2_subdev_core_ops mt9v111_core_ops = …;
static const struct v4l2_subdev_video_ops mt9v111_video_ops = …;
static const struct v4l2_subdev_pad_ops mt9v111_pad_ops = …;
static const struct v4l2_subdev_ops mt9v111_ops = …;
static const struct v4l2_subdev_internal_ops mt9v111_internal_ops = …;
static const struct media_entity_operations mt9v111_subdev_entity_ops = …;
static int mt9v111_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops mt9v111_ctrl_ops = …;
static int mt9v111_chip_probe(struct mt9v111_dev *mt9v111)
{ … }
static int mt9v111_probe(struct i2c_client *client)
{ … }
static void mt9v111_remove(struct i2c_client *client)
{ … }
static const struct of_device_id mt9v111_of_match[] = …;
MODULE_DEVICE_TABLE(of, mt9v111_of_match);
static struct i2c_driver mt9v111_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;