linux/drivers/media/i2c/ov5648.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2020 Bootlin
 * Author: Paul Kocialkowski <[email protected]>
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/videodev2.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-mediabus.h>

/* Clock rate */

#define OV5648_XVCLK_RATE

/* Register definitions */

/* System */

#define OV5648_SW_STANDBY_REG
#define OV5648_SW_STANDBY_STREAM_ON

#define OV5648_SW_RESET_REG
#define OV5648_SW_RESET_RESET

#define OV5648_PAD_OEN0_REG
#define OV5648_PAD_OEN1_REG
#define OV5648_PAD_OEN2_REG
#define OV5648_PAD_OUT0_REG
#define OV5648_PAD_OUT1_REG

#define OV5648_CHIP_ID_H_REG
#define OV5648_CHIP_ID_H_VALUE
#define OV5648_CHIP_ID_L_REG
#define OV5648_CHIP_ID_L_VALUE

#define OV5648_PAD_OUT2_REG
#define OV5648_PAD_SEL0_REG
#define OV5648_PAD_SEL1_REG
#define OV5648_PAD_SEL2_REG
#define OV5648_PAD_PK_REG
#define OV5648_PAD_PK_PD_DATO_EN
#define OV5648_PAD_PK_DRIVE_STRENGTH_1X
#define OV5648_PAD_PK_DRIVE_STRENGTH_2X
#define OV5648_PAD_PK_FREX_N

#define OV5648_A_PWC_PK_O0_REG
#define OV5648_A_PWC_PK_O0_BP_REGULATOR_N
#define OV5648_A_PWC_PK_O1_REG

#define OV5648_MIPI_PHY0_REG
#define OV5648_MIPI_PHY1_REG
#define OV5648_MIPI_SC_CTRL0_REG
#define OV5648_MIPI_SC_CTRL0_MIPI_LANES(v)
#define OV5648_MIPI_SC_CTRL0_PHY_HS_TX_PD
#define OV5648_MIPI_SC_CTRL0_PHY_LP_RX_PD
#define OV5648_MIPI_SC_CTRL0_MIPI_EN
#define OV5648_MIPI_SC_CTRL0_MIPI_SUSP
#define OV5648_MIPI_SC_CTRL0_LANE_DIS_OP
#define OV5648_MIPI_SC_CTRL1_REG
#define OV5648_MISC_CTRL0_REG
#define OV5648_MIPI_SC_CTRL2_REG
#define OV5648_SUB_ID_REG

#define OV5648_PLL_CTRL0_REG
#define OV5648_PLL_CTRL0_PLL_CHARGE_PUMP(v)
#define OV5648_PLL_CTRL0_BITS(v)
#define OV5648_PLL_CTRL1_REG
#define OV5648_PLL_CTRL1_SYS_DIV(v)
#define OV5648_PLL_CTRL1_MIPI_DIV(v)
#define OV5648_PLL_MUL_REG
#define OV5648_PLL_MUL(v)
#define OV5648_PLL_DIV_REG
#define OV5648_PLL_DIV_ROOT_DIV(v)
#define OV5648_PLL_DIV_PLL_PRE_DIV(v)
#define OV5648_PLL_DEBUG_REG
#define OV5648_PLL_BYPASS_REG

#define OV5648_PLLS_BYPASS_REG
#define OV5648_PLLS_MUL_REG
#define OV5648_PLLS_MUL(v)
#define OV5648_PLLS_CTRL_REG
#define OV5648_PLLS_CTRL_PLL_CHARGE_PUMP(v)
#define OV5648_PLLS_CTRL_SYS_DIV(v)
#define OV5648_PLLS_DIV_REG
#define OV5648_PLLS_DIV_PLLS_PRE_DIV(v)
#define OV5648_PLLS_DIV_PLLS_DIV_R(v)
#define OV5648_PLLS_DIV_PLLS_SEL_DIV(v)

#define OV5648_SRB_CTRL_REG
#define OV5648_SRB_CTRL_SCLK_DIV(v)
#define OV5648_SRB_CTRL_RESET_ARBITER_EN
#define OV5648_SRB_CTRL_SCLK_ARBITER_EN

/* Group Hold */

