linux/drivers/media/i2c/ov5670.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017 Intel Corporation.

#include <linux/unaligned.h>
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>

#define OV5670_XVCLK_FREQ

#define OV5670_REG_CHIP_ID
#define OV5670_CHIP_ID

#define OV5670_REG_MODE_SELECT
#define OV5670_MODE_STANDBY
#define OV5670_MODE_STREAMING

#define OV5670_REG_SOFTWARE_RST
#define OV5670_SOFTWARE_RST

#define OV5670_MIPI_SC_CTRL0_REG
#define OV5670_MIPI_SC_CTRL0_LANES(v)
#define OV5670_MIPI_SC_CTRL0_MIPI_EN
#define OV5670_MIPI_SC_CTRL0_RESERVED

/* vertical-timings from sensor */
#define OV5670_REG_VTS
#define OV5670_VTS_30FPS
#define OV5670_VTS_MAX

/* horizontal-timings from sensor */
#define OV5670_REG_HTS

/*
 * Pixels-per-line(PPL) = Time-per-line * pixel-rate
 * In OV5670, Time-per-line = HTS/SCLK.
 * HTS is fixed for all resolutions, not recommended to change.
 */
#define OV5670_FIXED_PPL

/* Exposure controls from sensor */
#define OV5670_REG_EXPOSURE
#define OV5670_EXPOSURE_MIN
#define OV5670_EXPOSURE_STEP

/* Analog gain controls from sensor */
#define OV5670_REG_ANALOG_GAIN
#define ANALOG_GAIN_MIN
#define ANALOG_GAIN_MAX
#define ANALOG_GAIN_STEP
#define ANALOG_GAIN_DEFAULT

/* Digital gain controls from sensor */
#define OV5670_REG_R_DGTL_GAIN
#define OV5670_REG_G_DGTL_GAIN
#define OV5670_REG_B_DGTL_GAIN
#define OV5670_DGTL_GAIN_MIN
#define OV5670_DGTL_GAIN_MAX
#define OV5670_DGTL_GAIN_STEP
#define OV5670_DGTL_GAIN_DEFAULT

/* Test Pattern Control */
#define OV5670_REG_TEST_PATTERN
#define OV5670_TEST_PATTERN_ENABLE
#define OV5670_REG_TEST_PATTERN_CTRL

#define OV5670_REG_VALUE_08BIT
#define OV5670_REG_VALUE_16BIT
#define OV5670_REG_VALUE_24BIT

/* Pixel Array */
#define OV5670_NATIVE_WIDTH
#define OV5670_NATIVE_HEIGHT

/* Initial number of frames to skip to avoid possible garbage */
#define OV5670_NUM_OF_SKIP_FRAMES

struct ov5670_reg {};

struct ov5670_reg_list {};

struct ov5670_link_freq_config {};

static const char * const ov5670_supply_names[] =;

#define OV5670_NUM_SUPPLIES

struct ov5670_mode {};

/*
 * All the modes supported by the driver are obtained by subsampling the
 * full pixel array. The below values are reflected in registers from
 * 0x3800-0x3807 in the modes register-value tables.
 */
static const struct v4l2_rect ov5670_analog_crop =;

static const struct ov5670_reg mipi_data_rate_840mbps[] =;

static const struct ov5670_reg mode_2592x1944_regs[] =;

static const struct ov5670_reg mode_1296x972_regs[] =;

static const struct ov5670_reg mode_648x486_regs[] =;

static const struct ov5670_reg mode_2560x1440_regs[] =;

static const struct ov5670_reg mode_1280x720_regs[] =;

static const struct ov5670_reg mode_640x360_regs[] =;

static const char * const ov5670_test_pattern_menu[] =;

/* Supported link frequencies */
#define OV5670_LINK_FREQ_422MHZ
#define OV5670_LINK_FREQ_422MHZ_INDEX
static const struct ov5670_link_freq_config link_freq_configs[] =;

static const s64 link_freq_menu_items[] =;

/*
 * OV5670 sensor supports following resolutions with full FOV:
 * 4:3  ==> {2592x1944, 1296x972, 648x486}
 * 16:9 ==> {2560x1440, 1280x720, 640x360}
 */
static const struct ov5670_mode supported_modes[] =;

struct ov5670 {};

#define to_ov5670(_sd)

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

/* Write registers up to 4 at a time */
static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len,
			    u32 val)
{}

/* Write a list of registers */
static int ov5670_write_regs(struct ov5670 *ov5670,
			     const struct ov5670_reg *regs, unsigned int len)
{}

static int ov5670_write_reg_list(struct ov5670 *ov5670,
				 const struct ov5670_reg_list *r_list)
{}

static int ov5670_update_digital_gain(struct ov5670 *ov5670, u32 d_gain)
{}

static int ov5670_enable_test_pattern(struct ov5670 *ov5670, u32 pattern)
{}

/* Initialize control handlers */
static int ov5670_set_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops ov5670_ctrl_ops =;

/* Initialize control handlers */
static int ov5670_init_controls(struct ov5670 *ov5670)
{}

static int ov5670_init_state(struct v4l2_subdev *sd,
			     struct v4l2_subdev_state *state)
{}

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

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

static void ov5670_update_pad_format(const struct ov5670_mode *mode,
				     struct v4l2_subdev_format *fmt)
{}

static int ov5670_do_get_pad_format(struct ov5670 *ov5670,
				    struct v4l2_subdev_state *sd_state,
				    struct v4l2_subdev_format *fmt)
{}

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

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

static int ov5670_get_skip_frames(struct v4l2_subdev *sd, u32 *frames)
{}

/* Verify chip ID */
static int ov5670_identify_module(struct ov5670 *ov5670)
{}

static int ov5670_mipi_configure(struct ov5670 *ov5670)
{}

/* Prepare streaming by writing default values and customized values */
static int ov5670_start_streaming(struct ov5670 *ov5670)
{}

static int ov5670_stop_streaming(struct ov5670 *ov5670)
{}

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

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

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

static const struct v4l2_subdev_core_ops ov5670_core_ops =;

static const struct v4l2_rect *
__ov5670_get_pad_crop(struct ov5670 *sensor, struct v4l2_subdev_state *state,
		      unsigned int pad, enum v4l2_subdev_format_whence which)
{}

static int ov5670_get_selection(struct v4l2_subdev *subdev,
				struct v4l2_subdev_state *state,
				struct v4l2_subdev_selection *sel)
{}

static const struct v4l2_subdev_video_ops ov5670_video_ops =;

static const struct v4l2_subdev_pad_ops ov5670_pad_ops =;

static const struct v4l2_subdev_sensor_ops ov5670_sensor_ops =;

static const struct v4l2_subdev_ops ov5670_subdev_ops =;

static const struct v4l2_subdev_internal_ops ov5670_internal_ops =;

static const struct media_entity_operations ov5670_subdev_entity_ops =;

static int ov5670_regulators_probe(struct ov5670 *ov5670)
{}

static int ov5670_gpio_probe(struct ov5670 *ov5670)
{}

static int ov5670_probe(struct i2c_client *client)
{}

static void ov5670_remove(struct i2c_client *client)
{}

static const struct dev_pm_ops ov5670_pm_ops =;

#ifdef CONFIG_ACPI
static const struct acpi_device_id ov5670_acpi_ids[] =;

MODULE_DEVICE_TABLE(acpi, ov5670_acpi_ids);
#endif

static const struct of_device_id ov5670_of_ids[] =;
MODULE_DEVICE_TABLE(of, ov5670_of_ids);

static struct i2c_driver ov5670_i2c_driver =;

module_i2c_driver();

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