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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/slab.hlinux/i2c.hlinux/delay.hlinux/videodev2.hlinux/workqueue.hlinux/v4l2-dv-timings.hlinux/hdmi.hmedia/cec.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-ctrls.hmedia/v4l2-dv-timings.hmedia/i2c/adv7842.h
Detected Declarations
struct adv7842_format_infostruct adv7842_statestruct adv7842_video_standardsstruct stdi_readbackstruct adv7842_cfg_read_infoframefunction adv7842_check_dv_timingsfunction htotalfunction vtotalfunction adv_smbus_read_byte_data_checkfunction adv_smbus_read_byte_datafunction adv_smbus_write_byte_datafunction adv_smbus_write_byte_no_checkfunction io_readfunction io_writefunction io_write_and_orfunction io_write_clr_setfunction avlink_readfunction avlink_writefunction cec_readfunction cec_writefunction cec_write_clr_setfunction infoframe_readfunction infoframe_writefunction sdp_io_readfunction sdp_io_writefunction sdp_io_write_and_orfunction sdp_readfunction sdp_writefunction sdp_write_and_orfunction afe_readfunction afe_writefunction afe_write_and_orfunction rep_readfunction rep_writefunction rep_write_and_orfunction edid_readfunction edid_writefunction hdmi_readfunction hdmi_writefunction hdmi_write_and_orfunction cp_readfunction cp_writefunction cp_write_and_orfunction vdp_readfunction vdp_writefunction main_resetfunction adv7842_format_infofunction is_analog_input
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
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/i2c.h`, `linux/delay.h`, `linux/videodev2.h`, `linux/workqueue.h`, `linux/v4l2-dv-timings.h`.
- Detected declarations: `struct adv7842_format_info`, `struct adv7842_state`, `struct adv7842_video_standards`, `struct stdi_readback`, `struct adv7842_cfg_read_infoframe`, `function adv7842_check_dv_timings`, `function htotal`, `function vtotal`, `function adv_smbus_read_byte_data_check`, `function adv_smbus_read_byte_data`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.