linux/drivers/media/i2c/ov64a40.c

// SPDX-License-Identifier: GPL-2.0
/*
 * V4L2 sensor driver for OmniVision OV64A40
 *
 * Copyright (C) 2023 Ideas On Board Oy
 * Copyright (C) 2023 Arducam
 */

#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/pm_runtime.h>
#include <linux/regulator/consumer.h>

#include <media/v4l2-cci.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-mediabus.h>
#include <media/v4l2-subdev.h>

#define OV64A40_XCLK_FREQ

#define OV64A40_NATIVE_WIDTH
#define OV64A40_NATIVE_HEIGHT
#define OV64A40_PIXEL_ARRAY_TOP
#define OV64A40_PIXEL_ARRAY_LEFT
#define OV64A40_PIXEL_ARRAY_WIDTH
#define OV64A40_PIXEL_ARRAY_HEIGHT

#define OV64A40_PIXEL_RATE

#define OV64A40_LINK_FREQ_360M
#define OV64A40_LINK_FREQ_456M

#define OV64A40_PLL1_PRE_DIV0
#define OV64A40_PLL1_PRE_DIV
#define OV64A40_PLL1_MULTIPLIER
#define OV64A40_PLL1_M_DIV
#define OV64A40_PLL2_SEL_BAK_SA1
#define OV64A40_PLL2_PRE_DIV
#define OV64A40_PLL2_MULTIPLIER
#define OV64A40_PLL2_PRE_DIV0
#define OV64A40_PLL2_DIVDAC
#define OV64A40_PLL2_DIVSP
#define OV64A40_PLL2_DACPREDIV

/* TODO: validate vblank_min, it's not characterized in the datasheet. */
#define OV64A40_VBLANK_MIN
#define OV64A40_VTS_MAX

#define OV64A40_REG_MEC_LONG_EXPO
#define OV64A40_EXPOSURE_MIN
#define OV64A40_EXPOSURE_MARGIN

#define OV64A40_REG_MEC_LONG_GAIN
#define OV64A40_ANA_GAIN_MIN
#define OV64A40_ANA_GAIN_MAX
#define OV64A40_ANA_GAIN_DEFAULT

#define OV64A40_REG_TIMING_CTRL0
#define OV64A40_REG_TIMING_CTRL2
#define OV64A40_REG_TIMING_CTRL4
#define OV64A40_REG_TIMING_CTRL6
#define OV64A40_REG_TIMING_CTRL8
#define OV64A40_REG_TIMING_CTRLA
#define OV64A40_REG_TIMING_CTRLC
#define OV64A40_REG_TIMING_CTRLE
#define OV64A40_REG_TIMING_CTRL10
#define OV64A40_REG_TIMING_CTRL12

/*
 * Careful: a typo in the datasheet calls this register
 * OV64A40_REG_TIMING_CTRL20.
 */
#define OV64A40_REG_TIMING_CTRL14
#define OV64A40_REG_TIMING_CTRL15
#define OV64A40_ODD_INC_SHIFT
#define OV64A40_SKIPPING_CONFIG(_odd, _even)

#define OV64A40_REG_TIMING_CTRL_20
#define OV64A40_TIMING_CTRL_20_VFLIP
#define OV64A40_TIMING_CTRL_20_VBIN

#define OV64A40_REG_TIMING_CTRL_21
#define OV64A40_TIMING_CTRL_21_HBIN
#define OV64A40_TIMING_CTRL_21_HFLIP
#define OV64A40_TIMING_CTRL_21_DSPEED
#define OV64A40_TIMING_CTRL_21_HBIN_CONF

#define OV64A40_REG_TIMINGS_VTS_HIGH
#define OV64A40_REG_TIMINGS_VTS_MID
#define OV64A40_REG_TIMINGS_VTS_LOW

/* The test pattern control is weirdly named PRE_ISP_2325_D2V2_TOP_1 in TRM. */
#define OV64A40_REG_TEST_PATTERN
#define OV64A40_TEST_PATTERN_DISABLED
#define OV64A40_TEST_PATTERN_TYPE1
#define OV64A40_TEST_PATTERN_TYPE2
#define OV64A40_TEST_PATTERN_TYPE3
#define OV64A40_TEST_PATTERN_TYPE4

