drivers/media/i2c/adv7511-v4l2.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/adv7511-v4l2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/adv7511-v4l2.c- Extension
.c- Size
- 56523 bytes
- Lines
- 2026
- 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/hdmi.hlinux/v4l2-dv-timings.hmedia/v4l2-device.hmedia/v4l2-common.hmedia/v4l2-ctrls.hmedia/v4l2-dv-timings.hmedia/i2c/adv7511.hmedia/cec.h
Detected Declarations
struct adv7511_state_edidstruct adv7511_statestruct adv7511_cfg_read_infoframefunction adv_smbus_read_byte_data_checkfunction adv_smbus_read_byte_datafunction adv7511_rdfunction adv7511_wrfunction adv7511_wr_and_orfunction adv7511_edid_rdfunction adv7511_cec_readfunction adv7511_cec_writefunction adv7511_cec_write_and_orfunction adv7511_pktmem_rdfunction adv7511_have_hotplugfunction adv7511_have_rx_sensefunction adv7511_csc_conversion_modefunction adv7511_csc_coefffunction adv7511_csc_rgb_full2limitfunction adv7511_set_rgb_quantization_modefunction adv7511_s_ctrlfunction adv7511_inv_registerfunction adv7511_g_registerfunction adv7511_s_registerfunction hdmi_infoframe_checksumfunction read_infoframefunction log_infoframefunction adv7511_log_infoframesfunction adv7511_log_statusfunction adv7511_s_powerfunction adv7511_cec_adap_enablefunction adv7511_cec_adap_log_addrfunction adv7511_cec_adap_transmitfunction adv_cec_tx_raw_statusfunction adv7511_set_isrfunction adv7511_isrfunction adv7511_s_streamfunction adv7511_s_dv_timingsfunction adv7511_g_dv_timingsfunction adv7511_enum_dv_timingsfunction adv7511_dv_timings_capfunction adv7511_s_audio_streamfunction adv7511_s_clock_freqfunction adv7511_s_i2s_clock_freqfunction adv7511_s_routingfunction adv7511_get_edidfunction adv7511_enum_mbus_codefunction adv7511_fill_formatfunction adv7511_get_fmt
Annotated Snippet
struct adv7511_state_edid {
/* total number of blocks */
u32 blocks;
/* Number of segments read */
u32 segments;
u8 data[EDID_MAX_SEGM * 256];
/* Number of EDID read retries left */
unsigned read_retries;
bool complete;
};
struct adv7511_state {
struct adv7511_platform_data pdata;
struct v4l2_subdev sd;
struct media_pad pad;
struct v4l2_ctrl_handler hdl;
int chip_revision;
u8 i2c_edid_addr;
u8 i2c_pktmem_addr;
u8 i2c_cec_addr;
struct i2c_client *i2c_cec;
struct cec_adapter *cec_adap;
u8 cec_addr[ADV7511_MAX_ADDRS];
u8 cec_valid_addrs;
bool cec_enabled_adap;
/* Is the adv7511 powered on? */
bool power_on;
/* Did we receive hotplug and rx-sense signals? */
bool have_monitor;
bool enabled_irq;
/* timings from s_dv_timings */
struct v4l2_dv_timings dv_timings;
u32 fmt_code;
u32 colorspace;
u32 ycbcr_enc;
u32 quantization;
u32 xfer_func;
u32 content_type;
/* controls */
struct v4l2_ctrl *hdmi_mode_ctrl;
struct v4l2_ctrl *hotplug_ctrl;
struct v4l2_ctrl *rx_sense_ctrl;
struct v4l2_ctrl *have_edid0_ctrl;
struct v4l2_ctrl *rgb_quantization_range_ctrl;
struct v4l2_ctrl *content_type_ctrl;
struct i2c_client *i2c_edid;
struct i2c_client *i2c_pktmem;
struct adv7511_state_edid edid;
/* Running counter of the number of detected EDIDs (for debugging) */
unsigned edid_detect_counter;
struct workqueue_struct *work_queue;
struct delayed_work edid_handler; /* work entry */
struct dentry *debugfs_dir;
struct v4l2_debugfs_if *infoframes;
};
static void adv7511_check_monitor_present_status(struct v4l2_subdev *sd);
static bool adv7511_check_edid_status(struct v4l2_subdev *sd);
static void adv7511_setup(struct v4l2_subdev *sd);
static int adv7511_s_i2s_clock_freq(struct v4l2_subdev *sd, u32 freq);
static int adv7511_s_clock_freq(struct v4l2_subdev *sd, u32 freq);
static const struct v4l2_dv_timings_cap adv7511_timings_cap = {
.type = V4L2_DV_BT_656_1120,
/* keep this initialization for compatibility with GCC < 4.4.6 */
.reserved = { 0 },
V4L2_INIT_BT_TIMINGS(640, ADV7511_MAX_WIDTH, 350, ADV7511_MAX_HEIGHT,
ADV7511_MIN_PIXELCLOCK, ADV7511_MAX_PIXELCLOCK,
V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING |
V4L2_DV_BT_CAP_CUSTOM)
};
static inline struct adv7511_state *get_adv7511_state(struct v4l2_subdev *sd)
{
return container_of(sd, struct adv7511_state, sd);
}
static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
{
return &container_of(ctrl->handler, struct adv7511_state, hdl)->sd;
}
/* ------------------------ I2C ----------------------------------------------- */
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/hdmi.h`.
- Detected declarations: `struct adv7511_state_edid`, `struct adv7511_state`, `struct adv7511_cfg_read_infoframe`, `function adv_smbus_read_byte_data_check`, `function adv_smbus_read_byte_data`, `function adv7511_rd`, `function adv7511_wr`, `function adv7511_wr_and_or`, `function adv7511_edid_rd`, `function adv7511_cec_read`.
- 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.