#define OV5648_GROUP_ADR0_REG
#define OV5648_GROUP_ADR1_REG
#define OV5648_GROUP_ADR2_REG
#define OV5648_GROUP_ADR3_REG
#define OV5648_GROUP_LEN0_REG
#define OV5648_GROUP_LEN1_REG
#define OV5648_GROUP_LEN2_REG
#define OV5648_GROUP_LEN3_REG
#define OV5648_GROUP_ACCESS_REG

/* Exposure/gain/banding */

#define OV5648_EXPOSURE_CTRL_HH_REG
#define OV5648_EXPOSURE_CTRL_HH(v)
#define OV5648_EXPOSURE_CTRL_HH_VALUE(v)
#define OV5648_EXPOSURE_CTRL_H_REG
#define OV5648_EXPOSURE_CTRL_H(v)
#define OV5648_EXPOSURE_CTRL_H_VALUE(v)
#define OV5648_EXPOSURE_CTRL_L_REG
#define OV5648_EXPOSURE_CTRL_L(v)
#define OV5648_EXPOSURE_CTRL_L_VALUE(v)
#define OV5648_MANUAL_CTRL_REG
#define OV5648_MANUAL_CTRL_FRAME_DELAY(v)
#define OV5648_MANUAL_CTRL_AGC_MANUAL_EN
#define OV5648_MANUAL_CTRL_AEC_MANUAL_EN
#define OV5648_GAIN_CTRL_H_REG
#define OV5648_GAIN_CTRL_H(v)
#define OV5648_GAIN_CTRL_H_VALUE(v)
#define OV5648_GAIN_CTRL_L_REG
#define OV5648_GAIN_CTRL_L(v)
#define OV5648_GAIN_CTRL_L_VALUE(v)

#define OV5648_ANALOG_CTRL0_REG_BASE
#define OV5648_ANALOG_CTRL1_REG_BASE

#define OV5648_AEC_CTRL0_REG
#define OV5648_AEC_CTRL0_DEBUG
#define OV5648_AEC_CTRL0_DEBAND_EN
#define OV5648_AEC_CTRL0_DEBAND_LOW_LIMIT_EN
#define OV5648_AEC_CTRL0_START_SEL_EN
#define OV5648_AEC_CTRL0_NIGHT_MODE_EN
#define OV5648_AEC_CTRL0_FREEZE_EN
#define OV5648_EXPOSURE_MIN_REG
#define OV5648_EXPOSURE_MAX_60_H_REG
#define OV5648_EXPOSURE_MAX_60_L_REG
#define OV5648_AEC_CTRL5_REG
#define OV5648_AEC_CTRL6_REG
#define OV5648_AEC_CTRL7_REG
#define OV5648_BANDING_STEP_50_H_REG
#define OV5648_BANDING_STEP_50_L_REG
#define OV5648_BANDING_STEP_60_H_REG
#define OV5648_BANDING_STEP_60_L_REG
#define OV5648_AEC_CTRLC_REG
#define OV5648_BANDING_MAX_60_REG
#define OV5648_BANDING_MAX_50_REG
#define OV5648_WPT_REG
#define OV5648_BPT_REG
#define OV5648_VPT_HIGH_REG
#define OV5648_AVG_MANUAL_REG
#define OV5648_PRE_GAIN_REG
#define OV5648_EXPOSURE_MAX_50_H_REG
#define OV5648_EXPOSURE_MAX_50_L_REG
#define OV5648_GAIN_BASE_NIGHT_REG
#define OV5648_AEC_GAIN_CEILING_H_REG
#define OV5648_AEC_GAIN_CEILING_L_REG
#define OV5648_DIFF_MAX_REG
#define OV5648_WPT2_REG
#define OV5648_LED_ADD_ROW_H_REG
#define OV5648_LED_ADD_ROW_L_REG
#define OV5648_BPT2_REG
#define OV5648_VPT_LOW_REG
#define OV5648_AEC_CTRL20_REG
#define OV5648_AEC_CTRL21_REG

