linux/drivers/media/i2c/imx208.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2021 Intel Corporation

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <linux/unaligned.h>

#define IMX208_REG_MODE_SELECT
#define IMX208_MODE_STANDBY
#define IMX208_MODE_STREAMING

/* Chip ID */
#define IMX208_REG_CHIP_ID
#define IMX208_CHIP_ID

/* V_TIMING internal */
#define IMX208_REG_VTS
#define IMX208_VTS_60FPS
#define IMX208_VTS_BINNING
#define IMX208_VTS_60FPS_MIN
#define IMX208_VTS_BINNING_MIN
#define IMX208_VTS_MAX

/* HBLANK control - read only */
#define IMX208_PPL_384MHZ
#define IMX208_PPL_96MHZ

/* Exposure control */
#define IMX208_REG_EXPOSURE
#define IMX208_EXPOSURE_MIN
#define IMX208_EXPOSURE_STEP
#define IMX208_EXPOSURE_DEFAULT
#define IMX208_EXPOSURE_MAX

/* Analog gain control */
#define IMX208_REG_ANALOG_GAIN
#define IMX208_ANA_GAIN_MIN
#define IMX208_ANA_GAIN_MAX
#define IMX208_ANA_GAIN_STEP
#define IMX208_ANA_GAIN_DEFAULT

/* Digital gain control */
#define IMX208_REG_GR_DIGITAL_GAIN
#define IMX208_REG_R_DIGITAL_GAIN
#define IMX208_REG_B_DIGITAL_GAIN
#define IMX208_REG_GB_DIGITAL_GAIN
#define IMX208_DIGITAL_GAIN_SHIFT

/* Orientation */
#define IMX208_REG_ORIENTATION_CONTROL

/* Test Pattern Control */
#define IMX208_REG_TEST_PATTERN_MODE
#define IMX208_TEST_PATTERN_DISABLE
#define IMX208_TEST_PATTERN_SOLID_COLOR
#define IMX208_TEST_PATTERN_COLOR_BARS
#define IMX208_TEST_PATTERN_GREY_COLOR
#define IMX208_TEST_PATTERN_PN9
#define IMX208_TEST_PATTERN_FIX_1
#define IMX208_TEST_PATTERN_FIX_2
#define IMX208_TEST_PATTERN_FIX_3
#define IMX208_TEST_PATTERN_FIX_4
#define IMX208_TEST_PATTERN_FIX_5
#define IMX208_TEST_PATTERN_FIX_6

/* OTP Access */
#define IMX208_OTP_BASE
#define IMX208_OTP_SIZE

struct imx208_reg {};

struct imx208_reg_list {};

/* Link frequency config */
struct imx208_link_freq_config {};

/* Mode : resolution and related config&values */
struct imx208_mode {};

static const struct imx208_reg pll_ctrl_reg[] =;

static const struct imx208_reg mode_1936x1096_60fps_regs[] =;

static const struct imx208_reg mode_968_548_60fps_regs[] =;

static const s64 imx208_discrete_digital_gain[] =;

static const char * const imx208_test_pattern_menu[] =;

static const int imx208_test_pattern_val[] =;

/* Configurations for supported link frequencies */
#define IMX208_MHZ
#define IMX208_LINK_FREQ_384MHZ
#define IMX208_LINK_FREQ_96MHZ

#define IMX208_DATA_RATE_DOUBLE
#define IMX208_NUM_OF_LANES
#define IMX208_PIXEL_BITS

enum {};

/*
 * pixel_rate = link_freq * data-rate * nr_of_lanes / bits_per_sample
 * data rate => double data rate; number of lanes => 2; bits per pixel => 10
 */
static u64 link_freq_to_pixel_rate(u64 f)
{}

/* Menu items for LINK_FREQ V4L2 control */
static const s64 link_freq_menu_items[] =;

/* Link frequency configs */
static const struct imx208_link_freq_config link_freq_configs[] =;

/* Mode configs */
static const struct imx208_mode supported_modes[] =;

struct imx208 {};

static inline struct imx208 *to_imx208(struct v4l2_subdev *_sd)
{}

/* Get bayer order based on flip setting. */
static u32 imx208_get_format_code(struct imx208 *imx208)
{}

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

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

/* Write a list of registers */
static int imx208_write_regs(struct imx208 *imx208,
			     const struct imx208_reg *regs, u32 len)
{}

/* Open sub-device */
static int imx208_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{}

static int imx208_update_digital_gain(struct imx208 *imx208, u32 len, u32 val)
{}

static int imx208_set_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops imx208_ctrl_ops =;

static const struct v4l2_ctrl_config imx208_digital_gain_control =;

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

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

static void imx208_mode_to_pad_format(struct imx208 *imx208,
				      const struct imx208_mode *mode,
				      struct v4l2_subdev_format *fmt)
{}

static int __imx208_get_pad_format(struct imx208 *imx208,
				   struct v4l2_subdev_state *sd_state,
				   struct v4l2_subdev_format *fmt)
{}

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

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

static int imx208_identify_module(struct imx208 *imx208)
{}

/* Start streaming */
static int imx208_start_streaming(struct imx208 *imx208)
{}

/* Stop streaming */
static int imx208_stop_streaming(struct imx208 *imx208)
{}

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

/* Verify chip ID */
static const struct v4l2_subdev_video_ops imx208_video_ops =;

static const struct v4l2_subdev_pad_ops imx208_pad_ops =;

static const struct v4l2_subdev_ops imx208_subdev_ops =;

static const struct v4l2_subdev_internal_ops imx208_internal_ops =;

static int imx208_read_otp(struct imx208 *imx208)
{}

static ssize_t otp_read(struct file *filp, struct kobject *kobj,
			struct bin_attribute *bin_attr,
			char *buf, loff_t off, size_t count)
{}

static const BIN_ATTR_RO(otp, IMX208_OTP_SIZE);

/* Initialize control handlers */
static int imx208_init_controls(struct imx208 *imx208)
{}

static void imx208_free_controls(struct imx208 *imx208)
{}

static int imx208_probe(struct i2c_client *client)
{}

static void imx208_remove(struct i2c_client *client)
{}

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

MODULE_DEVICE_TABLE(acpi, imx208_acpi_ids);
#endif

static struct i2c_driver imx208_i2c_driver =;

module_i2c_driver();

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