#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.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-fwnode.h>
#include <linux/unaligned.h>
#define IMX258_REG_MODE_SELECT …
#define IMX258_MODE_STANDBY …
#define IMX258_MODE_STREAMING …
#define IMX258_REG_RESET …
#define IMX258_REG_CHIP_ID …
#define IMX258_CHIP_ID …
#define IMX258_VTS_30FPS …
#define IMX258_VTS_30FPS_2K …
#define IMX258_VTS_30FPS_VGA …
#define IMX258_VTS_MAX …
#define IMX258_PPL_DEFAULT …
#define IMX258_REG_EXPOSURE …
#define IMX258_EXPOSURE_OFFSET …
#define IMX258_EXPOSURE_MIN …
#define IMX258_EXPOSURE_STEP …
#define IMX258_EXPOSURE_DEFAULT …
#define IMX258_EXPOSURE_MAX …
#define IMX258_REG_ANALOG_GAIN …
#define IMX258_ANA_GAIN_MIN …
#define IMX258_ANA_GAIN_MAX …
#define IMX258_ANA_GAIN_STEP …
#define IMX258_ANA_GAIN_DEFAULT …
#define IMX258_REG_GR_DIGITAL_GAIN …
#define IMX258_REG_R_DIGITAL_GAIN …
#define IMX258_REG_B_DIGITAL_GAIN …
#define IMX258_REG_GB_DIGITAL_GAIN …
#define IMX258_DGTL_GAIN_MIN …
#define IMX258_DGTL_GAIN_MAX …
#define IMX258_DGTL_GAIN_DEFAULT …
#define IMX258_DGTL_GAIN_STEP …
#define IMX258_REG_HDR …
#define IMX258_HDR_ON …
#define IMX258_REG_HDR_RATIO …
#define IMX258_HDR_RATIO_MIN …
#define IMX258_HDR_RATIO_MAX …
#define IMX258_HDR_RATIO_STEP …
#define IMX258_HDR_RATIO_DEFAULT …
#define IMX258_REG_TEST_PATTERN …
#define IMX258_CLK_BLANK_STOP …
#define REG_MIRROR_FLIP_CONTROL …
#define REG_CONFIG_MIRROR_HFLIP …
#define REG_CONFIG_MIRROR_VFLIP …
#define IMX258_NATIVE_WIDTH …
#define IMX258_NATIVE_HEIGHT …
#define IMX258_PIXEL_ARRAY_LEFT …
#define IMX258_PIXEL_ARRAY_TOP …
#define IMX258_PIXEL_ARRAY_WIDTH …
#define IMX258_PIXEL_ARRAY_HEIGHT …
#define IMX258_REG_PLL_MULT_DRIV …
#define IMX258_REG_IVTPXCK_DIV …
#define IMX258_REG_IVTSYCK_DIV …
#define IMX258_REG_PREPLLCK_VT_DIV …
#define IMX258_REG_IOPPXCK_DIV …
#define IMX258_REG_IOPSYCK_DIV …
#define IMX258_REG_PREPLLCK_OP_DIV …
#define IMX258_REG_PHASE_PIX_OUTEN …
#define IMX258_REG_PDPIX_DATA_RATE …
#define IMX258_REG_SCALE_MODE …
#define IMX258_REG_SCALE_MODE_EXT …
#define IMX258_REG_AF_WINDOW_MODE …
#define IMX258_REG_FRM_LENGTH_CTL …
#define IMX258_REG_CSI_LANE_MODE …
#define IMX258_REG_X_EVN_INC …
#define IMX258_REG_X_ODD_INC …
#define IMX258_REG_Y_EVN_INC …
#define IMX258_REG_Y_ODD_INC …
#define IMX258_REG_BINNING_MODE …
#define IMX258_REG_BINNING_TYPE_V …
#define IMX258_REG_FORCE_FD_SUM …
#define IMX258_REG_DIG_CROP_X_OFFSET …
#define IMX258_REG_DIG_CROP_Y_OFFSET …
#define IMX258_REG_DIG_CROP_IMAGE_WIDTH …
#define IMX258_REG_DIG_CROP_IMAGE_HEIGHT …
#define IMX258_REG_SCALE_M …
#define IMX258_REG_X_OUT_SIZE …
#define IMX258_REG_Y_OUT_SIZE …
#define IMX258_REG_X_ADD_STA …
#define IMX258_REG_Y_ADD_STA …
#define IMX258_REG_X_ADD_END …
#define IMX258_REG_Y_ADD_END …
#define IMX258_REG_EXCK_FREQ …
#define IMX258_REG_CSI_DT_FMT …
#define IMX258_REG_LINE_LENGTH_PCK …
#define IMX258_REG_SCALE_M_EXT …
#define IMX258_REG_FRM_LENGTH_LINES …
#define IMX258_REG_FINE_INTEG_TIME …
#define IMX258_REG_PLL_IVT_MPY …
#define IMX258_REG_PLL_IOP_MPY …
#define IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H …
#define IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L …
struct imx258_reg_list { … };
struct imx258_link_cfg { … };
enum { … };
struct imx258_link_freq_config { … };
struct imx258_mode { … };
static const struct cci_reg_sequence mipi_1267mbps_19_2mhz_2l[] = …;
static const struct cci_reg_sequence mipi_1267mbps_19_2mhz_4l[] = …;
static const struct cci_reg_sequence mipi_1272mbps_24mhz_2l[] = …;
static const struct cci_reg_sequence mipi_1272mbps_24mhz_4l[] = …;
static const struct cci_reg_sequence mipi_640mbps_19_2mhz_2l[] = …;
static const struct cci_reg_sequence mipi_640mbps_19_2mhz_4l[] = …;
static const struct cci_reg_sequence mipi_642mbps_24mhz_2l[] = …;
static const struct cci_reg_sequence mipi_642mbps_24mhz_4l[] = …;
static const struct cci_reg_sequence mode_common_regs[] = …;
static const struct cci_reg_sequence mode_4208x3120_regs[] = …;
static const struct cci_reg_sequence mode_2104_1560_regs[] = …;
static const struct cci_reg_sequence mode_1048_780_regs[] = …;
struct imx258_variant_cfg { … };
static const struct cci_reg_sequence imx258_cfg_regs[] = …;
static const struct imx258_variant_cfg imx258_cfg = …;
static const struct cci_reg_sequence imx258_pdaf_cfg_regs[] = …;
static const struct imx258_variant_cfg imx258_pdaf_cfg = …;
static const u32 codes[] = …;
static const char * const imx258_test_pattern_menu[] = …;
static const char * const imx258_supply_name[] = …;
#define IMX258_NUM_SUPPLIES …
enum { … };
static u64 link_freq_to_pixel_rate(u64 f, const struct imx258_link_cfg *link_cfg)
{ … }
static const s64 link_freq_menu_items_19_2[] = …;
static const s64 link_freq_menu_items_24[] = …;
#define REGS(_list) …
static const struct imx258_link_freq_config link_freq_configs_19_2[] = …;
static const struct imx258_link_freq_config link_freq_configs_24[] = …;
static const struct imx258_mode supported_modes[] = …;
struct imx258 { … };
static inline struct imx258 *to_imx258(struct v4l2_subdev *_sd)
{ … }
static u32 imx258_get_format_code(const struct imx258 *imx258)
{ … }
static int imx258_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{ … }
static int imx258_update_digital_gain(struct imx258 *imx258, u32 val)
{ … }
static void imx258_adjust_exposure_range(struct imx258 *imx258)
{ … }
static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops imx258_ctrl_ops = …;
static int imx258_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int imx258_enum_frame_size(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{ … }
static void imx258_update_pad_format(struct imx258 *imx258,
const struct imx258_mode *mode,
struct v4l2_subdev_format *fmt)
{ … }
static int __imx258_get_pad_format(struct imx258 *imx258,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int imx258_get_pad_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int imx258_set_pad_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static const struct v4l2_rect *
__imx258_get_pad_crop(struct imx258 *imx258,
struct v4l2_subdev_state *sd_state,
unsigned int pad, enum v4l2_subdev_format_whence which)
{ … }
static int imx258_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static int imx258_start_streaming(struct imx258 *imx258)
{ … }
static int imx258_stop_streaming(struct imx258 *imx258)
{ … }
static int imx258_power_on(struct device *dev)
{ … }
static int imx258_power_off(struct device *dev)
{ … }
static int imx258_set_stream(struct v4l2_subdev *sd, int enable)
{ … }
static int imx258_identify_module(struct imx258 *imx258)
{ … }
static const struct v4l2_subdev_video_ops imx258_video_ops = …;
static const struct v4l2_subdev_pad_ops imx258_pad_ops = …;
static const struct v4l2_subdev_ops imx258_subdev_ops = …;
static const struct v4l2_subdev_internal_ops imx258_internal_ops = …;
static int imx258_init_controls(struct imx258 *imx258)
{ … }
static void imx258_free_controls(struct imx258 *imx258)
{ … }
static int imx258_get_regulators(struct imx258 *imx258,
struct i2c_client *client)
{ … }
static int imx258_probe(struct i2c_client *client)
{ … }
static void imx258_remove(struct i2c_client *client)
{ … }
static const struct dev_pm_ops imx258_pm_ops = …;
#ifdef CONFIG_ACPI
static const struct acpi_device_id imx258_acpi_ids[] = …;
MODULE_DEVICE_TABLE(acpi, imx258_acpi_ids);
#endif
static const struct of_device_id imx258_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, imx258_dt_ids);
static struct i2c_driver imx258_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;