#define OV64A40_REG_CHIP_ID
#define OV64A40_CHIP_ID

#define OV64A40_REG_SMIA
#define OV64A40_REG_SMIA_STREAMING

enum ov64a40_link_freq_ids {};

static const char * const ov64a40_supply_names[] =;

static const char * const ov64a40_test_pattern_menu[] =;

static const int ov64a40_test_pattern_val[] =;

static const unsigned int ov64a40_mbus_codes[] =;

static const struct cci_reg_sequence ov64a40_init[] =;

static const struct cci_reg_sequence ov64a40_9248x6944[] =;

static const struct cci_reg_sequence ov64a40_8000x6000[] =;

static const struct cci_reg_sequence ov64a40_4624_3472[] =;

static const struct cci_reg_sequence ov64a40_3840x2160[] =;

static const struct cci_reg_sequence ov64a40_2312_1736[] =;

static const struct cci_reg_sequence ov64a40_1920x1080[] =;

/* 456MHz MIPI link frequency with 24MHz input clock. */
static const struct cci_reg_sequence ov64a40_pll_config[] =;

struct ov64a40_reglist {};

struct ov64a40_subsampling {};

static struct ov64a40_mode {} ov64a40_modes[] =;

struct ov64a40 {};

static inline struct ov64a40 *sd_to_ov64a40(struct v4l2_subdev *sd)
{}

static const struct ov64a40_timings *
ov64a40_get_timings(struct ov64a40 *ov64a40, unsigned int link_freq_index)
{}

static int ov64a40_program_geometry(struct ov64a40 *ov64a40)
{}

static int ov64a40_program_subsampling(struct ov64a40 *ov64a40)
{}

static int ov64a40_start_streaming(struct ov64a40 *ov64a40,
				   struct v4l2_subdev_state *state)
{}

static int ov64a40_stop_streaming(struct ov64a40 *ov64a40,
				  struct v4l2_subdev_state *state)
{}

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

static const struct v4l2_subdev_video_ops ov64a40_video_ops =;

static u32 ov64a40_mbus_code(struct ov64a40 *ov64a40)
{}

static void ov64a40_update_pad_fmt(struct ov64a40 *ov64a40,
				   struct ov64a40_mode *mode,
				   struct v4l2_mbus_framefmt *fmt)
{}

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

static int ov64a40_enum_mbus_code(struct v4l2_subdev *sd,
				  struct v4l2_subdev_state *state,
				  struct v4l2_subdev_mbus_code_enum *code)
{}

static int ov64a40_enum_frame_size(struct v4l2_subdev *sd,
				   struct v4l2_subdev_state *state,
				   struct v4l2_subdev_frame_size_enum *fse)
{}

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

static int ov64a40_set_format(struct v4l2_subdev *sd,
			      struct v4l2_subdev_state *state,
			      struct v4l2_subdev_format *fmt)
{}

static const struct v4l2_subdev_pad_ops ov64a40_pad_ops =;

static const struct v4l2_subdev_core_ops ov64a40_core_ops =;

static const struct v4l2_subdev_ops ov64a40_subdev_ops =;

static const struct v4l2_subdev_internal_ops ov64a40_internal_ops =;

static int ov64a40_power_on(struct device *dev)
{}

static int ov64a40_power_off(struct device *dev)
{}

static int ov64a40_link_freq_config(struct ov64a40 *ov64a40, int link_freq_id)
{}

static int ov64a40_set_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops ov64a40_ctrl_ops =;

static int ov64a40_init_controls(struct ov64a40 *ov64a40)
{}

static int ov64a40_identify(struct ov64a40 *ov64a40)
{}

static int ov64a40_parse_dt(struct ov64a40 *ov64a40)
{}

static int ov64a40_get_regulators(struct ov64a40 *ov64a40)
{}

static int ov64a40_probe(struct i2c_client *client)
{}

static void ov64a40_remove(struct i2c_client *client)
{}

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

static const struct dev_pm_ops ov64a40_pm_ops =;

static struct i2c_driver ov64a40_i2c_driver =;

module_i2c_driver();

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