linux/drivers/media/i2c/ov5695.c

// SPDX-License-Identifier: GPL-2.0
/*
 * ov5695 driver
 *
 * Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd.
 */

#include <linux/clk.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/sysfs.h>
#include <media/media-entity.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>

#ifndef V4L2_CID_DIGITAL_GAIN
#define V4L2_CID_DIGITAL_GAIN
#endif

/* 45Mhz * 4 Binning */
#define OV5695_PIXEL_RATE
#define OV5695_XVCLK_FREQ

#define CHIP_ID
#define OV5695_REG_CHIP_ID

#define OV5695_REG_CTRL_MODE
#define OV5695_MODE_SW_STANDBY
#define OV5695_MODE_STREAMING

#define OV5695_REG_EXPOSURE
#define OV5695_EXPOSURE_MIN
#define OV5695_EXPOSURE_STEP
#define OV5695_VTS_MAX

#define OV5695_REG_ANALOG_GAIN
#define ANALOG_GAIN_MIN
#define ANALOG_GAIN_MAX
#define ANALOG_GAIN_STEP
#define ANALOG_GAIN_DEFAULT

#define OV5695_REG_DIGI_GAIN_H
#define OV5695_REG_DIGI_GAIN_L
#define OV5695_DIGI_GAIN_L_MASK
#define OV5695_DIGI_GAIN_H_SHIFT
#define OV5695_DIGI_GAIN_MIN
#define OV5695_DIGI_GAIN_MAX
#define OV5695_DIGI_GAIN_STEP
#define OV5695_DIGI_GAIN_DEFAULT

#define OV5695_REG_TEST_PATTERN
#define OV5695_TEST_PATTERN_ENABLE
#define OV5695_TEST_PATTERN_DISABLE

#define OV5695_REG_VTS

#define REG_NULL

#define OV5695_REG_VALUE_08BIT
#define OV5695_REG_VALUE_16BIT
#define OV5695_REG_VALUE_24BIT

#define OV5695_LANES
#define OV5695_BITS_PER_SAMPLE

static const char * const ov5695_supply_names[] =;

#define OV5695_NUM_SUPPLIES

struct regval {};

struct ov5695_mode {};

struct ov5695 {};

#define to_ov5695(sd)

/*
 * Xclk 24Mhz
 * Pclk 45Mhz
 * linelength 672(0x2a0)
 * framelength 2232(0x8b8)
 * grabwindow_width 1296
 * grabwindow_height 972
 * max_framerate 30fps
 * mipi_datarate per lane 840Mbps
 */
static const struct regval ov5695_global_regs[] =;

/*
 * Xclk 24Mhz
 * Pclk 45Mhz
 * linelength 740(0x2e4)
 * framelength 2024(0x7e8)
 * grabwindow_width 2592
 * grabwindow_height 1944
 * max_framerate 30fps
 * mipi_datarate per lane 840Mbps
 */
static const struct regval ov5695_2592x1944_regs[] =;

/*
 * Xclk 24Mhz
 * Pclk 45Mhz
 * linelength 672(0x2a0)
 * framelength 2232(0x8b8)
 * grabwindow_width 1920
 * grabwindow_height 1080
 * max_framerate 30fps
 * mipi_datarate per lane 840Mbps
 */
static const struct regval ov5695_1920x1080_regs[] =;

/*
 * Xclk 24Mhz
 * Pclk 45Mhz
 * linelength 740(0x02e4)
 * framelength 1012(0x03f4)
 * grabwindow_width 1296
 * grabwindow_height 972
 * max_framerate 60fps
 * mipi_datarate per lane 840Mbps
 */
static const struct regval ov5695_1296x972_regs[] =;

/*
 * Xclk 24Mhz
 * Pclk 45Mhz
 * linelength 672(0x2a0)
 * framelength 2232(0x8b8)
 * grabwindow_width 1280
 * grabwindow_height 720
 * max_framerate 30fps
 * mipi_datarate per lane 840Mbps
 */
static const struct regval ov5695_1280x720_regs[] =;

/*
 * Xclk 24Mhz
 * Pclk 45Mhz
 * linelength 672(0x2a0)
 * framelength 558(0x22e)
 * grabwindow_width 640
 * grabwindow_height 480
 * max_framerate 120fps
 * mipi_datarate per lane 840Mbps
 */
static const struct regval ov5695_640x480_regs[] =;

static const struct ov5695_mode supported_modes[] =;

#define OV5695_LINK_FREQ_420MHZ
static const s64 link_freq_menu_items[] =;

static const char * const ov5695_test_pattern_menu[] =;

/* Write registers up to 4 at a time */
static int ov5695_write_reg(struct i2c_client *client, u16 reg,
			    u32 len, u32 val)
{}

static int ov5695_write_array(struct i2c_client *client,
			      const struct regval *regs)
{}

/* Read registers up to 4 at a time */
static int ov5695_read_reg(struct i2c_client *client, u16 reg, unsigned int len,
			   u32 *val)
{}

static int ov5695_get_reso_dist(const struct ov5695_mode *mode,
				struct v4l2_mbus_framefmt *framefmt)
{}

static const struct ov5695_mode *
ov5695_find_best_fit(struct v4l2_subdev_format *fmt)
{}

static int ov5695_set_fmt(struct v4l2_subdev *sd,
			  struct v4l2_subdev_state *sd_state,
			  struct v4l2_subdev_format *fmt)
{}

static int ov5695_get_fmt(struct v4l2_subdev *sd,
			  struct v4l2_subdev_state *sd_state,
			  struct v4l2_subdev_format *fmt)
{}

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

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

static int ov5695_enable_test_pattern(struct ov5695 *ov5695, u32 pattern)
{}

static int __ov5695_start_stream(struct ov5695 *ov5695)
{}

static int __ov5695_stop_stream(struct ov5695 *ov5695)
{}

static int ov5695_s_stream(struct v4l2_subdev *sd, int on)
{}

static int __ov5695_power_on(struct ov5695 *ov5695)
{}

static void __ov5695_power_off(struct ov5695 *ov5695)
{}

static int __maybe_unused ov5695_runtime_resume(struct device *dev)
{}

static int __maybe_unused ov5695_runtime_suspend(struct device *dev)
{}

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

static const struct dev_pm_ops ov5695_pm_ops =;

static const struct v4l2_subdev_internal_ops ov5695_internal_ops =;

static const struct v4l2_subdev_video_ops ov5695_video_ops =;

static const struct v4l2_subdev_pad_ops ov5695_pad_ops =;

static const struct v4l2_subdev_ops ov5695_subdev_ops =;

static int ov5695_set_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops ov5695_ctrl_ops =;

static int ov5695_initialize_controls(struct ov5695 *ov5695)
{}

static int ov5695_check_sensor_id(struct ov5695 *ov5695,
				  struct i2c_client *client)
{}

static int ov5695_configure_regulators(struct ov5695 *ov5695)
{}

static int ov5695_probe(struct i2c_client *client)
{}

static void ov5695_remove(struct i2c_client *client)
{}

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

static struct i2c_driver ov5695_i2c_driver =;

module_i2c_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();