drivers/media/i2c/adv7842.c

Source file repositories/reference/linux-study-clean/drivers/media/i2c/adv7842.c

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/adv7842.c
Extension
.c
Size
107006 bytes
Lines
3695
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct adv7842_format_info {
	u32 code;
	u8 op_ch_sel;
	bool rgb_out;
	bool swap_cb_cr;
	u8 op_format_sel;
};

struct adv7842_state {
	struct adv7842_platform_data pdata;
	struct v4l2_subdev sd;
	struct media_pad pads[ADV7842_PAD_SOURCE + 1];
	struct v4l2_ctrl_handler hdl;
	enum adv7842_mode mode;
	struct v4l2_dv_timings timings;
	enum adv7842_vid_std_select vid_std_select;

	const struct adv7842_format_info *format;

	v4l2_std_id norm;
	struct {
		u8 edid[512];
		u32 blocks;
		u32 present;
	} hdmi_edid;
	struct {
		u8 edid[128];
		u32 blocks;
		u32 present;
	} vga_edid;
	struct v4l2_fract aspect_ratio;
	u32 rgb_quantization_range;
	bool is_cea_format;
	struct delayed_work delayed_work_enable_hotplug;
	bool restart_stdi_once;
	bool hdmi_port_a;

	struct dentry *debugfs_dir;
	struct v4l2_debugfs_if *infoframes;

	/* i2c clients */
	struct i2c_client *i2c_sdp_io;
	struct i2c_client *i2c_sdp;
	struct i2c_client *i2c_cp;
	struct i2c_client *i2c_vdp;
	struct i2c_client *i2c_afe;
	struct i2c_client *i2c_hdmi;
	struct i2c_client *i2c_repeater;
	struct i2c_client *i2c_edid;
	struct i2c_client *i2c_infoframe;
	struct i2c_client *i2c_cec;
	struct i2c_client *i2c_avlink;

	/* controls */
	struct v4l2_ctrl *detect_tx_5v_ctrl;
	struct v4l2_ctrl *analog_sampling_phase_ctrl;
	struct v4l2_ctrl *free_run_color_ctrl_manual;
	struct v4l2_ctrl *free_run_color_ctrl;
	struct v4l2_ctrl *rgb_quantization_range_ctrl;

	struct cec_adapter *cec_adap;
	u8   cec_addr[ADV7842_MAX_ADDRS];
	u8   cec_valid_addrs;
	bool cec_enabled_adap;
};

/* Unsupported timings. This device cannot support 720p30. */
static const struct v4l2_dv_timings adv7842_timings_exceptions[] = {
	V4L2_DV_BT_CEA_1280X720P30,
	{ }
};

static bool adv7842_check_dv_timings(const struct v4l2_dv_timings *t, void *hdl)
{
	int i;

	for (i = 0; adv7842_timings_exceptions[i].bt.width; i++)
		if (v4l2_match_dv_timings(t, adv7842_timings_exceptions + i, 0, false))
			return false;
	return true;
}

struct adv7842_video_standards {
	struct v4l2_dv_timings timings;
	u8 vid_std;
	u8 v_freq;
};

/* sorted by number of lines */
static const struct adv7842_video_standards adv7842_prim_mode_comp[] = {

Annotation

Implementation Notes