#define OV5648_AVG_START_X_H_REG
#define OV5648_AVG_START_X_L_REG
#define OV5648_AVG_START_Y_H_REG
#define OV5648_AVG_START_Y_L_REG
#define OV5648_AVG_WINDOW_X_H_REG
#define OV5648_AVG_WINDOW_X_L_REG
#define OV5648_AVG_WINDOW_Y_H_REG
#define OV5648_AVG_WINDOW_Y_L_REG
#define OV5648_AVG_WEIGHT00_REG
#define OV5648_AVG_WEIGHT01_REG
#define OV5648_AVG_WEIGHT02_REG
#define OV5648_AVG_WEIGHT03_REG
#define OV5648_AVG_WEIGHT04_REG
#define OV5648_AVG_WEIGHT05_REG
#define OV5648_AVG_WEIGHT06_REG
#define OV5648_AVG_WEIGHT07_REG
#define OV5648_AVG_CTRL10_REG
#define OV5648_AVG_WEIGHT_SUM_REG
#define OV5648_AVG_READOUT_REG

#define OV5648_DIG_CTRL0_REG
#define OV5648_DIG_COMP_MAN_H_REG
#define OV5648_DIG_COMP_MAN_L_REG

#define OV5648_GAINC_MAN_H_REG
#define OV5648_GAINC_MAN_L_REG
#define OV5648_GAINC_DGC_MAN_H_REG
#define OV5648_GAINC_DGC_MAN_L_REG
#define OV5648_GAINC_CTRL0_REG

#define OV5648_GAINF_ANA_NUM_REG
#define OV5648_GAINF_DIG_GAIN_REG

/* Timing */

#define OV5648_CROP_START_X_H_REG
#define OV5648_CROP_START_X_H(v)
#define OV5648_CROP_START_X_L_REG
#define OV5648_CROP_START_X_L(v)
#define OV5648_CROP_START_Y_H_REG
#define OV5648_CROP_START_Y_H(v)
#define OV5648_CROP_START_Y_L_REG
#define OV5648_CROP_START_Y_L(v)
#define OV5648_CROP_END_X_H_REG
#define OV5648_CROP_END_X_H(v)
#define OV5648_CROP_END_X_L_REG
#define OV5648_CROP_END_X_L(v)
#define OV5648_CROP_END_Y_H_REG
#define OV5648_CROP_END_Y_H(v)
#define OV5648_CROP_END_Y_L_REG
#define OV5648_CROP_END_Y_L(v)
#define OV5648_OUTPUT_SIZE_X_H_REG
#define OV5648_OUTPUT_SIZE_X_H(v)
#define OV5648_OUTPUT_SIZE_X_L_REG
#define OV5648_OUTPUT_SIZE_X_L(v)
#define OV5648_OUTPUT_SIZE_Y_H_REG
#define OV5648_OUTPUT_SIZE_Y_H(v)
#define OV5648_OUTPUT_SIZE_Y_L_REG
#define OV5648_OUTPUT_SIZE_Y_L(v)
#define OV5648_HTS_H_REG
#define OV5648_HTS_H(v)
#define OV5648_HTS_L_REG
#define OV5648_HTS_L(v)
#define OV5648_VTS_H_REG
#define OV5648_VTS_H(v)
#define OV5648_VTS_L_REG
#define OV5648_VTS_L(v)
#define OV5648_OFFSET_X_H_REG
#define OV5648_OFFSET_X_H(v)
#define OV5648_OFFSET_X_L_REG
#define OV5648_OFFSET_X_L(v)
#define OV5648_OFFSET_Y_H_REG
#define OV5648_OFFSET_Y_H(v)
#define OV5648_OFFSET_Y_L_REG
#define OV5648_OFFSET_Y_L(v)
#define OV5648_SUB_INC_X_REG
#define OV5648_SUB_INC_X_ODD(v)
#define OV5648_SUB_INC_X_EVEN(v)
#define OV5648_SUB_INC_Y_REG
#define OV5648_SUB_INC_Y_ODD(v)
#define OV5648_SUB_INC_Y_EVEN(v)
#define OV5648_HSYNCST_H_REG
#define OV5648_HSYNCST_H(v)
#define OV5648_HSYNCST_L_REG
#define OV5648_HSYNCST_L(v)
#define OV5648_HSYNCW_H_REG
#define OV5648_HSYNCW_H(v)
#define OV5648_HSYNCW_L_REG
#define OV5648_HSYNCW_L(v)

#define OV5648_TC20_REG
#define OV5648_TC20_DEBUG
#define OV5648_TC20_FLIP_VERT_ISP_EN
#define OV5648_TC20_FLIP_VERT_SENSOR_EN
#define OV5648_TC20_BINNING_VERT_EN
#define OV5648_TC21_REG
#define OV5648_TC21_FLIP_HORZ_ISP_EN
#define OV5648_TC21_FLIP_HORZ_SENSOR_EN
#define OV5648_TC21_BINNING_HORZ_EN

