#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/gpio/consumer.h>
#include <linux/videodev2.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#define ADV7180_STD_AD_PAL_BG_NTSC_J_SECAM …
#define ADV7180_STD_AD_PAL_BG_NTSC_J_SECAM_PED …
#define ADV7180_STD_AD_PAL_N_NTSC_J_SECAM …
#define ADV7180_STD_AD_PAL_N_NTSC_M_SECAM …
#define ADV7180_STD_NTSC_J …
#define ADV7180_STD_NTSC_M …
#define ADV7180_STD_PAL60 …
#define ADV7180_STD_NTSC_443 …
#define ADV7180_STD_PAL_BG …
#define ADV7180_STD_PAL_N …
#define ADV7180_STD_PAL_M …
#define ADV7180_STD_PAL_M_PED …
#define ADV7180_STD_PAL_COMB_N …
#define ADV7180_STD_PAL_COMB_N_PED …
#define ADV7180_STD_PAL_SECAM …
#define ADV7180_STD_PAL_SECAM_PED …
#define ADV7180_REG_INPUT_CONTROL …
#define ADV7180_INPUT_CONTROL_INSEL_MASK …
#define ADV7182_REG_INPUT_VIDSEL …
#define ADV7182_REG_INPUT_RESERVED …
#define ADV7180_REG_OUTPUT_CONTROL …
#define ADV7180_REG_EXTENDED_OUTPUT_CONTROL …
#define ADV7180_EXTENDED_OUTPUT_CONTROL_NTSCDIS …
#define ADV7180_REG_AUTODETECT_ENABLE …
#define ADV7180_AUTODETECT_DEFAULT …
#define ADV7180_REG_CON …
#define ADV7180_CON_MIN …
#define ADV7180_CON_DEF …
#define ADV7180_CON_MAX …
#define ADV7180_REG_BRI …
#define ADV7180_BRI_MIN …
#define ADV7180_BRI_DEF …
#define ADV7180_BRI_MAX …
#define ADV7180_REG_HUE …
#define ADV7180_HUE_MIN …
#define ADV7180_HUE_DEF …
#define ADV7180_HUE_MAX …
#define ADV7180_REG_DEF_VALUE_Y …
#define ADV7180_DEF_VAL_EN …
#define ADV7180_DEF_VAL_AUTO_EN …
#define ADV7180_REG_CTRL …
#define ADV7180_CTRL_IRQ_SPACE …
#define ADV7180_REG_PWR_MAN …
#define ADV7180_PWR_MAN_ON …
#define ADV7180_PWR_MAN_OFF …
#define ADV7180_PWR_MAN_RES …
#define ADV7180_REG_STATUS1 …
#define ADV7180_STATUS1_IN_LOCK …
#define ADV7180_STATUS1_AUTOD_MASK …
#define ADV7180_STATUS1_AUTOD_NTSM_M_J …
#define ADV7180_STATUS1_AUTOD_NTSC_4_43 …
#define ADV7180_STATUS1_AUTOD_PAL_M …
#define ADV7180_STATUS1_AUTOD_PAL_60 …
#define ADV7180_STATUS1_AUTOD_PAL_B_G …
#define ADV7180_STATUS1_AUTOD_SECAM …
#define ADV7180_STATUS1_AUTOD_PAL_COMB …
#define ADV7180_STATUS1_AUTOD_SECAM_525 …
#define ADV7180_REG_IDENT …
#define ADV7180_ID_7180 …
#define ADV7180_REG_STATUS3 …
#define ADV7180_REG_ANALOG_CLAMP_CTL …
#define ADV7180_REG_SHAP_FILTER_CTL_1 …
#define ADV7180_REG_CTRL_2 …
#define ADV7180_REG_VSYNC_FIELD_CTL_1 …
#define ADV7180_VSYNC_FIELD_CTL_1_NEWAV …
#define ADV7180_REG_MANUAL_WIN_CTL_1 …
#define ADV7180_REG_MANUAL_WIN_CTL_2 …
#define ADV7180_REG_MANUAL_WIN_CTL_3 …
#define ADV7180_REG_LOCK_CNT …
#define ADV7180_REG_CVBS_TRIM …
#define ADV7180_REG_CLAMP_ADJ …
#define ADV7180_REG_RES_CIR …
#define ADV7180_REG_DIFF_MODE …
#define ADV7180_REG_ICONF1 …
#define ADV7180_ICONF1_ACTIVE_LOW …
#define ADV7180_ICONF1_PSYNC_ONLY …
#define ADV7180_ICONF1_ACTIVE_TO_CLR …
#define ADV7180_REG_SD_SAT_CB …
#define ADV7180_REG_SD_SAT_CR …
#define ADV7180_SAT_MIN …
#define ADV7180_SAT_DEF …
#define ADV7180_SAT_MAX …
#define ADV7180_IRQ1_LOCK …
#define ADV7180_IRQ1_UNLOCK …
#define ADV7180_REG_ISR1 …
#define ADV7180_REG_ICR1 …
#define ADV7180_REG_IMR1 …
#define ADV7180_REG_IMR2 …
#define ADV7180_IRQ3_AD_CHANGE …
#define ADV7180_REG_ISR3 …
#define ADV7180_REG_ICR3 …
#define ADV7180_REG_IMR3 …
#define ADV7180_REG_IMR4 …
#define ADV7180_REG_NTSC_V_BIT_END …
#define ADV7180_NTSC_V_BIT_END_MANUAL_NVEND …
#define ADV7180_REG_VPP_SLAVE_ADDR …
#define ADV7180_REG_CSI_SLAVE_ADDR …
#define ADV7180_REG_ACE_CTRL1 …
#define ADV7180_REG_ACE_CTRL5 …
#define ADV7180_REG_FLCONTROL …
#define ADV7180_FLCONTROL_FL_ENABLE …
#define ADV7180_REG_RST_CLAMP …
#define ADV7180_REG_AGC_ADJ1 …
#define ADV7180_REG_AGC_ADJ2 …
#define ADV7180_CSI_REG_PWRDN …
#define ADV7180_CSI_PWRDN …
#define ADV7180_INPUT_CVBS_AIN1 …
#define ADV7180_INPUT_CVBS_AIN2 …
#define ADV7180_INPUT_CVBS_AIN3 …
#define ADV7180_INPUT_CVBS_AIN4 …
#define ADV7180_INPUT_CVBS_AIN5 …
#define ADV7180_INPUT_CVBS_AIN6 …
#define ADV7180_INPUT_SVIDEO_AIN1_AIN2 …
#define ADV7180_INPUT_SVIDEO_AIN3_AIN4 …
#define ADV7180_INPUT_SVIDEO_AIN5_AIN6 …
#define ADV7180_INPUT_YPRPB_AIN1_AIN2_AIN3 …
#define ADV7180_INPUT_YPRPB_AIN4_AIN5_AIN6 …
#define ADV7182_INPUT_CVBS_AIN1 …
#define ADV7182_INPUT_CVBS_AIN2 …
#define ADV7182_INPUT_CVBS_AIN3 …
#define ADV7182_INPUT_CVBS_AIN4 …
#define ADV7182_INPUT_CVBS_AIN5 …
#define ADV7182_INPUT_CVBS_AIN6 …
#define ADV7182_INPUT_CVBS_AIN7 …
#define ADV7182_INPUT_CVBS_AIN8 …
#define ADV7182_INPUT_SVIDEO_AIN1_AIN2 …
#define ADV7182_INPUT_SVIDEO_AIN3_AIN4 …
#define ADV7182_INPUT_SVIDEO_AIN5_AIN6 …
#define ADV7182_INPUT_SVIDEO_AIN7_AIN8 …
#define ADV7182_INPUT_YPRPB_AIN1_AIN2_AIN3 …
#define ADV7182_INPUT_YPRPB_AIN4_AIN5_AIN6 …
#define ADV7182_INPUT_DIFF_CVBS_AIN1_AIN2 …
#define ADV7182_INPUT_DIFF_CVBS_AIN3_AIN4 …
#define ADV7182_INPUT_DIFF_CVBS_AIN5_AIN6 …
#define ADV7182_INPUT_DIFF_CVBS_AIN7_AIN8 …
#define ADV7180_DEFAULT_CSI_I2C_ADDR …
#define ADV7180_DEFAULT_VPP_I2C_ADDR …
#define V4L2_CID_ADV_FAST_SWITCH …
#define ADV7180_NUM_OF_SKIP_FRAMES …
struct adv7180_state;
#define ADV7180_FLAG_RESET_POWERED …
#define ADV7180_FLAG_V2 …
#define ADV7180_FLAG_MIPI_CSI2 …
#define ADV7180_FLAG_I2P …
struct adv7180_chip_info { … };
struct adv7180_state { … };
#define to_adv7180_sd(_ctrl) …
static int adv7180_select_page(struct adv7180_state *state, unsigned int page)
{ … }
static int adv7180_write(struct adv7180_state *state, unsigned int reg,
unsigned int value)
{ … }
static int adv7180_read(struct adv7180_state *state, unsigned int reg)
{ … }
static int adv7180_csi_write(struct adv7180_state *state, unsigned int reg,
unsigned int value)
{ … }
static int adv7180_set_video_standard(struct adv7180_state *state,
unsigned int std)
{ … }
static int adv7180_vpp_write(struct adv7180_state *state, unsigned int reg,
unsigned int value)
{ … }
static v4l2_std_id adv7180_std_to_v4l2(u8 status1)
{ … }
static int v4l2_std_to_adv7180(v4l2_std_id std)
{ … }
static u32 adv7180_status_to_v4l2(u8 status1)
{ … }
static int __adv7180_status(struct adv7180_state *state, u32 *status,
v4l2_std_id *std)
{ … }
static inline struct adv7180_state *to_state(struct v4l2_subdev *sd)
{ … }
static int adv7180_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
{ … }
static int adv7180_s_routing(struct v4l2_subdev *sd, u32 input,
u32 output, u32 config)
{ … }
static int adv7180_g_input_status(struct v4l2_subdev *sd, u32 *status)
{ … }
static int adv7180_program_std(struct adv7180_state *state)
{ … }
static int adv7180_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
{ … }
static int adv7180_g_std(struct v4l2_subdev *sd, v4l2_std_id *norm)
{ … }
static int adv7180_get_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval *fi)
{ … }
static void adv7180_set_power_pin(struct adv7180_state *state, bool on)
{ … }
static void adv7180_set_reset_pin(struct adv7180_state *state, bool on)
{ … }
static int adv7180_set_power(struct adv7180_state *state, bool on)
{ … }
static int adv7180_s_power(struct v4l2_subdev *sd, int on)
{ … }
static const char * const test_pattern_menu[] = …;
static int adv7180_test_pattern(struct adv7180_state *state, int value)
{ … }
static int adv7180_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops adv7180_ctrl_ops = …;
static const struct v4l2_ctrl_config adv7180_ctrl_fast_switch = …;
static int adv7180_init_controls(struct adv7180_state *state)
{ … }
static void adv7180_exit_controls(struct adv7180_state *state)
{ … }
static int adv7180_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int adv7180_mbus_fmt(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *fmt)
{ … }
static int adv7180_set_field_mode(struct adv7180_state *state)
{ … }
static int adv7180_get_pad_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int adv7180_set_pad_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int adv7180_init_state(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state)
{ … }
static int adv7180_get_mbus_config(struct v4l2_subdev *sd,
unsigned int pad,
struct v4l2_mbus_config *cfg)
{ … }
static int adv7180_get_skip_frames(struct v4l2_subdev *sd, u32 *frames)
{ … }
static int adv7180_g_pixelaspect(struct v4l2_subdev *sd, struct v4l2_fract *aspect)
{ … }
static int adv7180_g_tvnorms(struct v4l2_subdev *sd, v4l2_std_id *norm)
{ … }
static int adv7180_s_stream(struct v4l2_subdev *sd, int enable)
{ … }
static int adv7180_subscribe_event(struct v4l2_subdev *sd,
struct v4l2_fh *fh,
struct v4l2_event_subscription *sub)
{ … }
static const struct v4l2_subdev_video_ops adv7180_video_ops = …;
static const struct v4l2_subdev_core_ops adv7180_core_ops = …;
static const struct v4l2_subdev_pad_ops adv7180_pad_ops = …;
static const struct v4l2_subdev_sensor_ops adv7180_sensor_ops = …;
static const struct v4l2_subdev_ops adv7180_ops = …;
static const struct v4l2_subdev_internal_ops adv7180_internal_ops = …;
static irqreturn_t adv7180_irq(int irq, void *devid)
{ … }
static int adv7180_init(struct adv7180_state *state)
{ … }
static int adv7180_set_std(struct adv7180_state *state, unsigned int std)
{ … }
static int adv7180_select_input(struct adv7180_state *state, unsigned int input)
{ … }
static int adv7182_init(struct adv7180_state *state)
{ … }
static int adv7182_set_std(struct adv7180_state *state, unsigned int std)
{ … }
enum adv7182_input_type { … };
static enum adv7182_input_type adv7182_get_input_type(unsigned int input)
{ … }
static unsigned int adv7182_lbias_settings[][3] = …;
static unsigned int adv7280_lbias_settings[][3] = …;
static int adv7182_select_input(struct adv7180_state *state, unsigned int input)
{ … }
static const struct adv7180_chip_info adv7180_info = …;
static const struct adv7180_chip_info adv7182_info = …;
static const struct adv7180_chip_info adv7280_info = …;
static const struct adv7180_chip_info adv7280_m_info = …;
static const struct adv7180_chip_info adv7281_info = …;
static const struct adv7180_chip_info adv7281_m_info = …;
static const struct adv7180_chip_info adv7281_ma_info = …;
static const struct adv7180_chip_info adv7282_info = …;
static const struct adv7180_chip_info adv7282_m_info = …;
static int init_device(struct adv7180_state *state)
{ … }
static int adv7180_probe(struct i2c_client *client)
{ … }
static void adv7180_remove(struct i2c_client *client)
{ … }
#ifdef CONFIG_PM_SLEEP
static int adv7180_suspend(struct device *dev)
{ … }
static int adv7180_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
#define ADV7180_PM_OPS …
#else
#define ADV7180_PM_OPS …
#endif
static const struct i2c_device_id adv7180_id[] = …;
MODULE_DEVICE_TABLE(i2c, adv7180_id);
static const struct of_device_id adv7180_of_id[] = …;
MODULE_DEVICE_TABLE(of, adv7180_of_id);
static struct i2c_driver adv7180_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;