#include <linux/unaligned.h>
#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 <media/v4l2-fwnode.h>
#define HI847_REG_VALUE_08BIT …
#define HI847_REG_VALUE_16BIT …
#define HI847_REG_VALUE_24BIT …
#define HI847_LINK_FREQ_400MHZ …
#define HI847_LINK_FREQ_200MHZ …
#define HI847_SCLK …
#define HI847_MCLK …
#define HI847_DATA_LANES …
#define HI847_RGB_DEPTH …
#define HI847_REG_CHIP_ID …
#define HI847_CHIP_ID …
#define HI847_REG_MODE_SELECT …
#define HI847_MODE_STANDBY …
#define HI847_MODE_STREAMING …
#define HI847_REG_MODE_TG …
#define HI847_REG_MODE_TG_ENABLE …
#define HI847_REG_MODE_TG_DISABLE …
#define HI847_REG_FLL …
#define HI847_FLL_30FPS …
#define HI847_FLL_30FPS_MIN …
#define HI847_FLL_60FPS …
#define HI847_FLL_60FPS_MIN …
#define HI847_FLL_MAX …
#define HI847_REG_LLP …
#define HI847_REG_EXPOSURE …
#define HI847_EXPOSURE_MIN …
#define HI847_EXPOSURE_MAX_MARGIN …
#define HI847_EXPOSURE_STEP …
#define HI847_REG_ANALOG_GAIN …
#define HI847_ANAL_GAIN_MIN …
#define HI847_ANAL_GAIN_MAX …
#define HI847_ANAL_GAIN_STEP …
#define HI847_REG_MWB_GR_GAIN …
#define HI847_REG_MWB_GB_GAIN …
#define HI847_REG_MWB_R_GAIN …
#define HI847_REG_MWB_B_GAIN …
#define HI847_DGTL_GAIN_MIN …
#define HI847_DGTL_GAIN_MAX …
#define HI847_DGTL_GAIN_STEP …
#define HI847_DGTL_GAIN_DEFAULT …
#define HI847_REG_ISP …
#define HI847_REG_ISP_TPG_EN …
#define HI847_REG_TEST_PATTERN …
#define HI847_REG_MIRROR_FLIP …
#define HI847_REG_FORMAT_X …
#define HI847_REG_FORMAT_Y …
enum { … };
struct hi847_reg { … };
struct hi847_reg_list { … };
struct hi847_link_freq_config { … };
struct hi847_mode { … };
#define to_hi847(_sd) …
static const struct hi847_reg mipi_data_rate_lane_4[] = …;
static const struct hi847_reg mode_3264x2448_regs[] = …;
static const struct hi847_reg mode_1632x1224_regs[] = …;
static const char * const hi847_test_pattern_menu[] = …;
static const s64 link_freq_menu_items[] = …;
static const struct hi847_link_freq_config link_freq_configs[] = …;
static const struct hi847_mode supported_modes[] = …;
struct hi847 { … };
static u64 to_pixel_rate(u32 f_index)
{ … }
static int hi847_read_reg(struct hi847 *hi847, u16 reg, u16 len, u32 *val)
{ … }
static int hi847_write_reg(struct hi847 *hi847, u16 reg, u16 len, u32 val)
{ … }
static int hi847_write_reg_list(struct hi847 *hi847,
const struct hi847_reg_list *r_list)
{ … }
static int hi847_update_digital_gain(struct hi847 *hi847, u32 d_gain)
{ … }
static int hi847_test_pattern(struct hi847 *hi847, u32 pattern)
{ … }
static int hi847_grbg_shift(struct hi847 *hi847)
{ … }
static int hi847_set_ctrl_hflip(struct hi847 *hi847, u32 ctrl_val)
{ … }
static int hi847_set_ctrl_vflip(struct hi847 *hi847, u8 ctrl_val)
{ … }
static int hi847_set_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops hi847_ctrl_ops = …;
static int hi847_init_controls(struct hi847 *hi847)
{ … }
static void hi847_assign_pad_format(const struct hi847_mode *mode,
struct v4l2_mbus_framefmt *fmt)
{ … }
static int hi847_start_streaming(struct hi847 *hi847)
{ … }
static void hi847_stop_streaming(struct hi847 *hi847)
{ … }
static int hi847_set_stream(struct v4l2_subdev *sd, int enable)
{ … }
static int hi847_set_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int hi847_get_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int hi847_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int hi847_enum_frame_size(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{ … }
static int hi847_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{ … }
static const struct v4l2_subdev_video_ops hi847_video_ops = …;
static const struct v4l2_subdev_pad_ops hi847_pad_ops = …;
static const struct v4l2_subdev_ops hi847_subdev_ops = …;
static const struct media_entity_operations hi847_subdev_entity_ops = …;
static const struct v4l2_subdev_internal_ops hi847_internal_ops = …;
static int hi847_identify_module(struct hi847 *hi847)
{ … }
static int hi847_check_hwcfg(struct device *dev)
{ … }
static void hi847_remove(struct i2c_client *client)
{ … }
static int hi847_probe(struct i2c_client *client)
{ … }
#ifdef CONFIG_ACPI
static const struct acpi_device_id hi847_acpi_ids[] = …;
MODULE_DEVICE_TABLE(acpi, hi847_acpi_ids);
#endif
static struct i2c_driver hi847_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;