/* Strobe/exposure */

#define OV5648_STROBE_REG
#define OV5648_FREX_EXP_HH_REG
#define OV5648_SHUTTER_DLY_H_REG
#define OV5648_SHUTTER_DLY_L_REG
#define OV5648_FREX_EXP_H_REG
#define OV5648_FREX_EXP_L_REG
#define OV5648_FREX_CTRL_REG
#define OV5648_FREX_MODE_SEL_REG
#define OV5648_FREX_MODE_SEL_FREX_SA1
#define OV5648_FREX_MODE_SEL_FX1_FM_EN
#define OV5648_FREX_MODE_SEL_FREX_INV
#define OV5648_FREX_MODE_SEL_MODE1
#define OV5648_FREX_MODE_SEL_MODE2
#define OV5648_FREX_MODE_SEL_ROLLING
#define OV5648_FREX_EXP_REQ_REG
#define OV5648_FREX_SHUTTER_DLY_REG
#define OV5648_FREX_RST_LEN_REG
#define OV5648_STROBE_WIDTH_HH_REG
#define OV5648_STROBE_WIDTH_H_REG

/* OTP */

#define OV5648_OTP_DATA_REG_BASE
#define OV5648_OTP_PROGRAM_CTRL_REG
#define OV5648_OTP_LOAD_CTRL_REG

/* PSRAM */

#define OV5648_PSRAM_CTRL1_REG
#define OV5648_PSRAM_CTRLF_REG

/* Black Level */

#define OV5648_BLC_CTRL0_REG
#define OV5648_BLC_CTRL1_REG
#define OV5648_BLC_CTRL1_START_LINE(v)
#define OV5648_BLC_CTRL2_REG
#define OV5648_BLC_CTRL2_AUTO_EN
#define OV5648_BLC_CTRL2_RESET_FRAME_NUM(v)
#define OV5648_BLC_CTRL3_REG
#define OV5648_BLC_LINE_NUM_REG
#define OV5648_BLC_LINE_NUM(v)
#define OV5648_BLC_CTRL5_REG
#define OV5648_BLC_CTRL5_UPDATE_EN
#define OV5648_BLC_LEVEL_REG

/* Frame */

#define OV5648_FRAME_CTRL_REG
#define OV5648_FRAME_ON_NUM_REG
#define OV5648_FRAME_OFF_NUM_REG

/* MIPI CSI-2 */

#define OV5648_MIPI_CTRL0_REG
#define OV5648_MIPI_CTRL0_CLK_LANE_AUTOGATE
#define OV5648_MIPI_CTRL0_LANE_SYNC_EN
#define OV5648_MIPI_CTRL0_LANE_SELECT_LANE1
#define OV5648_MIPI_CTRL0_LANE_SELECT_LANE2
#define OV5648_MIPI_CTRL0_IDLE_LP00
#define OV5648_MIPI_CTRL0_IDLE_LP11

