drivers/gpu/drm/i915/gvt/edid.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gvt/edid.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gvt/edid.c- Extension
.c- Size
- 15949 bytes
- Lines
- 586
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/display/drm_dp.hdrm/drm_print.hdisplay/intel_dp_aux_regs.hdisplay/intel_gmbus.hdisplay/intel_gmbus_regs.hgvt.hi915_drv.hi915_reg.h
Detected Declarations
function Copyrightfunction cnp_get_port_from_gmbus0function bxt_get_port_from_gmbus0function get_port_from_gmbus0function reset_gmbus_controllerfunction gmbus0_mmio_writefunction gmbus1_mmio_writefunction gmbus3_mmio_writefunction gmbus3_mmio_readfunction gmbus2_mmio_readfunction gmbus2_mmio_writefunction intel_gvt_i2c_handle_gmbus_readfunction intel_gvt_i2c_handle_gmbus_writefunction get_aux_ch_regfunction intel_gvt_i2c_handle_aux_ch_writefunction intel_vgpu_init_i2c_edid
Annotated Snippet
if (!(wvalue & GMBUS_SW_CLR_INT)) {
vgpu_vreg(vgpu, offset) &= ~GMBUS_SW_CLR_INT;
reset_gmbus_controller(vgpu);
}
/*
* TODO: "This bit is cleared to zero when an event
* causes the HW_RDY bit transition to occur "
*/
} else {
/*
* per bspec setting this bit can cause:
* 1) INT status bit cleared
* 2) HW_RDY bit asserted
*/
if (wvalue & GMBUS_SW_CLR_INT) {
vgpu_vreg_t(vgpu, PCH_GMBUS2) &= ~GMBUS_INT;
vgpu_vreg_t(vgpu, PCH_GMBUS2) |= GMBUS_HW_RDY;
}
/* For virtualization, we suppose that HW is always ready,
* so GMBUS_SW_RDY should always be cleared
*/
if (wvalue & GMBUS_SW_RDY)
wvalue &= ~GMBUS_SW_RDY;
i2c_edid->gmbus.total_byte_count =
gmbus1_total_byte_count(wvalue);
target_addr = gmbus1_target_addr(wvalue);
/* vgpu gmbus only support EDID */
if (target_addr == EDID_ADDR) {
i2c_edid->target_selected = true;
} else if (target_addr != 0) {
gvt_dbg_dpy(
"vgpu%d: unsupported gmbus target addr(0x%x)\n"
" gmbus operations will be ignored.\n",
vgpu->id, target_addr);
}
if (wvalue & GMBUS_CYCLE_INDEX)
i2c_edid->current_edid_read =
gmbus1_target_index(wvalue);
i2c_edid->gmbus.cycle_type = gmbus1_bus_cycle(wvalue);
switch (gmbus1_bus_cycle(wvalue)) {
case GMBUS_NOCYCLE:
break;
case GMBUS_STOP:
/* From spec:
* This can only cause a STOP to be generated
* if a GMBUS cycle is generated, the GMBUS is
* currently in a data/wait/idle phase, or it is in a
* WAIT phase
*/
if (gmbus1_bus_cycle(vgpu_vreg(vgpu, offset))
!= GMBUS_NOCYCLE) {
intel_vgpu_init_i2c_edid(vgpu);
/* After the 'stop' cycle, hw state would become
* 'stop phase' and then 'idle phase' after a
* few milliseconds. In emulation, we just set
* it as 'idle phase' ('stop phase' is not
* visible in gmbus interface)
*/
i2c_edid->gmbus.phase = GMBUS_IDLE_PHASE;
vgpu_vreg_t(vgpu, PCH_GMBUS2) &= ~GMBUS_ACTIVE;
}
break;
case NIDX_NS_W:
case IDX_NS_W:
case NIDX_STOP:
case IDX_STOP:
/* From hw spec the GMBUS phase
* transition like this:
* START (-->INDEX) -->DATA
*/
i2c_edid->gmbus.phase = GMBUS_DATA_PHASE;
vgpu_vreg_t(vgpu, PCH_GMBUS2) |= GMBUS_ACTIVE;
break;
default:
gvt_vgpu_err("Unknown/reserved GMBUS cycle detected!\n");
break;
}
/*
* From hw spec the WAIT state will be
* cleared:
* (1) in a new GMBUS cycle
* (2) by generating a stop
*/
vgpu_vreg(vgpu, offset) = wvalue;
}
Annotation
- Immediate include surface: `drm/display/drm_dp.h`, `drm/drm_print.h`, `display/intel_dp_aux_regs.h`, `display/intel_gmbus.h`, `display/intel_gmbus_regs.h`, `gvt.h`, `i915_drv.h`, `i915_reg.h`.
- Detected declarations: `function Copyright`, `function cnp_get_port_from_gmbus0`, `function bxt_get_port_from_gmbus0`, `function get_port_from_gmbus0`, `function reset_gmbus_controller`, `function gmbus0_mmio_write`, `function gmbus1_mmio_write`, `function gmbus3_mmio_write`, `function gmbus3_mmio_read`, `function gmbus2_mmio_read`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.