linux/drivers/media/i2c/ov02a10.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 MediaTek Inc.

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.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/units.h>
#include <media/media-entity.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>

#define OV02A10_ID
#define OV02A10_ID_MASK

#define OV02A10_REG_CHIP_ID

/* Bit[1] vertical upside down */
/* Bit[0] horizontal mirror */
#define REG_MIRROR_FLIP_CONTROL

/* Orientation */
#define REG_MIRROR_FLIP_ENABLE

/* Bit[2:0] MIPI transmission speed select */
#define TX_SPEED_AREA_SEL
#define OV02A10_MIPI_TX_SPEED_DEFAULT

#define REG_PAGE_SWITCH
#define REG_GLOBAL_EFFECTIVE
#define REG_ENABLE

#define REG_SC_CTRL_MODE
#define SC_CTRL_MODE_STANDBY
#define SC_CTRL_MODE_STREAMING

/* Exposure control */
#define OV02A10_EXP_SHIFT
#define OV02A10_REG_EXPOSURE_H
#define OV02A10_REG_EXPOSURE_L
#define OV02A10_EXPOSURE_MIN
#define OV02A10_EXPOSURE_MAX_MARGIN
#define OV02A10_EXPOSURE_STEP

/* Vblanking control */
#define OV02A10_VTS_SHIFT
#define OV02A10_REG_VTS_H
#define OV02A10_REG_VTS_L
#define OV02A10_VTS_MAX
#define OV02A10_BASE_LINES

/* Analog gain control */
#define OV02A10_REG_GAIN
#define OV02A10_GAIN_MIN
#define OV02A10_GAIN_MAX
#define OV02A10_GAIN_STEP
#define OV02A10_GAIN_DEFAULT

/* Test pattern control */
#define OV02A10_REG_TEST_PATTERN

#define OV02A10_LINK_FREQ_390MHZ
#define OV02A10_ECLK_FREQ

/* Number of lanes supported by this driver */
#define OV02A10_DATA_LANES

/* Bits per sample of sensor output */
#define OV02A10_BITS_PER_SAMPLE

static const char * const ov02a10_supply_names[] =;

struct ov02a10_reg {};

struct ov02a10_reg_list {};

struct ov02a10_mode {};

struct ov02a10 {};

static inline struct ov02a10 *to_ov02a10(struct v4l2_subdev *sd)
{}

/*
 * eclk 24Mhz
 * pclk 39Mhz
 * linelength 934(0x3a6)
 * framelength 1390(0x56E)
 * grabwindow_width 1600
 * grabwindow_height 1200
 * max_framerate 30fps
 * mipi_datarate per lane 780Mbps
 */
static const struct ov02a10_reg ov02a10_1600x1200_regs[] =;

static const char * const ov02a10_test_pattern_menu[] =;

static const s64 link_freq_menu_items[] =;

static u64 to_pixel_rate(u32 f_index)
{}

static const struct ov02a10_mode supported_modes[] =;

static int ov02a10_write_array(struct ov02a10 *ov02a10,
			       const struct ov02a10_reg_list *r_list)
{}

static void ov02a10_fill_fmt(const struct ov02a10_mode *mode,
			     struct v4l2_mbus_framefmt *fmt)
{}

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

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

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

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

static int ov02a10_check_sensor_id(struct ov02a10 *ov02a10)
{}

static int ov02a10_power_on(struct device *dev)
{}

static int ov02a10_power_off(struct device *dev)
{}

static int __ov02a10_start_stream(struct ov02a10 *ov02a10)
{}

static int __ov02a10_stop_stream(struct ov02a10 *ov02a10)
{}

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

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

static const struct dev_pm_ops ov02a10_pm_ops =;

static int ov02a10_set_exposure(struct ov02a10 *ov02a10, int val)
{}

static int ov02a10_set_gain(struct ov02a10 *ov02a10, int val)
{}

static int ov02a10_set_vblank(struct ov02a10 *ov02a10, int val)
{}

static int ov02a10_set_test_pattern(struct ov02a10 *ov02a10, int pattern)
{}

static int ov02a10_set_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_subdev_video_ops ov02a10_video_ops =;

static const struct v4l2_subdev_pad_ops ov02a10_pad_ops =;

static const struct v4l2_subdev_ops ov02a10_subdev_ops =;

static const struct v4l2_subdev_internal_ops ov02a10_internal_ops =;

static const struct media_entity_operations ov02a10_subdev_entity_ops =;

static const struct v4l2_ctrl_ops ov02a10_ctrl_ops =;

static int ov02a10_initialize_controls(struct ov02a10 *ov02a10)
{}

static int ov02a10_check_hwcfg(struct device *dev, struct ov02a10 *ov02a10)
{}

static int ov02a10_probe(struct i2c_client *client)
{}

static void ov02a10_remove(struct i2c_client *client)
{}

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

static struct i2c_driver ov02a10_i2c_driver =;
module_i2c_driver();

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