#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/log2.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-subdev.h>
#define MT9M001_CHIP_VERSION …
#define MT9M001_ROW_START …
#define MT9M001_COLUMN_START …
#define MT9M001_WINDOW_HEIGHT …
#define MT9M001_WINDOW_WIDTH …
#define MT9M001_HORIZONTAL_BLANKING …
#define MT9M001_VERTICAL_BLANKING …
#define MT9M001_OUTPUT_CONTROL …
#define MT9M001_SHUTTER_WIDTH …
#define MT9M001_FRAME_RESTART …
#define MT9M001_SHUTTER_DELAY …
#define MT9M001_RESET …
#define MT9M001_READ_OPTIONS1 …
#define MT9M001_READ_OPTIONS2 …
#define MT9M001_GLOBAL_GAIN …
#define MT9M001_CHIP_ENABLE …
#define MT9M001_MAX_WIDTH …
#define MT9M001_MAX_HEIGHT …
#define MT9M001_MIN_WIDTH …
#define MT9M001_MIN_HEIGHT …
#define MT9M001_COLUMN_SKIP …
#define MT9M001_ROW_SKIP …
#define MT9M001_DEFAULT_HBLANK …
#define MT9M001_DEFAULT_VBLANK …
struct mt9m001_datafmt { … };
static const struct mt9m001_datafmt *mt9m001_find_datafmt(
u32 code, const struct mt9m001_datafmt *fmt,
int n)
{ … }
static const struct mt9m001_datafmt mt9m001_colour_fmts[] = …;
static const struct mt9m001_datafmt mt9m001_monochrome_fmts[] = …;
struct mt9m001 { … };
static struct mt9m001 *to_mt9m001(const struct i2c_client *client)
{ … }
static int reg_read(struct i2c_client *client, const u8 reg)
{ … }
static int reg_write(struct i2c_client *client, const u8 reg,
const u16 data)
{ … }
static int reg_set(struct i2c_client *client, const u8 reg,
const u16 data)
{ … }
static int reg_clear(struct i2c_client *client, const u8 reg,
const u16 data)
{ … }
struct mt9m001_reg { … };
static int multi_reg_write(struct i2c_client *client,
const struct mt9m001_reg *regs, int num)
{ … }
static int mt9m001_init(struct i2c_client *client)
{ … }
static int mt9m001_apply_selection(struct v4l2_subdev *sd)
{ … }
static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable)
{ … }
static int mt9m001_set_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static int mt9m001_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static int mt9m001_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int mt9m001_s_fmt(struct v4l2_subdev *sd,
const struct mt9m001_datafmt *fmt,
struct v4l2_mbus_framefmt *mf)
{ … }
static int mt9m001_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
#ifdef CONFIG_VIDEO_ADV_DEBUG
static int mt9m001_g_register(struct v4l2_subdev *sd,
struct v4l2_dbg_register *reg)
{ … }
static int mt9m001_s_register(struct v4l2_subdev *sd,
const struct v4l2_dbg_register *reg)
{ … }
#endif
static int mt9m001_power_on(struct device *dev)
{ … }
static int mt9m001_power_off(struct device *dev)
{ … }
static int mt9m001_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int mt9m001_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int mt9m001_video_probe(struct i2c_client *client)
{ … }
static int mt9m001_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines)
{ … }
static const struct v4l2_ctrl_ops mt9m001_ctrl_ops = …;
static const struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = …;
static int mt9m001_init_state(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state)
{ … }
static int mt9m001_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int mt9m001_get_mbus_config(struct v4l2_subdev *sd,
unsigned int pad,
struct v4l2_mbus_config *cfg)
{ … }
static const struct v4l2_subdev_video_ops mt9m001_subdev_video_ops = …;
static const struct v4l2_subdev_sensor_ops mt9m001_subdev_sensor_ops = …;
static const struct v4l2_subdev_pad_ops mt9m001_subdev_pad_ops = …;
static const struct v4l2_subdev_ops mt9m001_subdev_ops = …;
static const struct v4l2_subdev_internal_ops mt9m001_internal_ops = …;
static int mt9m001_probe(struct i2c_client *client)
{ … }
static void mt9m001_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id mt9m001_id[] = …;
MODULE_DEVICE_TABLE(i2c, mt9m001_id);
static const struct dev_pm_ops mt9m001_pm_ops = …;
static const struct of_device_id mt9m001_of_match[] = …;
MODULE_DEVICE_TABLE(of, mt9m001_of_match);
static struct i2c_driver mt9m001_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;