#include <asm/unaligned.h>
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/nvmem-provider.h>
#include <linux/regmap.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#define OV2740_LINK_FREQ_360MHZ …
#define OV2740_LINK_FREQ_180MHZ …
#define OV2740_SCLK …
#define OV2740_MCLK …
#define OV2740_DATA_LANES …
#define OV2740_RGB_DEPTH …
#define OV2740_REG_CHIP_ID …
#define OV2740_CHIP_ID …
#define OV2740_REG_MODE_SELECT …
#define OV2740_MODE_STANDBY …
#define OV2740_MODE_STREAMING …
#define OV2740_REG_VTS …
#define OV2740_REG_HTS …
#define OV2740_REG_EXPOSURE …
#define OV2740_EXPOSURE_MIN …
#define OV2740_EXPOSURE_MAX_MARGIN …
#define OV2740_EXPOSURE_STEP …
#define OV2740_REG_ANALOG_GAIN …
#define OV2740_ANAL_GAIN_MIN …
#define OV2740_ANAL_GAIN_MAX …
#define OV2740_ANAL_GAIN_STEP …
#define OV2740_REG_MWB_R_GAIN …
#define OV2740_REG_MWB_G_GAIN …
#define OV2740_REG_MWB_B_GAIN …
#define OV2740_DGTL_GAIN_MIN …
#define OV2740_DGTL_GAIN_MAX …
#define OV2740_DGTL_GAIN_STEP …
#define OV2740_DGTL_GAIN_DEFAULT …
#define OV2740_REG_TEST_PATTERN …
#define OV2740_TEST_PATTERN_ENABLE …
#define OV2740_TEST_PATTERN_BAR_SHIFT …
#define OV2740_REG_GROUP_ACCESS …
#define OV2740_GROUP_HOLD_START …
#define OV2740_GROUP_HOLD_END …
#define OV2740_GROUP_HOLD_LAUNCH …
#define OV2740_REG_ISP_CTRL00 …
#define OV2740_REG_ISP_CTRL01 …
#define CUSTOMER_USE_OTP_SIZE …
#define OV2740_REG_OTP_CUSTOMER …
struct nvm_data { … };
enum { … };
struct ov2740_reg { … };
struct ov2740_reg_list { … };
struct ov2740_link_freq_config { … };
struct ov2740_mode { … };
static const struct ov2740_reg mipi_data_rate_720mbps[] = …;
static const struct ov2740_reg mipi_data_rate_360mbps[] = …;
static const struct ov2740_reg mode_1932x1092_regs_360mhz[] = …;
static const struct ov2740_reg mode_1932x1092_regs_180mhz[] = …;
static const char * const ov2740_test_pattern_menu[] = …;
static const s64 link_freq_menu_items[] = …;
static const struct ov2740_link_freq_config link_freq_configs[] = …;
static const struct ov2740_mode supported_modes_360mhz[] = …;
static const struct ov2740_mode supported_modes_180mhz[] = …;
struct ov2740 { … };
static inline struct ov2740 *to_ov2740(struct v4l2_subdev *subdev)
{ … }
static u64 to_pixel_rate(u32 f_index)
{ … }
static int ov2740_read_reg(struct ov2740 *ov2740, u16 reg, u16 len, u32 *val)
{ … }
static int ov2740_write_reg(struct ov2740 *ov2740, u16 reg, u16 len, u32 val)
{ … }
static int ov2740_write_reg_list(struct ov2740 *ov2740,
const struct ov2740_reg_list *r_list)
{ … }
static int ov2740_identify_module(struct ov2740 *ov2740)
{ … }
static int ov2740_update_digital_gain(struct ov2740 *ov2740, u32 d_gain)
{ … }
static int ov2740_test_pattern(struct ov2740 *ov2740, u32 pattern)
{ … }
static int ov2740_set_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops ov2740_ctrl_ops = …;
static int ov2740_init_controls(struct ov2740 *ov2740)
{ … }
static void ov2740_update_pad_format(const struct ov2740_mode *mode,
struct v4l2_mbus_framefmt *fmt)
{ … }
static int ov2740_load_otp_data(struct nvm_data *nvm)
{ … }
static int ov2740_start_streaming(struct ov2740 *ov2740)
{ … }
static void ov2740_stop_streaming(struct ov2740 *ov2740)
{ … }
static int ov2740_set_stream(struct v4l2_subdev *sd, int enable)
{ … }
static int ov2740_set_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int ov2740_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int ov2740_enum_frame_size(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{ … }
static int ov2740_init_state(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state)
{ … }
static const struct v4l2_subdev_video_ops ov2740_video_ops = …;
static const struct v4l2_subdev_pad_ops ov2740_pad_ops = …;
static const struct v4l2_subdev_ops ov2740_subdev_ops = …;
static const struct v4l2_subdev_internal_ops ov2740_internal_ops = …;
static const struct media_entity_operations ov2740_subdev_entity_ops = …;
static int ov2740_check_hwcfg(struct device *dev)
{ … }
static void ov2740_remove(struct i2c_client *client)
{ … }
static int ov2740_nvmem_read(void *priv, unsigned int off, void *val,
size_t count)
{ … }
static int ov2740_register_nvmem(struct i2c_client *client,
struct ov2740 *ov2740)
{ … }
static int ov2740_suspend(struct device *dev)
{ … }
static int ov2740_resume(struct device *dev)
{ … }
static int ov2740_probe(struct i2c_client *client)
{ … }
static DEFINE_RUNTIME_DEV_PM_OPS(ov2740_pm_ops, ov2740_suspend, ov2740_resume,
NULL);
static const struct acpi_device_id ov2740_acpi_ids[] = …;
MODULE_DEVICE_TABLE(acpi, ov2740_acpi_ids);
static struct i2c_driver ov2740_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;