drivers/media/i2c/adv748x/adv748x-hdmi.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/adv748x/adv748x-hdmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/adv748x/adv748x-hdmi.c- Extension
.c- Size
- 20764 bytes
- Lines
- 762
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/mutex.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-dv-timings.hmedia/v4l2-ioctl.huapi/linux/v4l2-dv-timings.hadv748x.h
Detected Declarations
struct adv748x_hdmi_video_standardsfunction adv748x_hdmi_fill_formatfunction adv748x_fill_optional_dv_timingsfunction adv748x_hdmi_has_signalfunction adv748x_hdmi_read_pixelclockfunction adv748x_hdmi_set_de_timingsfunction adv748x_hdmi_set_video_timingsfunction adv748x_hdmi_s_dv_timingsfunction adv748x_hdmi_g_dv_timingsfunction adv748x_hdmi_query_dv_timingsfunction adv748x_hdmi_g_input_statusfunction adv748x_hdmi_s_streamfunction adv748x_hdmi_propagate_pixelratefunction adv748x_hdmi_enum_mbus_codefunction adv748x_hdmi_get_formatfunction adv748x_hdmi_set_formatfunction adv748x_hdmi_get_edidfunction adv748x_hdmi_edid_write_blockfunction adv748x_hdmi_set_edidfunction adv748x_hdmi_check_dv_timingsfunction adv748x_hdmi_enum_dv_timingsfunction adv748x_hdmi_dv_timings_capfunction adv748x_hdmi_s_ctrlfunction adv748x_hdmi_init_controlsfunction adv748x_hdmi_initfunction adv748x_hdmi_cleanup
Annotated Snippet
struct adv748x_hdmi_video_standards {
struct v4l2_dv_timings timings;
u8 vid_std;
u8 v_freq;
};
static const struct adv748x_hdmi_video_standards
adv748x_hdmi_video_standards[] = {
{ V4L2_DV_BT_CEA_720X480P59_94, 0x4a, 0x00 },
{ V4L2_DV_BT_CEA_720X576P50, 0x4b, 0x00 },
{ V4L2_DV_BT_CEA_1280X720P60, 0x53, 0x00 },
{ V4L2_DV_BT_CEA_1280X720P50, 0x53, 0x01 },
{ V4L2_DV_BT_CEA_1280X720P30, 0x53, 0x02 },
{ V4L2_DV_BT_CEA_1280X720P25, 0x53, 0x03 },
{ V4L2_DV_BT_CEA_1280X720P24, 0x53, 0x04 },
{ V4L2_DV_BT_CEA_1920X1080P60, 0x5e, 0x00 },
{ V4L2_DV_BT_CEA_1920X1080P50, 0x5e, 0x01 },
{ V4L2_DV_BT_CEA_1920X1080P30, 0x5e, 0x02 },
{ V4L2_DV_BT_CEA_1920X1080P25, 0x5e, 0x03 },
{ V4L2_DV_BT_CEA_1920X1080P24, 0x5e, 0x04 },
/* SVGA */
{ V4L2_DV_BT_DMT_800X600P56, 0x80, 0x00 },
{ V4L2_DV_BT_DMT_800X600P60, 0x81, 0x00 },
{ V4L2_DV_BT_DMT_800X600P72, 0x82, 0x00 },
{ V4L2_DV_BT_DMT_800X600P75, 0x83, 0x00 },
{ V4L2_DV_BT_DMT_800X600P85, 0x84, 0x00 },
/* SXGA */
{ V4L2_DV_BT_DMT_1280X1024P60, 0x85, 0x00 },
{ V4L2_DV_BT_DMT_1280X1024P75, 0x86, 0x00 },
/* VGA */
{ V4L2_DV_BT_DMT_640X480P60, 0x88, 0x00 },
{ V4L2_DV_BT_DMT_640X480P72, 0x89, 0x00 },
{ V4L2_DV_BT_DMT_640X480P75, 0x8a, 0x00 },
{ V4L2_DV_BT_DMT_640X480P85, 0x8b, 0x00 },
/* XGA */
{ V4L2_DV_BT_DMT_1024X768P60, 0x8c, 0x00 },
{ V4L2_DV_BT_DMT_1024X768P70, 0x8d, 0x00 },
{ V4L2_DV_BT_DMT_1024X768P75, 0x8e, 0x00 },
{ V4L2_DV_BT_DMT_1024X768P85, 0x8f, 0x00 },
/* UXGA */
{ V4L2_DV_BT_DMT_1600X1200P60, 0x96, 0x00 },
};
static void adv748x_hdmi_fill_format(struct adv748x_hdmi *hdmi,
struct v4l2_mbus_framefmt *fmt)
{
memset(fmt, 0, sizeof(*fmt));
fmt->code = MEDIA_BUS_FMT_RGB888_1X24;
fmt->field = hdmi->timings.bt.interlaced ?
V4L2_FIELD_ALTERNATE : V4L2_FIELD_NONE;
/* TODO: The colorspace depends on the AVI InfoFrame contents */
fmt->colorspace = V4L2_COLORSPACE_SRGB;
fmt->width = hdmi->timings.bt.width;
fmt->height = hdmi->timings.bt.height;
if (fmt->field == V4L2_FIELD_ALTERNATE)
fmt->height /= 2;
}
static void adv748x_fill_optional_dv_timings(struct v4l2_dv_timings *timings)
{
v4l2_find_dv_timings_cap(timings, &adv748x_hdmi_timings_cap,
250000, NULL, NULL);
}
static bool adv748x_hdmi_has_signal(struct adv748x_state *state)
{
int val;
/* Check that VERT_FILTER and DE_REGEN is locked */
val = hdmi_read(state, ADV748X_HDMI_LW1);
return (val & ADV748X_HDMI_LW1_VERT_FILTER) &&
(val & ADV748X_HDMI_LW1_DE_REGEN);
}
static int adv748x_hdmi_read_pixelclock(struct adv748x_state *state)
{
int a, b;
a = hdmi_read(state, ADV748X_HDMI_TMDS_1);
b = hdmi_read(state, ADV748X_HDMI_TMDS_2);
if (a < 0 || b < 0)
return -ENODATA;
/*
* The high 9 bits store TMDS frequency measurement in MHz
* The low 7 bits of TMDS_2 store the 7-bit TMDS fractional frequency
Annotation
- Immediate include surface: `linux/module.h`, `linux/mutex.h`, `media/v4l2-ctrls.h`, `media/v4l2-device.h`, `media/v4l2-dv-timings.h`, `media/v4l2-ioctl.h`, `uapi/linux/v4l2-dv-timings.h`, `adv748x.h`.
- Detected declarations: `struct adv748x_hdmi_video_standards`, `function adv748x_hdmi_fill_format`, `function adv748x_fill_optional_dv_timings`, `function adv748x_hdmi_has_signal`, `function adv748x_hdmi_read_pixelclock`, `function adv748x_hdmi_set_de_timings`, `function adv748x_hdmi_set_video_timings`, `function adv748x_hdmi_s_dv_timings`, `function adv748x_hdmi_g_dv_timings`, `function adv748x_hdmi_query_dv_timings`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.