[Intel-gfx] [PATCH 09/18] drm/i915/display13: Handle new location of outputs D and E

Matt Roper matthew.d.roper at intel.com
Thu Jan 28 19:24:04 UTC 2021


The DDI naming template for Display12 went A-C, TC1-TC6.  With
Display13, that naming scheme for DDI's has now changed to A-E, TC1-TC4.

The Display13 design keeps the register offsets and bitfields relating
to the TC outputs in the same location they were on Display12.  The new
"D" and "E" outputs now take the locations that were previously used by
Display12's TC5 and TC6 outputs, or what we would have considered to be
outputs "H" and "I" under the legacy lettering scheme.

For the most part everything will just work as long as we initialize the
output with the proper 'enum port' value.  However we do need to take
care to pick the correct AUX channel when parsing the VBT (e.g., a
reference to 'AUX D' is actually asking us to use the 8th aux channel,
not the fourth).  We should also make sure that our encoders and aux
channels are named appropriately so that it's easier to correlate driver
debug messages with the bspec instructions.

Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
 drivers/gpu/drm/i915/display/intel_bios.c    |  8 ++++++--
 drivers/gpu/drm/i915/display/intel_ddi.c     |  8 +++++++-
 drivers/gpu/drm/i915/display/intel_display.c |  6 +++++-
 drivers/gpu/drm/i915/display/intel_display.h |  8 ++++++++
 drivers/gpu/drm/i915/display/intel_dp_aux.c  | 14 +++++++++-----
 5 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 04337ac6f8c4..b9e00fc3715d 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -2716,7 +2716,9 @@ enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
 			aux_ch = AUX_CH_C;
 		break;
 	case DP_AUX_D:
-		if (IS_ALDERLAKE_S(dev_priv))
+		if (HAS_DISPLAY13(dev_priv))
+			aux_ch = AUX_CH_D_D13;
+		else if (IS_ALDERLAKE_S(dev_priv))
 			aux_ch = AUX_CH_USBC3;
 		else if (IS_DG1(dev_priv) || IS_ROCKETLAKE(dev_priv))
 			aux_ch = AUX_CH_USBC2;
@@ -2724,7 +2726,9 @@ enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
 			aux_ch = AUX_CH_D;
 		break;
 	case DP_AUX_E:
-		if (IS_ALDERLAKE_S(dev_priv))
+		if (HAS_DISPLAY13(dev_priv))
+			aux_ch = AUX_CH_E_D13;
+		else if (IS_ALDERLAKE_S(dev_priv))
 			aux_ch = AUX_CH_USBC4;
 		else
 			aux_ch = AUX_CH_E;
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 9506b8048530..68e58e94f2a5 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -5520,7 +5520,13 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 
 	encoder = &dig_port->base;
 
-	if (INTEL_GEN(dev_priv) >= 12) {
+	if (HAS_DISPLAY13(dev_priv) && port >= PORT_D_D13) {
+		drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
+				 DRM_MODE_ENCODER_TMDS,
+				 "DDI %c/PHY %c",
+				 port_name(port - PORT_D_D13 + PORT_D),
+				 phy_name(phy));
+	} else if (INTEL_GEN(dev_priv) >= 12) {
 		enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
 
 		drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index f56237aaa7b5..4dc4b1be0809 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -5699,7 +5699,11 @@ bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy)
 
 enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port)
 {
-	if (IS_ALDERLAKE_S(i915) && port >= PORT_TC1)
+	if (HAS_DISPLAY13(i915) && port >= PORT_D_D13)
+		return PHY_D + port - PORT_D_D13;
+	else if (HAS_DISPLAY13(i915) && port >= PORT_TC1)
+		return PHY_F + port - PORT_TC1;
+	else if (IS_ALDERLAKE_S(i915) && port >= PORT_TC1)
 		return PHY_B + port - PORT_TC1;
 	else if ((IS_DG1(i915) || IS_ROCKETLAKE(i915)) && port >= PORT_TC1)
 		return PHY_C + port - PORT_TC1;
diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
index 64ffa34544a7..b102ec0d5390 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -216,6 +216,10 @@ enum port {
 	PORT_TC5,
 	PORT_TC6,
 
+	/* Display13 repositions D/E offsets and bitfields */
+	PORT_D_D13 = PORT_TC5,
+	PORT_E_D13,
+
 	I915_MAX_PORTS
 };
 
@@ -299,6 +303,10 @@ enum aux_ch {
 	AUX_CH_USBC4,
 	AUX_CH_USBC5,
 	AUX_CH_USBC6,
+
+	/* Display13 repositions D/E offsets and bitfields */
+	AUX_CH_D_D13 = AUX_CH_USBC5,
+	AUX_CH_E_D13,
 };
 
 #define aux_ch_name(a) ((a) + 'A')
diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.c b/drivers/gpu/drm/i915/display/intel_dp_aux.c
index eaebf123310a..355680ace6f9 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
@@ -600,8 +600,8 @@ static i915_reg_t tgl_aux_ctl_reg(struct intel_dp *intel_dp)
 	case AUX_CH_USBC2:
 	case AUX_CH_USBC3:
 	case AUX_CH_USBC4:
-	case AUX_CH_USBC5:
-	case AUX_CH_USBC6:
+	case AUX_CH_USBC5:  /* aka AUX_CH_D_D13 */
+	case AUX_CH_USBC6:  /* aka AUX_CH_E_D13 */
 		return DP_AUX_CH_CTL(aux_ch);
 	default:
 		MISSING_CASE(aux_ch);
@@ -623,8 +623,8 @@ static i915_reg_t tgl_aux_data_reg(struct intel_dp *intel_dp, int index)
 	case AUX_CH_USBC2:
 	case AUX_CH_USBC3:
 	case AUX_CH_USBC4:
-	case AUX_CH_USBC5:
-	case AUX_CH_USBC6:
+	case AUX_CH_USBC5:  /* aka AUX_CH_D_D13 */
+	case AUX_CH_USBC6:  /* aka AUX_CH_E_D13 */
 		return DP_AUX_CH_DATA(aux_ch, index);
 	default:
 		MISSING_CASE(aux_ch);
@@ -678,7 +678,11 @@ void intel_dp_aux_init(struct intel_dp *intel_dp)
 	drm_dp_aux_init(&intel_dp->aux);
 
 	/* Failure to allocate our preferred name is not critical */
-	if (INTEL_GEN(dev_priv) >= 12 && aux_ch >= AUX_CH_USBC1)
+	if (HAS_DISPLAY13(dev_priv) && aux_ch >= AUX_CH_D_D13)
+		intel_dp->aux.name = kasprintf(GFP_KERNEL, "AUX %c/%s",
+					       aux_ch_name(aux_ch - AUX_CH_D_D13 + AUX_CH_D),
+					       encoder->base.name);
+	else if (INTEL_GEN(dev_priv) >= 12 && aux_ch >= AUX_CH_USBC1)
 		intel_dp->aux.name = kasprintf(GFP_KERNEL, "AUX USBC%c/%s",
 					       aux_ch - AUX_CH_USBC1 + '1',
 					       encoder->base.name);
-- 
2.25.4



More information about the Intel-gfx mailing list