#define OV5648_MIPI_CTRL1_REG
#define OV5648_MIPI_CTRL2_REG
#define OV5648_MIPI_CTRL3_REG
#define OV5648_MIPI_CTRL4_REG
#define OV5648_MIPI_CTRL5_REG
#define OV5648_MIPI_MAX_FRAME_COUNT_H_REG
#define OV5648_MIPI_MAX_FRAME_COUNT_L_REG
#define OV5648_MIPI_CTRL14_REG
#define OV5648_MIPI_DT_SPKT_REG
#define OV5648_MIPI_HS_ZERO_MIN_H_REG
#define OV5648_MIPI_HS_ZERO_MIN_L_REG
#define OV5648_MIPI_HS_TRAIN_MIN_H_REG
#define OV5648_MIPI_HS_TRAIN_MIN_L_REG
#define OV5648_MIPI_CLK_ZERO_MIN_H_REG
#define OV5648_MIPI_CLK_ZERO_MIN_L_REG
#define OV5648_MIPI_CLK_PREPARE_MIN_H_REG
#define OV5648_MIPI_CLK_PREPARE_MIN_L_REG
#define OV5648_MIPI_CLK_POST_MIN_H_REG
#define OV5648_MIPI_CLK_POST_MIN_L_REG
#define OV5648_MIPI_CLK_TRAIL_MIN_H_REG
#define OV5648_MIPI_CLK_TRAIL_MIN_L_REG
#define OV5648_MIPI_LPX_P_MIN_H_REG
#define OV5648_MIPI_LPX_P_MIN_L_REG
#define OV5648_MIPI_HS_PREPARE_MIN_H_REG
#define OV5648_MIPI_HS_PREPARE_MIN_L_REG
#define OV5648_MIPI_HS_EXIT_MIN_H_REG
#define OV5648_MIPI_HS_EXIT_MIN_L_REG
#define OV5648_MIPI_HS_ZERO_MIN_UI_REG
#define OV5648_MIPI_HS_TRAIL_MIN_UI_REG
#define OV5648_MIPI_CLK_ZERO_MIN_UI_REG
#define OV5648_MIPI_CLK_PREPARE_MIN_UI_REG
#define OV5648_MIPI_CLK_POST_MIN_UI_REG
#define OV5648_MIPI_CLK_TRAIL_MIN_UI_REG
#define OV5648_MIPI_LPX_P_MIN_UI_REG
#define OV5648_MIPI_HS_PREPARE_MIN_UI_REG
#define OV5648_MIPI_HS_EXIT_MIN_UI_REG
#define OV5648_MIPI_REG_MIN_H_REG
#define OV5648_MIPI_REG_MIN_L_REG
#define OV5648_MIPI_REG_MAX_H_REG
#define OV5648_MIPI_REG_MAX_L_REG
#define OV5648_MIPI_PCLK_PERIOD_REG
#define OV5648_MIPI_WKUP_DLY_REG
#define OV5648_MIPI_LP_GPIO_REG
#define OV5648_MIPI_SNR_PCLK_DIV_REG

/* ISP */

#define OV5648_ISP_CTRL0_REG
#define OV5648_ISP_CTRL0_BLACK_CORRECT_EN
#define OV5648_ISP_CTRL0_WHITE_CORRECT_EN
#define OV5648_ISP_CTRL1_REG
#define OV5648_ISP_CTRL1_AWB_EN
#define OV5648_ISP_CTRL2_REG
#define OV5648_ISP_CTRL2_WIN_EN
#define OV5648_ISP_CTRL2_OTP_EN
#define OV5648_ISP_CTRL2_AWB_GAIN_EN
#define OV5648_ISP_CTRL3_REG
#define OV5648_ISP_CTRL3_BUF_EN
#define OV5648_ISP_CTRL3_BIN_MAN_SET
#define OV5648_ISP_CTRL3_BIN_AUTO_EN
#define OV5648_ISP_CTRL4_REG
#define OV5648_ISP_CTRL5_REG
#define OV5648_ISP_CTRL6_REG
#define OV5648_ISP_CTRL7_REG
#define OV5648_ISP_MAN_OFFSET_X_H_REG
#define OV5648_ISP_MAN_OFFSET_X_L_REG
#define OV5648_ISP_MAN_OFFSET_Y_H_REG
#define OV5648_ISP_MAN_OFFSET_Y_L_REG
#define OV5648_ISP_MAN_WIN_OFFSET_X_H_REG
#define OV5648_ISP_MAN_WIN_OFFSET_X_L_REG
#define OV5648_ISP_MAN_WIN_OFFSET_Y_H_REG
#define OV5648_ISP_MAN_WIN_OFFSET_Y_L_REG
#define OV5648_ISP_MAN_WIN_OUTPUT_X_H_REG
#define OV5648_ISP_MAN_WIN_OUTPUT_X_L_REG
#define OV5648_ISP_MAN_WIN_OUTPUT_Y_H_REG
#define OV5648_ISP_MAN_WIN_OUTPUT_Y_L_REG
#define OV5648_ISP_MAN_INPUT_X_H_REG
#define OV5648_ISP_MAN_INPUT_X_L_REG
#define OV5648_ISP_MAN_INPUT_Y_H_REG
#define OV5648_ISP_MAN_INPUT_Y_L_REG
#define OV5648_ISP_CTRL18_REG
#define OV5648_ISP_CTRL19_REG
#define OV5648_ISP_CTRL1A_REG
#define OV5648_ISP_CTRL1D_REG
#define OV5648_ISP_CTRL1F_REG
#define OV5648_ISP_CTRL1F_OUTPUT_EN
#define OV5648_ISP_CTRL25_REG

