From: Imre Deak <imre.deak@intel.com>
To: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Subject: [PATCH 03/13] drm/i915/nvl+: Add support for remapping logical HPD pins to HW pins
Date: Thu, 26 Nov 2026 12:07:43 +0200 [thread overview]
Message-ID: <20261126100755.1252635-4-imre.deak@intel.com> (raw)
In-Reply-To: <20261126100755.1252635-1-imre.deak@intel.com>
Add support for remapping an encoder's logical HPD pin to north and PCH
HW pins. This prepares for moving a legacy port's handling to another
encoder, changing a TC encoder's legacy/alt mode role and its
legacy/DP-alt/TBT-alt HPD sources.
Only the legacy PCH mapping needs to select a different HW pin. North
pins retain their identity mapping or have their source disabled.
Limit support to NVL+ for now, leaving a unified approach for later.
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
.../gpu/drm/i915/display/intel_display_core.h | 4 +
.../gpu/drm/i915/display/intel_hotplug_irq.c | 115 ++++++++++++++++--
.../gpu/drm/i915/display/intel_hotplug_irq.h | 4 +
3 files changed, 113 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
index b422d24e21b2d..72183bfee07a3 100644
--- a/drivers/gpu/drm/i915/display/intel_display_core.h
+++ b/drivers/gpu/drm/i915/display/intel_display_core.h
@@ -168,6 +168,10 @@ struct intel_hotplug {
struct delayed_work hotplug_work;
const u32 *hpd, *pch_hpd;
+ /* Mutable hardware sources for stable logical pins on NVL+. */
+ u32 hpd_map[HPD_NUM_PINS], pch_hpd_map[HPD_NUM_PINS];
+ /* Logical to physical PCH pin; HPD_NONE means no south source. */
+ enum hpd_pin pch_pin_map[HPD_NUM_PINS];
struct {
unsigned long last_jiffies;
diff --git a/drivers/gpu/drm/i915/display/intel_hotplug_irq.c b/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
index 81aaf38f1b130..da45eb4775707 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
@@ -136,6 +136,14 @@ static const u32 hpd_mtp[HPD_NUM_PINS] = {
static void intel_hpd_init_pins(struct intel_display *display)
{
struct intel_hotplug *hpd = &display->hotplug;
+ enum hpd_pin pin;
+
+ /*
+ * NOTE: the pin map is only used by MTL+, but for simplicity init it
+ * for all platforms.
+ */
+ for (pin = HPD_NONE; pin < HPD_NUM_PINS; pin++)
+ hpd->pch_pin_map[pin] = pin;
if (HAS_GMCH(display)) {
if (display->platform.g4x || display->platform.valleyview ||
@@ -146,7 +154,14 @@ static void intel_hpd_init_pins(struct intel_display *display)
return;
}
- if (DISPLAY_VER(display) >= 14)
+ if (DISPLAY_VER(display) >= 35) {
+ /*
+ * The (north) HPD map is only used by NVL+.
+ * TODO: Make the mapping logic platform independent.
+ */
+ memcpy(hpd->hpd_map, hpd_xelpdp, sizeof(hpd->hpd_map));
+ hpd->hpd = hpd->hpd_map;
+ } else if (DISPLAY_VER(display) >= 14)
hpd->hpd = hpd_xelpdp;
else if (DISPLAY_VER(display) >= 11)
hpd->hpd = hpd_gen11;
@@ -165,7 +180,14 @@ static void intel_hpd_init_pins(struct intel_display *display)
(!HAS_PCH_SPLIT(display) || HAS_PCH_NOP(display)))
return;
- if (INTEL_PCH_TYPE(display) >= PCH_MTL)
+ if (DISPLAY_VER(display) >= 35) {
+ /*
+ * The PCH HPD map is only used by NVL+.
+ * TODO: Make the mapping logic platform independent.
+ */
+ memcpy(hpd->pch_hpd_map, hpd_mtp, sizeof(hpd->pch_hpd_map));
+ hpd->pch_hpd = hpd->pch_hpd_map;
+ } else if (INTEL_PCH_TYPE(display) >= PCH_MTL)
hpd->pch_hpd = hpd_mtp;
else if (INTEL_PCH_TYPE(display) >= PCH_DG1)
hpd->pch_hpd = hpd_sde_dg1;
@@ -181,6 +203,38 @@ static void intel_hpd_init_pins(struct intel_display *display)
MISSING_CASE(INTEL_PCH_TYPE(display));
}
+/*
+ * Remap an encoder's logical TC HPD pin to separate north and PCH HW HPD
+ * pins. The north mapping must be an identity mapping or disable the
+ * source. The PCH mapping may select any TC HW pin or disable the source.
+ * Either source is disabled by mapping it to HPD_NONE.
+ *
+ * TODO: Make the remapping generic and independent of the platform.
+ */
+void intel_hpd_set_pin_sources(struct intel_display *display, enum
+ hpd_pin logical_pin, enum hpd_pin hw_pin,
+ enum hpd_pin pch_hw_pin)
+{
+ struct intel_hotplug *hpd = &display->hotplug;
+
+ if (drm_WARN_ON(display->drm, DISPLAY_VER(display) < 35))
+ return;
+
+ if (drm_WARN_ON(display->drm, logical_pin < HPD_PORT_TC1 || logical_pin > HPD_PORT_TC4))
+ return;
+
+ if (drm_WARN_ON(display->drm, hw_pin != HPD_NONE && logical_pin != hw_pin))
+ return;
+
+ if (drm_WARN_ON(display->drm, pch_hw_pin != HPD_NONE &&
+ (pch_hw_pin < HPD_PORT_TC1 || pch_hw_pin > HPD_PORT_TC4)))
+ return;
+
+ hpd->hpd_map[logical_pin] = hpd_xelpdp[hw_pin];
+ hpd->pch_pin_map[logical_pin] = pch_hw_pin;
+ hpd->pch_hpd_map[logical_pin] = hpd_mtp[pch_hw_pin];
+}
+
/* For display hotplug interrupt */
void i915_hotplug_interrupt_update_locked(struct intel_display *display,
u32 mask, u32 bits)
@@ -552,6 +606,28 @@ void xelpdp_pica_irq_handler(struct intel_display *display, u32 iir)
"Unexpected DE HPD/AUX interrupt 0x%08x\n", iir);
}
+static void xe3plpd_tc_hpd_pins(struct intel_display *display,
+ u32 *pin_mask, u32 *long_mask,
+ u32 trigger, u32 hotplug_reg)
+{
+ enum hpd_pin pin;
+
+ for (pin = HPD_PORT_TC1; pin <= HPD_PORT_TC4; pin++) {
+ enum hpd_pin hw_pin = display->hotplug.pch_pin_map[pin];
+
+ if (!(display->hotplug.pch_hpd[pin] & trigger))
+ continue;
+
+ *pin_mask |= BIT(pin);
+ if (icp_tc_port_hotplug_long_detect(hw_pin, hotplug_reg))
+ *long_mask |= BIT(pin);
+ }
+
+ drm_dbg_kms(display->drm,
+ "hotplug event received, stat 0x%08x, dig 0x%08x, pins 0x%08x, long 0x%08x\n",
+ trigger, hotplug_reg, *pin_mask, *long_mask);
+}
+
void icp_irq_handler(struct intel_display *display, u32 pch_iir)
{
u32 ddi_hotplug_trigger = pch_iir & SDE_DDI_HOTPLUG_MASK_ICP;
@@ -577,10 +653,14 @@ void icp_irq_handler(struct intel_display *display, u32 pch_iir)
dig_hotplug_reg = intel_de_rmw_fw(display, SHOTPLUG_CTL_TC, 0, 0);
- intel_get_hpd_pins(display, &pin_mask, &long_mask,
- tc_hotplug_trigger, dig_hotplug_reg,
- display->hotplug.pch_hpd,
- icp_tc_port_hotplug_long_detect);
+ if (DISPLAY_VER(display) >= 35)
+ xe3plpd_tc_hpd_pins(display, &pin_mask, &long_mask,
+ tc_hotplug_trigger, dig_hotplug_reg);
+ else
+ intel_get_hpd_pins(display, &pin_mask, &long_mask,
+ tc_hotplug_trigger, dig_hotplug_reg,
+ display->hotplug.pch_hpd,
+ icp_tc_port_hotplug_long_detect);
}
if (pin_mask)
@@ -994,7 +1074,10 @@ static u32 mtp_tc_hotplug_mask(enum hpd_pin hpd_pin)
static u32 mtp_tc_hotplug_enables(struct intel_encoder *encoder)
{
- return mtp_tc_hotplug_mask(encoder->hpd_pin);
+ struct intel_display *display = to_intel_display(encoder);
+ enum hpd_pin hw_pin = display->hotplug.pch_pin_map[encoder->hpd_pin];
+
+ return mtp_tc_hotplug_mask(hw_pin);
}
static void mtp_ddi_hpd_detection_setup(struct intel_display *display)
@@ -1096,6 +1179,12 @@ static void _xelpdp_pica_hpd_detection_setup(struct intel_display *display,
u32 mask = XELPDP_TBT_HOTPLUG_ENABLE |
XELPDP_DP_ALT_HOTPLUG_ENABLE;
+ /*
+ * North HPD mappings are either identity mappings or disabled, so the
+ * logical pin passed here can also be used as the HW pin.
+ *
+ * TODO: Unify north and PCH HPD mapping handling.
+ */
if (!is_xelpdp_pica_hpd_pin(hpd_pin))
return;
@@ -1119,7 +1208,8 @@ static void xelpdp_pica_hpd_detection_setup(struct intel_display *display)
BUILD_BUG_ON(BITS_PER_TYPE(available_pins) < HPD_NUM_PINS);
for_each_intel_encoder(display->drm, encoder)
- available_pins |= BIT(encoder->hpd_pin);
+ if (display->hotplug.hpd[encoder->hpd_pin])
+ available_pins |= BIT(encoder->hpd_pin);
for_each_hpd_pin(pin)
_xelpdp_pica_hpd_detection_setup(display, pin, available_pins & BIT(pin));
@@ -1127,8 +1217,13 @@ static void xelpdp_pica_hpd_detection_setup(struct intel_display *display)
static void xelpdp_hpd_enable_detection(struct intel_encoder *encoder)
{
- xelpdp_pica_hpd_enable_detection(encoder);
- mtp_hpd_enable_detection(encoder);
+ struct intel_display *display = to_intel_display(encoder);
+
+ if (display->hotplug.hpd[encoder->hpd_pin])
+ xelpdp_pica_hpd_enable_detection(encoder);
+
+ if (display->hotplug.pch_hpd[encoder->hpd_pin])
+ mtp_hpd_enable_detection(encoder);
}
static void xelpdp_hpd_irq_setup(struct intel_display *display)
diff --git a/drivers/gpu/drm/i915/display/intel_hotplug_irq.h b/drivers/gpu/drm/i915/display/intel_hotplug_irq.h
index 9063bb02a2e9a..9bfa446202b69 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug_irq.h
+++ b/drivers/gpu/drm/i915/display/intel_hotplug_irq.h
@@ -8,6 +8,7 @@
#include <linux/types.h>
+enum hpd_pin;
struct intel_display;
struct intel_encoder;
@@ -27,6 +28,9 @@ void i915_hotplug_interrupt_update_locked(struct intel_display *display,
void i915_hotplug_interrupt_update(struct intel_display *display,
u32 mask, u32 bits);
+void intel_hpd_set_pin_sources(struct intel_display *display, enum hpd_pin logical_pin,
+ enum hpd_pin hw_pin, enum hpd_pin pch_hw_pin);
+
void intel_hpd_enable_detection(struct intel_encoder *encoder);
void intel_hpd_irq_setup(struct intel_display *display);
--
2.49.1
next prev parent reply other threads:[~2026-11-26 10:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 10:07 [PATCH 00/13] drm/i915/ddi_mgr: Add support for dynamic DDI allocation Imre Deak
2026-11-26 10:07 ` [PATCH 01/13] drm/i915/dp: Allow rebuilding the source rate list Imre Deak
2026-11-26 10:07 ` [PATCH 02/13] drm/i915/hotplug: Set detector enable bits without a clear mask Imre Deak
2026-11-26 10:07 ` Imre Deak [this message]
2026-11-26 10:07 ` [PATCH 04/13] drm/xe/display: Distinguish failed system suspend recovery Imre Deak
2026-11-26 13:22 ` Jani Nikula
2026-11-26 10:07 ` [PATCH 05/13] drm/i915/gmbus: Extract a helper for Type-C DDC pin mapping Imre Deak
2026-11-26 10:07 ` [PATCH 06/13] drm/i915/ddi_mgr: Add support for dynamic DDI allocation Imre Deak
2026-11-26 13:23 ` Jani Nikula
2026-11-26 16:51 ` Imre Deak
2026-11-26 10:07 ` [PATCH 07/13] drm/i915/gmbus: Extract adapter creation and destruction Imre Deak
2026-11-26 10:07 ` [PATCH 08/13] drm/i915/gmbus: Add stable DDC adapters for the DDI pool Imre Deak
2026-11-26 10:07 ` [PATCH 09/13] drm/i915/ddi_mgr: Register encoders with dynamic DDI support Imre Deak
2026-11-26 10:26 ` sashiko-bot
2026-11-26 10:07 ` [PATCH 10/13] drm/i915/ddi_mgr: Keep AUX access consistent with DDI pool routes Imre Deak
2026-11-26 10:07 ` [PATCH 11/13] drm/i915/ddi_mgr: Verify and restore DDI allocations after runtime resume Imre Deak
2026-11-26 13:25 ` Jani Nikula
2026-11-26 10:07 ` [PATCH 12/13] drm/i915/ddi_mgr: Handle DDI pool system suspend and resume Imre Deak
2026-11-26 10:41 ` sashiko-bot
2026-11-26 13:25 ` Jani Nikula
2026-11-26 10:07 ` [PATCH 13/13] drm/i915/ddi_mgr: Enable dynamic DDI allocation at load Imre Deak
2026-11-26 11:15 ` ✗ i915.CI.BAT: failure for drm/i915/ddi_mgr: Add support for dynamic DDI allocation Patchwork
2026-11-26 14:08 ` ✗ CI.checkpatch: warning " Patchwork
2026-11-26 14:10 ` ✓ CI.KUnit: success " Patchwork
2026-11-26 14:49 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-26 21:32 ` ✓ Xe.CI.FULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126100755.1252635-4-imre.deak@intel.com \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.