linux/drivers/media/i2c/ov5647.c

// SPDX-License-Identifier: GPL-2.0
/*
 * A V4L2 driver for OmniVision OV5647 cameras.
 *
 * Based on Samsung S5K6AAFX SXGA 1/6" 1.3M CMOS Image Sensor driver
 * Copyright (C) 2011 Sylwester Nawrocki <[email protected]>
 *
 * Based on Omnivision OV7670 Camera Driver
 * Copyright (C) 2006-7 Jonathan Corbet <[email protected]>
 *
 * Copyright (C) 2016, Synopsys, Inc.
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_graph.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-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-mediabus.h>

/*
 * From the datasheet, "20ms after PWDN goes low or 20ms after RESETB goes
 * high if reset is inserted after PWDN goes high, host can access sensor's
 * SCCB to initialize sensor."
 */
#define PWDN_ACTIVE_DELAY_MS

#define MIPI_CTRL00_CLOCK_LANE_GATE
#define MIPI_CTRL00_LINE_SYNC_ENABLE
#define MIPI_CTRL00_BUS_IDLE
#define MIPI_CTRL00_CLOCK_LANE_DISABLE

#define OV5647_SW_STANDBY
#define OV5647_SW_RESET
#define OV5647_REG_CHIPID_H
#define OV5647_REG_CHIPID_L
#define OV5640_REG_PAD_OUT
#define OV5647_REG_EXP_HI
#define OV5647_REG_EXP_MID
#define OV5647_REG_EXP_LO
#define OV5647_REG_AEC_AGC
#define OV5647_REG_GAIN_HI
#define OV5647_REG_GAIN_LO
#define OV5647_REG_VTS_HI
#define OV5647_REG_VTS_LO
#define OV5647_REG_FRAME_OFF_NUMBER
#define OV5647_REG_MIPI_CTRL00
#define OV5647_REG_MIPI_CTRL14
#define OV5647_REG_AWB
#define OV5647_REG_ISPCTRL3D

#define REG_TERM
#define VAL_TERM
#define REG_DLY

/* OV5647 native and active pixel array size */
#define OV5647_NATIVE_WIDTH
#define OV5647_NATIVE_HEIGHT

#define OV5647_PIXEL_ARRAY_LEFT
#define OV5647_PIXEL_ARRAY_TOP
#define OV5647_PIXEL_ARRAY_WIDTH
#define OV5647_PIXEL_ARRAY_HEIGHT

#define OV5647_VBLANK_MIN
#define OV5647_VTS_MAX

#define OV5647_EXPOSURE_MIN
#define OV5647_EXPOSURE_STEP
#define OV5647_EXPOSURE_DEFAULT
#define OV5647_EXPOSURE_MAX

struct regval_list {};

struct ov5647_mode {};

struct ov5647 {};

static inline struct ov5647 *to_sensor(struct v4l2_subdev *sd)
{}

static const char * const ov5647_test_pattern_menu[] =;

static const u8 ov5647_test_pattern_val[] =;

static const struct regval_list sensor_oe_disable_regs[] =;

static const struct regval_list sensor_oe_enable_regs[] =;

static struct regval_list ov5647_2592x1944_10bpp[] =;

static struct regval_list ov5647_1080p30_10bpp[] =;

static struct regval_list ov5647_2x2binned_10bpp[] =;

static struct regval_list ov5647_640x480_10bpp[] =;

static const struct ov5647_mode ov5647_modes[] =;

/* Default sensor mode is 2x2 binned 640x480 SBGGR10_1X10. */
#define OV5647_DEFAULT_MODE
#define OV5647_DEFAULT_FORMAT

static int ov5647_write16(struct v4l2_subdev *sd, u16 reg, u16 val)
{}

static int ov5647_write(struct v4l2_subdev *sd, u16 reg, u8 val)
{}

static int ov5647_read(struct v4l2_subdev *sd, u16 reg, u8 *val)
{}

static int ov5647_write_array(struct v4l2_subdev *sd,
			      const struct regval_list *regs, int array_size)
{}

static int ov5647_set_virtual_channel(struct v4l2_subdev *sd, int channel)
{}

static int ov5647_set_mode(struct v4l2_subdev *sd)
{}

static int ov5647_stream_on(struct v4l2_subdev *sd)
{}

static int ov5647_stream_off(struct v4l2_subdev *sd)
{}

static int ov5647_power_on(struct device *dev)
{}

static int ov5647_power_off(struct device *dev)
{}

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

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

/* Subdev core operations registration */
static const struct v4l2_subdev_core_ops ov5647_subdev_core_ops =;

static const struct v4l2_rect *
__ov5647_get_pad_crop(struct ov5647 *ov5647,
		      struct v4l2_subdev_state *sd_state,
		      unsigned int pad, enum v4l2_subdev_format_whence which)
{}

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

static const struct v4l2_subdev_video_ops ov5647_subdev_video_ops =;

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

static int ov5647_enum_frame_size(struct v4l2_subdev *sd,
				  struct v4l2_subdev_state *sd_state,
				  struct v4l2_subdev_frame_size_enum *fse)
{}

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

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

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

static const struct v4l2_subdev_pad_ops ov5647_subdev_pad_ops =;

static const struct v4l2_subdev_ops ov5647_subdev_ops =;

static int ov5647_detect(struct v4l2_subdev *sd)
{}

static int ov5647_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{}

static const struct v4l2_subdev_internal_ops ov5647_subdev_internal_ops =;

static int ov5647_s_auto_white_balance(struct v4l2_subdev *sd, u32 val)
{}

static int ov5647_s_autogain(struct v4l2_subdev *sd, u32 val)
{}

static int ov5647_s_exposure_auto(struct v4l2_subdev *sd, u32 val)
{}

static int ov5647_s_analogue_gain(struct v4l2_subdev *sd, u32 val)
{}

static int ov5647_s_exposure(struct v4l2_subdev *sd, u32 val)
{}

static int ov5647_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops ov5647_ctrl_ops =;

static int ov5647_init_controls(struct ov5647 *sensor)
{}

static int ov5647_parse_dt(struct ov5647 *sensor, struct device_node *np)
{}

static int ov5647_probe(struct i2c_client *client)
{}

static void ov5647_remove(struct i2c_client *client)
{}

static const struct dev_pm_ops ov5647_pm_ops =;

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

#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id ov5647_of_match[] =;
MODULE_DEVICE_TABLE(of, ov5647_of_match);
#endif

static struct i2c_driver ov5647_driver =;

module_i2c_driver();

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