#define OV5648_ISP_CTRL3D_REG
#define OV5648_ISP_CTRL3D_PATTERN_EN
#define OV5648_ISP_CTRL3D_ROLLING_BAR_EN
#define OV5648_ISP_CTRL3D_TRANSPARENT_MODE
#define OV5648_ISP_CTRL3D_SQUARES_BW_MODE
#define OV5648_ISP_CTRL3D_PATTERN_COLOR_BARS
#define OV5648_ISP_CTRL3D_PATTERN_RANDOM_DATA
#define OV5648_ISP_CTRL3D_PATTERN_COLOR_SQUARES
#define OV5648_ISP_CTRL3D_PATTERN_INPUT

#define OV5648_ISP_CTRL3E_REG
#define OV5648_ISP_CTRL4B_REG
#define OV5648_ISP_CTRL4B_POST_BIN_H_EN
#define OV5648_ISP_CTRL4B_POST_BIN_V_EN
#define OV5648_ISP_CTRL4C_REG
#define OV5648_ISP_CTRL57_REG
#define OV5648_ISP_CTRL58_REG
#define OV5648_ISP_CTRL59_REG

#define OV5648_ISP_WINDOW_START_X_H_REG
#define OV5648_ISP_WINDOW_START_X_L_REG
#define OV5648_ISP_WINDOW_START_Y_H_REG
#define OV5648_ISP_WINDOW_START_Y_L_REG
#define OV5648_ISP_WINDOW_WIN_X_H_REG
#define OV5648_ISP_WINDOW_WIN_X_L_REG
#define OV5648_ISP_WINDOW_WIN_Y_H_REG
#define OV5648_ISP_WINDOW_WIN_Y_L_REG
#define OV5648_ISP_WINDOW_MAN_REG

/* White Balance */

#define OV5648_AWB_CTRL_REG
#define OV5648_AWB_CTRL_FAST_AWB
#define OV5648_AWB_CTRL_GAIN_FREEZE_EN
#define OV5648_AWB_CTRL_SUM_FREEZE_EN
#define OV5648_AWB_CTRL_GAIN_MANUAL_EN

#define OV5648_AWB_DELTA_REG
#define OV5648_AWB_STABLE_RANGE_REG
#define OV5648_AWB_STABLE_RANGE_WIDE_REG
#define OV5648_HSIZE_MAN_REG

#define OV5648_GAIN_RED_MAN_H_REG
#define OV5648_GAIN_RED_MAN_H(v)
#define OV5648_GAIN_RED_MAN_L_REG
#define OV5648_GAIN_RED_MAN_L(v)
#define OV5648_GAIN_GREEN_MAN_H_REG
#define OV5648_GAIN_GREEN_MAN_H(v)
#define OV5648_GAIN_GREEN_MAN_L_REG
#define OV5648_GAIN_GREEN_MAN_L(v)
#define OV5648_GAIN_BLUE_MAN_H_REG
#define OV5648_GAIN_BLUE_MAN_H(v)
#define OV5648_GAIN_BLUE_MAN_L_REG
#define OV5648_GAIN_BLUE_MAN_L(v)
#define OV5648_GAIN_RED_LIMIT_REG
#define OV5648_GAIN_GREEN_LIMIT_REG
#define OV5648_GAIN_BLUE_LIMIT_REG
#define OV5648_AWB_FRAME_COUNT_REG
#define OV5648_AWB_BASE_MAN_REG

/* Macros */

#define ov5648_subdev_sensor(s)

#define ov5648_ctrl_subdev(c)

/* Data structures */

struct ov5648_register_value {};

/*
 * PLL1 Clock Tree:
 *
 * +-< XVCLK
 * |
 * +-+ pll_pre_div (0x3037 [3:0], special values: 5: 1.5, 7: 2.5)
 *   |
 *   +-+ pll_mul (0x3036 [7:0])
 *     |
 *     +-+ sys_div (0x3035 [7:4])
 *       |
 *       +-+ mipi_div (0x3035 [3:0])
 *       | |
 *       | +-> MIPI_SCLK
 *       | |
 *       | +-+ mipi_phy_div (2)
 *       |   |
 *       |   +-> MIPI_CLK
 *       |
 *       +-+ root_div (0x3037 [4])
 *         |
 *         +-+ bit_div (0x3034 [3:0], 8 bits: 2, 10 bits: 2.5, other: 1)
 *           |
 *           +-+ sclk_div (0x3106 [3:2])
 *             |
 *             +-> SCLK
 *             |
 *             +-+ mipi_div (0x3035, 1: PCLK = SCLK)
 *               |
 *               +-> PCLK
 */

