linux/drivers/media/i2c/ov2680.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Omnivision OV2680 CMOS Image Sensor driver
 *
 * Copyright (C) 2018 Linaro Ltd
 *
 * Based on OV5640 Sensor Driver
 * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
 * Copyright (C) 2014-2017 Mentor Graphics Inc.
 *
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>

#include <media/v4l2-cci.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>

#define OV2680_CHIP_ID

#define OV2680_REG_STREAM_CTRL
#define OV2680_REG_SOFT_RESET

#define OV2680_REG_CHIP_ID
#define OV2680_REG_SC_CMMN_SUB_ID
#define OV2680_REG_PLL_MULTIPLIER

#define OV2680_REG_EXPOSURE_PK
#define OV2680_REG_R_MANUAL
#define OV2680_REG_GAIN_PK

#define OV2680_REG_SENSOR_CTRL_0A

#define OV2680_REG_HORIZONTAL_START
#define OV2680_REG_VERTICAL_START
#define OV2680_REG_HORIZONTAL_END
#define OV2680_REG_VERTICAL_END
#define OV2680_REG_HORIZONTAL_OUTPUT_SIZE
#define OV2680_REG_VERTICAL_OUTPUT_SIZE
#define OV2680_REG_TIMING_HTS
#define OV2680_REG_TIMING_VTS
#define OV2680_REG_ISP_X_WIN
#define OV2680_REG_ISP_Y_WIN
#define OV2680_REG_X_INC
#define OV2680_REG_Y_INC
#define OV2680_REG_FORMAT1
#define OV2680_REG_FORMAT2

#define OV2680_REG_ISP_CTRL00

#define OV2680_REG_X_WIN
#define OV2680_REG_Y_WIN

#define OV2680_FRAME_RATE

#define OV2680_NATIVE_WIDTH
#define OV2680_NATIVE_HEIGHT
#define OV2680_NATIVE_START_LEFT
#define OV2680_NATIVE_START_TOP
#define OV2680_ACTIVE_WIDTH
#define OV2680_ACTIVE_HEIGHT
#define OV2680_ACTIVE_START_LEFT
#define OV2680_ACTIVE_START_TOP
#define OV2680_MIN_CROP_WIDTH
#define OV2680_MIN_CROP_HEIGHT
#define OV2680_MIN_VBLANK
#define OV2680_MAX_VBLANK

/* Fixed pre-div of 1/2 */
#define OV2680_PLL_PREDIV0

/* Pre-div configurable through reg 0x3080, left at its default of 0x02 : 1/2 */
#define OV2680_PLL_PREDIV

/* 66MHz pixel clock: 66MHz / 1704 * 1294 = 30fps */
#define OV2680_PIXELS_PER_LINE
#define OV2680_LINES_PER_FRAME_30FPS

/* Max exposure time is VTS - 8 */
#define OV2680_INTEGRATION_TIME_MARGIN

#define OV2680_DEFAULT_WIDTH
#define OV2680_DEFAULT_HEIGHT

/* For enum_frame_size() full-size + binned-/quarter-size */
#define OV2680_FRAME_SIZES

static const char * const ov2680_supply_name[] =;

#define OV2680_NUM_SUPPLIES

enum {};

static const unsigned long ov2680_xvclk_freqs[] =;

static const u8 ov2680_pll_multipliers[] =;

struct ov2680_ctrls {};

struct ov2680_mode {};

struct ov2680_dev {};

static const struct v4l2_rect ov2680_default_crop =;

static const char * const test_pattern_menu[] =;

static const int ov2680_hv_flip_bayer_order[] =;

static const struct reg_sequence ov2680_global_setting[] =;

static struct ov2680_dev *to_ov2680_dev(struct v4l2_subdev *sd)
{}

static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl)
{}

static void ov2680_power_up(struct ov2680_dev *sensor)
{}

static void ov2680_power_down(struct ov2680_dev *sensor)
{}

static void ov2680_set_bayer_order(struct ov2680_dev *sensor,
				   struct v4l2_mbus_framefmt *fmt)
{}

