drivers/gpu/drm/i915/display/intel_crt.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_crt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_crt.c- Extension
.c- Size
- 33177 bytes
- Lines
- 1140
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/dmi.hlinux/i2c.hlinux/slab.hdrm/drm_atomic_helper.hdrm/drm_crtc.hdrm/drm_edid.hdrm/drm_print.hdrm/drm_probe_helper.hvideo/vga.hintel_connector.hintel_crt.hintel_crt_regs.hintel_crtc.hintel_ddi.hintel_ddi_buf_trans.hintel_de.hintel_display_driver.hintel_display_regs.hintel_display_types.hintel_fdi.hintel_fdi_regs.hintel_fifo_underrun.hintel_gmbus.hintel_hotplug.hintel_hotplug_irq.hintel_link_bw.hintel_load_detect.hintel_pch_display.hintel_pch_refclk.hintel_pfit.hintel_vga.h
Detected Declarations
struct intel_crtfunction intel_crt_port_enabledfunction intel_crt_get_hw_statefunction intel_crt_get_flagsfunction intel_crt_get_configfunction hsw_crt_get_configfunction intel_crt_set_dpmsfunction intel_disable_crtfunction pch_disable_crtfunction hsw_disable_crtfunction hsw_post_disable_crtfunction hsw_pre_pll_enable_crtfunction hsw_pre_enable_crtfunction hsw_enable_crtfunction intel_enable_crtfunction intel_crt_mode_validfunction intel_crt_compute_configfunction pch_crt_compute_configfunction hsw_crt_compute_configfunction ilk_crt_detect_hotplugfunction valleyview_crt_detect_hotplugfunction intel_crt_detect_hotplugfunction intel_crt_ddc_get_modesfunction intel_crt_detect_ddcfunction intel_crt_sense_above_thresholdfunction intel_crt_load_detectfunction intel_spurious_crt_detect_dmi_callbackfunction intel_crt_detectfunction monitorfunction intel_crt_get_modesfunction intel_crt_resetfunction intel_crt_init
Annotated Snippet
struct intel_crt {
struct intel_encoder base;
bool force_hotplug_required;
intel_reg_t adpa_reg;
};
static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder)
{
return container_of(encoder, struct intel_crt, base);
}
static struct intel_crt *intel_attached_crt(struct intel_connector *connector)
{
return intel_encoder_to_crt(intel_attached_encoder(connector));
}
bool intel_crt_port_enabled(struct intel_display *display,
intel_reg_t adpa_reg, enum pipe *pipe)
{
u32 val;
val = intel_de_read(display, adpa_reg);
/* asserts want to know the pipe even if the port is disabled */
if (HAS_PCH_CPT(display))
*pipe = REG_FIELD_GET(ADPA_PIPE_SEL_MASK_CPT, val);
else
*pipe = REG_FIELD_GET(ADPA_PIPE_SEL_MASK, val);
return val & ADPA_DAC_ENABLE;
}
static bool intel_crt_get_hw_state(struct intel_encoder *encoder,
enum pipe *pipe)
{
struct intel_display *display = to_intel_display(encoder);
struct intel_crt *crt = intel_encoder_to_crt(encoder);
struct ref_tracker *wakeref;
bool ret;
wakeref = intel_display_power_get_if_enabled(display,
encoder->power_domain);
if (!wakeref)
return false;
ret = intel_crt_port_enabled(display, crt->adpa_reg, pipe);
intel_display_power_put(display, encoder->power_domain, wakeref);
return ret;
}
static unsigned int intel_crt_get_flags(struct intel_encoder *encoder)
{
struct intel_display *display = to_intel_display(encoder);
struct intel_crt *crt = intel_encoder_to_crt(encoder);
u32 tmp, flags = 0;
tmp = intel_de_read(display, crt->adpa_reg);
if (tmp & ADPA_HSYNC_ACTIVE_HIGH)
flags |= DRM_MODE_FLAG_PHSYNC;
else
flags |= DRM_MODE_FLAG_NHSYNC;
if (tmp & ADPA_VSYNC_ACTIVE_HIGH)
flags |= DRM_MODE_FLAG_PVSYNC;
else
flags |= DRM_MODE_FLAG_NVSYNC;
return flags;
}
static void intel_crt_get_config(struct intel_encoder *encoder,
struct intel_crtc_state *crtc_state)
{
crtc_state->output_types |= BIT(INTEL_OUTPUT_ANALOG);
crtc_state->hw.adjusted_mode.flags |= intel_crt_get_flags(encoder);
crtc_state->hw.adjusted_mode.crtc_clock = crtc_state->port_clock;
}
static void hsw_crt_get_config(struct intel_encoder *encoder,
struct intel_crtc_state *crtc_state)
{
lpt_pch_get_config(crtc_state);
hsw_ddi_get_config(encoder, crtc_state);
Annotation
- Immediate include surface: `linux/dmi.h`, `linux/i2c.h`, `linux/slab.h`, `drm/drm_atomic_helper.h`, `drm/drm_crtc.h`, `drm/drm_edid.h`, `drm/drm_print.h`, `drm/drm_probe_helper.h`.
- Detected declarations: `struct intel_crt`, `function intel_crt_port_enabled`, `function intel_crt_get_hw_state`, `function intel_crt_get_flags`, `function intel_crt_get_config`, `function hsw_crt_get_config`, `function intel_crt_set_dpms`, `function intel_disable_crt`, `function pch_disable_crt`, `function hsw_disable_crt`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.