struct ov5648_pll1_config {};

/*
 * PLL2 Clock Tree:
 *
 * +-< XVCLK
 * |
 * +-+ plls_pre_div (0x303d [5:4], special values: 0: 1, 1: 1.5)
 *   |
 *   +-+ plls_div_r (0x303d [2])
 *     |
 *     +-+ plls_mul (0x303b [4:0])
 *       |
 *       +-+ sys_div (0x303c [3:0])
 *         |
 *         +-+ sel_div (0x303d [1:0], special values: 0: 1, 3: 2.5)
 *           |
 *           +-> ADCLK
 */

struct ov5648_pll2_config {};

/*
 * General formulas for (array-centered) mode calculation:
 * - photo_array_width = 2624
 * - crop_start_x = (photo_array_width - output_size_x) / 2
 * - crop_end_x = crop_start_x + offset_x + output_size_x - 1
 *
 * - photo_array_height = 1956
 * - crop_start_y = (photo_array_height - output_size_y) / 2
 * - crop_end_y = crop_start_y + offset_y + output_size_y - 1
 */

struct ov5648_mode {};

struct ov5648_state {};

struct ov5648_ctrls {};

struct ov5648_sensor {};

/* Static definitions */

/*
 * XVCLK = 24 MHz
 * SCLK  = 84 MHz
 * PCLK  = 84 MHz
 */
static const struct ov5648_pll1_config ov5648_pll1_config_native_8_bits =;

/*
 * XVCLK = 24 MHz
 * SCLK  = 84 MHz
 * PCLK  = 84 MHz
 */
static const struct ov5648_pll1_config ov5648_pll1_config_native_10_bits =;

/*
 * XVCLK = 24 MHz
 * ADCLK = 200 MHz
 */
static const struct ov5648_pll2_config ov5648_pll2_config_native =;

static const struct ov5648_mode ov5648_modes[] =;

static const u32 ov5648_mbus_codes[] =;

static const struct ov5648_register_value ov5648_init_sequence[] =;

static const s64 ov5648_link_freq_menu[] =;

static const char *const ov5648_test_pattern_menu[] =;

static const u8 ov5648_test_pattern_bits[] =;

/* Input/Output */

static int ov5648_read(struct ov5648_sensor *sensor, u16 address, u8 *value)
{}

static int ov5648_write(struct ov5648_sensor *sensor, u16 address, u8 value)
{}

static int ov5648_write_sequence(struct ov5648_sensor *sensor,
				 const struct ov5648_register_value *sequence,
				 unsigned int sequence_count)
{}

static int ov5648_update_bits(struct ov5648_sensor *sensor, u16 address,
			      u8 mask, u8 bits)
{}

/* Sensor */

static int ov5648_sw_reset(struct ov5648_sensor *sensor)
{}

static int ov5648_sw_standby(struct ov5648_sensor *sensor, int standby)
{}

static int ov5648_chip_id_check(struct ov5648_sensor *sensor)
{}

static int ov5648_avdd_internal_power(struct ov5648_sensor *sensor, int on)
{}

static int ov5648_pad_configure(struct ov5648_sensor *sensor)
{}

static int ov5648_mipi_configure(struct ov5648_sensor *sensor)
{}

static int ov5648_black_level_configure(struct ov5648_sensor *sensor)
{}

static int ov5648_isp_configure(struct ov5648_sensor *sensor)
{}

static unsigned long ov5648_mode_pll1_rate(struct ov5648_sensor *sensor,
					   const struct ov5648_pll1_config *config)
{}

static int ov5648_mode_pll1_configure(struct ov5648_sensor *sensor,
				      const struct ov5648_mode *mode,
				      u32 mbus_code)
{}

static int ov5648_mode_pll2_configure(struct ov5648_sensor *sensor,
				      const struct ov5648_mode *mode)
{}

static int ov5648_mode_configure(struct ov5648_sensor *sensor,
				 const struct ov5648_mode *mode, u32 mbus_code)
{}