static struct v4l2_mbus_framefmt *
__ov2680_get_pad_format(struct ov2680_dev *sensor,
			struct v4l2_subdev_state *state,
			unsigned int pad,
			enum v4l2_subdev_format_whence which)
{}

static struct v4l2_rect *
__ov2680_get_pad_crop(struct ov2680_dev *sensor,
		      struct v4l2_subdev_state *state,
		      unsigned int pad,
		      enum v4l2_subdev_format_whence which)
{}

static void ov2680_fill_format(struct ov2680_dev *sensor,
			       struct v4l2_mbus_framefmt *fmt,
			       unsigned int width, unsigned int height)
{}

static void ov2680_calc_mode(struct ov2680_dev *sensor)
{}

static int ov2680_set_mode(struct ov2680_dev *sensor)
{}

static int ov2680_set_vflip(struct ov2680_dev *sensor, s32 val)
{}

static int ov2680_set_hflip(struct ov2680_dev *sensor, s32 val)
{}

static int ov2680_test_pattern_set(struct ov2680_dev *sensor, int value)
{}

static int ov2680_gain_set(struct ov2680_dev *sensor, u32 gain)
{}

static int ov2680_exposure_set(struct ov2680_dev *sensor, u32 exp)
{}

static int ov2680_exposure_update_range(struct ov2680_dev *sensor)
{}

static int ov2680_stream_enable(struct ov2680_dev *sensor)
{}

static int ov2680_stream_disable(struct ov2680_dev *sensor)
{}

static int ov2680_power_off(struct ov2680_dev *sensor)
{}

static int ov2680_power_on(struct ov2680_dev *sensor)
{}

static int ov2680_get_frame_interval(struct v4l2_subdev *sd,
				     struct v4l2_subdev_state *sd_state,
				     struct v4l2_subdev_frame_interval *fi)
{}

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

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

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

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

static int ov2680_get_selection(struct v4l2_subdev *sd,
				struct v4l2_subdev_state *state,
				struct v4l2_subdev_selection *sel)
{}

static int ov2680_set_selection(struct v4l2_subdev *sd,
				struct v4l2_subdev_state *state,
				struct v4l2_subdev_selection *sel)
{}

static int ov2680_init_state(struct v4l2_subdev *sd,
			     struct v4l2_subdev_state *sd_state)
{}

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

static bool ov2680_valid_frame_size(struct v4l2_subdev *sd,
				    struct v4l2_subdev_state *sd_state,
				    struct v4l2_subdev_frame_interval_enum *fie)
{}

static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,
			      struct v4l2_subdev_state *sd_state,
			      struct v4l2_subdev_frame_interval_enum *fie)
{}

static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops ov2680_ctrl_ops =;

static const struct v4l2_subdev_video_ops ov2680_video_ops =;

static const struct v4l2_subdev_pad_ops ov2680_pad_ops =;

static const struct v4l2_subdev_ops ov2680_subdev_ops =;

static const struct v4l2_subdev_internal_ops ov2680_internal_ops =;

static int ov2680_mode_init(struct ov2680_dev *sensor)
{}

static int ov2680_v4l2_register(struct ov2680_dev *sensor)
{}

static int ov2680_get_regulators(struct ov2680_dev *sensor)
{}

static int ov2680_check_id(struct ov2680_dev *sensor)
{}

static int ov2680_parse_dt(struct ov2680_dev *sensor)
{}

static int ov2680_probe(struct i2c_client *client)
{}

static void ov2680_remove(struct i2c_client *client)
{}

static int ov2680_suspend(struct device *dev)
{}

static int ov2680_resume(struct device *dev)
{}

static DEFINE_RUNTIME_DEV_PM_OPS(ov2680_pm_ops, ov2680_suspend, ov2680_resume,
				 NULL);

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

static const struct acpi_device_id ov2680_acpi_ids[] =;
MODULE_DEVICE_TABLE(acpi, ov2680_acpi_ids);

static struct i2c_driver ov2680_i2c_driver =;
module_i2c_driver();

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