drivers/gpu/drm/i915/display/intel_hotplug_irq.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_hotplug_irq.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/i915/display/intel_hotplug_irq.c
Extension
.c
Size
41234 bytes
Lines
1492
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct intel_hotplug_irq_funcs {
	/* Enable HPD sense and interrupts for all present encoders */
	void (*hpd_irq_setup)(struct intel_display *display);
	/* Enable HPD sense for a single encoder */
	void (*hpd_enable_detection)(struct intel_encoder *encoder);
};

#define HPD_FUNCS(platform)					 \
static const struct intel_hotplug_irq_funcs platform##_hpd_funcs = { \
	.hpd_irq_setup = platform##_hpd_irq_setup,		 \
	.hpd_enable_detection = platform##_hpd_enable_detection, \
}

HPD_FUNCS(i915);
HPD_FUNCS(xelpdp);
HPD_FUNCS(dg1);
HPD_FUNCS(gen11);
HPD_FUNCS(bxt);
HPD_FUNCS(icp);
HPD_FUNCS(spt);
HPD_FUNCS(ilk);
#undef HPD_FUNCS

void intel_hpd_enable_detection(struct intel_encoder *encoder)
{
	struct intel_display *display = to_intel_display(encoder);

	if (display->hotplug.funcs)
		display->hotplug.funcs->hpd_enable_detection(encoder);
}

void intel_hpd_irq_setup(struct intel_display *display)
{
	if ((display->platform.valleyview || display->platform.cherryview) &&
	    !display->irq.vlv_display_irqs_enabled)
		return;

	if (display->hotplug.funcs)
		display->hotplug.funcs->hpd_irq_setup(display);
}

void intel_hotplug_irq_init(struct intel_display *display)
{
	intel_hpd_init_pins(display);

	intel_hpd_init_early(display);

	if (HAS_GMCH(display)) {
		if (HAS_HOTPLUG(display))
			display->hotplug.funcs = &i915_hpd_funcs;
	} else {
		if (HAS_PCH_DG2(display))
			display->hotplug.funcs = &icp_hpd_funcs;
		else if (HAS_PCH_DG1(display))
			display->hotplug.funcs = &dg1_hpd_funcs;
		else if (DISPLAY_VER(display) >= 14)
			display->hotplug.funcs = &xelpdp_hpd_funcs;
		else if (DISPLAY_VER(display) >= 11)
			display->hotplug.funcs = &gen11_hpd_funcs;
		else if (display->platform.geminilake || display->platform.broxton)
			display->hotplug.funcs = &bxt_hpd_funcs;
		else if (INTEL_PCH_TYPE(display) >= PCH_ICP)
			display->hotplug.funcs = &icp_hpd_funcs;
		else if (INTEL_PCH_TYPE(display) >= PCH_SPT)
			display->hotplug.funcs = &spt_hpd_funcs;
		else
			display->hotplug.funcs = &ilk_hpd_funcs;
	}
}

Annotation

Implementation Notes