static unsigned long ov5648_mode_mipi_clk_rate(struct ov5648_sensor *sensor,
					       const struct ov5648_mode *mode,
					       u32 mbus_code)
{}

/* Exposure */

static int ov5648_exposure_auto_configure(struct ov5648_sensor *sensor,
					  bool enable)
{}

static int ov5648_exposure_configure(struct ov5648_sensor *sensor, u32 exposure)
{}

static int ov5648_exposure_value(struct ov5648_sensor *sensor,
				 u32 *exposure)
{}

/* Gain */

static int ov5648_gain_auto_configure(struct ov5648_sensor *sensor, bool enable)
{}

static int ov5648_gain_configure(struct ov5648_sensor *sensor, u32 gain)
{}

static int ov5648_gain_value(struct ov5648_sensor *sensor, u32 *gain)
{}

/* White Balance */

static int ov5648_white_balance_auto_configure(struct ov5648_sensor *sensor,
					       bool enable)
{}

static int ov5648_white_balance_configure(struct ov5648_sensor *sensor,
					  u32 red_balance, u32 blue_balance)
{}

/* Flip */

static int ov5648_flip_vert_configure(struct ov5648_sensor *sensor, bool enable)
{}

static int ov5648_flip_horz_configure(struct ov5648_sensor *sensor, bool enable)
{}

/* Test Pattern */

static int ov5648_test_pattern_configure(struct ov5648_sensor *sensor,
					 unsigned int index)
{}

/* State */

static int ov5648_state_mipi_configure(struct ov5648_sensor *sensor,
				       const struct ov5648_mode *mode,
				       u32 mbus_code)
{}

static int ov5648_state_configure(struct ov5648_sensor *sensor,
				  const struct ov5648_mode *mode,
				  u32 mbus_code)
{}

static int ov5648_state_init(struct ov5648_sensor *sensor)
{}

/* Sensor Base */

static int ov5648_sensor_init(struct ov5648_sensor *sensor)
{}

static int ov5648_sensor_power(struct ov5648_sensor *sensor, bool on)
{}

/* Controls */

static int ov5648_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
{}

static int ov5648_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops ov5648_ctrl_ops =;

static int ov5648_ctrls_init(struct ov5648_sensor *sensor)
{}

/* Subdev Video Operations */

static int ov5648_s_stream(struct v4l2_subdev *subdev, int enable)
{}

static const struct v4l2_subdev_video_ops ov5648_subdev_video_ops =;

/* Subdev Pad Operations */

static int ov5648_enum_mbus_code(struct v4l2_subdev *subdev,
				 struct v4l2_subdev_state *sd_state,
				 struct v4l2_subdev_mbus_code_enum *code_enum)
{}

static void ov5648_mbus_format_fill(struct v4l2_mbus_framefmt *mbus_format,
				    u32 mbus_code,
				    const struct ov5648_mode *mode)
{}

static int ov5648_get_fmt(struct v4l2_subdev *subdev,
			  struct v4l2_subdev_state *sd_state,
			  struct v4l2_subdev_format *format)
{}

static int ov5648_set_fmt(struct v4l2_subdev *subdev,
			  struct v4l2_subdev_state *sd_state,
			  struct v4l2_subdev_format *format)
{}

static int ov5648_get_frame_interval(struct v4l2_subdev *subdev,
				     struct v4l2_subdev_state *sd_state,
				     struct v4l2_subdev_frame_interval *interval)
{}

static int ov5648_enum_frame_size(struct v4l2_subdev *subdev,
				  struct v4l2_subdev_state *sd_state,
				  struct v4l2_subdev_frame_size_enum *size_enum)
{}

static int ov5648_enum_frame_interval(struct v4l2_subdev *subdev,
				      struct v4l2_subdev_state *sd_state,
				      struct v4l2_subdev_frame_interval_enum *interval_enum)
{}

static const struct v4l2_subdev_pad_ops ov5648_subdev_pad_ops =;

static const struct v4l2_subdev_ops ov5648_subdev_ops =;

static int ov5648_suspend(struct device *dev)
{}

static int ov5648_resume(struct device *dev)
{}

static int ov5648_probe(struct i2c_client *client)
{}

static void ov5648_remove(struct i2c_client *client)
{}

static const struct dev_pm_ops ov5648_pm_ops =;

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

static struct i2c_driver ov5648_driver =;

module_i2c_driver();

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