All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table
@ 2019-12-23 19:58 Lucas De Marchi
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 1/9] drm/i915/display: nuke skl workaround for pre-production hw Lucas De Marchi
                   ` (10 more replies)
  0 siblings, 11 replies; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

First 3 commits are more or less independent from this RFC and pretty
harmless "drive-by changes".

For the others: my intention is to get rid of the never ending checks
for platform to decide what to depending on the port and phy,
conversions from port to phy, port to tc_port, etc.

For that I decided to create a table-based initialization approach in
which I keep the useful indexes for each platform: these indexes work
similarly to what we have on the pll part. "enum port" is mostly a
"driver thing" and when all the conversions take place, it would allow
us to stop using the port as indexes to register or register bits. "enum
tc_port", "enum phy", etc are not meaningful numbers from the spec POV
and change with every other platform.

I'm doing the conversion to use the new indexes, but the effort is
paramount as the port <-> tc_port <-> phy, paired with the checks
intel_phy_is_combo(), are everywhere, hence this RFC on the idea before
I continue the conversions.

Right now I'm keeping a intel_ddi_port_info inside intel_digital_port
(see last commit). I first imagined I could ignore the dsi part and let
it leave on its own world, but upon converting
icl_dpclka_cfgcr0_clk_off() and  icl_sanitize_encoder_pll_mapping() I
noticed this is probably not true, since it re-uses the phy mapping.
So, I would probably have to move the port_info to intel_encoder and
make let the dsi init also fill it up or let the dsi init() call be part
of the ddi init. IMO the latter is better, but pulls another great
amount of work to complete.

RFC: do you see other shortcomings? I think this provides a nice cleanup
but others may disagree.


Lucas De Marchi (9):
  drm/i915/display: nuke skl workaround for pre-production hw
  drm/i915/display: remove alias to dig_port
  drm/i915/display: prefer the more common dig_port name
  drm/i915/display: start description-based ddi initialization
  drm/i915/display: move icl to description-based ddi init
  drm/i915/display: description-based initialization for remaining ddi
    platforms
  drm/i915/display: add phy, vbt and ddi indexes
  drm/i915/display: refer to vbt info as vbt_port_info
  drm/i915/display: use port_info on intel_ddi_init

 drivers/gpu/drm/i915/display/intel_ddi.c      |  93 +++----
 drivers/gpu/drm/i915/display/intel_ddi.h      |   8 +-
 drivers/gpu/drm/i915/display/intel_display.c  | 232 ++++++++++++------
 drivers/gpu/drm/i915/display/intel_display.h  |   9 +-
 .../drm/i915/display/intel_display_power.c    |   4 +-
 .../drm/i915/display/intel_display_types.h    |  20 +-
 drivers/gpu/drm/i915/display/intel_dpio_phy.c |  38 +--
 drivers/gpu/drm/i915/display/intel_hdmi.c     |  20 +-
 8 files changed, 269 insertions(+), 155 deletions(-)

-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 1/9] drm/i915/display: nuke skl workaround for pre-production hw
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 2/9] drm/i915/display: remove alias to dig_port Lucas De Marchi
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

According to intel_detect_preproduction_hw(), the SKL steeping D0 is
still pre-production so we can nuke the additional workaround.

While at it, nuke dangling new line.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 1860da0a493e..3b9011fd086c 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16280,14 +16280,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 		if (intel_ddi_crt_present(dev_priv))
 			intel_crt_init(dev_priv);
 
-		/*
-		 * Haswell uses DDI functions to detect digital outputs.
-		 * On SKL pre-D0 the strap isn't connected, so we assume
-		 * it's there.
-		 */
 		found = I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_INIT_DISPLAY_DETECTED;
-		/* WaIgnoreDDIAStrap: skl */
-		if (found || IS_GEN9_BC(dev_priv))
+		if (found)
 			intel_ddi_init(dev_priv, PORT_A);
 
 		/* DDI B, C, D, and F detection is indicated by the SFUSE_STRAP
@@ -16308,7 +16302,6 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 		if (IS_GEN9_BC(dev_priv) &&
 		    intel_bios_is_port_present(dev_priv, PORT_E))
 			intel_ddi_init(dev_priv, PORT_E);
-
 	} else if (HAS_PCH_SPLIT(dev_priv)) {
 		int found;
 
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 2/9] drm/i915/display: remove alias to dig_port
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 1/9] drm/i915/display: nuke skl workaround for pre-production hw Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-23 21:05   ` Matt Roper
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 3/9] drm/i915/display: prefer the more common dig_port name Lucas De Marchi
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

We don't need intel_dig_port and dig_port to refer to the same thing.
Prefer the latter.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index c9ba7d7f3787..f054c82214c0 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3674,12 +3674,11 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 				      const struct intel_crtc_state *crtc_state,
 				      const struct drm_connector_state *conn_state)
 {
-	struct intel_digital_port *intel_dig_port = enc_to_dig_port(&encoder->base);
-	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	struct intel_hdmi *intel_hdmi = &dig_port->hdmi;
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = encoder->port;
 	int level = intel_ddi_hdmi_level(dev_priv, port);
-	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 
 	intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
 	intel_ddi_clk_select(encoder, crtc_state);
@@ -3709,9 +3708,8 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 
 	intel_ddi_enable_pipe_clock(crtc_state);
 
-	intel_dig_port->set_infoframes(encoder,
-				       crtc_state->has_infoframe,
-				       crtc_state, conn_state);
+	dig_port->set_infoframes(encoder, crtc_state->has_infoframe,
+				 crtc_state, conn_state);
 }
 
 static void intel_ddi_pre_enable(struct intel_encoder *encoder,
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 3/9] drm/i915/display: prefer the more common dig_port name
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 1/9] drm/i915/display: nuke skl workaround for pre-production hw Lucas De Marchi
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 2/9] drm/i915/display: remove alias to dig_port Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-23 21:16   ` Matt Roper
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization Lucas De Marchi
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

intel_ddi.c uses a mix of dport and dig_port as variable for
intel_digital_port, with the latter being more frequent. In some cases
we were also using intel_dport to make it worse. intel_dpio_phy.c had
standardized on dport, but overall dig_port is much more common.
Standardize on dig_port.

This is the only place in the driver where we refer to a
intel_digital_port as intel_dport. Let's use the same name everywhere:
dig_port.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c      | 30 +++++++--------
 drivers/gpu/drm/i915/display/intel_display.c  |  6 +--
 drivers/gpu/drm/i915/display/intel_display.h  |  2 +-
 .../drm/i915/display/intel_display_power.c    |  4 +-
 .../drm/i915/display/intel_display_types.h    |  8 ++--
 drivers/gpu/drm/i915/display/intel_dpio_phy.c | 38 +++++++++----------
 drivers/gpu/drm/i915/display/intel_hdmi.c     | 20 +++++-----
 7 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index f054c82214c0..1bdf63845472 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -2900,9 +2900,9 @@ static u32 intel_ddi_dp_level(struct intel_dp *intel_dp)
 
 u32 bxt_signal_levels(struct intel_dp *intel_dp)
 {
-	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
-	struct intel_encoder *encoder = &dport->base;
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	struct intel_encoder *encoder = &dig_port->base;
 	int level = intel_ddi_dp_level(intel_dp);
 
 	if (INTEL_GEN(dev_priv) >= 12)
@@ -2921,9 +2921,9 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp)
 
 u32 ddi_signal_levels(struct intel_dp *intel_dp)
 {
-	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
-	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
-	struct intel_encoder *encoder = &dport->base;
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	struct intel_encoder *encoder = &dig_port->base;
 	int level = intel_ddi_dp_level(intel_dp);
 
 	if (IS_GEN9_BC(dev_priv))
@@ -4721,14 +4721,14 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)
 	return connector;
 }
 
-static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dport)
+static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dig_port)
 {
-	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
 
-	if (dport->base.port != PORT_A)
+	if (dig_port->base.port != PORT_A)
 		return false;
 
-	if (dport->saved_port_bits & DDI_A_4_LANES)
+	if (dig_port->saved_port_bits & DDI_A_4_LANES)
 		return false;
 
 	/* Broxton/Geminilake: Bspec says that DDI_A_4_LANES is the only
@@ -4750,10 +4750,10 @@ static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dport)
 }
 
 static int
-intel_ddi_max_lanes(struct intel_digital_port *intel_dport)
+intel_ddi_max_lanes(struct intel_digital_port *dig_port)
 {
-	struct drm_i915_private *dev_priv = to_i915(intel_dport->base.base.dev);
-	enum port port = intel_dport->base.port;
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	enum port port = dig_port->base.port;
 	int max_lanes = 4;
 
 	if (INTEL_GEN(dev_priv) >= 11)
@@ -4772,9 +4772,9 @@ intel_ddi_max_lanes(struct intel_digital_port *intel_dport)
 	 * wasn't lit up at boot.  Force this bit set when needed
 	 * so we use the proper lane count for our calculations.
 	 */
-	if (intel_ddi_a_force_4_lanes(intel_dport)) {
+	if (intel_ddi_a_force_4_lanes(dig_port)) {
 		DRM_DEBUG_KMS("Forcing DDI_A_4_LANES for port A\n");
-		intel_dport->saved_port_bits |= DDI_A_4_LANES;
+		dig_port->saved_port_bits |= DDI_A_4_LANES;
 		max_lanes = 4;
 	}
 
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 3b9011fd086c..04819b0bd494 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -1606,13 +1606,13 @@ static void chv_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
 }
 
 void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
-			 struct intel_digital_port *dport,
+			 struct intel_digital_port *dig_port,
 			 unsigned int expected_mask)
 {
 	u32 port_mask;
 	i915_reg_t dpll_reg;
 
-	switch (dport->base.port) {
+	switch (dig_port->base.port) {
 	case PORT_B:
 		port_mask = DPLL_PORTB_READY_MASK;
 		dpll_reg = DPLL(0);
@@ -1633,7 +1633,7 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
 	if (intel_de_wait_for_register(dev_priv, dpll_reg,
 				       port_mask, expected_mask, 1000))
 		WARN(1, "timed out waiting for [ENCODER:%d:%s] port ready: got 0x%x, expected 0x%x\n",
-		     dport->base.base.base.id, dport->base.base.name,
+		     dig_port->base.base.base.id, dig_port->base.base.name,
 		     I915_READ(dpll_reg) & port_mask, expected_mask);
 }
 
diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
index 0fef9263cddc..05d68bd393dc 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -523,7 +523,7 @@ void intel_crtc_vblank_off(const struct intel_crtc_state *crtc_state);
 
 int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
 void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
-			 struct intel_digital_port *dport,
+			 struct intel_digital_port *dig_port,
 			 unsigned int expected_mask);
 int intel_get_load_detect_pipe(struct drm_connector *connector,
 			       struct intel_load_detect_pipe *old,
diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
index 679457156797..e6f33e50d6fb 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -1664,8 +1664,8 @@ void chv_phy_powergate_lanes(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct i915_power_domains *power_domains = &dev_priv->power_domains;
-	enum dpio_phy phy = vlv_dport_to_phy(enc_to_dig_port(&encoder->base));
-	enum dpio_channel ch = vlv_dport_to_channel(enc_to_dig_port(&encoder->base));
+	enum dpio_phy phy = vlv_dig_port_to_phy(enc_to_dig_port(&encoder->base));
+	enum dpio_channel ch = vlv_dig_port_to_channel(enc_to_dig_port(&encoder->base));
 
 	mutex_lock(&power_domains->lock);
 
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 83ea04149b77..a3a067dacf84 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1377,9 +1377,9 @@ struct intel_dp_mst_encoder {
 };
 
 static inline enum dpio_channel
-vlv_dport_to_channel(struct intel_digital_port *dport)
+vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
 {
-	switch (dport->base.port) {
+	switch (dig_port->base.port) {
 	case PORT_B:
 	case PORT_D:
 		return DPIO_CH0;
@@ -1391,9 +1391,9 @@ vlv_dport_to_channel(struct intel_digital_port *dport)
 }
 
 static inline enum dpio_phy
-vlv_dport_to_phy(struct intel_digital_port *dport)
+vlv_dig_port_to_phy(struct intel_digital_port *dig_port)
 {
-	switch (dport->base.port) {
+	switch (dig_port->base.port) {
 	case PORT_B:
 	case PORT_C:
 		return DPIO_PHY0;
diff --git a/drivers/gpu/drm/i915/display/intel_dpio_phy.c b/drivers/gpu/drm/i915/display/intel_dpio_phy.c
index 704f38681c4b..f784fe8f6c21 100644
--- a/drivers/gpu/drm/i915/display/intel_dpio_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_dpio_phy.c
@@ -642,9 +642,9 @@ void chv_set_phy_signal_level(struct intel_encoder *encoder,
 			      bool uniq_trans_scale)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
-	enum dpio_channel ch = vlv_dport_to_channel(dport);
+	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
 	enum pipe pipe = intel_crtc->pipe;
 	u32 val;
 	int i;
@@ -738,7 +738,7 @@ void chv_data_lane_soft_reset(struct intel_encoder *encoder,
 			      bool reset)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	enum dpio_channel ch = vlv_dport_to_channel(enc_to_dig_port(&encoder->base));
+	enum dpio_channel ch = vlv_dig_port_to_channel(enc_to_dig_port(&encoder->base));
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 	enum pipe pipe = crtc->pipe;
 	u32 val;
@@ -781,10 +781,10 @@ void chv_data_lane_soft_reset(struct intel_encoder *encoder,
 void chv_phy_pre_pll_enable(struct intel_encoder *encoder,
 			    const struct intel_crtc_state *crtc_state)
 {
-	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
-	enum dpio_channel ch = vlv_dport_to_channel(dport);
+	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
 	enum pipe pipe = crtc->pipe;
 	unsigned int lane_mask =
 		intel_dp_unused_lane_mask(crtc_state->lane_count);
@@ -795,7 +795,7 @@ void chv_phy_pre_pll_enable(struct intel_encoder *encoder,
 	 * Otherwise we can't even access the PLL.
 	 */
 	if (ch == DPIO_CH0 && pipe == PIPE_B)
-		dport->release_cl2_override =
+		dig_port->release_cl2_override =
 			!chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, true);
 
 	chv_phy_powergate_lanes(encoder, true, lane_mask);
@@ -862,10 +862,10 @@ void chv_phy_pre_encoder_enable(struct intel_encoder *encoder,
 				const struct intel_crtc_state *crtc_state)
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
-	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
-	enum dpio_channel ch = vlv_dport_to_channel(dport);
+	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
 	enum pipe pipe = crtc->pipe;
 	int data, i, stagger;
 	u32 val;
@@ -940,12 +940,12 @@ void chv_phy_pre_encoder_enable(struct intel_encoder *encoder,
 
 void chv_phy_release_cl2_override(struct intel_encoder *encoder)
 {
-	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 
-	if (dport->release_cl2_override) {
+	if (dig_port->release_cl2_override) {
 		chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, false);
-		dport->release_cl2_override = false;
+		dig_port->release_cl2_override = false;
 	}
 }
 
@@ -989,8 +989,8 @@ void vlv_set_phy_signal_level(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
-	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
-	enum dpio_channel port = vlv_dport_to_channel(dport);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
 	enum pipe pipe = intel_crtc->pipe;
 
 	vlv_dpio_get(dev_priv);
@@ -1014,10 +1014,10 @@ void vlv_set_phy_signal_level(struct intel_encoder *encoder,
 void vlv_phy_pre_pll_enable(struct intel_encoder *encoder,
 			    const struct intel_crtc_state *crtc_state)
 {
-	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
-	enum dpio_channel port = vlv_dport_to_channel(dport);
+	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
 	enum pipe pipe = crtc->pipe;
 
 	/* Program Tx lane resets to default */
@@ -1044,10 +1044,10 @@ void vlv_phy_pre_encoder_enable(struct intel_encoder *encoder,
 				const struct intel_crtc_state *crtc_state)
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
-	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
-	enum dpio_channel port = vlv_dport_to_channel(dport);
+	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
 	enum pipe pipe = crtc->pipe;
 	u32 val;
 
@@ -1073,10 +1073,10 @@ void vlv_phy_pre_encoder_enable(struct intel_encoder *encoder,
 void vlv_phy_reset_lanes(struct intel_encoder *encoder,
 			 const struct intel_crtc_state *old_crtc_state)
 {
-	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
-	enum dpio_channel port = vlv_dport_to_channel(dport);
+	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
 	enum pipe pipe = crtc->pipe;
 
 	vlv_dpio_get(dev_priv);
diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 685589064d10..69fc31df4978 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -2676,7 +2676,7 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder,
 				const struct intel_crtc_state *pipe_config,
 				const struct drm_connector_state *conn_state)
 {
-	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 
 	vlv_phy_pre_encoder_enable(encoder, pipe_config);
@@ -2685,13 +2685,13 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder,
 	vlv_set_phy_signal_level(encoder, 0x2b245f5f, 0x00002000, 0x5578b83a,
 				 0x2b247878);
 
-	dport->set_infoframes(encoder,
-			      pipe_config->has_infoframe,
-			      pipe_config, conn_state);
+	dig_port->set_infoframes(encoder,
+				 pipe_config->has_infoframe,
+				 pipe_config, conn_state);
 
 	g4x_enable_hdmi(encoder, pipe_config, conn_state);
 
-	vlv_wait_port_ready(dev_priv, dport, 0x0);
+	vlv_wait_port_ready(dev_priv, dig_port, 0x0);
 }
 
 static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder,
@@ -2746,7 +2746,7 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
 				const struct intel_crtc_state *pipe_config,
 				const struct drm_connector_state *conn_state)
 {
-	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	struct drm_device *dev = encoder->base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
 
@@ -2756,13 +2756,13 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
 	/* Use 800mV-0dB */
 	chv_set_phy_signal_level(encoder, 128, 102, false);
 
-	dport->set_infoframes(encoder,
-			      pipe_config->has_infoframe,
-			      pipe_config, conn_state);
+	dig_port->set_infoframes(encoder,
+				 pipe_config->has_infoframe,
+				 pipe_config, conn_state);
 
 	g4x_enable_hdmi(encoder, pipe_config, conn_state);
 
-	vlv_wait_port_ready(dev_priv, dport, 0x0);
+	vlv_wait_port_ready(dev_priv, dig_port, 0x0);
 
 	/* Second common lane will stay alive on its own now */
 	chv_phy_release_cl2_override(encoder);
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
                   ` (2 preceding siblings ...)
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 3/9] drm/i915/display: prefer the more common dig_port name Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-31  9:58   ` Jani Nikula
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init Lucas De Marchi
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

For the latest platforms we can share the logic to initialize the the
ddi, so start moving the most trivial ones to a new setup_outputs_desc()
function that will be responsible for initialization according to a
static const table.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c  | 96 +++++++++++++------
 .../drm/i915/display/intel_display_types.h    |  4 +
 2 files changed, 73 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 04819b0bd494..b3fb1e03cb0b 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16221,6 +16221,72 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
 	intel_pps_unlock_regs_wa(dev_priv);
 }
 
+struct intel_output {
+	/* Initialize DSI if present */
+	void (*dsi_init)(struct drm_i915_private *i915);
+	struct intel_ddi_port_info ddi_ports[];
+};
+
+static const struct intel_output tgl_output = {
+	.dsi_init = icl_dsi_init,
+	.ddi_ports = {
+		{ .port = PORT_A },
+		{ .port = PORT_B },
+		{ .port = PORT_D },
+		{ .port = PORT_E },
+		{ .port = PORT_F },
+		{ .port = PORT_G },
+		{ .port = PORT_H },
+		{ .port = PORT_I },
+		{ .port = PORT_NONE }
+	}
+};
+
+static const struct intel_output ehl_output = {
+	.dsi_init = icl_dsi_init,
+	.ddi_ports = {
+		{ .port = PORT_A },
+		{ .port = PORT_B },
+		{ .port = PORT_C },
+		{ .port = PORT_D },
+		{ .port = PORT_NONE }
+	}
+};
+
+static const struct intel_output gen9lp_output = {
+	.dsi_init = vlv_dsi_init,
+	.ddi_ports = {
+		{ .port = PORT_A },
+		{ .port = PORT_B },
+		{ .port = PORT_C },
+		{ .port = PORT_NONE }
+	},
+};
+
+/*
+ * Use a description-based approach for platforms that can be supported with a
+ * static table
+ */
+static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
+{
+	const struct intel_output *output;
+	const struct intel_ddi_port_info *port_info;
+
+	if (INTEL_GEN(i915) >= 12)
+		output = &tgl_output;
+	else if (IS_ELKHARTLAKE(i915))
+		output = &ehl_output;
+	else if (IS_GEN9_LP(i915))
+		output = &gen9lp_output;
+
+	for (port_info = output->ddi_ports;
+	     port_info->port != PORT_NONE; port_info++)
+		intel_ddi_init(i915, port_info->port);
+
+	if (output->dsi_init)
+		output->dsi_init(i915);
+}
+
 static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 {
 	struct intel_encoder *encoder;
@@ -16231,22 +16297,9 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 	if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
 		return;
 
-	if (INTEL_GEN(dev_priv) >= 12) {
-		intel_ddi_init(dev_priv, PORT_A);
-		intel_ddi_init(dev_priv, PORT_B);
-		intel_ddi_init(dev_priv, PORT_D);
-		intel_ddi_init(dev_priv, PORT_E);
-		intel_ddi_init(dev_priv, PORT_F);
-		intel_ddi_init(dev_priv, PORT_G);
-		intel_ddi_init(dev_priv, PORT_H);
-		intel_ddi_init(dev_priv, PORT_I);
-		icl_dsi_init(dev_priv);
-	} else if (IS_ELKHARTLAKE(dev_priv)) {
-		intel_ddi_init(dev_priv, PORT_A);
-		intel_ddi_init(dev_priv, PORT_B);
-		intel_ddi_init(dev_priv, PORT_C);
-		intel_ddi_init(dev_priv, PORT_D);
-		icl_dsi_init(dev_priv);
+	if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
+	    IS_GEN9_LP(dev_priv)) {
+		setup_ddi_outputs_desc(dev_priv);
 	} else if (IS_GEN(dev_priv, 11)) {
 		intel_ddi_init(dev_priv, PORT_A);
 		intel_ddi_init(dev_priv, PORT_B);
@@ -16263,17 +16316,6 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 			intel_ddi_init(dev_priv, PORT_F);
 
 		icl_dsi_init(dev_priv);
-	} else if (IS_GEN9_LP(dev_priv)) {
-		/*
-		 * FIXME: Broxton doesn't support port detection via the
-		 * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
-		 * detect the ports.
-		 */
-		intel_ddi_init(dev_priv, PORT_A);
-		intel_ddi_init(dev_priv, PORT_B);
-		intel_ddi_init(dev_priv, PORT_C);
-
-		vlv_dsi_init(dev_priv);
 	} else if (HAS_DDI(dev_priv)) {
 		int found;
 
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index a3a067dacf84..4d2f4ee35812 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1376,6 +1376,10 @@ struct intel_dp_mst_encoder {
 	struct intel_connector *connector;
 };
 
+struct intel_ddi_port_info {
+	enum port port;
+};
+
 static inline enum dpio_channel
 vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
 {
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
                   ` (3 preceding siblings ...)
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-24  0:00   ` Matt Roper
  2019-12-31 10:14   ` Jani Nikula
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms Lucas De Marchi
                   ` (5 subsequent siblings)
  10 siblings, 2 replies; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

By adding a hook that determines if a port is present, we are able to
support Ice Lake in the new description-based DDI initialization.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 61 ++++++++++++++------
 1 file changed, 42 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index b3fb1e03cb0b..6b4d320ff92c 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16224,9 +16224,28 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
 struct intel_output {
 	/* Initialize DSI if present */
 	void (*dsi_init)(struct drm_i915_private *i915);
+
+	/*
+	 * Check if port is present before trying to initialize; if not provided
+	 * it's assumed the port is present (or we can't check and fail
+	 * gracefully
+	 */
+	bool (*is_port_present)(struct drm_i915_private *i915,
+				const struct intel_ddi_port_info *port_info);
+
 	struct intel_ddi_port_info ddi_ports[];
 };
 
+static bool icl_is_port_present(struct drm_i915_private *i915,
+				const struct intel_ddi_port_info *port_info)
+{
+	if (port_info->port != PORT_F)
+		return true;
+
+	return IS_ICL_WITH_PORT_F(i915) &&
+		intel_bios_is_port_present(i915, PORT_F);
+}
+
 static const struct intel_output tgl_output = {
 	.dsi_init = icl_dsi_init,
 	.ddi_ports = {
@@ -16242,6 +16261,20 @@ static const struct intel_output tgl_output = {
 	}
 };
 
+static const struct intel_output icl_output = {
+	.dsi_init = icl_dsi_init,
+	.is_port_present = icl_is_port_present,
+	.ddi_ports = {
+		{ .port = PORT_A },
+		{ .port = PORT_B },
+		{ .port = PORT_C },
+		{ .port = PORT_D },
+		{ .port = PORT_E },
+		{ .port = PORT_F },
+		{ .port = PORT_NONE }
+	}
+};
+
 static const struct intel_output ehl_output = {
 	.dsi_init = icl_dsi_init,
 	.ddi_ports = {
@@ -16276,12 +16309,19 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
 		output = &tgl_output;
 	else if (IS_ELKHARTLAKE(i915))
 		output = &ehl_output;
+	else if (IS_GEN(i915, 11))
+		output = &icl_output;
 	else if (IS_GEN9_LP(i915))
 		output = &gen9lp_output;
 
 	for (port_info = output->ddi_ports;
-	     port_info->port != PORT_NONE; port_info++)
+	     port_info->port != PORT_NONE; port_info++) {
+		if (output->is_port_present &&
+		    !output->is_port_present(i915, port_info))
+			continue;
+
 		intel_ddi_init(i915, port_info->port);
+	}
 
 	if (output->dsi_init)
 		output->dsi_init(i915);
@@ -16297,25 +16337,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 	if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
 		return;
 
-	if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
-	    IS_GEN9_LP(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
 		setup_ddi_outputs_desc(dev_priv);
-	} else if (IS_GEN(dev_priv, 11)) {
-		intel_ddi_init(dev_priv, PORT_A);
-		intel_ddi_init(dev_priv, PORT_B);
-		intel_ddi_init(dev_priv, PORT_C);
-		intel_ddi_init(dev_priv, PORT_D);
-		intel_ddi_init(dev_priv, PORT_E);
-		/*
-		 * On some ICL SKUs port F is not present. No strap bits for
-		 * this, so rely on VBT.
-		 * Work around broken VBTs on SKUs known to have no port F.
-		 */
-		if (IS_ICL_WITH_PORT_F(dev_priv) &&
-		    intel_bios_is_port_present(dev_priv, PORT_F))
-			intel_ddi_init(dev_priv, PORT_F);
-
-		icl_dsi_init(dev_priv);
 	} else if (HAS_DDI(dev_priv)) {
 		int found;
 
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
                   ` (4 preceding siblings ...)
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-31 10:25   ` Jani Nikula
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes Lucas De Marchi
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

Support remaining platforms under HAS_DDI() by providing a slightly more
complex is_port_present() hook. The downside is that now we call
I915_READ(SFUSE_STRAP) for each port being initialized, but that's only
on initialization: a few more mmio reads won't hurt.

Alternatives would be to provide one hook per port, or to have a
"pre_init()" hook that takes care of the mmio read. However I think this
is simpler - we may need to adapt if future platforms don't follow the
same initialization "template".

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 72 +++++++++++++-------
 1 file changed, 46 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 6b4d320ff92c..ad85cf75c815 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16246,6 +16246,34 @@ static bool icl_is_port_present(struct drm_i915_private *i915,
 		intel_bios_is_port_present(i915, PORT_F);
 }
 
+static bool ddi_is_port_present(struct drm_i915_private *i915,
+				const struct intel_ddi_port_info *port_info)
+{
+	/* keep I915_READ() happy */
+	struct drm_i915_private *dev_priv = i915;
+
+	if (port_info->port == PORT_A)
+		return I915_READ(DDI_BUF_CTL(PORT_A))
+			& DDI_INIT_DISPLAY_DETECTED;
+
+	if (port_info->port == PORT_E)
+		return IS_GEN9_BC(dev_priv) &&
+			intel_bios_is_port_present(i915, PORT_E);
+
+	switch (port_info->port) {
+	case PORT_B:
+		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIB_DETECTED;
+	case PORT_C:
+		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIC_DETECTED;
+	case PORT_D:
+		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDID_DETECTED;
+	case PORT_F:
+		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIF_DETECTED;
+	default:
+		return false;
+	}
+}
+
 static const struct intel_output tgl_output = {
 	.dsi_init = icl_dsi_init,
 	.ddi_ports = {
@@ -16296,11 +16324,24 @@ static const struct intel_output gen9lp_output = {
 	},
 };
 
+static const struct intel_output ddi_output = {
+	.is_port_present = ddi_is_port_present,
+	.ddi_ports = {
+		{ .port = PORT_A },
+		{ .port = PORT_B },
+		{ .port = PORT_C },
+		{ .port = PORT_D },
+		{ .port = PORT_E },
+		{ .port = PORT_F },
+		{ .port = PORT_NONE }
+	}
+};
+
 /*
  * Use a description-based approach for platforms that can be supported with a
  * static table
  */
-static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
+static void setup_ddi_outputs(struct drm_i915_private *i915)
 {
 	const struct intel_output *output;
 	const struct intel_ddi_port_info *port_info;
@@ -16313,6 +16354,8 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
 		output = &icl_output;
 	else if (IS_GEN9_LP(i915))
 		output = &gen9lp_output;
+	else
+		output = &ddi_output;
 
 	for (port_info = output->ddi_ports;
 	     port_info->port != PORT_NONE; port_info++) {
@@ -16338,35 +16381,12 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 		return;
 
 	if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
-		setup_ddi_outputs_desc(dev_priv);
+		setup_ddi_outputs(dev_priv);
 	} else if (HAS_DDI(dev_priv)) {
-		int found;
-
 		if (intel_ddi_crt_present(dev_priv))
 			intel_crt_init(dev_priv);
 
-		found = I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_INIT_DISPLAY_DETECTED;
-		if (found)
-			intel_ddi_init(dev_priv, PORT_A);
-
-		/* DDI B, C, D, and F detection is indicated by the SFUSE_STRAP
-		 * register */
-		found = I915_READ(SFUSE_STRAP);
-
-		if (found & SFUSE_STRAP_DDIB_DETECTED)
-			intel_ddi_init(dev_priv, PORT_B);
-		if (found & SFUSE_STRAP_DDIC_DETECTED)
-			intel_ddi_init(dev_priv, PORT_C);
-		if (found & SFUSE_STRAP_DDID_DETECTED)
-			intel_ddi_init(dev_priv, PORT_D);
-		if (found & SFUSE_STRAP_DDIF_DETECTED)
-			intel_ddi_init(dev_priv, PORT_F);
-		/*
-		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
-		 */
-		if (IS_GEN9_BC(dev_priv) &&
-		    intel_bios_is_port_present(dev_priv, PORT_E))
-			intel_ddi_init(dev_priv, PORT_E);
+		setup_ddi_outputs(dev_priv);
 	} else if (HAS_PCH_SPLIT(dev_priv)) {
 		int found;
 
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
                   ` (5 preceding siblings ...)
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-24  0:10   ` Matt Roper
  2019-12-31 10:33   ` Jani Nikula
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 8/9] drm/i915/display: refer to vbt info as vbt_port_info Lucas De Marchi
                   ` (3 subsequent siblings)
  10 siblings, 2 replies; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

Identify 3 possible cases in which the index numbers can be different
from the "port" and add them to the description-based ddi initialization
table.  This can be used in place of additional functions mapping from
on to the other.  Right now we already cover part of this by creating kind of
virtual phy numbering, but that comes with downsides:

a) there's not really a "phy numbering" in the spec, this is purely a
software thing; hardware uses whatever they want thinking mapping from
one to the other arbitrarily is easy in software.

b) currently the mapping occurs on "leaf" functions, making the decision
based on the platform.

With this new table the approach will be: the port as defined by the
enum port is purely a driver convention and won't be used anymore to
define the register offset or register bits. For that we have the other
3 indexes, identified as being possibly different from the current usage
of register bits: ddi, vbt and phy. The phy type is also added here,
meant to replace the checks for combo vs tc (although the helper
functions can remain so we may differentiate between, e.g. Dekel and MG
phys).

While at it, also give names to the ports so they can be easily
identified.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c  | 54 +++++++++----------
 drivers/gpu/drm/i915/display/intel_display.h  |  7 +++
 .../drm/i915/display/intel_display_types.h    |  5 ++
 3 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index ad85cf75c815..219f180fa395 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16277,14 +16277,14 @@ static bool ddi_is_port_present(struct drm_i915_private *i915,
 static const struct intel_output tgl_output = {
 	.dsi_init = icl_dsi_init,
 	.ddi_ports = {
-		{ .port = PORT_A },
-		{ .port = PORT_B },
-		{ .port = PORT_D },
-		{ .port = PORT_E },
-		{ .port = PORT_F },
-		{ .port = PORT_G },
-		{ .port = PORT_H },
-		{ .port = PORT_I },
+		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
+		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
+		{ .name = "DDI TC1", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x2, },
+		{ .name = "DDI TC2", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x1, .vbt_idx = 0x3, },
+		{ .name = "DDI TC3", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x2, .vbt_idx = 0x4, },
+		{ .name = "DDI TC4", .port = PORT_G, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x6, .phy_idx = 0x3, .vbt_idx = 0x5, },
+		{ .name = "DDI TC5", .port = PORT_H, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x7, .phy_idx = 0x4, .vbt_idx = 0x6, },
+		{ .name = "DDI TC6", .port = PORT_I, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x8, .phy_idx = 0x5, .vbt_idx = 0x7, },
 		{ .port = PORT_NONE }
 	}
 };
@@ -16293,12 +16293,12 @@ static const struct intel_output icl_output = {
 	.dsi_init = icl_dsi_init,
 	.is_port_present = icl_is_port_present,
 	.ddi_ports = {
-		{ .port = PORT_A },
-		{ .port = PORT_B },
-		{ .port = PORT_C },
-		{ .port = PORT_D },
-		{ .port = PORT_E },
-		{ .port = PORT_F },
+		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
+		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
+		{ .name = "DDI TC1", .port = PORT_C, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x2, .phy_idx = 0x0, .vbt_idx = 0x2, },
+		{ .name = "DDI TC2", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x1, .vbt_idx = 0x3, },
+		{ .name = "DDI TC3", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x2, .vbt_idx = 0x4, },
+		{ .name = "DDI TC4", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x3, .vbt_idx = 0x5, },
 		{ .port = PORT_NONE }
 	}
 };
@@ -16306,10 +16306,10 @@ static const struct intel_output icl_output = {
 static const struct intel_output ehl_output = {
 	.dsi_init = icl_dsi_init,
 	.ddi_ports = {
-		{ .port = PORT_A },
-		{ .port = PORT_B },
-		{ .port = PORT_C },
-		{ .port = PORT_D },
+		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
+		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
+		{ .name = "DDI C",   .port = PORT_C, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2, },
+		{ .name = "DDI D",   .port = PORT_D, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x3, },
 		{ .port = PORT_NONE }
 	}
 };
@@ -16317,9 +16317,9 @@ static const struct intel_output ehl_output = {
 static const struct intel_output gen9lp_output = {
 	.dsi_init = vlv_dsi_init,
 	.ddi_ports = {
-		{ .port = PORT_A },
-		{ .port = PORT_B },
-		{ .port = PORT_C },
+		{ .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
+		{ .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
+		{ .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
 		{ .port = PORT_NONE }
 	},
 };
@@ -16327,12 +16327,12 @@ static const struct intel_output gen9lp_output = {
 static const struct intel_output ddi_output = {
 	.is_port_present = ddi_is_port_present,
 	.ddi_ports = {
-		{ .port = PORT_A },
-		{ .port = PORT_B },
-		{ .port = PORT_C },
-		{ .port = PORT_D },
-		{ .port = PORT_E },
-		{ .port = PORT_F },
+		{ .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
+		{ .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
+		{ .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
+		{ .name = "DDI D", .port = PORT_D, .ddi_idx = 0x3, .phy_idx = 0x3, .vbt_idx = 0x3 },
+		{ .name = "DDI E", .port = PORT_E, .ddi_idx = 0x4, .phy_idx = 0x4, .vbt_idx = 0x4 },
+		{ .name = "DDI F", .port = PORT_F, .ddi_idx = 0x5, .phy_idx = 0x5, .vbt_idx = 0x5 },
 		{ .port = PORT_NONE }
 	}
 };
diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
index 05d68bd393dc..db19e5eee248 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -303,6 +303,13 @@ enum phy {
 	I915_MAX_PHYS
 };
 
+enum phy_type {
+	PHY_TYPE_NONE = 0,
+
+	PHY_TYPE_COMBO,
+	PHY_TYPE_TC,
+};
+
 #define phy_name(a) ((a) + 'A')
 
 enum phy_fia {
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 4d2f4ee35812..23a885895803 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1377,7 +1377,12 @@ struct intel_dp_mst_encoder {
 };
 
 struct intel_ddi_port_info {
+	const char *name;
 	enum port port;
+	s8 phy_type;
+	u8 ddi_idx;
+	u8 phy_idx;
+	u8 vbt_idx;
 };
 
 static inline enum dpio_channel
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 8/9] drm/i915/display: refer to vbt info as vbt_port_info
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
                   ` (6 preceding siblings ...)
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-31 10:39   ` Jani Nikula
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init Lucas De Marchi
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

Now that we maintain our static port info, rename the places that refer
to the port_info from vbt to use the vbt prefix. This is just a
preparation step for a following change in which we will use the
port_info variable name.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 1bdf63845472..a1b7075ea6be 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -902,7 +902,8 @@ icl_get_combo_buf_trans(struct drm_i915_private *dev_priv, int type, int rate,
 
 static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port port)
 {
-	struct ddi_vbt_port_info *port_info = &dev_priv->vbt.ddi_port_info[port];
+	struct ddi_vbt_port_info *vbt_port_info =
+		&dev_priv->vbt.ddi_port_info[port];
 	int n_entries, level, default_entry;
 	enum phy phy = intel_port_to_phy(dev_priv, port);
 
@@ -943,8 +944,8 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
 	if (WARN_ON_ONCE(n_entries == 0))
 		return 0;
 
-	if (port_info->hdmi_level_shift_set)
-		level = port_info->hdmi_level_shift;
+	if (vbt_port_info->hdmi_level_shift_set)
+		level = vbt_port_info->hdmi_level_shift;
 	else
 		level = default_entry;
 
@@ -4783,15 +4784,15 @@ intel_ddi_max_lanes(struct intel_digital_port *dig_port)
 
 void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 {
-	struct ddi_vbt_port_info *port_info =
+	struct ddi_vbt_port_info *vbt_port_info =
 		&dev_priv->vbt.ddi_port_info[port];
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *encoder;
 	bool init_hdmi, init_dp, init_lspcon = false;
 	enum phy phy = intel_port_to_phy(dev_priv, port);
 
-	init_hdmi = port_info->supports_dvi || port_info->supports_hdmi;
-	init_dp = port_info->supports_dp;
+	init_hdmi = vbt_port_info->supports_dvi || vbt_port_info->supports_hdmi;
+	init_dp = vbt_port_info->supports_dp;
 
 	if (intel_bios_is_lspcon_present(dev_priv, port)) {
 		/*
@@ -4852,8 +4853,8 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	intel_dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
 
 	if (intel_phy_is_tc(dev_priv, phy)) {
-		bool is_legacy = !port_info->supports_typec_usb &&
-				 !port_info->supports_tbt;
+		bool is_legacy = !vbt_port_info->supports_typec_usb &&
+				 !vbt_port_info->supports_tbt;
 
 		intel_tc_port_init(intel_dig_port, is_legacy);
 
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
                   ` (7 preceding siblings ...)
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 8/9] drm/i915/display: refer to vbt info as vbt_port_info Lucas De Marchi
@ 2019-12-23 19:58 ` Lucas De Marchi
  2019-12-24  0:16   ` Matt Roper
  2019-12-31 11:22   ` Jani Nikula
  2019-12-23 20:14 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for RFC: display/ddi: keep register indexes in a table Patchwork
  2019-12-23 20:57 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
  10 siblings, 2 replies; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 19:58 UTC (permalink / raw)
  To: intel-gfx

Now that we have tables for all platforms using ddi, keep the port_info
around so we can use it for decisions like "what phy does it have?"
instead of keep checking the platform/gen everywhere.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c      | 36 ++++++++++++-------
 drivers/gpu/drm/i915/display/intel_ddi.h      |  8 ++++-
 drivers/gpu/drm/i915/display/intel_display.c  |  2 +-
 .../drm/i915/display/intel_display_types.h    |  3 ++
 4 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index a1b7075ea6be..9d06a34f5f8e 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4782,14 +4782,25 @@ intel_ddi_max_lanes(struct intel_digital_port *dig_port)
 	return max_lanes;
 }
 
-void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
+bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port)
 {
+	return dig_port->port_info->phy_type == PHY_TYPE_TC;
+}
+
+bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port)
+{
+	return dig_port->port_info->phy_type == PHY_TYPE_COMBO;
+}
+
+void intel_ddi_init(struct drm_i915_private *dev_priv,
+		    const struct intel_ddi_port_info *port_info)
+{
+	enum port port = port_info->port;
 	struct ddi_vbt_port_info *vbt_port_info =
 		&dev_priv->vbt.ddi_port_info[port];
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *encoder;
 	bool init_hdmi, init_dp, init_lspcon = false;
-	enum phy phy = intel_port_to_phy(dev_priv, port);
 
 	init_hdmi = vbt_port_info->supports_dvi || vbt_port_info->supports_hdmi;
 	init_dp = vbt_port_info->supports_dp;
@@ -4803,12 +4814,12 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 		init_dp = true;
 		init_lspcon = true;
 		init_hdmi = false;
-		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
+		DRM_DEBUG_KMS("VBT says port %s has lspcon\n", port_info->name);
 	}
 
 	if (!init_dp && !init_hdmi) {
-		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
-			      port_name(port));
+		DRM_DEBUG_KMS("VBT says %s is not DVI/HDMI/DP compatible, respect it\n",
+			      port_info->name);
 		return;
 	}
 
@@ -4819,7 +4830,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	encoder = &intel_dig_port->base;
 
 	drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
-			 DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port));
+			 DRM_MODE_ENCODER_TMDS, port_info->name);
 
 	encoder->hotplug = intel_ddi_hotplug;
 	encoder->compute_output_type = intel_ddi_compute_output_type;
@@ -4837,7 +4848,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 
 	encoder->type = INTEL_OUTPUT_DDI;
 	encoder->power_domain = intel_port_to_power_domain(port);
-	encoder->port = port;
+	encoder->port = port_info->port;
 	encoder->cloneable = 0;
 	encoder->pipe_mask = ~0;
 
@@ -4851,8 +4862,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 	intel_dig_port->max_lanes = intel_ddi_max_lanes(intel_dig_port);
 	intel_dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
+	intel_dig_port->port_info = port_info;
 
-	if (intel_phy_is_tc(dev_priv, phy)) {
+	if (intel_ddi_has_tc_phy(intel_dig_port)) {
 		bool is_legacy = !vbt_port_info->supports_typec_usb &&
 				 !vbt_port_info->supports_tbt;
 
@@ -4883,15 +4895,15 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	if (init_lspcon) {
 		if (lspcon_init(intel_dig_port))
 			/* TODO: handle hdmi info frame part */
-			DRM_DEBUG_KMS("LSPCON init success on port %c\n",
-				port_name(port));
+			DRM_DEBUG_KMS("LSPCON init success on port %s\n",
+				      port_info->name);
 		else
 			/*
 			 * LSPCON init faied, but DP init was success, so
 			 * lets try to drive as DP++ port.
 			 */
-			DRM_ERROR("LSPCON init failed on port %c\n",
-				port_name(port));
+			DRM_ERROR("LSPCON init failed on port %s\n",
+				  port_info->name);
 	}
 
 	intel_infoframe_init(intel_dig_port);
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h b/drivers/gpu/drm/i915/display/intel_ddi.h
index 167c6579d972..c500d473963e 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.h
+++ b/drivers/gpu/drm/i915/display/intel_ddi.h
@@ -15,6 +15,7 @@ struct drm_i915_private;
 struct intel_connector;
 struct intel_crtc;
 struct intel_crtc_state;
+struct intel_ddi_port_info;
 struct intel_dp;
 struct intel_dpll_hw_state;
 struct intel_encoder;
@@ -24,7 +25,8 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
 				const struct drm_connector_state *old_conn_state);
 void hsw_fdi_link_train(struct intel_encoder *encoder,
 			const struct intel_crtc_state *crtc_state);
-void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port);
+void intel_ddi_init(struct drm_i915_private *dev_priv,
+		    const struct intel_ddi_port_info *port_info);
 bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
 void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state);
 void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state);
@@ -50,4 +52,8 @@ void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
 int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
 			struct intel_dpll_hw_state *state);
 
+
+bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port);
+bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port);
+
 #endif /* __INTEL_DDI_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 219f180fa395..96207dc83fac 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16363,7 +16363,7 @@ static void setup_ddi_outputs(struct drm_i915_private *i915)
 		    !output->is_port_present(i915, port_info))
 			continue;
 
-		intel_ddi_init(i915, port_info->port);
+		intel_ddi_init(i915, port_info);
 	}
 
 	if (output->dsi_init)
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 23a885895803..c54b0178e885 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1346,6 +1346,9 @@ struct intel_digital_port {
 	enum intel_display_power_domain ddi_io_power_domain;
 	struct mutex tc_lock;	/* protects the TypeC port mode */
 	intel_wakeref_t tc_lock_wakeref;
+
+	const struct intel_ddi_port_info *port_info;
+
 	int tc_link_refcount;
 	bool tc_legacy_port:1;
 	char tc_port_name[8];
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for RFC: display/ddi: keep register indexes in a table
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
                   ` (8 preceding siblings ...)
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init Lucas De Marchi
@ 2019-12-23 20:14 ` Patchwork
  2019-12-23 20:57 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
  10 siblings, 0 replies; 34+ messages in thread
From: Patchwork @ 2019-12-23 20:14 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

== Series Details ==

Series: RFC: display/ddi: keep register indexes in a table
URL   : https://patchwork.freedesktop.org/series/71330/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
f9993b30fcc2 drm/i915/display: nuke skl workaround for pre-production hw
4ed40d08b95f drm/i915/display: remove alias to dig_port
ea2ec826034a drm/i915/display: prefer the more common dig_port name
7a1e8b409ea0 drm/i915/display: start description-based ddi initialization
409c886b29d7 drm/i915/display: move icl to description-based ddi init
ac1ca5913330 drm/i915/display: description-based initialization for remaining ddi platforms
f385d919929d drm/i915/display: add phy, vbt and ddi indexes
-:9: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#9: 
on to the other.  Right now we already cover part of this by creating kind of

-:49: WARNING:LONG_LINE: line over 100 characters
#49: FILE: drivers/gpu/drm/i915/display/intel_display.c:16381:
+		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },

-:50: WARNING:LONG_LINE: line over 100 characters
#50: FILE: drivers/gpu/drm/i915/display/intel_display.c:16382:
+		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },

-:51: WARNING:LONG_LINE: line over 100 characters
#51: FILE: drivers/gpu/drm/i915/display/intel_display.c:16383:
+		{ .name = "DDI TC1", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x2, },

-:52: WARNING:LONG_LINE: line over 100 characters
#52: FILE: drivers/gpu/drm/i915/display/intel_display.c:16384:
+		{ .name = "DDI TC2", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x1, .vbt_idx = 0x3, },

-:53: WARNING:LONG_LINE: line over 100 characters
#53: FILE: drivers/gpu/drm/i915/display/intel_display.c:16385:
+		{ .name = "DDI TC3", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x2, .vbt_idx = 0x4, },

-:54: WARNING:LONG_LINE: line over 100 characters
#54: FILE: drivers/gpu/drm/i915/display/intel_display.c:16386:
+		{ .name = "DDI TC4", .port = PORT_G, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x6, .phy_idx = 0x3, .vbt_idx = 0x5, },

-:55: WARNING:LONG_LINE: line over 100 characters
#55: FILE: drivers/gpu/drm/i915/display/intel_display.c:16387:
+		{ .name = "DDI TC5", .port = PORT_H, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x7, .phy_idx = 0x4, .vbt_idx = 0x6, },

-:56: WARNING:LONG_LINE: line over 100 characters
#56: FILE: drivers/gpu/drm/i915/display/intel_display.c:16388:
+		{ .name = "DDI TC6", .port = PORT_I, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x8, .phy_idx = 0x5, .vbt_idx = 0x7, },

-:70: WARNING:LONG_LINE: line over 100 characters
#70: FILE: drivers/gpu/drm/i915/display/intel_display.c:16397:
+		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },

-:71: WARNING:LONG_LINE: line over 100 characters
#71: FILE: drivers/gpu/drm/i915/display/intel_display.c:16398:
+		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },

-:72: WARNING:LONG_LINE: line over 100 characters
#72: FILE: drivers/gpu/drm/i915/display/intel_display.c:16399:
+		{ .name = "DDI TC1", .port = PORT_C, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x2, .phy_idx = 0x0, .vbt_idx = 0x2, },

-:73: WARNING:LONG_LINE: line over 100 characters
#73: FILE: drivers/gpu/drm/i915/display/intel_display.c:16400:
+		{ .name = "DDI TC2", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x1, .vbt_idx = 0x3, },

-:74: WARNING:LONG_LINE: line over 100 characters
#74: FILE: drivers/gpu/drm/i915/display/intel_display.c:16401:
+		{ .name = "DDI TC3", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x2, .vbt_idx = 0x4, },

-:75: WARNING:LONG_LINE: line over 100 characters
#75: FILE: drivers/gpu/drm/i915/display/intel_display.c:16402:
+		{ .name = "DDI TC4", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x3, .vbt_idx = 0x5, },

-:87: WARNING:LONG_LINE: line over 100 characters
#87: FILE: drivers/gpu/drm/i915/display/intel_display.c:16410:
+		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },

-:88: WARNING:LONG_LINE: line over 100 characters
#88: FILE: drivers/gpu/drm/i915/display/intel_display.c:16411:
+		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },

-:89: WARNING:LONG_LINE: line over 100 characters
#89: FILE: drivers/gpu/drm/i915/display/intel_display.c:16412:
+		{ .name = "DDI C",   .port = PORT_C, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2, },

-:90: WARNING:LONG_LINE: line over 100 characters
#90: FILE: drivers/gpu/drm/i915/display/intel_display.c:16413:
+		{ .name = "DDI D",   .port = PORT_D, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x3, },

total: 0 errors, 19 warnings, 0 checks, 109 lines checked
f6feacf14aa5 drm/i915/display: refer to vbt info as vbt_port_info
910cfe50bff9 drm/i915/display: use port_info on intel_ddi_init
-:135: CHECK:LINE_SPACING: Please don't use multiple blank lines
#135: FILE: drivers/gpu/drm/i915/display/intel_ddi.h:55:
 
+

total: 0 errors, 0 warnings, 1 checks, 128 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BAT: failure for RFC: display/ddi: keep register indexes in a table
  2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
                   ` (9 preceding siblings ...)
  2019-12-23 20:14 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for RFC: display/ddi: keep register indexes in a table Patchwork
@ 2019-12-23 20:57 ` Patchwork
  10 siblings, 0 replies; 34+ messages in thread
From: Patchwork @ 2019-12-23 20:57 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

== Series Details ==

Series: RFC: display/ddi: keep register indexes in a table
URL   : https://patchwork.freedesktop.org/series/71330/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7630 -> Patchwork_15902
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15902 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15902, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/index.html

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_15902:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live_blt:
    - fi-snb-2520m:       [PASS][1] -> [FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-snb-2520m/igt@i915_selftest@live_blt.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-snb-2520m/igt@i915_selftest@live_blt.html

  
Known issues
------------

  Here are the changes found in Patchwork_15902 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_module_load@reload-with-fault-injection:
    - fi-cfl-guc:         [PASS][3] -> [INCOMPLETE][4] ([i915#505] / [i915#671])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-cfl-guc/igt@i915_module_load@reload-with-fault-injection.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-cfl-guc/igt@i915_module_load@reload-with-fault-injection.html
    - fi-skl-6700k2:      [PASS][5] -> [INCOMPLETE][6] ([i915#671])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-skl-6700k2/igt@i915_module_load@reload-with-fault-injection.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-skl-6700k2/igt@i915_module_load@reload-with-fault-injection.html

  
#### Possible fixes ####

  * igt@i915_module_load@reload-with-fault-injection:
    - fi-cfl-8700k:       [INCOMPLETE][7] ([i915#505]) -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-cfl-8700k/igt@i915_module_load@reload-with-fault-injection.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-cfl-8700k/igt@i915_module_load@reload-with-fault-injection.html

  * igt@i915_selftest@live_execlists:
    - fi-kbl-soraka:      [DMESG-FAIL][9] ([i915#656]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-kbl-soraka/igt@i915_selftest@live_execlists.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-kbl-soraka/igt@i915_selftest@live_execlists.html

  * igt@i915_selftest@live_memory_region:
    - fi-bwr-2160:        [FAIL][11] -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-bwr-2160/igt@i915_selftest@live_memory_region.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-bwr-2160/igt@i915_selftest@live_memory_region.html

  
#### Warnings ####

  * igt@i915_selftest@live_blt:
    - fi-hsw-4770:        [DMESG-FAIL][13] ([i915#725]) -> [DMESG-FAIL][14] ([i915#563])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-hsw-4770/igt@i915_selftest@live_blt.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-hsw-4770/igt@i915_selftest@live_blt.html

  * igt@kms_busy@basic-flip-pipe-b:
    - fi-kbl-x1275:       [DMESG-WARN][15] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][16] ([i915#62] / [i915#92]) +5 similar issues
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-kbl-x1275/igt@kms_busy@basic-flip-pipe-b.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-kbl-x1275/igt@kms_busy@basic-flip-pipe-b.html

  * igt@kms_flip@basic-flip-vs-modeset:
    - fi-kbl-x1275:       [DMESG-WARN][17] ([i915#62] / [i915#92]) -> [DMESG-WARN][18] ([i915#62] / [i915#92] / [i915#95]) +2 similar issues
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7630/fi-kbl-x1275/igt@kms_flip@basic-flip-vs-modeset.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/fi-kbl-x1275/igt@kms_flip@basic-flip-vs-modeset.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [i915#435]: https://gitlab.freedesktop.org/drm/intel/issues/435
  [i915#505]: https://gitlab.freedesktop.org/drm/intel/issues/505
  [i915#563]: https://gitlab.freedesktop.org/drm/intel/issues/563
  [i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
  [i915#656]: https://gitlab.freedesktop.org/drm/intel/issues/656
  [i915#671]: https://gitlab.freedesktop.org/drm/intel/issues/671
  [i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
  [i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
  [i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95


Participating hosts (43 -> 45)
------------------------------

  Additional (8): fi-hsw-4770r fi-byt-j1900 fi-skl-6770hq fi-glk-dsi fi-whl-u fi-gdg-551 fi-ivb-3770 fi-snb-2600 
  Missing    (6): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7630 -> Patchwork_15902

  CI-20190529: 20190529
  CI_DRM_7630: 28a2aa0ebf1520ea8a0dd89299f7ceea80dfd96f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5352: 0586d205f651674e575351c2d5a7d0760716c9f1 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15902: 910cfe50bff90c84cbb108c0287dbbaa3830010b @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

910cfe50bff9 drm/i915/display: use port_info on intel_ddi_init
f6feacf14aa5 drm/i915/display: refer to vbt info as vbt_port_info
f385d919929d drm/i915/display: add phy, vbt and ddi indexes
ac1ca5913330 drm/i915/display: description-based initialization for remaining ddi platforms
409c886b29d7 drm/i915/display: move icl to description-based ddi init
7a1e8b409ea0 drm/i915/display: start description-based ddi initialization
ea2ec826034a drm/i915/display: prefer the more common dig_port name
4ed40d08b95f drm/i915/display: remove alias to dig_port
f9993b30fcc2 drm/i915/display: nuke skl workaround for pre-production hw

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15902/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 2/9] drm/i915/display: remove alias to dig_port
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 2/9] drm/i915/display: remove alias to dig_port Lucas De Marchi
@ 2019-12-23 21:05   ` Matt Roper
  0 siblings, 0 replies; 34+ messages in thread
From: Matt Roper @ 2019-12-23 21:05 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

On Mon, Dec 23, 2019 at 11:58:43AM -0800, Lucas De Marchi wrote:
> We don't need intel_dig_port and dig_port to refer to the same thing.
> Prefer the latter.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index c9ba7d7f3787..f054c82214c0 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3674,12 +3674,11 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
>  				      const struct intel_crtc_state *crtc_state,
>  				      const struct drm_connector_state *conn_state)
>  {
> -	struct intel_digital_port *intel_dig_port = enc_to_dig_port(&encoder->base);
> -	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
> +	struct intel_hdmi *intel_hdmi = &dig_port->hdmi;
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	enum port port = encoder->port;
>  	int level = intel_ddi_hdmi_level(dev_priv, port);
> -	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>  
>  	intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
>  	intel_ddi_clk_select(encoder, crtc_state);
> @@ -3709,9 +3708,8 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
>  
>  	intel_ddi_enable_pipe_clock(crtc_state);
>  
> -	intel_dig_port->set_infoframes(encoder,
> -				       crtc_state->has_infoframe,
> -				       crtc_state, conn_state);
> +	dig_port->set_infoframes(encoder, crtc_state->has_infoframe,
> +				 crtc_state, conn_state);
>  }
>  
>  static void intel_ddi_pre_enable(struct intel_encoder *encoder,
> -- 
> 2.24.0
> 

-- 
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 3/9] drm/i915/display: prefer the more common dig_port name
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 3/9] drm/i915/display: prefer the more common dig_port name Lucas De Marchi
@ 2019-12-23 21:16   ` Matt Roper
  2019-12-23 21:25     ` Lucas De Marchi
  0 siblings, 1 reply; 34+ messages in thread
From: Matt Roper @ 2019-12-23 21:16 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

On Mon, Dec 23, 2019 at 11:58:44AM -0800, Lucas De Marchi wrote:
> intel_ddi.c uses a mix of dport and dig_port as variable for
> intel_digital_port, with the latter being more frequent. In some cases
> we were also using intel_dport to make it worse. intel_dpio_phy.c had
> standardized on dport, but overall dig_port is much more common.
> Standardize on dig_port.
> 
> This is the only place in the driver where we refer to a
> intel_digital_port as intel_dport. Let's use the same name everywhere:
> dig_port.

The second paragraph here seems redundant (and sounds like it might have
been the commit message for a second commit you squashed into the first
since the "This" is ambigous).

Also, there are still a bunch of remaining intel_dig_port
parameters/variables.  Maybe we want an additional patch to drop the
intel_ prefix from those and make everything consistent?  At this point
I think we've dropped the intel_ prefix from most/all of our crtcs,
planes, etc. so it probably makes sense to do the same here with
dig_ports.


Matt

> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c      | 30 +++++++--------
>  drivers/gpu/drm/i915/display/intel_display.c  |  6 +--
>  drivers/gpu/drm/i915/display/intel_display.h  |  2 +-
>  .../drm/i915/display/intel_display_power.c    |  4 +-
>  .../drm/i915/display/intel_display_types.h    |  8 ++--
>  drivers/gpu/drm/i915/display/intel_dpio_phy.c | 38 +++++++++----------
>  drivers/gpu/drm/i915/display/intel_hdmi.c     | 20 +++++-----
>  7 files changed, 54 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index f054c82214c0..1bdf63845472 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -2900,9 +2900,9 @@ static u32 intel_ddi_dp_level(struct intel_dp *intel_dp)
>  
>  u32 bxt_signal_levels(struct intel_dp *intel_dp)
>  {
> -	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
> -	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
> -	struct intel_encoder *encoder = &dport->base;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
> +	struct intel_encoder *encoder = &dig_port->base;
>  	int level = intel_ddi_dp_level(intel_dp);
>  
>  	if (INTEL_GEN(dev_priv) >= 12)
> @@ -2921,9 +2921,9 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp)
>  
>  u32 ddi_signal_levels(struct intel_dp *intel_dp)
>  {
> -	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
> -	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
> -	struct intel_encoder *encoder = &dport->base;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
> +	struct intel_encoder *encoder = &dig_port->base;
>  	int level = intel_ddi_dp_level(intel_dp);
>  
>  	if (IS_GEN9_BC(dev_priv))
> @@ -4721,14 +4721,14 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)
>  	return connector;
>  }
>  
> -static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dport)
> +static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dig_port)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
> +	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>  
> -	if (dport->base.port != PORT_A)
> +	if (dig_port->base.port != PORT_A)
>  		return false;
>  
> -	if (dport->saved_port_bits & DDI_A_4_LANES)
> +	if (dig_port->saved_port_bits & DDI_A_4_LANES)
>  		return false;
>  
>  	/* Broxton/Geminilake: Bspec says that DDI_A_4_LANES is the only
> @@ -4750,10 +4750,10 @@ static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dport)
>  }
>  
>  static int
> -intel_ddi_max_lanes(struct intel_digital_port *intel_dport)
> +intel_ddi_max_lanes(struct intel_digital_port *dig_port)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(intel_dport->base.base.dev);
> -	enum port port = intel_dport->base.port;
> +	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
> +	enum port port = dig_port->base.port;
>  	int max_lanes = 4;
>  
>  	if (INTEL_GEN(dev_priv) >= 11)
> @@ -4772,9 +4772,9 @@ intel_ddi_max_lanes(struct intel_digital_port *intel_dport)
>  	 * wasn't lit up at boot.  Force this bit set when needed
>  	 * so we use the proper lane count for our calculations.
>  	 */
> -	if (intel_ddi_a_force_4_lanes(intel_dport)) {
> +	if (intel_ddi_a_force_4_lanes(dig_port)) {
>  		DRM_DEBUG_KMS("Forcing DDI_A_4_LANES for port A\n");
> -		intel_dport->saved_port_bits |= DDI_A_4_LANES;
> +		dig_port->saved_port_bits |= DDI_A_4_LANES;
>  		max_lanes = 4;
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 3b9011fd086c..04819b0bd494 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -1606,13 +1606,13 @@ static void chv_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
>  }
>  
>  void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
> -			 struct intel_digital_port *dport,
> +			 struct intel_digital_port *dig_port,
>  			 unsigned int expected_mask)
>  {
>  	u32 port_mask;
>  	i915_reg_t dpll_reg;
>  
> -	switch (dport->base.port) {
> +	switch (dig_port->base.port) {
>  	case PORT_B:
>  		port_mask = DPLL_PORTB_READY_MASK;
>  		dpll_reg = DPLL(0);
> @@ -1633,7 +1633,7 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
>  	if (intel_de_wait_for_register(dev_priv, dpll_reg,
>  				       port_mask, expected_mask, 1000))
>  		WARN(1, "timed out waiting for [ENCODER:%d:%s] port ready: got 0x%x, expected 0x%x\n",
> -		     dport->base.base.base.id, dport->base.base.name,
> +		     dig_port->base.base.base.id, dig_port->base.base.name,
>  		     I915_READ(dpll_reg) & port_mask, expected_mask);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
> index 0fef9263cddc..05d68bd393dc 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.h
> +++ b/drivers/gpu/drm/i915/display/intel_display.h
> @@ -523,7 +523,7 @@ void intel_crtc_vblank_off(const struct intel_crtc_state *crtc_state);
>  
>  int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
>  void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
> -			 struct intel_digital_port *dport,
> +			 struct intel_digital_port *dig_port,
>  			 unsigned int expected_mask);
>  int intel_get_load_detect_pipe(struct drm_connector *connector,
>  			       struct intel_load_detect_pipe *old,
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 679457156797..e6f33e50d6fb 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -1664,8 +1664,8 @@ void chv_phy_powergate_lanes(struct intel_encoder *encoder,
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct i915_power_domains *power_domains = &dev_priv->power_domains;
> -	enum dpio_phy phy = vlv_dport_to_phy(enc_to_dig_port(&encoder->base));
> -	enum dpio_channel ch = vlv_dport_to_channel(enc_to_dig_port(&encoder->base));
> +	enum dpio_phy phy = vlv_dig_port_to_phy(enc_to_dig_port(&encoder->base));
> +	enum dpio_channel ch = vlv_dig_port_to_channel(enc_to_dig_port(&encoder->base));
>  
>  	mutex_lock(&power_domains->lock);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 83ea04149b77..a3a067dacf84 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1377,9 +1377,9 @@ struct intel_dp_mst_encoder {
>  };
>  
>  static inline enum dpio_channel
> -vlv_dport_to_channel(struct intel_digital_port *dport)
> +vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
>  {
> -	switch (dport->base.port) {
> +	switch (dig_port->base.port) {
>  	case PORT_B:
>  	case PORT_D:
>  		return DPIO_CH0;
> @@ -1391,9 +1391,9 @@ vlv_dport_to_channel(struct intel_digital_port *dport)
>  }
>  
>  static inline enum dpio_phy
> -vlv_dport_to_phy(struct intel_digital_port *dport)
> +vlv_dig_port_to_phy(struct intel_digital_port *dig_port)
>  {
> -	switch (dport->base.port) {
> +	switch (dig_port->base.port) {
>  	case PORT_B:
>  	case PORT_C:
>  		return DPIO_PHY0;
> diff --git a/drivers/gpu/drm/i915/display/intel_dpio_phy.c b/drivers/gpu/drm/i915/display/intel_dpio_phy.c
> index 704f38681c4b..f784fe8f6c21 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpio_phy.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpio_phy.c
> @@ -642,9 +642,9 @@ void chv_set_phy_signal_level(struct intel_encoder *encoder,
>  			      bool uniq_trans_scale)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> -	enum dpio_channel ch = vlv_dport_to_channel(dport);
> +	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
>  	enum pipe pipe = intel_crtc->pipe;
>  	u32 val;
>  	int i;
> @@ -738,7 +738,7 @@ void chv_data_lane_soft_reset(struct intel_encoder *encoder,
>  			      bool reset)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> -	enum dpio_channel ch = vlv_dport_to_channel(enc_to_dig_port(&encoder->base));
> +	enum dpio_channel ch = vlv_dig_port_to_channel(enc_to_dig_port(&encoder->base));
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  	enum pipe pipe = crtc->pipe;
>  	u32 val;
> @@ -781,10 +781,10 @@ void chv_data_lane_soft_reset(struct intel_encoder *encoder,
>  void chv_phy_pre_pll_enable(struct intel_encoder *encoder,
>  			    const struct intel_crtc_state *crtc_state)
>  {
> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> -	enum dpio_channel ch = vlv_dport_to_channel(dport);
> +	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
>  	enum pipe pipe = crtc->pipe;
>  	unsigned int lane_mask =
>  		intel_dp_unused_lane_mask(crtc_state->lane_count);
> @@ -795,7 +795,7 @@ void chv_phy_pre_pll_enable(struct intel_encoder *encoder,
>  	 * Otherwise we can't even access the PLL.
>  	 */
>  	if (ch == DPIO_CH0 && pipe == PIPE_B)
> -		dport->release_cl2_override =
> +		dig_port->release_cl2_override =
>  			!chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, true);
>  
>  	chv_phy_powergate_lanes(encoder, true, lane_mask);
> @@ -862,10 +862,10 @@ void chv_phy_pre_encoder_enable(struct intel_encoder *encoder,
>  				const struct intel_crtc_state *crtc_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> -	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> -	enum dpio_channel ch = vlv_dport_to_channel(dport);
> +	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
>  	enum pipe pipe = crtc->pipe;
>  	int data, i, stagger;
>  	u32 val;
> @@ -940,12 +940,12 @@ void chv_phy_pre_encoder_enable(struct intel_encoder *encoder,
>  
>  void chv_phy_release_cl2_override(struct intel_encoder *encoder)
>  {
> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  
> -	if (dport->release_cl2_override) {
> +	if (dig_port->release_cl2_override) {
>  		chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, false);
> -		dport->release_cl2_override = false;
> +		dig_port->release_cl2_override = false;
>  	}
>  }
>  
> @@ -989,8 +989,8 @@ void vlv_set_phy_signal_level(struct intel_encoder *encoder,
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> -	enum dpio_channel port = vlv_dport_to_channel(dport);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
> +	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
>  	enum pipe pipe = intel_crtc->pipe;
>  
>  	vlv_dpio_get(dev_priv);
> @@ -1014,10 +1014,10 @@ void vlv_set_phy_signal_level(struct intel_encoder *encoder,
>  void vlv_phy_pre_pll_enable(struct intel_encoder *encoder,
>  			    const struct intel_crtc_state *crtc_state)
>  {
> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> -	enum dpio_channel port = vlv_dport_to_channel(dport);
> +	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
>  	enum pipe pipe = crtc->pipe;
>  
>  	/* Program Tx lane resets to default */
> @@ -1044,10 +1044,10 @@ void vlv_phy_pre_encoder_enable(struct intel_encoder *encoder,
>  				const struct intel_crtc_state *crtc_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> -	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> -	enum dpio_channel port = vlv_dport_to_channel(dport);
> +	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
>  	enum pipe pipe = crtc->pipe;
>  	u32 val;
>  
> @@ -1073,10 +1073,10 @@ void vlv_phy_pre_encoder_enable(struct intel_encoder *encoder,
>  void vlv_phy_reset_lanes(struct intel_encoder *encoder,
>  			 const struct intel_crtc_state *old_crtc_state)
>  {
> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
> -	enum dpio_channel port = vlv_dport_to_channel(dport);
> +	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
>  	enum pipe pipe = crtc->pipe;
>  
>  	vlv_dpio_get(dev_priv);
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 685589064d10..69fc31df4978 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -2676,7 +2676,7 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder,
>  				const struct intel_crtc_state *pipe_config,
>  				const struct drm_connector_state *conn_state)
>  {
> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  
>  	vlv_phy_pre_encoder_enable(encoder, pipe_config);
> @@ -2685,13 +2685,13 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder,
>  	vlv_set_phy_signal_level(encoder, 0x2b245f5f, 0x00002000, 0x5578b83a,
>  				 0x2b247878);
>  
> -	dport->set_infoframes(encoder,
> -			      pipe_config->has_infoframe,
> -			      pipe_config, conn_state);
> +	dig_port->set_infoframes(encoder,
> +				 pipe_config->has_infoframe,
> +				 pipe_config, conn_state);
>  
>  	g4x_enable_hdmi(encoder, pipe_config, conn_state);
>  
> -	vlv_wait_port_ready(dev_priv, dport, 0x0);
> +	vlv_wait_port_ready(dev_priv, dig_port, 0x0);
>  }
>  
>  static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder,
> @@ -2746,7 +2746,7 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
>  				const struct intel_crtc_state *pipe_config,
>  				const struct drm_connector_state *conn_state)
>  {
> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  
> @@ -2756,13 +2756,13 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
>  	/* Use 800mV-0dB */
>  	chv_set_phy_signal_level(encoder, 128, 102, false);
>  
> -	dport->set_infoframes(encoder,
> -			      pipe_config->has_infoframe,
> -			      pipe_config, conn_state);
> +	dig_port->set_infoframes(encoder,
> +				 pipe_config->has_infoframe,
> +				 pipe_config, conn_state);
>  
>  	g4x_enable_hdmi(encoder, pipe_config, conn_state);
>  
> -	vlv_wait_port_ready(dev_priv, dport, 0x0);
> +	vlv_wait_port_ready(dev_priv, dig_port, 0x0);
>  
>  	/* Second common lane will stay alive on its own now */
>  	chv_phy_release_cl2_override(encoder);
> -- 
> 2.24.0
> 

-- 
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 3/9] drm/i915/display: prefer the more common dig_port name
  2019-12-23 21:16   ` Matt Roper
@ 2019-12-23 21:25     ` Lucas De Marchi
  0 siblings, 0 replies; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-23 21:25 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

On Mon, Dec 23, 2019 at 01:16:56PM -0800, Matt Roper wrote:
>On Mon, Dec 23, 2019 at 11:58:44AM -0800, Lucas De Marchi wrote:
>> intel_ddi.c uses a mix of dport and dig_port as variable for
>> intel_digital_port, with the latter being more frequent. In some cases
>> we were also using intel_dport to make it worse. intel_dpio_phy.c had
>> standardized on dport, but overall dig_port is much more common.
>> Standardize on dig_port.
>>
>> This is the only place in the driver where we refer to a
>> intel_digital_port as intel_dport. Let's use the same name everywhere:
>> dig_port.
>
>The second paragraph here seems redundant (and sounds like it might have
>been the commit message for a second commit you squashed into the first
>since the "This" is ambigous).

yes, I reworded the commit message and forgot to remove this part.
Thanks for catching it.

>
>Also, there are still a bunch of remaining intel_dig_port
>parameters/variables.  Maybe we want an additional patch to drop the
>intel_ prefix from those and make everything consistent?  At this point
>I think we've dropped the intel_ prefix from most/all of our crtcs,
>planes, etc. so it probably makes sense to do the same here with
>dig_ports.

Agreed.

thanks
Lucas De Marchi

>
>
>Matt
>
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_ddi.c      | 30 +++++++--------
>>  drivers/gpu/drm/i915/display/intel_display.c  |  6 +--
>>  drivers/gpu/drm/i915/display/intel_display.h  |  2 +-
>>  .../drm/i915/display/intel_display_power.c    |  4 +-
>>  .../drm/i915/display/intel_display_types.h    |  8 ++--
>>  drivers/gpu/drm/i915/display/intel_dpio_phy.c | 38 +++++++++----------
>>  drivers/gpu/drm/i915/display/intel_hdmi.c     | 20 +++++-----
>>  7 files changed, 54 insertions(+), 54 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
>> index f054c82214c0..1bdf63845472 100644
>> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
>> @@ -2900,9 +2900,9 @@ static u32 intel_ddi_dp_level(struct intel_dp *intel_dp)
>>
>>  u32 bxt_signal_levels(struct intel_dp *intel_dp)
>>  {
>> -	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
>> -	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
>> -	struct intel_encoder *encoder = &dport->base;
>> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>> +	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>> +	struct intel_encoder *encoder = &dig_port->base;
>>  	int level = intel_ddi_dp_level(intel_dp);
>>
>>  	if (INTEL_GEN(dev_priv) >= 12)
>> @@ -2921,9 +2921,9 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp)
>>
>>  u32 ddi_signal_levels(struct intel_dp *intel_dp)
>>  {
>> -	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
>> -	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
>> -	struct intel_encoder *encoder = &dport->base;
>> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>> +	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>> +	struct intel_encoder *encoder = &dig_port->base;
>>  	int level = intel_ddi_dp_level(intel_dp);
>>
>>  	if (IS_GEN9_BC(dev_priv))
>> @@ -4721,14 +4721,14 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)
>>  	return connector;
>>  }
>>
>> -static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dport)
>> +static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dig_port)
>>  {
>> -	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
>> +	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>>
>> -	if (dport->base.port != PORT_A)
>> +	if (dig_port->base.port != PORT_A)
>>  		return false;
>>
>> -	if (dport->saved_port_bits & DDI_A_4_LANES)
>> +	if (dig_port->saved_port_bits & DDI_A_4_LANES)
>>  		return false;
>>
>>  	/* Broxton/Geminilake: Bspec says that DDI_A_4_LANES is the only
>> @@ -4750,10 +4750,10 @@ static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dport)
>>  }
>>
>>  static int
>> -intel_ddi_max_lanes(struct intel_digital_port *intel_dport)
>> +intel_ddi_max_lanes(struct intel_digital_port *dig_port)
>>  {
>> -	struct drm_i915_private *dev_priv = to_i915(intel_dport->base.base.dev);
>> -	enum port port = intel_dport->base.port;
>> +	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>> +	enum port port = dig_port->base.port;
>>  	int max_lanes = 4;
>>
>>  	if (INTEL_GEN(dev_priv) >= 11)
>> @@ -4772,9 +4772,9 @@ intel_ddi_max_lanes(struct intel_digital_port *intel_dport)
>>  	 * wasn't lit up at boot.  Force this bit set when needed
>>  	 * so we use the proper lane count for our calculations.
>>  	 */
>> -	if (intel_ddi_a_force_4_lanes(intel_dport)) {
>> +	if (intel_ddi_a_force_4_lanes(dig_port)) {
>>  		DRM_DEBUG_KMS("Forcing DDI_A_4_LANES for port A\n");
>> -		intel_dport->saved_port_bits |= DDI_A_4_LANES;
>> +		dig_port->saved_port_bits |= DDI_A_4_LANES;
>>  		max_lanes = 4;
>>  	}
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index 3b9011fd086c..04819b0bd494 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -1606,13 +1606,13 @@ static void chv_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
>>  }
>>
>>  void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
>> -			 struct intel_digital_port *dport,
>> +			 struct intel_digital_port *dig_port,
>>  			 unsigned int expected_mask)
>>  {
>>  	u32 port_mask;
>>  	i915_reg_t dpll_reg;
>>
>> -	switch (dport->base.port) {
>> +	switch (dig_port->base.port) {
>>  	case PORT_B:
>>  		port_mask = DPLL_PORTB_READY_MASK;
>>  		dpll_reg = DPLL(0);
>> @@ -1633,7 +1633,7 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
>>  	if (intel_de_wait_for_register(dev_priv, dpll_reg,
>>  				       port_mask, expected_mask, 1000))
>>  		WARN(1, "timed out waiting for [ENCODER:%d:%s] port ready: got 0x%x, expected 0x%x\n",
>> -		     dport->base.base.base.id, dport->base.base.name,
>> +		     dig_port->base.base.base.id, dig_port->base.base.name,
>>  		     I915_READ(dpll_reg) & port_mask, expected_mask);
>>  }
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
>> index 0fef9263cddc..05d68bd393dc 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display.h
>> @@ -523,7 +523,7 @@ void intel_crtc_vblank_off(const struct intel_crtc_state *crtc_state);
>>
>>  int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
>>  void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
>> -			 struct intel_digital_port *dport,
>> +			 struct intel_digital_port *dig_port,
>>  			 unsigned int expected_mask);
>>  int intel_get_load_detect_pipe(struct drm_connector *connector,
>>  			       struct intel_load_detect_pipe *old,
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
>> index 679457156797..e6f33e50d6fb 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
>> @@ -1664,8 +1664,8 @@ void chv_phy_powergate_lanes(struct intel_encoder *encoder,
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>  	struct i915_power_domains *power_domains = &dev_priv->power_domains;
>> -	enum dpio_phy phy = vlv_dport_to_phy(enc_to_dig_port(&encoder->base));
>> -	enum dpio_channel ch = vlv_dport_to_channel(enc_to_dig_port(&encoder->base));
>> +	enum dpio_phy phy = vlv_dig_port_to_phy(enc_to_dig_port(&encoder->base));
>> +	enum dpio_channel ch = vlv_dig_port_to_channel(enc_to_dig_port(&encoder->base));
>>
>>  	mutex_lock(&power_domains->lock);
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
>> index 83ea04149b77..a3a067dacf84 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
>> @@ -1377,9 +1377,9 @@ struct intel_dp_mst_encoder {
>>  };
>>
>>  static inline enum dpio_channel
>> -vlv_dport_to_channel(struct intel_digital_port *dport)
>> +vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
>>  {
>> -	switch (dport->base.port) {
>> +	switch (dig_port->base.port) {
>>  	case PORT_B:
>>  	case PORT_D:
>>  		return DPIO_CH0;
>> @@ -1391,9 +1391,9 @@ vlv_dport_to_channel(struct intel_digital_port *dport)
>>  }
>>
>>  static inline enum dpio_phy
>> -vlv_dport_to_phy(struct intel_digital_port *dport)
>> +vlv_dig_port_to_phy(struct intel_digital_port *dig_port)
>>  {
>> -	switch (dport->base.port) {
>> +	switch (dig_port->base.port) {
>>  	case PORT_B:
>>  	case PORT_C:
>>  		return DPIO_PHY0;
>> diff --git a/drivers/gpu/drm/i915/display/intel_dpio_phy.c b/drivers/gpu/drm/i915/display/intel_dpio_phy.c
>> index 704f38681c4b..f784fe8f6c21 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dpio_phy.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dpio_phy.c
>> @@ -642,9 +642,9 @@ void chv_set_phy_signal_level(struct intel_encoder *encoder,
>>  			      bool uniq_trans_scale)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
>> -	enum dpio_channel ch = vlv_dport_to_channel(dport);
>> +	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
>>  	enum pipe pipe = intel_crtc->pipe;
>>  	u32 val;
>>  	int i;
>> @@ -738,7 +738,7 @@ void chv_data_lane_soft_reset(struct intel_encoder *encoder,
>>  			      bool reset)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>> -	enum dpio_channel ch = vlv_dport_to_channel(enc_to_dig_port(&encoder->base));
>> +	enum dpio_channel ch = vlv_dig_port_to_channel(enc_to_dig_port(&encoder->base));
>>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>>  	enum pipe pipe = crtc->pipe;
>>  	u32 val;
>> @@ -781,10 +781,10 @@ void chv_data_lane_soft_reset(struct intel_encoder *encoder,
>>  void chv_phy_pre_pll_enable(struct intel_encoder *encoder,
>>  			    const struct intel_crtc_state *crtc_state)
>>  {
>> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>> -	enum dpio_channel ch = vlv_dport_to_channel(dport);
>> +	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
>>  	enum pipe pipe = crtc->pipe;
>>  	unsigned int lane_mask =
>>  		intel_dp_unused_lane_mask(crtc_state->lane_count);
>> @@ -795,7 +795,7 @@ void chv_phy_pre_pll_enable(struct intel_encoder *encoder,
>>  	 * Otherwise we can't even access the PLL.
>>  	 */
>>  	if (ch == DPIO_CH0 && pipe == PIPE_B)
>> -		dport->release_cl2_override =
>> +		dig_port->release_cl2_override =
>>  			!chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, true);
>>
>>  	chv_phy_powergate_lanes(encoder, true, lane_mask);
>> @@ -862,10 +862,10 @@ void chv_phy_pre_encoder_enable(struct intel_encoder *encoder,
>>  				const struct intel_crtc_state *crtc_state)
>>  {
>>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>> -	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
>> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>> -	enum dpio_channel ch = vlv_dport_to_channel(dport);
>> +	enum dpio_channel ch = vlv_dig_port_to_channel(dig_port);
>>  	enum pipe pipe = crtc->pipe;
>>  	int data, i, stagger;
>>  	u32 val;
>> @@ -940,12 +940,12 @@ void chv_phy_pre_encoder_enable(struct intel_encoder *encoder,
>>
>>  void chv_phy_release_cl2_override(struct intel_encoder *encoder)
>>  {
>> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>
>> -	if (dport->release_cl2_override) {
>> +	if (dig_port->release_cl2_override) {
>>  		chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, false);
>> -		dport->release_cl2_override = false;
>> +		dig_port->release_cl2_override = false;
>>  	}
>>  }
>>
>> @@ -989,8 +989,8 @@ void vlv_set_phy_signal_level(struct intel_encoder *encoder,
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
>> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>> -	enum dpio_channel port = vlv_dport_to_channel(dport);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>> +	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
>>  	enum pipe pipe = intel_crtc->pipe;
>>
>>  	vlv_dpio_get(dev_priv);
>> @@ -1014,10 +1014,10 @@ void vlv_set_phy_signal_level(struct intel_encoder *encoder,
>>  void vlv_phy_pre_pll_enable(struct intel_encoder *encoder,
>>  			    const struct intel_crtc_state *crtc_state)
>>  {
>> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>> -	enum dpio_channel port = vlv_dport_to_channel(dport);
>> +	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
>>  	enum pipe pipe = crtc->pipe;
>>
>>  	/* Program Tx lane resets to default */
>> @@ -1044,10 +1044,10 @@ void vlv_phy_pre_encoder_enable(struct intel_encoder *encoder,
>>  				const struct intel_crtc_state *crtc_state)
>>  {
>>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>> -	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
>> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>> -	enum dpio_channel port = vlv_dport_to_channel(dport);
>> +	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
>>  	enum pipe pipe = crtc->pipe;
>>  	u32 val;
>>
>> @@ -1073,10 +1073,10 @@ void vlv_phy_pre_encoder_enable(struct intel_encoder *encoder,
>>  void vlv_phy_reset_lanes(struct intel_encoder *encoder,
>>  			 const struct intel_crtc_state *old_crtc_state)
>>  {
>> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
>> -	enum dpio_channel port = vlv_dport_to_channel(dport);
>> +	enum dpio_channel port = vlv_dig_port_to_channel(dig_port);
>>  	enum pipe pipe = crtc->pipe;
>>
>>  	vlv_dpio_get(dev_priv);
>> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
>> index 685589064d10..69fc31df4978 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
>> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
>> @@ -2676,7 +2676,7 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder,
>>  				const struct intel_crtc_state *pipe_config,
>>  				const struct drm_connector_state *conn_state)
>>  {
>> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>
>>  	vlv_phy_pre_encoder_enable(encoder, pipe_config);
>> @@ -2685,13 +2685,13 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder,
>>  	vlv_set_phy_signal_level(encoder, 0x2b245f5f, 0x00002000, 0x5578b83a,
>>  				 0x2b247878);
>>
>> -	dport->set_infoframes(encoder,
>> -			      pipe_config->has_infoframe,
>> -			      pipe_config, conn_state);
>> +	dig_port->set_infoframes(encoder,
>> +				 pipe_config->has_infoframe,
>> +				 pipe_config, conn_state);
>>
>>  	g4x_enable_hdmi(encoder, pipe_config, conn_state);
>>
>> -	vlv_wait_port_ready(dev_priv, dport, 0x0);
>> +	vlv_wait_port_ready(dev_priv, dig_port, 0x0);
>>  }
>>
>>  static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder,
>> @@ -2746,7 +2746,7 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
>>  				const struct intel_crtc_state *pipe_config,
>>  				const struct drm_connector_state *conn_state)
>>  {
>> -	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>>  	struct drm_device *dev = encoder->base.dev;
>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>
>> @@ -2756,13 +2756,13 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
>>  	/* Use 800mV-0dB */
>>  	chv_set_phy_signal_level(encoder, 128, 102, false);
>>
>> -	dport->set_infoframes(encoder,
>> -			      pipe_config->has_infoframe,
>> -			      pipe_config, conn_state);
>> +	dig_port->set_infoframes(encoder,
>> +				 pipe_config->has_infoframe,
>> +				 pipe_config, conn_state);
>>
>>  	g4x_enable_hdmi(encoder, pipe_config, conn_state);
>>
>> -	vlv_wait_port_ready(dev_priv, dport, 0x0);
>> +	vlv_wait_port_ready(dev_priv, dig_port, 0x0);
>>
>>  	/* Second common lane will stay alive on its own now */
>>  	chv_phy_release_cl2_override(encoder);
>> --
>> 2.24.0
>>
>
>-- 
>Matt Roper
>Graphics Software Engineer
>VTT-OSGC Platform Enablement
>Intel Corporation
>(916) 356-2795
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init Lucas De Marchi
@ 2019-12-24  0:00   ` Matt Roper
  2019-12-31 10:14   ` Jani Nikula
  1 sibling, 0 replies; 34+ messages in thread
From: Matt Roper @ 2019-12-24  0:00 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

On Mon, Dec 23, 2019 at 11:58:46AM -0800, Lucas De Marchi wrote:
> By adding a hook that determines if a port is present, we are able to
> support Ice Lake in the new description-based DDI initialization.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 61 ++++++++++++++------
>  1 file changed, 42 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index b3fb1e03cb0b..6b4d320ff92c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16224,9 +16224,28 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
>  struct intel_output {
>  	/* Initialize DSI if present */
>  	void (*dsi_init)(struct drm_i915_private *i915);
> +
> +	/*
> +	 * Check if port is present before trying to initialize; if not provided
> +	 * it's assumed the port is present (or we can't check and fail
> +	 * gracefully
> +	 */
> +	bool (*is_port_present)(struct drm_i915_private *i915,
> +				const struct intel_ddi_port_info *port_info);
> +
>  	struct intel_ddi_port_info ddi_ports[];
>  };
>  
> +static bool icl_is_port_present(struct drm_i915_private *i915,
> +				const struct intel_ddi_port_info *port_info)
> +{
> +	if (port_info->port != PORT_F)
> +		return true;
> +
> +	return IS_ICL_WITH_PORT_F(i915) &&
> +		intel_bios_is_port_present(i915, PORT_F);
> +}
> +
>  static const struct intel_output tgl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> @@ -16242,6 +16261,20 @@ static const struct intel_output tgl_output = {
>  	}
>  };
>  
> +static const struct intel_output icl_output = {
> +	.dsi_init = icl_dsi_init,
> +	.is_port_present = icl_is_port_present,
> +	.ddi_ports = {
> +		{ .port = PORT_A },
> +		{ .port = PORT_B },
> +		{ .port = PORT_C },
> +		{ .port = PORT_D },
> +		{ .port = PORT_E },
> +		{ .port = PORT_F },
> +		{ .port = PORT_NONE }
> +	}

As we add more platforms, I could see there being multiple reasons to
disqualify outputs that we mix and match across platforms (e.g.,
dedicated fuse + hw workaround + some new platform thing).  Maybe rather
than adding a per-platform detection funtion pointer at the top level,
we could add a detect_flags variable to .ddi_ports that indicates which
style(s) of detection should be applied?  Only if we satisfy the test
associated with each flag would the output get initialized.

But I might be overthinking this.  Up to you.


Matt

> +};
> +
>  static const struct intel_output ehl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> @@ -16276,12 +16309,19 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
>  		output = &tgl_output;
>  	else if (IS_ELKHARTLAKE(i915))
>  		output = &ehl_output;
> +	else if (IS_GEN(i915, 11))
> +		output = &icl_output;
>  	else if (IS_GEN9_LP(i915))
>  		output = &gen9lp_output;
>  
>  	for (port_info = output->ddi_ports;
> -	     port_info->port != PORT_NONE; port_info++)
> +	     port_info->port != PORT_NONE; port_info++) {
> +		if (output->is_port_present &&
> +		    !output->is_port_present(i915, port_info))
> +			continue;
> +
>  		intel_ddi_init(i915, port_info->port);
> +	}
>  
>  	if (output->dsi_init)
>  		output->dsi_init(i915);
> @@ -16297,25 +16337,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>  	if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
>  		return;
>  
> -	if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
> -	    IS_GEN9_LP(dev_priv)) {
> +	if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
>  		setup_ddi_outputs_desc(dev_priv);
> -	} else if (IS_GEN(dev_priv, 11)) {
> -		intel_ddi_init(dev_priv, PORT_A);
> -		intel_ddi_init(dev_priv, PORT_B);
> -		intel_ddi_init(dev_priv, PORT_C);
> -		intel_ddi_init(dev_priv, PORT_D);
> -		intel_ddi_init(dev_priv, PORT_E);
> -		/*
> -		 * On some ICL SKUs port F is not present. No strap bits for
> -		 * this, so rely on VBT.
> -		 * Work around broken VBTs on SKUs known to have no port F.
> -		 */
> -		if (IS_ICL_WITH_PORT_F(dev_priv) &&
> -		    intel_bios_is_port_present(dev_priv, PORT_F))
> -			intel_ddi_init(dev_priv, PORT_F);
> -
> -		icl_dsi_init(dev_priv);
>  	} else if (HAS_DDI(dev_priv)) {
>  		int found;
>  
> -- 
> 2.24.0
> 

-- 
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes Lucas De Marchi
@ 2019-12-24  0:10   ` Matt Roper
  2019-12-24  0:17     ` Lucas De Marchi
  2019-12-31 10:33   ` Jani Nikula
  1 sibling, 1 reply; 34+ messages in thread
From: Matt Roper @ 2019-12-24  0:10 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

On Mon, Dec 23, 2019 at 11:58:48AM -0800, Lucas De Marchi wrote:
> Identify 3 possible cases in which the index numbers can be different
> from the "port" and add them to the description-based ddi initialization
> table.  This can be used in place of additional functions mapping from
> on to the other.  Right now we already cover part of this by creating kind of
> virtual phy numbering, but that comes with downsides:
> 
> a) there's not really a "phy numbering" in the spec, this is purely a
> software thing; hardware uses whatever they want thinking mapping from
> one to the other arbitrarily is easy in software.
> 
> b) currently the mapping occurs on "leaf" functions, making the decision
> based on the platform.
> 
> With this new table the approach will be: the port as defined by the
> enum port is purely a driver convention and won't be used anymore to
> define the register offset or register bits. For that we have the other
> 3 indexes, identified as being possibly different from the current usage
> of register bits: ddi, vbt and phy. The phy type is also added here,
> meant to replace the checks for combo vs tc (although the helper
> functions can remain so we may differentiate between, e.g. Dekel and MG
> phys).
> 
> While at it, also give names to the ports so they can be easily
> identified.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 54 +++++++++----------
>  drivers/gpu/drm/i915/display/intel_display.h  |  7 +++
>  .../drm/i915/display/intel_display_types.h    |  5 ++
>  3 files changed, 39 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index ad85cf75c815..219f180fa395 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16277,14 +16277,14 @@ static bool ddi_is_port_present(struct drm_i915_private *i915,
>  static const struct intel_output tgl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_D },
> -		{ .port = PORT_E },
> -		{ .port = PORT_F },
> -		{ .port = PORT_G },
> -		{ .port = PORT_H },
> -		{ .port = PORT_I },
> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> +		{ .name = "DDI TC1", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x2, },
> +		{ .name = "DDI TC2", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x1, .vbt_idx = 0x3, },
> +		{ .name = "DDI TC3", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x2, .vbt_idx = 0x4, },
> +		{ .name = "DDI TC4", .port = PORT_G, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x6, .phy_idx = 0x3, .vbt_idx = 0x5, },
> +		{ .name = "DDI TC5", .port = PORT_H, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x7, .phy_idx = 0x4, .vbt_idx = 0x6, },
> +		{ .name = "DDI TC6", .port = PORT_I, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x8, .phy_idx = 0x5, .vbt_idx = 0x7, },
>  		{ .port = PORT_NONE }
>  	}
>  };
> @@ -16293,12 +16293,12 @@ static const struct intel_output icl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.is_port_present = icl_is_port_present,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_C },
> -		{ .port = PORT_D },
> -		{ .port = PORT_E },
> -		{ .port = PORT_F },
> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> +		{ .name = "DDI TC1", .port = PORT_C, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x2, .phy_idx = 0x0, .vbt_idx = 0x2, },
> +		{ .name = "DDI TC2", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x1, .vbt_idx = 0x3, },
> +		{ .name = "DDI TC3", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x2, .vbt_idx = 0x4, },
> +		{ .name = "DDI TC4", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x3, .vbt_idx = 0x5, },
>  		{ .port = PORT_NONE }
>  	}
>  };
> @@ -16306,10 +16306,10 @@ static const struct intel_output icl_output = {
>  static const struct intel_output ehl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_C },
> -		{ .port = PORT_D },
> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> +		{ .name = "DDI C",   .port = PORT_C, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2, },
> +		{ .name = "DDI D",   .port = PORT_D, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x3, },
>  		{ .port = PORT_NONE }
>  	}
>  };
> @@ -16317,9 +16317,9 @@ static const struct intel_output ehl_output = {
>  static const struct intel_output gen9lp_output = {
>  	.dsi_init = vlv_dsi_init,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_C },
> +		{ .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
> +		{ .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
> +		{ .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
>  		{ .port = PORT_NONE }
>  	},
>  };
> @@ -16327,12 +16327,12 @@ static const struct intel_output gen9lp_output = {
>  static const struct intel_output ddi_output = {
>  	.is_port_present = ddi_is_port_present,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_C },
> -		{ .port = PORT_D },
> -		{ .port = PORT_E },
> -		{ .port = PORT_F },
> +		{ .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
> +		{ .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
> +		{ .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
> +		{ .name = "DDI D", .port = PORT_D, .ddi_idx = 0x3, .phy_idx = 0x3, .vbt_idx = 0x3 },
> +		{ .name = "DDI E", .port = PORT_E, .ddi_idx = 0x4, .phy_idx = 0x4, .vbt_idx = 0x4 },
> +		{ .name = "DDI F", .port = PORT_F, .ddi_idx = 0x5, .phy_idx = 0x5, .vbt_idx = 0x5 },
>  		{ .port = PORT_NONE }
>  	}
>  };
> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
> index 05d68bd393dc..db19e5eee248 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.h
> +++ b/drivers/gpu/drm/i915/display/intel_display.h
> @@ -303,6 +303,13 @@ enum phy {
>  	I915_MAX_PHYS
>  };
>  
> +enum phy_type {
> +	PHY_TYPE_NONE = 0,
> +
> +	PHY_TYPE_COMBO,
> +	PHY_TYPE_TC,
> +};

Why not go ahead and actually specify the true phy type in the enum?

        enum phy_type {
                PHY_TYPE_NONE = 0,

                PHY_TYPE_COMBO,
                PHY_TYPE_MG,
                PHY_TYPE_DKL,
                PHY_TYPE_FOO,
                PHY_TYPE_BAR,
        };

and then once your series is complete the helpers can figure out whether
something is "type c" with something like
   type == MG || type == DKL || type == BAR


Matt

> +
>  #define phy_name(a) ((a) + 'A')
>  
>  enum phy_fia {
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 4d2f4ee35812..23a885895803 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1377,7 +1377,12 @@ struct intel_dp_mst_encoder {
>  };
>  
>  struct intel_ddi_port_info {
> +	const char *name;
>  	enum port port;
> +	s8 phy_type;
> +	u8 ddi_idx;
> +	u8 phy_idx;
> +	u8 vbt_idx;
>  };
>  
>  static inline enum dpio_channel
> -- 
> 2.24.0
> 

-- 
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init Lucas De Marchi
@ 2019-12-24  0:16   ` Matt Roper
  2019-12-31 11:20     ` Jani Nikula
  2019-12-31 11:22   ` Jani Nikula
  1 sibling, 1 reply; 34+ messages in thread
From: Matt Roper @ 2019-12-24  0:16 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

On Mon, Dec 23, 2019 at 11:58:50AM -0800, Lucas De Marchi wrote:
> Now that we have tables for all platforms using ddi, keep the port_info
> around so we can use it for decisions like "what phy does it have?"
> instead of keep checking the platform/gen everywhere.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c      | 36 ++++++++++++-------
>  drivers/gpu/drm/i915/display/intel_ddi.h      |  8 ++++-
>  drivers/gpu/drm/i915/display/intel_display.c  |  2 +-
>  .../drm/i915/display/intel_display_types.h    |  3 ++
>  4 files changed, 35 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index a1b7075ea6be..9d06a34f5f8e 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4782,14 +4782,25 @@ intel_ddi_max_lanes(struct intel_digital_port *dig_port)
>  	return max_lanes;
>  }
>  
> -void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
> +bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port)
>  {
> +	return dig_port->port_info->phy_type == PHY_TYPE_TC;
> +}
> +
> +bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port)
> +{
> +	return dig_port->port_info->phy_type == PHY_TYPE_COMBO;
> +}
> +
> +void intel_ddi_init(struct drm_i915_private *dev_priv,
> +		    const struct intel_ddi_port_info *port_info)
> +{
> +	enum port port = port_info->port;
>  	struct ddi_vbt_port_info *vbt_port_info =
>  		&dev_priv->vbt.ddi_port_info[port];
>  	struct intel_digital_port *intel_dig_port;
>  	struct intel_encoder *encoder;
>  	bool init_hdmi, init_dp, init_lspcon = false;
> -	enum phy phy = intel_port_to_phy(dev_priv, port);
>  
>  	init_hdmi = vbt_port_info->supports_dvi || vbt_port_info->supports_hdmi;
>  	init_dp = vbt_port_info->supports_dp;
> @@ -4803,12 +4814,12 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  		init_dp = true;
>  		init_lspcon = true;
>  		init_hdmi = false;
> -		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
> +		DRM_DEBUG_KMS("VBT says port %s has lspcon\n", port_info->name);
>  	}
>  
>  	if (!init_dp && !init_hdmi) {
> -		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
> -			      port_name(port));
> +		DRM_DEBUG_KMS("VBT says %s is not DVI/HDMI/DP compatible, respect it\n",
> +			      port_info->name);
>  		return;
>  	}
>  
> @@ -4819,7 +4830,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	encoder = &intel_dig_port->base;
>  
>  	drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
> -			 DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port));
> +			 DRM_MODE_ENCODER_TMDS, port_info->name);
>  
>  	encoder->hotplug = intel_ddi_hotplug;
>  	encoder->compute_output_type = intel_ddi_compute_output_type;
> @@ -4837,7 +4848,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  
>  	encoder->type = INTEL_OUTPUT_DDI;
>  	encoder->power_domain = intel_port_to_power_domain(port);
> -	encoder->port = port;
> +	encoder->port = port_info->port;

In theory, shouldn't we be able to drop encoder->port completely once
we've converted everything over to the proper ddi/phy/vbt namespace?

Overall I like the direction this series is going.  The continued use of
'port' terminology, both in the driver and in the hardware specs has
become increasingly confusing as things get chopped up and indexed
differently.  I think this will help clarify exactly what a platform is
expecting and force people to think about which namespace is correct for
the part of the hardware they're working with.


Matt

>  	encoder->cloneable = 0;
>  	encoder->pipe_mask = ~0;
>  
> @@ -4851,8 +4862,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
>  	intel_dig_port->max_lanes = intel_ddi_max_lanes(intel_dig_port);
>  	intel_dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
> +	intel_dig_port->port_info = port_info;
>  
> -	if (intel_phy_is_tc(dev_priv, phy)) {
> +	if (intel_ddi_has_tc_phy(intel_dig_port)) {
>  		bool is_legacy = !vbt_port_info->supports_typec_usb &&
>  				 !vbt_port_info->supports_tbt;
>  
> @@ -4883,15 +4895,15 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	if (init_lspcon) {
>  		if (lspcon_init(intel_dig_port))
>  			/* TODO: handle hdmi info frame part */
> -			DRM_DEBUG_KMS("LSPCON init success on port %c\n",
> -				port_name(port));
> +			DRM_DEBUG_KMS("LSPCON init success on port %s\n",
> +				      port_info->name);
>  		else
>  			/*
>  			 * LSPCON init faied, but DP init was success, so
>  			 * lets try to drive as DP++ port.
>  			 */
> -			DRM_ERROR("LSPCON init failed on port %c\n",
> -				port_name(port));
> +			DRM_ERROR("LSPCON init failed on port %s\n",
> +				  port_info->name);
>  	}
>  
>  	intel_infoframe_init(intel_dig_port);
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h b/drivers/gpu/drm/i915/display/intel_ddi.h
> index 167c6579d972..c500d473963e 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.h
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
> @@ -15,6 +15,7 @@ struct drm_i915_private;
>  struct intel_connector;
>  struct intel_crtc;
>  struct intel_crtc_state;
> +struct intel_ddi_port_info;
>  struct intel_dp;
>  struct intel_dpll_hw_state;
>  struct intel_encoder;
> @@ -24,7 +25,8 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
>  				const struct drm_connector_state *old_conn_state);
>  void hsw_fdi_link_train(struct intel_encoder *encoder,
>  			const struct intel_crtc_state *crtc_state);
> -void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port);
> +void intel_ddi_init(struct drm_i915_private *dev_priv,
> +		    const struct intel_ddi_port_info *port_info);
>  bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
>  void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state);
>  void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state);
> @@ -50,4 +52,8 @@ void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
>  int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
>  			struct intel_dpll_hw_state *state);
>  
> +
> +bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port);
> +bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port);
> +
>  #endif /* __INTEL_DDI_H__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 219f180fa395..96207dc83fac 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16363,7 +16363,7 @@ static void setup_ddi_outputs(struct drm_i915_private *i915)
>  		    !output->is_port_present(i915, port_info))
>  			continue;
>  
> -		intel_ddi_init(i915, port_info->port);
> +		intel_ddi_init(i915, port_info);
>  	}
>  
>  	if (output->dsi_init)
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 23a885895803..c54b0178e885 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1346,6 +1346,9 @@ struct intel_digital_port {
>  	enum intel_display_power_domain ddi_io_power_domain;
>  	struct mutex tc_lock;	/* protects the TypeC port mode */
>  	intel_wakeref_t tc_lock_wakeref;
> +
> +	const struct intel_ddi_port_info *port_info;
> +
>  	int tc_link_refcount;
>  	bool tc_legacy_port:1;
>  	char tc_port_name[8];
> -- 
> 2.24.0
> 

-- 
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes
  2019-12-24  0:10   ` Matt Roper
@ 2019-12-24  0:17     ` Lucas De Marchi
  0 siblings, 0 replies; 34+ messages in thread
From: Lucas De Marchi @ 2019-12-24  0:17 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

On Mon, Dec 23, 2019 at 04:10:44PM -0800, Matt Roper wrote:
>On Mon, Dec 23, 2019 at 11:58:48AM -0800, Lucas De Marchi wrote:
>> Identify 3 possible cases in which the index numbers can be different
>> from the "port" and add them to the description-based ddi initialization
>> table.  This can be used in place of additional functions mapping from
>> on to the other.  Right now we already cover part of this by creating kind of
>> virtual phy numbering, but that comes with downsides:
>>
>> a) there's not really a "phy numbering" in the spec, this is purely a
>> software thing; hardware uses whatever they want thinking mapping from
>> one to the other arbitrarily is easy in software.
>>
>> b) currently the mapping occurs on "leaf" functions, making the decision
>> based on the platform.
>>
>> With this new table the approach will be: the port as defined by the
>> enum port is purely a driver convention and won't be used anymore to
>> define the register offset or register bits. For that we have the other
>> 3 indexes, identified as being possibly different from the current usage
>> of register bits: ddi, vbt and phy. The phy type is also added here,
>> meant to replace the checks for combo vs tc (although the helper
>> functions can remain so we may differentiate between, e.g. Dekel and MG
>> phys).
>>
>> While at it, also give names to the ports so they can be easily
>> identified.
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_display.c  | 54 +++++++++----------
>>  drivers/gpu/drm/i915/display/intel_display.h  |  7 +++
>>  .../drm/i915/display/intel_display_types.h    |  5 ++
>>  3 files changed, 39 insertions(+), 27 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index ad85cf75c815..219f180fa395 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -16277,14 +16277,14 @@ static bool ddi_is_port_present(struct drm_i915_private *i915,
>>  static const struct intel_output tgl_output = {
>>  	.dsi_init = icl_dsi_init,
>>  	.ddi_ports = {
>> -		{ .port = PORT_A },
>> -		{ .port = PORT_B },
>> -		{ .port = PORT_D },
>> -		{ .port = PORT_E },
>> -		{ .port = PORT_F },
>> -		{ .port = PORT_G },
>> -		{ .port = PORT_H },
>> -		{ .port = PORT_I },
>> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
>> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
>> +		{ .name = "DDI TC1", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x2, },
>> +		{ .name = "DDI TC2", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x1, .vbt_idx = 0x3, },
>> +		{ .name = "DDI TC3", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x2, .vbt_idx = 0x4, },
>> +		{ .name = "DDI TC4", .port = PORT_G, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x6, .phy_idx = 0x3, .vbt_idx = 0x5, },
>> +		{ .name = "DDI TC5", .port = PORT_H, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x7, .phy_idx = 0x4, .vbt_idx = 0x6, },
>> +		{ .name = "DDI TC6", .port = PORT_I, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x8, .phy_idx = 0x5, .vbt_idx = 0x7, },
>>  		{ .port = PORT_NONE }
>>  	}
>>  };
>> @@ -16293,12 +16293,12 @@ static const struct intel_output icl_output = {
>>  	.dsi_init = icl_dsi_init,
>>  	.is_port_present = icl_is_port_present,
>>  	.ddi_ports = {
>> -		{ .port = PORT_A },
>> -		{ .port = PORT_B },
>> -		{ .port = PORT_C },
>> -		{ .port = PORT_D },
>> -		{ .port = PORT_E },
>> -		{ .port = PORT_F },
>> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
>> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
>> +		{ .name = "DDI TC1", .port = PORT_C, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x2, .phy_idx = 0x0, .vbt_idx = 0x2, },
>> +		{ .name = "DDI TC2", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x1, .vbt_idx = 0x3, },
>> +		{ .name = "DDI TC3", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x2, .vbt_idx = 0x4, },
>> +		{ .name = "DDI TC4", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x3, .vbt_idx = 0x5, },
>>  		{ .port = PORT_NONE }
>>  	}
>>  };
>> @@ -16306,10 +16306,10 @@ static const struct intel_output icl_output = {
>>  static const struct intel_output ehl_output = {
>>  	.dsi_init = icl_dsi_init,
>>  	.ddi_ports = {
>> -		{ .port = PORT_A },
>> -		{ .port = PORT_B },
>> -		{ .port = PORT_C },
>> -		{ .port = PORT_D },
>> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
>> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
>> +		{ .name = "DDI C",   .port = PORT_C, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2, },
>> +		{ .name = "DDI D",   .port = PORT_D, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x3, },
>>  		{ .port = PORT_NONE }
>>  	}
>>  };
>> @@ -16317,9 +16317,9 @@ static const struct intel_output ehl_output = {
>>  static const struct intel_output gen9lp_output = {
>>  	.dsi_init = vlv_dsi_init,
>>  	.ddi_ports = {
>> -		{ .port = PORT_A },
>> -		{ .port = PORT_B },
>> -		{ .port = PORT_C },
>> +		{ .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
>> +		{ .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
>> +		{ .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
>>  		{ .port = PORT_NONE }
>>  	},
>>  };
>> @@ -16327,12 +16327,12 @@ static const struct intel_output gen9lp_output = {
>>  static const struct intel_output ddi_output = {
>>  	.is_port_present = ddi_is_port_present,
>>  	.ddi_ports = {
>> -		{ .port = PORT_A },
>> -		{ .port = PORT_B },
>> -		{ .port = PORT_C },
>> -		{ .port = PORT_D },
>> -		{ .port = PORT_E },
>> -		{ .port = PORT_F },
>> +		{ .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
>> +		{ .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
>> +		{ .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
>> +		{ .name = "DDI D", .port = PORT_D, .ddi_idx = 0x3, .phy_idx = 0x3, .vbt_idx = 0x3 },
>> +		{ .name = "DDI E", .port = PORT_E, .ddi_idx = 0x4, .phy_idx = 0x4, .vbt_idx = 0x4 },
>> +		{ .name = "DDI F", .port = PORT_F, .ddi_idx = 0x5, .phy_idx = 0x5, .vbt_idx = 0x5 },
>>  		{ .port = PORT_NONE }
>>  	}
>>  };
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
>> index 05d68bd393dc..db19e5eee248 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display.h
>> @@ -303,6 +303,13 @@ enum phy {
>>  	I915_MAX_PHYS
>>  };
>>
>> +enum phy_type {
>> +	PHY_TYPE_NONE = 0,
>> +
>> +	PHY_TYPE_COMBO,
>> +	PHY_TYPE_TC,
>> +};
>
>Why not go ahead and actually specify the true phy type in the enum?
>
>        enum phy_type {
>                PHY_TYPE_NONE = 0,
>
>                PHY_TYPE_COMBO,
>                PHY_TYPE_MG,
>                PHY_TYPE_DKL,
>                PHY_TYPE_FOO,
>                PHY_TYPE_BAR,
>        };
>
>and then once your series is complete the helpers can figure out whether
>something is "type c" with something like
>   type == MG || type == DKL || type == BAR

yeah, I thought about that but I couldn't find a compelling reason to
differentiate DKL and MG.  There's only a single place where it could be
useful, but I didn't convert enough of the driver to make sure it
actually is.

that's a good option indeed, I will think about it while doing the rest
of the conversion if people agree with the general idea on this series.

thanks
Lucas De Marchi

>
>
>Matt
>
>> +
>>  #define phy_name(a) ((a) + 'A')
>>
>>  enum phy_fia {
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
>> index 4d2f4ee35812..23a885895803 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
>> @@ -1377,7 +1377,12 @@ struct intel_dp_mst_encoder {
>>  };
>>
>>  struct intel_ddi_port_info {
>> +	const char *name;
>>  	enum port port;
>> +	s8 phy_type;
>> +	u8 ddi_idx;
>> +	u8 phy_idx;
>> +	u8 vbt_idx;
>>  };
>>
>>  static inline enum dpio_channel
>> --
>> 2.24.0
>>
>
>-- 
>Matt Roper
>Graphics Software Engineer
>VTT-OSGC Platform Enablement
>Intel Corporation
>(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization Lucas De Marchi
@ 2019-12-31  9:58   ` Jani Nikula
  2020-01-02  7:19     ` Lucas De Marchi
  0 siblings, 1 reply; 34+ messages in thread
From: Jani Nikula @ 2019-12-31  9:58 UTC (permalink / raw)
  To: Lucas De Marchi, intel-gfx

On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> For the latest platforms we can share the logic to initialize the the
> ddi, so start moving the most trivial ones to a new setup_outputs_desc()
> function that will be responsible for initialization according to a
> static const table.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 96 +++++++++++++------
>  .../drm/i915/display/intel_display_types.h    |  4 +
>  2 files changed, 73 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 04819b0bd494..b3fb1e03cb0b 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16221,6 +16221,72 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
>  	intel_pps_unlock_regs_wa(dev_priv);
>  }
>  
> +struct intel_output {
> +	/* Initialize DSI if present */
> +	void (*dsi_init)(struct drm_i915_private *i915);

We'll need to be able to initialize DSI on multiple ports too. I've
already drafted a series to do so, maybe I've even sent it to the
list. Basically you'd pass the port to icl_dsi_init() too.

I don't want that development to get any more complicated than it
already is.

BR,
Jani.


> +	struct intel_ddi_port_info ddi_ports[];
> +};
> +
> +static const struct intel_output tgl_output = {
> +	.dsi_init = icl_dsi_init,
> +	.ddi_ports = {
> +		{ .port = PORT_A },
> +		{ .port = PORT_B },
> +		{ .port = PORT_D },
> +		{ .port = PORT_E },
> +		{ .port = PORT_F },
> +		{ .port = PORT_G },
> +		{ .port = PORT_H },
> +		{ .port = PORT_I },
> +		{ .port = PORT_NONE }
> +	}
> +};
> +
> +static const struct intel_output ehl_output = {
> +	.dsi_init = icl_dsi_init,
> +	.ddi_ports = {
> +		{ .port = PORT_A },
> +		{ .port = PORT_B },
> +		{ .port = PORT_C },
> +		{ .port = PORT_D },
> +		{ .port = PORT_NONE }
> +	}
> +};
> +
> +static const struct intel_output gen9lp_output = {
> +	.dsi_init = vlv_dsi_init,
> +	.ddi_ports = {
> +		{ .port = PORT_A },
> +		{ .port = PORT_B },
> +		{ .port = PORT_C },
> +		{ .port = PORT_NONE }
> +	},
> +};
> +
> +/*
> + * Use a description-based approach for platforms that can be supported with a
> + * static table
> + */
> +static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> +{
> +	const struct intel_output *output;
> +	const struct intel_ddi_port_info *port_info;
> +
> +	if (INTEL_GEN(i915) >= 12)
> +		output = &tgl_output;
> +	else if (IS_ELKHARTLAKE(i915))
> +		output = &ehl_output;
> +	else if (IS_GEN9_LP(i915))
> +		output = &gen9lp_output;
> +
> +	for (port_info = output->ddi_ports;
> +	     port_info->port != PORT_NONE; port_info++)
> +		intel_ddi_init(i915, port_info->port);
> +
> +	if (output->dsi_init)
> +		output->dsi_init(i915);
> +}
> +
>  static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>  {
>  	struct intel_encoder *encoder;
> @@ -16231,22 +16297,9 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>  	if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
>  		return;
>  
> -	if (INTEL_GEN(dev_priv) >= 12) {
> -		intel_ddi_init(dev_priv, PORT_A);
> -		intel_ddi_init(dev_priv, PORT_B);
> -		intel_ddi_init(dev_priv, PORT_D);
> -		intel_ddi_init(dev_priv, PORT_E);
> -		intel_ddi_init(dev_priv, PORT_F);
> -		intel_ddi_init(dev_priv, PORT_G);
> -		intel_ddi_init(dev_priv, PORT_H);
> -		intel_ddi_init(dev_priv, PORT_I);
> -		icl_dsi_init(dev_priv);
> -	} else if (IS_ELKHARTLAKE(dev_priv)) {
> -		intel_ddi_init(dev_priv, PORT_A);
> -		intel_ddi_init(dev_priv, PORT_B);
> -		intel_ddi_init(dev_priv, PORT_C);
> -		intel_ddi_init(dev_priv, PORT_D);
> -		icl_dsi_init(dev_priv);
> +	if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
> +	    IS_GEN9_LP(dev_priv)) {
> +		setup_ddi_outputs_desc(dev_priv);
>  	} else if (IS_GEN(dev_priv, 11)) {
>  		intel_ddi_init(dev_priv, PORT_A);
>  		intel_ddi_init(dev_priv, PORT_B);
> @@ -16263,17 +16316,6 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>  			intel_ddi_init(dev_priv, PORT_F);
>  
>  		icl_dsi_init(dev_priv);
> -	} else if (IS_GEN9_LP(dev_priv)) {
> -		/*
> -		 * FIXME: Broxton doesn't support port detection via the
> -		 * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
> -		 * detect the ports.
> -		 */
> -		intel_ddi_init(dev_priv, PORT_A);
> -		intel_ddi_init(dev_priv, PORT_B);
> -		intel_ddi_init(dev_priv, PORT_C);
> -
> -		vlv_dsi_init(dev_priv);
>  	} else if (HAS_DDI(dev_priv)) {
>  		int found;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index a3a067dacf84..4d2f4ee35812 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1376,6 +1376,10 @@ struct intel_dp_mst_encoder {
>  	struct intel_connector *connector;
>  };
>  
> +struct intel_ddi_port_info {
> +	enum port port;
> +};
> +
>  static inline enum dpio_channel
>  vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
>  {

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init Lucas De Marchi
  2019-12-24  0:00   ` Matt Roper
@ 2019-12-31 10:14   ` Jani Nikula
  2020-01-02  7:32     ` Lucas De Marchi
  1 sibling, 1 reply; 34+ messages in thread
From: Jani Nikula @ 2019-12-31 10:14 UTC (permalink / raw)
  To: Lucas De Marchi, intel-gfx

On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> By adding a hook that determines if a port is present, we are able to
> support Ice Lake in the new description-based DDI initialization.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 61 ++++++++++++++------
>  1 file changed, 42 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index b3fb1e03cb0b..6b4d320ff92c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16224,9 +16224,28 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
>  struct intel_output {
>  	/* Initialize DSI if present */
>  	void (*dsi_init)(struct drm_i915_private *i915);
> +
> +	/*
> +	 * Check if port is present before trying to initialize; if not provided
> +	 * it's assumed the port is present (or we can't check and fail
> +	 * gracefully
> +	 */
> +	bool (*is_port_present)(struct drm_i915_private *i915,
> +				const struct intel_ddi_port_info *port_info);
> +
>  	struct intel_ddi_port_info ddi_ports[];
>  };
>  
> +static bool icl_is_port_present(struct drm_i915_private *i915,
> +				const struct intel_ddi_port_info *port_info)
> +{
> +	if (port_info->port != PORT_F)
> +		return true;
> +
> +	return IS_ICL_WITH_PORT_F(i915) &&
> +		intel_bios_is_port_present(i915, PORT_F);
> +}
> +

You know, all of that is here because there were some boards with broken
VBTs claiming there was a port F on hardware that didn't have port
F. And now we're turning it into infrastructure for all platforms. :(

I actually preferred it when it was a localized hack for ICL. (Though I
said at the time we should not add hacks for VBTs because this shit
won't get fixed if we keep accommodating it.)

If we still need the port F hack, I think I'd rather move it to
intel_bios.c and skip port F description in VBT for platformsm that
don't have it. So we can rely on VBT info elsewhere.

Note that intel_ddi_init() will still check for VBT.

>  static const struct intel_output tgl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> @@ -16242,6 +16261,20 @@ static const struct intel_output tgl_output = {
>  	}
>  };
>  
> +static const struct intel_output icl_output = {
> +	.dsi_init = icl_dsi_init,
> +	.is_port_present = icl_is_port_present,
> +	.ddi_ports = {
> +		{ .port = PORT_A },
> +		{ .port = PORT_B },
> +		{ .port = PORT_C },
> +		{ .port = PORT_D },
> +		{ .port = PORT_E },
> +		{ .port = PORT_F },
> +		{ .port = PORT_NONE }

At this stage of the series it seems to me we could have a ports mask in
intel_device_info, and just loop over it using for_each_port_masked().

BR,
Jani.

> +	}
> +};
> +
>  static const struct intel_output ehl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> @@ -16276,12 +16309,19 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
>  		output = &tgl_output;
>  	else if (IS_ELKHARTLAKE(i915))
>  		output = &ehl_output;
> +	else if (IS_GEN(i915, 11))
> +		output = &icl_output;
>  	else if (IS_GEN9_LP(i915))
>  		output = &gen9lp_output;
>  
>  	for (port_info = output->ddi_ports;
> -	     port_info->port != PORT_NONE; port_info++)
> +	     port_info->port != PORT_NONE; port_info++) {
> +		if (output->is_port_present &&
> +		    !output->is_port_present(i915, port_info))
> +			continue;
> +
>  		intel_ddi_init(i915, port_info->port);
> +	}
>  
>  	if (output->dsi_init)
>  		output->dsi_init(i915);
> @@ -16297,25 +16337,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>  	if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
>  		return;
>  
> -	if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
> -	    IS_GEN9_LP(dev_priv)) {
> +	if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
>  		setup_ddi_outputs_desc(dev_priv);
> -	} else if (IS_GEN(dev_priv, 11)) {
> -		intel_ddi_init(dev_priv, PORT_A);
> -		intel_ddi_init(dev_priv, PORT_B);
> -		intel_ddi_init(dev_priv, PORT_C);
> -		intel_ddi_init(dev_priv, PORT_D);
> -		intel_ddi_init(dev_priv, PORT_E);
> -		/*
> -		 * On some ICL SKUs port F is not present. No strap bits for
> -		 * this, so rely on VBT.
> -		 * Work around broken VBTs on SKUs known to have no port F.
> -		 */
> -		if (IS_ICL_WITH_PORT_F(dev_priv) &&
> -		    intel_bios_is_port_present(dev_priv, PORT_F))
> -			intel_ddi_init(dev_priv, PORT_F);
> -
> -		icl_dsi_init(dev_priv);
>  	} else if (HAS_DDI(dev_priv)) {
>  		int found;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms Lucas De Marchi
@ 2019-12-31 10:25   ` Jani Nikula
  2019-12-31 10:26     ` Jani Nikula
  2020-01-02  7:23     ` Lucas De Marchi
  0 siblings, 2 replies; 34+ messages in thread
From: Jani Nikula @ 2019-12-31 10:25 UTC (permalink / raw)
  To: Lucas De Marchi, intel-gfx

On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Support remaining platforms under HAS_DDI() by providing a slightly more
> complex is_port_present() hook. The downside is that now we call
> I915_READ(SFUSE_STRAP) for each port being initialized, but that's only
> on initialization: a few more mmio reads won't hurt.
>
> Alternatives would be to provide one hook per port, or to have a
> "pre_init()" hook that takes care of the mmio read. However I think this
> is simpler - we may need to adapt if future platforms don't follow the
> same initialization "template".

All of this really makes me wonder if we end up being *more* complicated
overall by trying very hard to make this generic, when, in reality, it
doesn't seem to be all that generic.

As I said, two relatively low hanging improvements would be a) moving
VBT specific hacks to intel_bios.c and b) adding port mask to
intel_device_info. Those two alone would go a long way in simplifying
intel_setup_outputs().

>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 72 +++++++++++++-------
>  1 file changed, 46 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 6b4d320ff92c..ad85cf75c815 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16246,6 +16246,34 @@ static bool icl_is_port_present(struct drm_i915_private *i915,
>  		intel_bios_is_port_present(i915, PORT_F);
>  }
>  
> +static bool ddi_is_port_present(struct drm_i915_private *i915,
> +				const struct intel_ddi_port_info *port_info)
> +{
> +	/* keep I915_READ() happy */

Display could get rid of I915_READ and I915_WRITE after
https://patchwork.freedesktop.org/series/70298/ ...

BR,
Jani.

> +	struct drm_i915_private *dev_priv = i915;
> +
> +	if (port_info->port == PORT_A)
> +		return I915_READ(DDI_BUF_CTL(PORT_A))
> +			& DDI_INIT_DISPLAY_DETECTED;
> +
> +	if (port_info->port == PORT_E)
> +		return IS_GEN9_BC(dev_priv) &&
> +			intel_bios_is_port_present(i915, PORT_E);
> +
> +	switch (port_info->port) {
> +	case PORT_B:
> +		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIB_DETECTED;
> +	case PORT_C:
> +		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIC_DETECTED;
> +	case PORT_D:
> +		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDID_DETECTED;
> +	case PORT_F:
> +		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIF_DETECTED;
> +	default:
> +		return false;
> +	}
> +}
> +
>  static const struct intel_output tgl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> @@ -16296,11 +16324,24 @@ static const struct intel_output gen9lp_output = {
>  	},
>  };
>  
> +static const struct intel_output ddi_output = {
> +	.is_port_present = ddi_is_port_present,
> +	.ddi_ports = {
> +		{ .port = PORT_A },
> +		{ .port = PORT_B },
> +		{ .port = PORT_C },
> +		{ .port = PORT_D },
> +		{ .port = PORT_E },
> +		{ .port = PORT_F },
> +		{ .port = PORT_NONE }
> +	}
> +};
> +
>  /*
>   * Use a description-based approach for platforms that can be supported with a
>   * static table
>   */
> -static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> +static void setup_ddi_outputs(struct drm_i915_private *i915)
>  {
>  	const struct intel_output *output;
>  	const struct intel_ddi_port_info *port_info;
> @@ -16313,6 +16354,8 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
>  		output = &icl_output;
>  	else if (IS_GEN9_LP(i915))
>  		output = &gen9lp_output;
> +	else
> +		output = &ddi_output;
>  
>  	for (port_info = output->ddi_ports;
>  	     port_info->port != PORT_NONE; port_info++) {
> @@ -16338,35 +16381,12 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>  		return;
>  
>  	if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
> -		setup_ddi_outputs_desc(dev_priv);
> +		setup_ddi_outputs(dev_priv);
>  	} else if (HAS_DDI(dev_priv)) {
> -		int found;
> -
>  		if (intel_ddi_crt_present(dev_priv))
>  			intel_crt_init(dev_priv);
>  
> -		found = I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_INIT_DISPLAY_DETECTED;
> -		if (found)
> -			intel_ddi_init(dev_priv, PORT_A);
> -
> -		/* DDI B, C, D, and F detection is indicated by the SFUSE_STRAP
> -		 * register */
> -		found = I915_READ(SFUSE_STRAP);
> -
> -		if (found & SFUSE_STRAP_DDIB_DETECTED)
> -			intel_ddi_init(dev_priv, PORT_B);
> -		if (found & SFUSE_STRAP_DDIC_DETECTED)
> -			intel_ddi_init(dev_priv, PORT_C);
> -		if (found & SFUSE_STRAP_DDID_DETECTED)
> -			intel_ddi_init(dev_priv, PORT_D);
> -		if (found & SFUSE_STRAP_DDIF_DETECTED)
> -			intel_ddi_init(dev_priv, PORT_F);
> -		/*
> -		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> -		 */
> -		if (IS_GEN9_BC(dev_priv) &&
> -		    intel_bios_is_port_present(dev_priv, PORT_E))
> -			intel_ddi_init(dev_priv, PORT_E);
> +		setup_ddi_outputs(dev_priv);
>  	} else if (HAS_PCH_SPLIT(dev_priv)) {
>  		int found;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms
  2019-12-31 10:25   ` Jani Nikula
@ 2019-12-31 10:26     ` Jani Nikula
  2020-01-02  7:23     ` Lucas De Marchi
  1 sibling, 0 replies; 34+ messages in thread
From: Jani Nikula @ 2019-12-31 10:26 UTC (permalink / raw)
  To: Lucas De Marchi, intel-gfx

On Tue, 31 Dec 2019, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
>> Support remaining platforms under HAS_DDI() by providing a slightly more
>> complex is_port_present() hook. The downside is that now we call
>> I915_READ(SFUSE_STRAP) for each port being initialized, but that's only
>> on initialization: a few more mmio reads won't hurt.
>>
>> Alternatives would be to provide one hook per port, or to have a
>> "pre_init()" hook that takes care of the mmio read. However I think this
>> is simpler - we may need to adapt if future platforms don't follow the
>> same initialization "template".
>
> All of this really makes me wonder if we end up being *more* complicated
> overall by trying very hard to make this generic, when, in reality, it
> doesn't seem to be all that generic.
>
> As I said, two relatively low hanging improvements would be a) moving
> VBT specific hacks to intel_bios.c and b) adding port mask to
> intel_device_info. Those two alone would go a long way in simplifying
> intel_setup_outputs().
>
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_display.c | 72 +++++++++++++-------
>>  1 file changed, 46 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index 6b4d320ff92c..ad85cf75c815 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -16246,6 +16246,34 @@ static bool icl_is_port_present(struct drm_i915_private *i915,
>>  		intel_bios_is_port_present(i915, PORT_F);
>>  }
>>  
>> +static bool ddi_is_port_present(struct drm_i915_private *i915,
>> +				const struct intel_ddi_port_info *port_info)
>> +{
>> +	/* keep I915_READ() happy */
>
> Display could get rid of I915_READ and I915_WRITE after
> https://patchwork.freedesktop.org/series/70298/ ...
>
> BR,
> Jani.
>
>> +	struct drm_i915_private *dev_priv = i915;
>> +
>> +	if (port_info->port == PORT_A)
>> +		return I915_READ(DDI_BUF_CTL(PORT_A))
>> +			& DDI_INIT_DISPLAY_DETECTED;
>> +
>> +	if (port_info->port == PORT_E)
>> +		return IS_GEN9_BC(dev_priv) &&
>> +			intel_bios_is_port_present(i915, PORT_E);
>> +
>> +	switch (port_info->port) {
>> +	case PORT_B:
>> +		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIB_DETECTED;
>> +	case PORT_C:
>> +		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIC_DETECTED;
>> +	case PORT_D:
>> +		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDID_DETECTED;
>> +	case PORT_F:
>> +		return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIF_DETECTED;
>> +	default:
>> +		return false;
>> +	}
>> +}
>> +
>>  static const struct intel_output tgl_output = {
>>  	.dsi_init = icl_dsi_init,
>>  	.ddi_ports = {
>> @@ -16296,11 +16324,24 @@ static const struct intel_output gen9lp_output = {
>>  	},
>>  };
>>  
>> +static const struct intel_output ddi_output = {
>> +	.is_port_present = ddi_is_port_present,
>> +	.ddi_ports = {
>> +		{ .port = PORT_A },
>> +		{ .port = PORT_B },
>> +		{ .port = PORT_C },
>> +		{ .port = PORT_D },
>> +		{ .port = PORT_E },
>> +		{ .port = PORT_F },
>> +		{ .port = PORT_NONE }
>> +	}
>> +};
>> +
>>  /*
>>   * Use a description-based approach for platforms that can be supported with a
>>   * static table
>>   */
>> -static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
>> +static void setup_ddi_outputs(struct drm_i915_private *i915)
>>  {
>>  	const struct intel_output *output;
>>  	const struct intel_ddi_port_info *port_info;
>> @@ -16313,6 +16354,8 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
>>  		output = &icl_output;
>>  	else if (IS_GEN9_LP(i915))
>>  		output = &gen9lp_output;
>> +	else
>> +		output = &ddi_output;
>>  
>>  	for (port_info = output->ddi_ports;
>>  	     port_info->port != PORT_NONE; port_info++) {
>> @@ -16338,35 +16381,12 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>>  		return;
>>  
>>  	if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
>> -		setup_ddi_outputs_desc(dev_priv);
>> +		setup_ddi_outputs(dev_priv);
>>  	} else if (HAS_DDI(dev_priv)) {
>> -		int found;
>> -
>>  		if (intel_ddi_crt_present(dev_priv))
>>  			intel_crt_init(dev_priv);

PS. You still need stuff like this after the supposedly generic output
setup...

>>  
>> -		found = I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_INIT_DISPLAY_DETECTED;
>> -		if (found)
>> -			intel_ddi_init(dev_priv, PORT_A);
>> -
>> -		/* DDI B, C, D, and F detection is indicated by the SFUSE_STRAP
>> -		 * register */
>> -		found = I915_READ(SFUSE_STRAP);
>> -
>> -		if (found & SFUSE_STRAP_DDIB_DETECTED)
>> -			intel_ddi_init(dev_priv, PORT_B);
>> -		if (found & SFUSE_STRAP_DDIC_DETECTED)
>> -			intel_ddi_init(dev_priv, PORT_C);
>> -		if (found & SFUSE_STRAP_DDID_DETECTED)
>> -			intel_ddi_init(dev_priv, PORT_D);
>> -		if (found & SFUSE_STRAP_DDIF_DETECTED)
>> -			intel_ddi_init(dev_priv, PORT_F);
>> -		/*
>> -		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
>> -		 */
>> -		if (IS_GEN9_BC(dev_priv) &&
>> -		    intel_bios_is_port_present(dev_priv, PORT_E))
>> -			intel_ddi_init(dev_priv, PORT_E);
>> +		setup_ddi_outputs(dev_priv);
>>  	} else if (HAS_PCH_SPLIT(dev_priv)) {
>>  		int found;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes Lucas De Marchi
  2019-12-24  0:10   ` Matt Roper
@ 2019-12-31 10:33   ` Jani Nikula
  2020-01-02  7:50     ` Lucas De Marchi
  1 sibling, 1 reply; 34+ messages in thread
From: Jani Nikula @ 2019-12-31 10:33 UTC (permalink / raw)
  To: Lucas De Marchi, intel-gfx

On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Identify 3 possible cases in which the index numbers can be different
> from the "port" and add them to the description-based ddi initialization
> table.  This can be used in place of additional functions mapping from
> on to the other.  Right now we already cover part of this by creating kind of
> virtual phy numbering, but that comes with downsides:
>
> a) there's not really a "phy numbering" in the spec, this is purely a
> software thing; hardware uses whatever they want thinking mapping from
> one to the other arbitrarily is easy in software.
>
> b) currently the mapping occurs on "leaf" functions, making the decision
> based on the platform.
>
> With this new table the approach will be: the port as defined by the
> enum port is purely a driver convention and won't be used anymore to
> define the register offset or register bits. For that we have the other
> 3 indexes, identified as being possibly different from the current usage
> of register bits: ddi, vbt and phy. The phy type is also added here,
> meant to replace the checks for combo vs tc (although the helper
> functions can remain so we may differentiate between, e.g. Dekel and MG
> phys).

I'm not sure how the vbt_idx is supposed to be used (because it's
actually not used anywhere here). I would like to reduce the amount of
VBT info spread around in the driver, so I'd really need to know more.

> While at it, also give names to the ports so they can be easily
> identified.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 54 +++++++++----------
>  drivers/gpu/drm/i915/display/intel_display.h  |  7 +++
>  .../drm/i915/display/intel_display_types.h    |  5 ++
>  3 files changed, 39 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index ad85cf75c815..219f180fa395 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16277,14 +16277,14 @@ static bool ddi_is_port_present(struct drm_i915_private *i915,
>  static const struct intel_output tgl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_D },
> -		{ .port = PORT_E },
> -		{ .port = PORT_F },
> -		{ .port = PORT_G },
> -		{ .port = PORT_H },
> -		{ .port = PORT_I },
> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> +		{ .name = "DDI TC1", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x2, },
> +		{ .name = "DDI TC2", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x1, .vbt_idx = 0x3, },
> +		{ .name = "DDI TC3", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x2, .vbt_idx = 0x4, },
> +		{ .name = "DDI TC4", .port = PORT_G, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x6, .phy_idx = 0x3, .vbt_idx = 0x5, },
> +		{ .name = "DDI TC5", .port = PORT_H, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x7, .phy_idx = 0x4, .vbt_idx = 0x6, },
> +		{ .name = "DDI TC6", .port = PORT_I, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x8, .phy_idx = 0x5, .vbt_idx = 0x7, },
>  		{ .port = PORT_NONE }

Makes you wonder if this sort of info should be linked from the
intel_device_info instead of adding new arrays. Not sure.

BR,
Jani.


>  	}
>  };
> @@ -16293,12 +16293,12 @@ static const struct intel_output icl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.is_port_present = icl_is_port_present,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_C },
> -		{ .port = PORT_D },
> -		{ .port = PORT_E },
> -		{ .port = PORT_F },
> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> +		{ .name = "DDI TC1", .port = PORT_C, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x2, .phy_idx = 0x0, .vbt_idx = 0x2, },
> +		{ .name = "DDI TC2", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x1, .vbt_idx = 0x3, },
> +		{ .name = "DDI TC3", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x2, .vbt_idx = 0x4, },
> +		{ .name = "DDI TC4", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x3, .vbt_idx = 0x5, },
>  		{ .port = PORT_NONE }
>  	}
>  };
> @@ -16306,10 +16306,10 @@ static const struct intel_output icl_output = {
>  static const struct intel_output ehl_output = {
>  	.dsi_init = icl_dsi_init,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_C },
> -		{ .port = PORT_D },
> +		{ .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> +		{ .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> +		{ .name = "DDI C",   .port = PORT_C, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2, },
> +		{ .name = "DDI D",   .port = PORT_D, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x3, },
>  		{ .port = PORT_NONE }
>  	}
>  };
> @@ -16317,9 +16317,9 @@ static const struct intel_output ehl_output = {
>  static const struct intel_output gen9lp_output = {
>  	.dsi_init = vlv_dsi_init,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_C },
> +		{ .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
> +		{ .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
> +		{ .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
>  		{ .port = PORT_NONE }
>  	},
>  };
> @@ -16327,12 +16327,12 @@ static const struct intel_output gen9lp_output = {
>  static const struct intel_output ddi_output = {
>  	.is_port_present = ddi_is_port_present,
>  	.ddi_ports = {
> -		{ .port = PORT_A },
> -		{ .port = PORT_B },
> -		{ .port = PORT_C },
> -		{ .port = PORT_D },
> -		{ .port = PORT_E },
> -		{ .port = PORT_F },
> +		{ .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
> +		{ .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
> +		{ .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
> +		{ .name = "DDI D", .port = PORT_D, .ddi_idx = 0x3, .phy_idx = 0x3, .vbt_idx = 0x3 },
> +		{ .name = "DDI E", .port = PORT_E, .ddi_idx = 0x4, .phy_idx = 0x4, .vbt_idx = 0x4 },
> +		{ .name = "DDI F", .port = PORT_F, .ddi_idx = 0x5, .phy_idx = 0x5, .vbt_idx = 0x5 },
>  		{ .port = PORT_NONE }
>  	}
>  };
> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
> index 05d68bd393dc..db19e5eee248 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.h
> +++ b/drivers/gpu/drm/i915/display/intel_display.h
> @@ -303,6 +303,13 @@ enum phy {
>  	I915_MAX_PHYS
>  };
>  
> +enum phy_type {
> +	PHY_TYPE_NONE = 0,
> +
> +	PHY_TYPE_COMBO,
> +	PHY_TYPE_TC,
> +};
> +
>  #define phy_name(a) ((a) + 'A')
>  
>  enum phy_fia {
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 4d2f4ee35812..23a885895803 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1377,7 +1377,12 @@ struct intel_dp_mst_encoder {
>  };
>  
>  struct intel_ddi_port_info {
> +	const char *name;
>  	enum port port;
> +	s8 phy_type;
> +	u8 ddi_idx;
> +	u8 phy_idx;
> +	u8 vbt_idx;
>  };
>  
>  static inline enum dpio_channel

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 8/9] drm/i915/display: refer to vbt info as vbt_port_info
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 8/9] drm/i915/display: refer to vbt info as vbt_port_info Lucas De Marchi
@ 2019-12-31 10:39   ` Jani Nikula
  0 siblings, 0 replies; 34+ messages in thread
From: Jani Nikula @ 2019-12-31 10:39 UTC (permalink / raw)
  To: Lucas De Marchi, intel-gfx

On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Now that we maintain our static port info, rename the places that refer
> to the port_info from vbt to use the vbt prefix. This is just a
> preparation step for a following change in which we will use the
> port_info variable name.

Side note, I intend to get rid of dev_priv->vbt.ddi_port_info[]
entirely.

For output initialization time, you'd have to call some function in
intel_bios.c to get the info you want. Maybe at that point you'd get an
opaque pointer to struct display_device_data which you could use to
query the child device data. You'd stick that pointer to intel_encoder
(or intel_connector), and subsequent queries would be based on that,
instead of figuring out the port and indexing something in dev_priv.

In the mean time, the rename for now seems fine.


BR,
Jani.


>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 1bdf63845472..a1b7075ea6be 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -902,7 +902,8 @@ icl_get_combo_buf_trans(struct drm_i915_private *dev_priv, int type, int rate,
>  
>  static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port port)
>  {
> -	struct ddi_vbt_port_info *port_info = &dev_priv->vbt.ddi_port_info[port];
> +	struct ddi_vbt_port_info *vbt_port_info =
> +		&dev_priv->vbt.ddi_port_info[port];
>  	int n_entries, level, default_entry;
>  	enum phy phy = intel_port_to_phy(dev_priv, port);
>  
> @@ -943,8 +944,8 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
>  	if (WARN_ON_ONCE(n_entries == 0))
>  		return 0;
>  
> -	if (port_info->hdmi_level_shift_set)
> -		level = port_info->hdmi_level_shift;
> +	if (vbt_port_info->hdmi_level_shift_set)
> +		level = vbt_port_info->hdmi_level_shift;
>  	else
>  		level = default_entry;
>  
> @@ -4783,15 +4784,15 @@ intel_ddi_max_lanes(struct intel_digital_port *dig_port)
>  
>  void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  {
> -	struct ddi_vbt_port_info *port_info =
> +	struct ddi_vbt_port_info *vbt_port_info =
>  		&dev_priv->vbt.ddi_port_info[port];
>  	struct intel_digital_port *intel_dig_port;
>  	struct intel_encoder *encoder;
>  	bool init_hdmi, init_dp, init_lspcon = false;
>  	enum phy phy = intel_port_to_phy(dev_priv, port);
>  
> -	init_hdmi = port_info->supports_dvi || port_info->supports_hdmi;
> -	init_dp = port_info->supports_dp;
> +	init_hdmi = vbt_port_info->supports_dvi || vbt_port_info->supports_hdmi;
> +	init_dp = vbt_port_info->supports_dp;
>  
>  	if (intel_bios_is_lspcon_present(dev_priv, port)) {
>  		/*
> @@ -4852,8 +4853,8 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	intel_dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
>  
>  	if (intel_phy_is_tc(dev_priv, phy)) {
> -		bool is_legacy = !port_info->supports_typec_usb &&
> -				 !port_info->supports_tbt;
> +		bool is_legacy = !vbt_port_info->supports_typec_usb &&
> +				 !vbt_port_info->supports_tbt;
>  
>  		intel_tc_port_init(intel_dig_port, is_legacy);

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init
  2019-12-24  0:16   ` Matt Roper
@ 2019-12-31 11:20     ` Jani Nikula
  2020-06-23  1:11       ` Lucas De Marchi
  0 siblings, 1 reply; 34+ messages in thread
From: Jani Nikula @ 2019-12-31 11:20 UTC (permalink / raw)
  To: Matt Roper, Lucas De Marchi; +Cc: intel-gfx

On Mon, 23 Dec 2019, Matt Roper <matthew.d.roper@intel.com> wrote:
> On Mon, Dec 23, 2019 at 11:58:50AM -0800, Lucas De Marchi wrote:
>> Now that we have tables for all platforms using ddi, keep the port_info
>> around so we can use it for decisions like "what phy does it have?"
>> instead of keep checking the platform/gen everywhere.
>> 
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_ddi.c      | 36 ++++++++++++-------
>>  drivers/gpu/drm/i915/display/intel_ddi.h      |  8 ++++-
>>  drivers/gpu/drm/i915/display/intel_display.c  |  2 +-
>>  .../drm/i915/display/intel_display_types.h    |  3 ++
>>  4 files changed, 35 insertions(+), 14 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
>> index a1b7075ea6be..9d06a34f5f8e 100644
>> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
>> @@ -4782,14 +4782,25 @@ intel_ddi_max_lanes(struct intel_digital_port *dig_port)
>>  	return max_lanes;
>>  }
>>  
>> -void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>> +bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port)
>>  {
>> +	return dig_port->port_info->phy_type == PHY_TYPE_TC;
>> +}
>> +
>> +bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port)
>> +{
>> +	return dig_port->port_info->phy_type == PHY_TYPE_COMBO;
>> +}
>> +
>> +void intel_ddi_init(struct drm_i915_private *dev_priv,
>> +		    const struct intel_ddi_port_info *port_info)
>> +{
>> +	enum port port = port_info->port;
>>  	struct ddi_vbt_port_info *vbt_port_info =
>>  		&dev_priv->vbt.ddi_port_info[port];
>>  	struct intel_digital_port *intel_dig_port;
>>  	struct intel_encoder *encoder;
>>  	bool init_hdmi, init_dp, init_lspcon = false;
>> -	enum phy phy = intel_port_to_phy(dev_priv, port);
>>  
>>  	init_hdmi = vbt_port_info->supports_dvi || vbt_port_info->supports_hdmi;
>>  	init_dp = vbt_port_info->supports_dp;
>> @@ -4803,12 +4814,12 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>  		init_dp = true;
>>  		init_lspcon = true;
>>  		init_hdmi = false;
>> -		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
>> +		DRM_DEBUG_KMS("VBT says port %s has lspcon\n", port_info->name);
>>  	}
>>  
>>  	if (!init_dp && !init_hdmi) {
>> -		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
>> -			      port_name(port));
>> +		DRM_DEBUG_KMS("VBT says %s is not DVI/HDMI/DP compatible, respect it\n",
>> +			      port_info->name);
>>  		return;
>>  	}
>>  
>> @@ -4819,7 +4830,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>  	encoder = &intel_dig_port->base;
>>  
>>  	drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
>> -			 DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port));
>> +			 DRM_MODE_ENCODER_TMDS, port_info->name);
>>  
>>  	encoder->hotplug = intel_ddi_hotplug;
>>  	encoder->compute_output_type = intel_ddi_compute_output_type;
>> @@ -4837,7 +4848,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>  
>>  	encoder->type = INTEL_OUTPUT_DDI;
>>  	encoder->power_domain = intel_port_to_power_domain(port);
>> -	encoder->port = port;
>> +	encoder->port = port_info->port;
>
> In theory, shouldn't we be able to drop encoder->port completely once
> we've converted everything over to the proper ddi/phy/vbt namespace?
>
> Overall I like the direction this series is going.  The continued use of
> 'port' terminology, both in the driver and in the hardware specs has
> become increasingly confusing as things get chopped up and indexed
> differently.  I think this will help clarify exactly what a platform is
> expecting and force people to think about which namespace is correct for
> the part of the hardware they're working with.

Indeed, this part I like.

I am less certain whether we need to change output setup to be driven by
the new port_info. Seems like we could keep the existing output setup
(with its wrinkles) while converting port towards a struct consisting of
port, phy and phy type. And make the latter table driven instead of the
current intel_port_to_*() and intel_phy_is_*(). I think that's good
stuff.

But I don't like all the wrinkles with port F and DSI and straps etc. in
the output setup changes in this series. And we'll still *also* depend
on VBT here. I am not sure if the output setup should in fact be driven
by the VBT instead of the ports (yeah, *gasp*!).

I guess the issue with output setup would be if there are collisions in
ports with different phys. Though that would require VBT parsing changes
for DDI too, as that currently ignores such cases (and we have that in
CHV DSI).


BR,
Jani.

>
>
> Matt
>
>>  	encoder->cloneable = 0;
>>  	encoder->pipe_mask = ~0;
>>  
>> @@ -4851,8 +4862,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>  	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
>>  	intel_dig_port->max_lanes = intel_ddi_max_lanes(intel_dig_port);
>>  	intel_dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
>> +	intel_dig_port->port_info = port_info;
>>  
>> -	if (intel_phy_is_tc(dev_priv, phy)) {
>> +	if (intel_ddi_has_tc_phy(intel_dig_port)) {
>>  		bool is_legacy = !vbt_port_info->supports_typec_usb &&
>>  				 !vbt_port_info->supports_tbt;
>>  
>> @@ -4883,15 +4895,15 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>  	if (init_lspcon) {
>>  		if (lspcon_init(intel_dig_port))
>>  			/* TODO: handle hdmi info frame part */
>> -			DRM_DEBUG_KMS("LSPCON init success on port %c\n",
>> -				port_name(port));
>> +			DRM_DEBUG_KMS("LSPCON init success on port %s\n",
>> +				      port_info->name);
>>  		else
>>  			/*
>>  			 * LSPCON init faied, but DP init was success, so
>>  			 * lets try to drive as DP++ port.
>>  			 */
>> -			DRM_ERROR("LSPCON init failed on port %c\n",
>> -				port_name(port));
>> +			DRM_ERROR("LSPCON init failed on port %s\n",
>> +				  port_info->name);
>>  	}
>>  
>>  	intel_infoframe_init(intel_dig_port);
>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h b/drivers/gpu/drm/i915/display/intel_ddi.h
>> index 167c6579d972..c500d473963e 100644
>> --- a/drivers/gpu/drm/i915/display/intel_ddi.h
>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
>> @@ -15,6 +15,7 @@ struct drm_i915_private;
>>  struct intel_connector;
>>  struct intel_crtc;
>>  struct intel_crtc_state;
>> +struct intel_ddi_port_info;
>>  struct intel_dp;
>>  struct intel_dpll_hw_state;
>>  struct intel_encoder;
>> @@ -24,7 +25,8 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
>>  				const struct drm_connector_state *old_conn_state);
>>  void hsw_fdi_link_train(struct intel_encoder *encoder,
>>  			const struct intel_crtc_state *crtc_state);
>> -void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port);
>> +void intel_ddi_init(struct drm_i915_private *dev_priv,
>> +		    const struct intel_ddi_port_info *port_info);
>>  bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
>>  void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state);
>>  void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state);
>> @@ -50,4 +52,8 @@ void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
>>  int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
>>  			struct intel_dpll_hw_state *state);
>>  
>> +
>> +bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port);
>> +bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port);
>> +
>>  #endif /* __INTEL_DDI_H__ */
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index 219f180fa395..96207dc83fac 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -16363,7 +16363,7 @@ static void setup_ddi_outputs(struct drm_i915_private *i915)
>>  		    !output->is_port_present(i915, port_info))
>>  			continue;
>>  
>> -		intel_ddi_init(i915, port_info->port);
>> +		intel_ddi_init(i915, port_info);
>>  	}
>>  
>>  	if (output->dsi_init)
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
>> index 23a885895803..c54b0178e885 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
>> @@ -1346,6 +1346,9 @@ struct intel_digital_port {
>>  	enum intel_display_power_domain ddi_io_power_domain;
>>  	struct mutex tc_lock;	/* protects the TypeC port mode */
>>  	intel_wakeref_t tc_lock_wakeref;
>> +
>> +	const struct intel_ddi_port_info *port_info;
>> +
>>  	int tc_link_refcount;
>>  	bool tc_legacy_port:1;
>>  	char tc_port_name[8];
>> -- 
>> 2.24.0
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init
  2019-12-23 19:58 ` [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init Lucas De Marchi
  2019-12-24  0:16   ` Matt Roper
@ 2019-12-31 11:22   ` Jani Nikula
  1 sibling, 0 replies; 34+ messages in thread
From: Jani Nikula @ 2019-12-31 11:22 UTC (permalink / raw)
  To: Lucas De Marchi, intel-gfx

On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Now that we have tables for all platforms using ddi, keep the port_info
> around so we can use it for decisions like "what phy does it have?"
> instead of keep checking the platform/gen everywhere.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c      | 36 ++++++++++++-------
>  drivers/gpu/drm/i915/display/intel_ddi.h      |  8 ++++-
>  drivers/gpu/drm/i915/display/intel_display.c  |  2 +-
>  .../drm/i915/display/intel_display_types.h    |  3 ++
>  4 files changed, 35 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index a1b7075ea6be..9d06a34f5f8e 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4782,14 +4782,25 @@ intel_ddi_max_lanes(struct intel_digital_port *dig_port)
>  	return max_lanes;
>  }
>  
> -void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
> +bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port)

Nitpick, I think __pure is premature optimization that may cause more
confusion than it benefits. Also, 'git grep __pure -- drivers | wc -l'.

BR,
Jani.


>  {
> +	return dig_port->port_info->phy_type == PHY_TYPE_TC;
> +}
> +
> +bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port)
> +{
> +	return dig_port->port_info->phy_type == PHY_TYPE_COMBO;
> +}
> +
> +void intel_ddi_init(struct drm_i915_private *dev_priv,
> +		    const struct intel_ddi_port_info *port_info)
> +{
> +	enum port port = port_info->port;
>  	struct ddi_vbt_port_info *vbt_port_info =
>  		&dev_priv->vbt.ddi_port_info[port];
>  	struct intel_digital_port *intel_dig_port;
>  	struct intel_encoder *encoder;
>  	bool init_hdmi, init_dp, init_lspcon = false;
> -	enum phy phy = intel_port_to_phy(dev_priv, port);
>  
>  	init_hdmi = vbt_port_info->supports_dvi || vbt_port_info->supports_hdmi;
>  	init_dp = vbt_port_info->supports_dp;
> @@ -4803,12 +4814,12 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  		init_dp = true;
>  		init_lspcon = true;
>  		init_hdmi = false;
> -		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
> +		DRM_DEBUG_KMS("VBT says port %s has lspcon\n", port_info->name);
>  	}
>  
>  	if (!init_dp && !init_hdmi) {
> -		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
> -			      port_name(port));
> +		DRM_DEBUG_KMS("VBT says %s is not DVI/HDMI/DP compatible, respect it\n",
> +			      port_info->name);
>  		return;
>  	}
>  
> @@ -4819,7 +4830,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	encoder = &intel_dig_port->base;
>  
>  	drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
> -			 DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port));
> +			 DRM_MODE_ENCODER_TMDS, port_info->name);
>  
>  	encoder->hotplug = intel_ddi_hotplug;
>  	encoder->compute_output_type = intel_ddi_compute_output_type;
> @@ -4837,7 +4848,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  
>  	encoder->type = INTEL_OUTPUT_DDI;
>  	encoder->power_domain = intel_port_to_power_domain(port);
> -	encoder->port = port;
> +	encoder->port = port_info->port;
>  	encoder->cloneable = 0;
>  	encoder->pipe_mask = ~0;
>  
> @@ -4851,8 +4862,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
>  	intel_dig_port->max_lanes = intel_ddi_max_lanes(intel_dig_port);
>  	intel_dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
> +	intel_dig_port->port_info = port_info;
>  
> -	if (intel_phy_is_tc(dev_priv, phy)) {
> +	if (intel_ddi_has_tc_phy(intel_dig_port)) {
>  		bool is_legacy = !vbt_port_info->supports_typec_usb &&
>  				 !vbt_port_info->supports_tbt;
>  
> @@ -4883,15 +4895,15 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>  	if (init_lspcon) {
>  		if (lspcon_init(intel_dig_port))
>  			/* TODO: handle hdmi info frame part */
> -			DRM_DEBUG_KMS("LSPCON init success on port %c\n",
> -				port_name(port));
> +			DRM_DEBUG_KMS("LSPCON init success on port %s\n",
> +				      port_info->name);
>  		else
>  			/*
>  			 * LSPCON init faied, but DP init was success, so
>  			 * lets try to drive as DP++ port.
>  			 */
> -			DRM_ERROR("LSPCON init failed on port %c\n",
> -				port_name(port));
> +			DRM_ERROR("LSPCON init failed on port %s\n",
> +				  port_info->name);
>  	}
>  
>  	intel_infoframe_init(intel_dig_port);
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h b/drivers/gpu/drm/i915/display/intel_ddi.h
> index 167c6579d972..c500d473963e 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.h
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
> @@ -15,6 +15,7 @@ struct drm_i915_private;
>  struct intel_connector;
>  struct intel_crtc;
>  struct intel_crtc_state;
> +struct intel_ddi_port_info;
>  struct intel_dp;
>  struct intel_dpll_hw_state;
>  struct intel_encoder;
> @@ -24,7 +25,8 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
>  				const struct drm_connector_state *old_conn_state);
>  void hsw_fdi_link_train(struct intel_encoder *encoder,
>  			const struct intel_crtc_state *crtc_state);
> -void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port);
> +void intel_ddi_init(struct drm_i915_private *dev_priv,
> +		    const struct intel_ddi_port_info *port_info);
>  bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
>  void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state);
>  void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state);
> @@ -50,4 +52,8 @@ void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
>  int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
>  			struct intel_dpll_hw_state *state);
>  
> +
> +bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port);
> +bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port);
> +
>  #endif /* __INTEL_DDI_H__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 219f180fa395..96207dc83fac 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16363,7 +16363,7 @@ static void setup_ddi_outputs(struct drm_i915_private *i915)
>  		    !output->is_port_present(i915, port_info))
>  			continue;
>  
> -		intel_ddi_init(i915, port_info->port);
> +		intel_ddi_init(i915, port_info);
>  	}
>  
>  	if (output->dsi_init)
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 23a885895803..c54b0178e885 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1346,6 +1346,9 @@ struct intel_digital_port {
>  	enum intel_display_power_domain ddi_io_power_domain;
>  	struct mutex tc_lock;	/* protects the TypeC port mode */
>  	intel_wakeref_t tc_lock_wakeref;
> +
> +	const struct intel_ddi_port_info *port_info;
> +
>  	int tc_link_refcount;
>  	bool tc_legacy_port:1;
>  	char tc_port_name[8];

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization
  2019-12-31  9:58   ` Jani Nikula
@ 2020-01-02  7:19     ` Lucas De Marchi
  2020-06-22 23:50       ` Lucas De Marchi
  0 siblings, 1 reply; 34+ messages in thread
From: Lucas De Marchi @ 2020-01-02  7:19 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Intel Graphics, Lucas De Marchi

On Tue, Dec 31, 2019 at 1:58 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> > For the latest platforms we can share the logic to initialize the the
> > ddi, so start moving the most trivial ones to a new setup_outputs_desc()
> > function that will be responsible for initialization according to a
> > static const table.
> >
> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c  | 96 +++++++++++++------
> >  .../drm/i915/display/intel_display_types.h    |  4 +
> >  2 files changed, 73 insertions(+), 27 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 04819b0bd494..b3fb1e03cb0b 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -16221,6 +16221,72 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
> >       intel_pps_unlock_regs_wa(dev_priv);
> >  }
> >
> > +struct intel_output {
> > +     /* Initialize DSI if present */
> > +     void (*dsi_init)(struct drm_i915_private *i915);
>
> We'll need to be able to initialize DSI on multiple ports too. I've
> already drafted a series to do so, maybe I've even sent it to the
> list. Basically you'd pass the port to icl_dsi_init() too.
>
> I don't want that development to get any more complicated than it
> already is.

Right now this is just working with what is there. I don't see a problem
to update this series with the additional port argument, but let's
keep the series
independent from each other.

Lucas De Marchi

>
> BR,
> Jani.
>
>
> > +     struct intel_ddi_port_info ddi_ports[];
> > +};
> > +
> > +static const struct intel_output tgl_output = {
> > +     .dsi_init = icl_dsi_init,
> > +     .ddi_ports = {
> > +             { .port = PORT_A },
> > +             { .port = PORT_B },
> > +             { .port = PORT_D },
> > +             { .port = PORT_E },
> > +             { .port = PORT_F },
> > +             { .port = PORT_G },
> > +             { .port = PORT_H },
> > +             { .port = PORT_I },
> > +             { .port = PORT_NONE }
> > +     }
> > +};
> > +
> > +static const struct intel_output ehl_output = {
> > +     .dsi_init = icl_dsi_init,
> > +     .ddi_ports = {
> > +             { .port = PORT_A },
> > +             { .port = PORT_B },
> > +             { .port = PORT_C },
> > +             { .port = PORT_D },
> > +             { .port = PORT_NONE }
> > +     }
> > +};
> > +
> > +static const struct intel_output gen9lp_output = {
> > +     .dsi_init = vlv_dsi_init,
> > +     .ddi_ports = {
> > +             { .port = PORT_A },
> > +             { .port = PORT_B },
> > +             { .port = PORT_C },
> > +             { .port = PORT_NONE }
> > +     },
> > +};
> > +
> > +/*
> > + * Use a description-based approach for platforms that can be supported with a
> > + * static table
> > + */
> > +static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> > +{
> > +     const struct intel_output *output;
> > +     const struct intel_ddi_port_info *port_info;
> > +
> > +     if (INTEL_GEN(i915) >= 12)
> > +             output = &tgl_output;
> > +     else if (IS_ELKHARTLAKE(i915))
> > +             output = &ehl_output;
> > +     else if (IS_GEN9_LP(i915))
> > +             output = &gen9lp_output;
> > +
> > +     for (port_info = output->ddi_ports;
> > +          port_info->port != PORT_NONE; port_info++)
> > +             intel_ddi_init(i915, port_info->port);
> > +
> > +     if (output->dsi_init)
> > +             output->dsi_init(i915);
> > +}
> > +
> >  static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> >  {
> >       struct intel_encoder *encoder;
> > @@ -16231,22 +16297,9 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> >       if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
> >               return;
> >
> > -     if (INTEL_GEN(dev_priv) >= 12) {
> > -             intel_ddi_init(dev_priv, PORT_A);
> > -             intel_ddi_init(dev_priv, PORT_B);
> > -             intel_ddi_init(dev_priv, PORT_D);
> > -             intel_ddi_init(dev_priv, PORT_E);
> > -             intel_ddi_init(dev_priv, PORT_F);
> > -             intel_ddi_init(dev_priv, PORT_G);
> > -             intel_ddi_init(dev_priv, PORT_H);
> > -             intel_ddi_init(dev_priv, PORT_I);
> > -             icl_dsi_init(dev_priv);
> > -     } else if (IS_ELKHARTLAKE(dev_priv)) {
> > -             intel_ddi_init(dev_priv, PORT_A);
> > -             intel_ddi_init(dev_priv, PORT_B);
> > -             intel_ddi_init(dev_priv, PORT_C);
> > -             intel_ddi_init(dev_priv, PORT_D);
> > -             icl_dsi_init(dev_priv);
> > +     if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
> > +         IS_GEN9_LP(dev_priv)) {
> > +             setup_ddi_outputs_desc(dev_priv);
> >       } else if (IS_GEN(dev_priv, 11)) {
> >               intel_ddi_init(dev_priv, PORT_A);
> >               intel_ddi_init(dev_priv, PORT_B);
> > @@ -16263,17 +16316,6 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> >                       intel_ddi_init(dev_priv, PORT_F);
> >
> >               icl_dsi_init(dev_priv);
> > -     } else if (IS_GEN9_LP(dev_priv)) {
> > -             /*
> > -              * FIXME: Broxton doesn't support port detection via the
> > -              * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
> > -              * detect the ports.
> > -              */
> > -             intel_ddi_init(dev_priv, PORT_A);
> > -             intel_ddi_init(dev_priv, PORT_B);
> > -             intel_ddi_init(dev_priv, PORT_C);
> > -
> > -             vlv_dsi_init(dev_priv);
> >       } else if (HAS_DDI(dev_priv)) {
> >               int found;
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index a3a067dacf84..4d2f4ee35812 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -1376,6 +1376,10 @@ struct intel_dp_mst_encoder {
> >       struct intel_connector *connector;
> >  };
> >
> > +struct intel_ddi_port_info {
> > +     enum port port;
> > +};
> > +
> >  static inline enum dpio_channel
> >  vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
> >  {
>
> --
> Jani Nikula, Intel Open Source Graphics Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Lucas De Marchi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms
  2019-12-31 10:25   ` Jani Nikula
  2019-12-31 10:26     ` Jani Nikula
@ 2020-01-02  7:23     ` Lucas De Marchi
  1 sibling, 0 replies; 34+ messages in thread
From: Lucas De Marchi @ 2020-01-02  7:23 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Intel Graphics, Lucas De Marchi

On Tue, Dec 31, 2019 at 2:25 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> > Support remaining platforms under HAS_DDI() by providing a slightly more
> > complex is_port_present() hook. The downside is that now we call
> > I915_READ(SFUSE_STRAP) for each port being initialized, but that's only
> > on initialization: a few more mmio reads won't hurt.
> >
> > Alternatives would be to provide one hook per port, or to have a
> > "pre_init()" hook that takes care of the mmio read. However I think this
> > is simpler - we may need to adapt if future platforms don't follow the
> > same initialization "template".
>
> All of this really makes me wonder if we end up being *more* complicated
> overall by trying very hard to make this generic, when, in reality, it
> doesn't seem to be all that generic.

maybe, but it seems the ddi init part has settled and we are now mainly doing
if / else for additional platforms with just calls to intel_ddi_init()
and intel_dsi_init(),
so I think it was worth merging them together. I also think this
prevents additional
hacks from sprinkling here.

Lucas De Marchi

>
> As I said, two relatively low hanging improvements would be a) moving
> VBT specific hacks to intel_bios.c and b) adding port mask to
> intel_device_info. Those two alone would go a long way in simplifying
> intel_setup_outputs().
>
> >
> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 72 +++++++++++++-------
> >  1 file changed, 46 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 6b4d320ff92c..ad85cf75c815 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -16246,6 +16246,34 @@ static bool icl_is_port_present(struct drm_i915_private *i915,
> >               intel_bios_is_port_present(i915, PORT_F);
> >  }
> >
> > +static bool ddi_is_port_present(struct drm_i915_private *i915,
> > +                             const struct intel_ddi_port_info *port_info)
> > +{
> > +     /* keep I915_READ() happy */
>
> Display could get rid of I915_READ and I915_WRITE after
> https://patchwork.freedesktop.org/series/70298/ ...
>
> BR,
> Jani.
>
> > +     struct drm_i915_private *dev_priv = i915;
> > +
> > +     if (port_info->port == PORT_A)
> > +             return I915_READ(DDI_BUF_CTL(PORT_A))
> > +                     & DDI_INIT_DISPLAY_DETECTED;
> > +
> > +     if (port_info->port == PORT_E)
> > +             return IS_GEN9_BC(dev_priv) &&
> > +                     intel_bios_is_port_present(i915, PORT_E);
> > +
> > +     switch (port_info->port) {
> > +     case PORT_B:
> > +             return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIB_DETECTED;
> > +     case PORT_C:
> > +             return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIC_DETECTED;
> > +     case PORT_D:
> > +             return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDID_DETECTED;
> > +     case PORT_F:
> > +             return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIF_DETECTED;
> > +     default:
> > +             return false;
> > +     }
> > +}
> > +
> >  static const struct intel_output tgl_output = {
> >       .dsi_init = icl_dsi_init,
> >       .ddi_ports = {
> > @@ -16296,11 +16324,24 @@ static const struct intel_output gen9lp_output = {
> >       },
> >  };
> >
> > +static const struct intel_output ddi_output = {
> > +     .is_port_present = ddi_is_port_present,
> > +     .ddi_ports = {
> > +             { .port = PORT_A },
> > +             { .port = PORT_B },
> > +             { .port = PORT_C },
> > +             { .port = PORT_D },
> > +             { .port = PORT_E },
> > +             { .port = PORT_F },
> > +             { .port = PORT_NONE }
> > +     }
> > +};
> > +
> >  /*
> >   * Use a description-based approach for platforms that can be supported with a
> >   * static table
> >   */
> > -static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> > +static void setup_ddi_outputs(struct drm_i915_private *i915)
> >  {
> >       const struct intel_output *output;
> >       const struct intel_ddi_port_info *port_info;
> > @@ -16313,6 +16354,8 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> >               output = &icl_output;
> >       else if (IS_GEN9_LP(i915))
> >               output = &gen9lp_output;
> > +     else
> > +             output = &ddi_output;
> >
> >       for (port_info = output->ddi_ports;
> >            port_info->port != PORT_NONE; port_info++) {
> > @@ -16338,35 +16381,12 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> >               return;
> >
> >       if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
> > -             setup_ddi_outputs_desc(dev_priv);
> > +             setup_ddi_outputs(dev_priv);
> >       } else if (HAS_DDI(dev_priv)) {
> > -             int found;
> > -
> >               if (intel_ddi_crt_present(dev_priv))
> >                       intel_crt_init(dev_priv);
> >
> > -             found = I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_INIT_DISPLAY_DETECTED;
> > -             if (found)
> > -                     intel_ddi_init(dev_priv, PORT_A);
> > -
> > -             /* DDI B, C, D, and F detection is indicated by the SFUSE_STRAP
> > -              * register */
> > -             found = I915_READ(SFUSE_STRAP);
> > -
> > -             if (found & SFUSE_STRAP_DDIB_DETECTED)
> > -                     intel_ddi_init(dev_priv, PORT_B);
> > -             if (found & SFUSE_STRAP_DDIC_DETECTED)
> > -                     intel_ddi_init(dev_priv, PORT_C);
> > -             if (found & SFUSE_STRAP_DDID_DETECTED)
> > -                     intel_ddi_init(dev_priv, PORT_D);
> > -             if (found & SFUSE_STRAP_DDIF_DETECTED)
> > -                     intel_ddi_init(dev_priv, PORT_F);
> > -             /*
> > -              * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> > -              */
> > -             if (IS_GEN9_BC(dev_priv) &&
> > -                 intel_bios_is_port_present(dev_priv, PORT_E))
> > -                     intel_ddi_init(dev_priv, PORT_E);
> > +             setup_ddi_outputs(dev_priv);
> >       } else if (HAS_PCH_SPLIT(dev_priv)) {
> >               int found;
>
> --
> Jani Nikula, Intel Open Source Graphics Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Lucas De Marchi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init
  2019-12-31 10:14   ` Jani Nikula
@ 2020-01-02  7:32     ` Lucas De Marchi
  0 siblings, 0 replies; 34+ messages in thread
From: Lucas De Marchi @ 2020-01-02  7:32 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Intel Graphics, Lucas De Marchi

On Tue, Dec 31, 2019 at 2:14 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> > By adding a hook that determines if a port is present, we are able to
> > support Ice Lake in the new description-based DDI initialization.
> >
> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 61 ++++++++++++++------
> >  1 file changed, 42 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index b3fb1e03cb0b..6b4d320ff92c 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -16224,9 +16224,28 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
> >  struct intel_output {
> >       /* Initialize DSI if present */
> >       void (*dsi_init)(struct drm_i915_private *i915);
> > +
> > +     /*
> > +      * Check if port is present before trying to initialize; if not provided
> > +      * it's assumed the port is present (or we can't check and fail
> > +      * gracefully
> > +      */
> > +     bool (*is_port_present)(struct drm_i915_private *i915,
> > +                             const struct intel_ddi_port_info *port_info);
> > +
> >       struct intel_ddi_port_info ddi_ports[];
> >  };
> >
> > +static bool icl_is_port_present(struct drm_i915_private *i915,
> > +                             const struct intel_ddi_port_info *port_info)
> > +{
> > +     if (port_info->port != PORT_F)
> > +             return true;
> > +
> > +     return IS_ICL_WITH_PORT_F(i915) &&
> > +             intel_bios_is_port_present(i915, PORT_F);
> > +}
> > +
>
> You know, all of that is here because there were some boards with broken
> VBTs claiming there was a port F on hardware that didn't have port
> F. And now we're turning it into infrastructure for all platforms. :(
>
> I actually preferred it when it was a localized hack for ICL. (Though I
> said at the time we should not add hacks for VBTs because this shit
> won't get fixed if we keep accommodating it.)
>
> If we still need the port F hack, I think I'd rather move it to
> intel_bios.c and skip port F description in VBT for platformsm that
> don't have it. So we can rely on VBT info elsewhere.
>
> Note that intel_ddi_init() will still check for VBT.

I don't think that is sufficient.... It may be a VBT thing, it may be a strap,
it may be because the phy is not hooked up (hence why we don't init
DDIC on TGL).

Idea here is to have a generic "is_port_present()" in which we collect
the N reasons why
we may not want to initialize a DDI.

The check intel_ddi_init() does is not sufficient for TGL, because the
VBT still says the port
is there, the port is in fact there, but the registers related to the
combophy don't behave.

Lucas De Marchi

>
> >  static const struct intel_output tgl_output = {
> >       .dsi_init = icl_dsi_init,
> >       .ddi_ports = {
> > @@ -16242,6 +16261,20 @@ static const struct intel_output tgl_output = {
> >       }
> >  };
> >
> > +static const struct intel_output icl_output = {
> > +     .dsi_init = icl_dsi_init,
> > +     .is_port_present = icl_is_port_present,
> > +     .ddi_ports = {
> > +             { .port = PORT_A },
> > +             { .port = PORT_B },
> > +             { .port = PORT_C },
> > +             { .port = PORT_D },
> > +             { .port = PORT_E },
> > +             { .port = PORT_F },
> > +             { .port = PORT_NONE }
>
> At this stage of the series it seems to me we could have a ports mask in
> intel_device_info, and just loop over it using for_each_port_masked().
>
> BR,
> Jani.
>
> > +     }
> > +};
> > +
> >  static const struct intel_output ehl_output = {
> >       .dsi_init = icl_dsi_init,
> >       .ddi_ports = {
> > @@ -16276,12 +16309,19 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> >               output = &tgl_output;
> >       else if (IS_ELKHARTLAKE(i915))
> >               output = &ehl_output;
> > +     else if (IS_GEN(i915, 11))
> > +             output = &icl_output;
> >       else if (IS_GEN9_LP(i915))
> >               output = &gen9lp_output;
> >
> >       for (port_info = output->ddi_ports;
> > -          port_info->port != PORT_NONE; port_info++)
> > +          port_info->port != PORT_NONE; port_info++) {
> > +             if (output->is_port_present &&
> > +                 !output->is_port_present(i915, port_info))
> > +                     continue;
> > +
> >               intel_ddi_init(i915, port_info->port);
> > +     }
> >
> >       if (output->dsi_init)
> >               output->dsi_init(i915);
> > @@ -16297,25 +16337,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> >       if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
> >               return;
> >
> > -     if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
> > -         IS_GEN9_LP(dev_priv)) {
> > +     if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
> >               setup_ddi_outputs_desc(dev_priv);
> > -     } else if (IS_GEN(dev_priv, 11)) {
> > -             intel_ddi_init(dev_priv, PORT_A);
> > -             intel_ddi_init(dev_priv, PORT_B);
> > -             intel_ddi_init(dev_priv, PORT_C);
> > -             intel_ddi_init(dev_priv, PORT_D);
> > -             intel_ddi_init(dev_priv, PORT_E);
> > -             /*
> > -              * On some ICL SKUs port F is not present. No strap bits for
> > -              * this, so rely on VBT.
> > -              * Work around broken VBTs on SKUs known to have no port F.
> > -              */
> > -             if (IS_ICL_WITH_PORT_F(dev_priv) &&
> > -                 intel_bios_is_port_present(dev_priv, PORT_F))
> > -                     intel_ddi_init(dev_priv, PORT_F);
> > -
> > -             icl_dsi_init(dev_priv);
> >       } else if (HAS_DDI(dev_priv)) {
> >               int found;
>
> --
> Jani Nikula, Intel Open Source Graphics Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Lucas De Marchi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes
  2019-12-31 10:33   ` Jani Nikula
@ 2020-01-02  7:50     ` Lucas De Marchi
  0 siblings, 0 replies; 34+ messages in thread
From: Lucas De Marchi @ 2020-01-02  7:50 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Intel Graphics, Lucas De Marchi

On Tue, Dec 31, 2019 at 2:33 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> > Identify 3 possible cases in which the index numbers can be different
> > from the "port" and add them to the description-based ddi initialization
> > table.  This can be used in place of additional functions mapping from
> > on to the other.  Right now we already cover part of this by creating kind of
> > virtual phy numbering, but that comes with downsides:
> >
> > a) there's not really a "phy numbering" in the spec, this is purely a
> > software thing; hardware uses whatever they want thinking mapping from
> > one to the other arbitrarily is easy in software.
> >
> > b) currently the mapping occurs on "leaf" functions, making the decision
> > based on the platform.
> >
> > With this new table the approach will be: the port as defined by the
> > enum port is purely a driver convention and won't be used anymore to
> > define the register offset or register bits. For that we have the other
> > 3 indexes, identified as being possibly different from the current usage
> > of register bits: ddi, vbt and phy. The phy type is also added here,
> > meant to replace the checks for combo vs tc (although the helper
> > functions can remain so we may differentiate between, e.g. Dekel and MG
> > phys).
>
> I'm not sure how the vbt_idx is supposed to be used (because it's
> actually not used anywhere here). I would like to reduce the amount of
> VBT info spread around in the driver, so I'd really need to know more.

The index the VBT uses to refer to a DDI may not match the index used by
the display engine, that is why I'm adding it here.

Lucas De Marchi

>
> > While at it, also give names to the ports so they can be easily
> > identified.
> >
> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c  | 54 +++++++++----------
> >  drivers/gpu/drm/i915/display/intel_display.h  |  7 +++
> >  .../drm/i915/display/intel_display_types.h    |  5 ++
> >  3 files changed, 39 insertions(+), 27 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index ad85cf75c815..219f180fa395 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -16277,14 +16277,14 @@ static bool ddi_is_port_present(struct drm_i915_private *i915,
> >  static const struct intel_output tgl_output = {
> >       .dsi_init = icl_dsi_init,
> >       .ddi_ports = {
> > -             { .port = PORT_A },
> > -             { .port = PORT_B },
> > -             { .port = PORT_D },
> > -             { .port = PORT_E },
> > -             { .port = PORT_F },
> > -             { .port = PORT_G },
> > -             { .port = PORT_H },
> > -             { .port = PORT_I },
> > +             { .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> > +             { .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> > +             { .name = "DDI TC1", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x2, },
> > +             { .name = "DDI TC2", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x1, .vbt_idx = 0x3, },
> > +             { .name = "DDI TC3", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x2, .vbt_idx = 0x4, },
> > +             { .name = "DDI TC4", .port = PORT_G, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x6, .phy_idx = 0x3, .vbt_idx = 0x5, },
> > +             { .name = "DDI TC5", .port = PORT_H, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x7, .phy_idx = 0x4, .vbt_idx = 0x6, },
> > +             { .name = "DDI TC6", .port = PORT_I, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x8, .phy_idx = 0x5, .vbt_idx = 0x7, },
> >               { .port = PORT_NONE }
>
> Makes you wonder if this sort of info should be linked from the
> intel_device_info instead of adding new arrays. Not sure.

Yeah, but I think it may be too much info there. Otherwise we should
migrate the powerwell definitions, hpd, etc. Just
like for the powerwells, I think the table is only relevant for the
init function. Every other user should just go through the
port_info from the port it's working with instead of looping through
all of ports in the intel_device_info. By keeping the array
private here we at least prevent that I think.

Lucas De Marchi

>
> BR,
> Jani.
>
>
> >       }
> >  };
> > @@ -16293,12 +16293,12 @@ static const struct intel_output icl_output = {
> >       .dsi_init = icl_dsi_init,
> >       .is_port_present = icl_is_port_present,
> >       .ddi_ports = {
> > -             { .port = PORT_A },
> > -             { .port = PORT_B },
> > -             { .port = PORT_C },
> > -             { .port = PORT_D },
> > -             { .port = PORT_E },
> > -             { .port = PORT_F },
> > +             { .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> > +             { .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> > +             { .name = "DDI TC1", .port = PORT_C, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x2, .phy_idx = 0x0, .vbt_idx = 0x2, },
> > +             { .name = "DDI TC2", .port = PORT_D, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x3, .phy_idx = 0x1, .vbt_idx = 0x3, },
> > +             { .name = "DDI TC3", .port = PORT_E, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x4, .phy_idx = 0x2, .vbt_idx = 0x4, },
> > +             { .name = "DDI TC4", .port = PORT_F, .phy_type = PHY_TYPE_TC,    .ddi_idx = 0x5, .phy_idx = 0x3, .vbt_idx = 0x5, },
> >               { .port = PORT_NONE }
> >       }
> >  };
> > @@ -16306,10 +16306,10 @@ static const struct intel_output icl_output = {
> >  static const struct intel_output ehl_output = {
> >       .dsi_init = icl_dsi_init,
> >       .ddi_ports = {
> > -             { .port = PORT_A },
> > -             { .port = PORT_B },
> > -             { .port = PORT_C },
> > -             { .port = PORT_D },
> > +             { .name = "DDI A",   .port = PORT_A, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0, },
> > +             { .name = "DDI B",   .port = PORT_B, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1, },
> > +             { .name = "DDI C",   .port = PORT_C, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2, },
> > +             { .name = "DDI D",   .port = PORT_D, .phy_type = PHY_TYPE_COMBO, .ddi_idx = 0x3, .phy_idx = 0x0, .vbt_idx = 0x3, },
> >               { .port = PORT_NONE }
> >       }
> >  };
> > @@ -16317,9 +16317,9 @@ static const struct intel_output ehl_output = {
> >  static const struct intel_output gen9lp_output = {
> >       .dsi_init = vlv_dsi_init,
> >       .ddi_ports = {
> > -             { .port = PORT_A },
> > -             { .port = PORT_B },
> > -             { .port = PORT_C },
> > +             { .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
> > +             { .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
> > +             { .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
> >               { .port = PORT_NONE }
> >       },
> >  };
> > @@ -16327,12 +16327,12 @@ static const struct intel_output gen9lp_output = {
> >  static const struct intel_output ddi_output = {
> >       .is_port_present = ddi_is_port_present,
> >       .ddi_ports = {
> > -             { .port = PORT_A },
> > -             { .port = PORT_B },
> > -             { .port = PORT_C },
> > -             { .port = PORT_D },
> > -             { .port = PORT_E },
> > -             { .port = PORT_F },
> > +             { .name = "DDI A", .port = PORT_A, .ddi_idx = 0x0, .phy_idx = 0x0, .vbt_idx = 0x0 },
> > +             { .name = "DDI B", .port = PORT_B, .ddi_idx = 0x1, .phy_idx = 0x1, .vbt_idx = 0x1 },
> > +             { .name = "DDI C", .port = PORT_C, .ddi_idx = 0x2, .phy_idx = 0x2, .vbt_idx = 0x2 },
> > +             { .name = "DDI D", .port = PORT_D, .ddi_idx = 0x3, .phy_idx = 0x3, .vbt_idx = 0x3 },
> > +             { .name = "DDI E", .port = PORT_E, .ddi_idx = 0x4, .phy_idx = 0x4, .vbt_idx = 0x4 },
> > +             { .name = "DDI F", .port = PORT_F, .ddi_idx = 0x5, .phy_idx = 0x5, .vbt_idx = 0x5 },
> >               { .port = PORT_NONE }
> >       }
> >  };
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
> > index 05d68bd393dc..db19e5eee248 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display.h
> > @@ -303,6 +303,13 @@ enum phy {
> >       I915_MAX_PHYS
> >  };
> >
> > +enum phy_type {
> > +     PHY_TYPE_NONE = 0,
> > +
> > +     PHY_TYPE_COMBO,
> > +     PHY_TYPE_TC,
> > +};
> > +
> >  #define phy_name(a) ((a) + 'A')
> >
> >  enum phy_fia {
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index 4d2f4ee35812..23a885895803 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -1377,7 +1377,12 @@ struct intel_dp_mst_encoder {
> >  };
> >
> >  struct intel_ddi_port_info {
> > +     const char *name;
> >       enum port port;
> > +     s8 phy_type;
> > +     u8 ddi_idx;
> > +     u8 phy_idx;
> > +     u8 vbt_idx;
> >  };
> >
> >  static inline enum dpio_channel
>
> --
> Jani Nikula, Intel Open Source Graphics Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Lucas De Marchi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization
  2020-01-02  7:19     ` Lucas De Marchi
@ 2020-06-22 23:50       ` Lucas De Marchi
  2020-07-03 13:22         ` Jani Nikula
  0 siblings, 1 reply; 34+ messages in thread
From: Lucas De Marchi @ 2020-06-22 23:50 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Intel Graphics, Lucas De Marchi

On Wed, Jan 1, 2020 at 11:19 PM Lucas De Marchi
<lucas.de.marchi@gmail.com> wrote:
>
> On Tue, Dec 31, 2019 at 1:58 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
> >
> > On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> > > For the latest platforms we can share the logic to initialize the the
> > > ddi, so start moving the most trivial ones to a new setup_outputs_desc()
> > > function that will be responsible for initialization according to a
> > > static const table.
> > >
> > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_display.c  | 96 +++++++++++++------
> > >  .../drm/i915/display/intel_display_types.h    |  4 +
> > >  2 files changed, 73 insertions(+), 27 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > > index 04819b0bd494..b3fb1e03cb0b 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > @@ -16221,6 +16221,72 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
> > >       intel_pps_unlock_regs_wa(dev_priv);
> > >  }
> > >
> > > +struct intel_output {
> > > +     /* Initialize DSI if present */
> > > +     void (*dsi_init)(struct drm_i915_private *i915);
> >
> > We'll need to be able to initialize DSI on multiple ports too. I've
> > already drafted a series to do so, maybe I've even sent it to the
> > list. Basically you'd pass the port to icl_dsi_init() too.
> >
> > I don't want that development to get any more complicated than it
> > already is.

Did you make progress on that series? Anywhere for me to look at?
I'd like to respin this series.

Lucas De Marchi

>
> Right now this is just working with what is there. I don't see a problem
> to update this series with the additional port argument, but let's
> keep the series
> independent from each other.
>
> Lucas De Marchi
>
> >
> > BR,
> > Jani.
> >
> >
> > > +     struct intel_ddi_port_info ddi_ports[];
> > > +};
> > > +
> > > +static const struct intel_output tgl_output = {
> > > +     .dsi_init = icl_dsi_init,
> > > +     .ddi_ports = {
> > > +             { .port = PORT_A },
> > > +             { .port = PORT_B },
> > > +             { .port = PORT_D },
> > > +             { .port = PORT_E },
> > > +             { .port = PORT_F },
> > > +             { .port = PORT_G },
> > > +             { .port = PORT_H },
> > > +             { .port = PORT_I },
> > > +             { .port = PORT_NONE }
> > > +     }
> > > +};
> > > +
> > > +static const struct intel_output ehl_output = {
> > > +     .dsi_init = icl_dsi_init,
> > > +     .ddi_ports = {
> > > +             { .port = PORT_A },
> > > +             { .port = PORT_B },
> > > +             { .port = PORT_C },
> > > +             { .port = PORT_D },
> > > +             { .port = PORT_NONE }
> > > +     }
> > > +};
> > > +
> > > +static const struct intel_output gen9lp_output = {
> > > +     .dsi_init = vlv_dsi_init,
> > > +     .ddi_ports = {
> > > +             { .port = PORT_A },
> > > +             { .port = PORT_B },
> > > +             { .port = PORT_C },
> > > +             { .port = PORT_NONE }
> > > +     },
> > > +};
> > > +
> > > +/*
> > > + * Use a description-based approach for platforms that can be supported with a
> > > + * static table
> > > + */
> > > +static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> > > +{
> > > +     const struct intel_output *output;
> > > +     const struct intel_ddi_port_info *port_info;
> > > +
> > > +     if (INTEL_GEN(i915) >= 12)
> > > +             output = &tgl_output;
> > > +     else if (IS_ELKHARTLAKE(i915))
> > > +             output = &ehl_output;
> > > +     else if (IS_GEN9_LP(i915))
> > > +             output = &gen9lp_output;
> > > +
> > > +     for (port_info = output->ddi_ports;
> > > +          port_info->port != PORT_NONE; port_info++)
> > > +             intel_ddi_init(i915, port_info->port);
> > > +
> > > +     if (output->dsi_init)
> > > +             output->dsi_init(i915);
> > > +}
> > > +
> > >  static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> > >  {
> > >       struct intel_encoder *encoder;
> > > @@ -16231,22 +16297,9 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> > >       if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
> > >               return;
> > >
> > > -     if (INTEL_GEN(dev_priv) >= 12) {
> > > -             intel_ddi_init(dev_priv, PORT_A);
> > > -             intel_ddi_init(dev_priv, PORT_B);
> > > -             intel_ddi_init(dev_priv, PORT_D);
> > > -             intel_ddi_init(dev_priv, PORT_E);
> > > -             intel_ddi_init(dev_priv, PORT_F);
> > > -             intel_ddi_init(dev_priv, PORT_G);
> > > -             intel_ddi_init(dev_priv, PORT_H);
> > > -             intel_ddi_init(dev_priv, PORT_I);
> > > -             icl_dsi_init(dev_priv);
> > > -     } else if (IS_ELKHARTLAKE(dev_priv)) {
> > > -             intel_ddi_init(dev_priv, PORT_A);
> > > -             intel_ddi_init(dev_priv, PORT_B);
> > > -             intel_ddi_init(dev_priv, PORT_C);
> > > -             intel_ddi_init(dev_priv, PORT_D);
> > > -             icl_dsi_init(dev_priv);
> > > +     if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
> > > +         IS_GEN9_LP(dev_priv)) {
> > > +             setup_ddi_outputs_desc(dev_priv);
> > >       } else if (IS_GEN(dev_priv, 11)) {
> > >               intel_ddi_init(dev_priv, PORT_A);
> > >               intel_ddi_init(dev_priv, PORT_B);
> > > @@ -16263,17 +16316,6 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> > >                       intel_ddi_init(dev_priv, PORT_F);
> > >
> > >               icl_dsi_init(dev_priv);
> > > -     } else if (IS_GEN9_LP(dev_priv)) {
> > > -             /*
> > > -              * FIXME: Broxton doesn't support port detection via the
> > > -              * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
> > > -              * detect the ports.
> > > -              */
> > > -             intel_ddi_init(dev_priv, PORT_A);
> > > -             intel_ddi_init(dev_priv, PORT_B);
> > > -             intel_ddi_init(dev_priv, PORT_C);
> > > -
> > > -             vlv_dsi_init(dev_priv);
> > >       } else if (HAS_DDI(dev_priv)) {
> > >               int found;
> > >
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > index a3a067dacf84..4d2f4ee35812 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > @@ -1376,6 +1376,10 @@ struct intel_dp_mst_encoder {
> > >       struct intel_connector *connector;
> > >  };
> > >
> > > +struct intel_ddi_port_info {
> > > +     enum port port;
> > > +};
> > > +
> > >  static inline enum dpio_channel
> > >  vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
> > >  {
> >
> > --
> > Jani Nikula, Intel Open Source Graphics Center
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>
>
> --
> Lucas De Marchi



-- 
Lucas De Marchi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init
  2019-12-31 11:20     ` Jani Nikula
@ 2020-06-23  1:11       ` Lucas De Marchi
  0 siblings, 0 replies; 34+ messages in thread
From: Lucas De Marchi @ 2020-06-23  1:11 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Tue, Dec 31, 2019 at 01:20:32PM +0200, Jani Nikula wrote:
>On Mon, 23 Dec 2019, Matt Roper <matthew.d.roper@intel.com> wrote:
>> On Mon, Dec 23, 2019 at 11:58:50AM -0800, Lucas De Marchi wrote:
>>> Now that we have tables for all platforms using ddi, keep the port_info
>>> around so we can use it for decisions like "what phy does it have?"
>>> instead of keep checking the platform/gen everywhere.
>>>
>>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>>> ---
>>>  drivers/gpu/drm/i915/display/intel_ddi.c      | 36 ++++++++++++-------
>>>  drivers/gpu/drm/i915/display/intel_ddi.h      |  8 ++++-
>>>  drivers/gpu/drm/i915/display/intel_display.c  |  2 +-
>>>  .../drm/i915/display/intel_display_types.h    |  3 ++
>>>  4 files changed, 35 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
>>> index a1b7075ea6be..9d06a34f5f8e 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
>>> @@ -4782,14 +4782,25 @@ intel_ddi_max_lanes(struct intel_digital_port *dig_port)
>>>  	return max_lanes;
>>>  }
>>>
>>> -void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>> +bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port)
>>>  {
>>> +	return dig_port->port_info->phy_type == PHY_TYPE_TC;
>>> +}
>>> +
>>> +bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port)
>>> +{
>>> +	return dig_port->port_info->phy_type == PHY_TYPE_COMBO;
>>> +}
>>> +
>>> +void intel_ddi_init(struct drm_i915_private *dev_priv,
>>> +		    const struct intel_ddi_port_info *port_info)
>>> +{
>>> +	enum port port = port_info->port;
>>>  	struct ddi_vbt_port_info *vbt_port_info =
>>>  		&dev_priv->vbt.ddi_port_info[port];
>>>  	struct intel_digital_port *intel_dig_port;
>>>  	struct intel_encoder *encoder;
>>>  	bool init_hdmi, init_dp, init_lspcon = false;
>>> -	enum phy phy = intel_port_to_phy(dev_priv, port);
>>>
>>>  	init_hdmi = vbt_port_info->supports_dvi || vbt_port_info->supports_hdmi;
>>>  	init_dp = vbt_port_info->supports_dp;
>>> @@ -4803,12 +4814,12 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>>  		init_dp = true;
>>>  		init_lspcon = true;
>>>  		init_hdmi = false;
>>> -		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
>>> +		DRM_DEBUG_KMS("VBT says port %s has lspcon\n", port_info->name);
>>>  	}
>>>
>>>  	if (!init_dp && !init_hdmi) {
>>> -		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
>>> -			      port_name(port));
>>> +		DRM_DEBUG_KMS("VBT says %s is not DVI/HDMI/DP compatible, respect it\n",
>>> +			      port_info->name);
>>>  		return;
>>>  	}
>>>
>>> @@ -4819,7 +4830,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>>  	encoder = &intel_dig_port->base;
>>>
>>>  	drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
>>> -			 DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port));
>>> +			 DRM_MODE_ENCODER_TMDS, port_info->name);
>>>
>>>  	encoder->hotplug = intel_ddi_hotplug;
>>>  	encoder->compute_output_type = intel_ddi_compute_output_type;
>>> @@ -4837,7 +4848,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>>
>>>  	encoder->type = INTEL_OUTPUT_DDI;
>>>  	encoder->power_domain = intel_port_to_power_domain(port);
>>> -	encoder->port = port;
>>> +	encoder->port = port_info->port;
>>
>> In theory, shouldn't we be able to drop encoder->port completely once
>> we've converted everything over to the proper ddi/phy/vbt namespace?
>>
>> Overall I like the direction this series is going.  The continued use of
>> 'port' terminology, both in the driver and in the hardware specs has
>> become increasingly confusing as things get chopped up and indexed
>> differently.  I think this will help clarify exactly what a platform is
>> expecting and force people to think about which namespace is correct for
>> the part of the hardware they're working with.
>
>Indeed, this part I like.
>
>I am less certain whether we need to change output setup to be driven by
>the new port_info. Seems like we could keep the existing output setup
>(with its wrinkles) while converting port towards a struct consisting of
>port, phy and phy type. And make the latter table driven instead of the
>current intel_port_to_*() and intel_phy_is_*(). I think that's good
>stuff.

I have to put the table somewhere. I prefer it localized on
intel_display then globally on device info because nobody really should
be looking at that table except the init function. This prevents hacks
to sprinkle over the driver.


>But I don't like all the wrinkles with port F and DSI and straps etc. in
>the output setup changes in this series. And we'll still *also* depend
>on VBT here. I am not sure if the output setup should in fact be driven
>by the VBT instead of the ports (yeah, *gasp*!).

I think those are orthogonal things. On a quick look, for port F the
thing that can be done is to move it to intel_bios.c as you suggested
and then get rid of the "is_port_present()" hook.

That would allow us to easily use the "generic approach" for gen9lp and
gen11+. As I'm reworking on this stuff, I'd leave the previous platforms
alone so we don't have to make it more complex.

For dsi, it's not clear to me what to do. I could add a
intel_dsi_init(), but that would be just an indirection over the
platform-specific functions. I'm happy to rebase this series on whatever
you provide for dsi.


Lucas De Marchi

>
>I guess the issue with output setup would be if there are collisions in
>ports with different phys. Though that would require VBT parsing changes
>for DDI too, as that currently ignores such cases (and we have that in
>CHV DSI).
>
>
>BR,
>Jani.
>
>>
>>
>> Matt
>>
>>>  	encoder->cloneable = 0;
>>>  	encoder->pipe_mask = ~0;
>>>
>>> @@ -4851,8 +4862,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>>  	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
>>>  	intel_dig_port->max_lanes = intel_ddi_max_lanes(intel_dig_port);
>>>  	intel_dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
>>> +	intel_dig_port->port_info = port_info;
>>>
>>> -	if (intel_phy_is_tc(dev_priv, phy)) {
>>> +	if (intel_ddi_has_tc_phy(intel_dig_port)) {
>>>  		bool is_legacy = !vbt_port_info->supports_typec_usb &&
>>>  				 !vbt_port_info->supports_tbt;
>>>
>>> @@ -4883,15 +4895,15 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>>>  	if (init_lspcon) {
>>>  		if (lspcon_init(intel_dig_port))
>>>  			/* TODO: handle hdmi info frame part */
>>> -			DRM_DEBUG_KMS("LSPCON init success on port %c\n",
>>> -				port_name(port));
>>> +			DRM_DEBUG_KMS("LSPCON init success on port %s\n",
>>> +				      port_info->name);
>>>  		else
>>>  			/*
>>>  			 * LSPCON init faied, but DP init was success, so
>>>  			 * lets try to drive as DP++ port.
>>>  			 */
>>> -			DRM_ERROR("LSPCON init failed on port %c\n",
>>> -				port_name(port));
>>> +			DRM_ERROR("LSPCON init failed on port %s\n",
>>> +				  port_info->name);
>>>  	}
>>>
>>>  	intel_infoframe_init(intel_dig_port);
>>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h b/drivers/gpu/drm/i915/display/intel_ddi.h
>>> index 167c6579d972..c500d473963e 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_ddi.h
>>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
>>> @@ -15,6 +15,7 @@ struct drm_i915_private;
>>>  struct intel_connector;
>>>  struct intel_crtc;
>>>  struct intel_crtc_state;
>>> +struct intel_ddi_port_info;
>>>  struct intel_dp;
>>>  struct intel_dpll_hw_state;
>>>  struct intel_encoder;
>>> @@ -24,7 +25,8 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
>>>  				const struct drm_connector_state *old_conn_state);
>>>  void hsw_fdi_link_train(struct intel_encoder *encoder,
>>>  			const struct intel_crtc_state *crtc_state);
>>> -void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port);
>>> +void intel_ddi_init(struct drm_i915_private *dev_priv,
>>> +		    const struct intel_ddi_port_info *port_info);
>>>  bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
>>>  void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state);
>>>  void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state);
>>> @@ -50,4 +52,8 @@ void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
>>>  int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
>>>  			struct intel_dpll_hw_state *state);
>>>
>>> +
>>> +bool __pure intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port);
>>> +bool __pure intel_ddi_has_combo_phy(const struct intel_digital_port *dig_port);
>>> +
>>>  #endif /* __INTEL_DDI_H__ */
>>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>>> index 219f180fa395..96207dc83fac 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>>> @@ -16363,7 +16363,7 @@ static void setup_ddi_outputs(struct drm_i915_private *i915)
>>>  		    !output->is_port_present(i915, port_info))
>>>  			continue;
>>>
>>> -		intel_ddi_init(i915, port_info->port);
>>> +		intel_ddi_init(i915, port_info);
>>>  	}
>>>
>>>  	if (output->dsi_init)
>>> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
>>> index 23a885895803..c54b0178e885 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
>>> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
>>> @@ -1346,6 +1346,9 @@ struct intel_digital_port {
>>>  	enum intel_display_power_domain ddi_io_power_domain;
>>>  	struct mutex tc_lock;	/* protects the TypeC port mode */
>>>  	intel_wakeref_t tc_lock_wakeref;
>>> +
>>> +	const struct intel_ddi_port_info *port_info;
>>> +
>>>  	int tc_link_refcount;
>>>  	bool tc_legacy_port:1;
>>>  	char tc_port_name[8];
>>> --
>>> 2.24.0
>>>
>
>-- 
>Jani Nikula, Intel Open Source Graphics Center
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization
  2020-06-22 23:50       ` Lucas De Marchi
@ 2020-07-03 13:22         ` Jani Nikula
  0 siblings, 0 replies; 34+ messages in thread
From: Jani Nikula @ 2020-07-03 13:22 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Intel Graphics, Lucas De Marchi

On Mon, 22 Jun 2020, Lucas De Marchi <lucas.de.marchi@gmail.com> wrote:
> On Wed, Jan 1, 2020 at 11:19 PM Lucas De Marchi
> <lucas.de.marchi@gmail.com> wrote:
>>
>> On Tue, Dec 31, 2019 at 1:58 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>> >
>> > On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
>> > > For the latest platforms we can share the logic to initialize the the
>> > > ddi, so start moving the most trivial ones to a new setup_outputs_desc()
>> > > function that will be responsible for initialization according to a
>> > > static const table.
>> > >
>> > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> > > ---
>> > >  drivers/gpu/drm/i915/display/intel_display.c  | 96 +++++++++++++------
>> > >  .../drm/i915/display/intel_display_types.h    |  4 +
>> > >  2 files changed, 73 insertions(+), 27 deletions(-)
>> > >
>> > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> > > index 04819b0bd494..b3fb1e03cb0b 100644
>> > > --- a/drivers/gpu/drm/i915/display/intel_display.c
>> > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> > > @@ -16221,6 +16221,72 @@ static void intel_pps_init(struct drm_i915_private *dev_priv)
>> > >       intel_pps_unlock_regs_wa(dev_priv);
>> > >  }
>> > >
>> > > +struct intel_output {
>> > > +     /* Initialize DSI if present */
>> > > +     void (*dsi_init)(struct drm_i915_private *i915);
>> >
>> > We'll need to be able to initialize DSI on multiple ports too. I've
>> > already drafted a series to do so, maybe I've even sent it to the
>> > list. Basically you'd pass the port to icl_dsi_init() too.
>> >
>> > I don't want that development to get any more complicated than it
>> > already is.
>
> Did you make progress on that series? Anywhere for me to look at?
> I'd like to respin this series.

Alas I didn't, but the gist of it was [1]. There were VLV/CHV DSI
related issues I didn't take into account that Ville pointed out to me.

There's been some subsequent changes since then.

Anyway, I was hoping to make faster progress, and it's not fair to hold
anyone's work back based on what could be.


BR,
Jani.


[1] https://patchwork.freedesktop.org/series/68729/


>
> Lucas De Marchi
>
>>
>> Right now this is just working with what is there. I don't see a problem
>> to update this series with the additional port argument, but let's
>> keep the series
>> independent from each other.
>>
>> Lucas De Marchi
>>
>> >
>> > BR,
>> > Jani.
>> >
>> >
>> > > +     struct intel_ddi_port_info ddi_ports[];
>> > > +};
>> > > +
>> > > +static const struct intel_output tgl_output = {
>> > > +     .dsi_init = icl_dsi_init,
>> > > +     .ddi_ports = {
>> > > +             { .port = PORT_A },
>> > > +             { .port = PORT_B },
>> > > +             { .port = PORT_D },
>> > > +             { .port = PORT_E },
>> > > +             { .port = PORT_F },
>> > > +             { .port = PORT_G },
>> > > +             { .port = PORT_H },
>> > > +             { .port = PORT_I },
>> > > +             { .port = PORT_NONE }
>> > > +     }
>> > > +};
>> > > +
>> > > +static const struct intel_output ehl_output = {
>> > > +     .dsi_init = icl_dsi_init,
>> > > +     .ddi_ports = {
>> > > +             { .port = PORT_A },
>> > > +             { .port = PORT_B },
>> > > +             { .port = PORT_C },
>> > > +             { .port = PORT_D },
>> > > +             { .port = PORT_NONE }
>> > > +     }
>> > > +};
>> > > +
>> > > +static const struct intel_output gen9lp_output = {
>> > > +     .dsi_init = vlv_dsi_init,
>> > > +     .ddi_ports = {
>> > > +             { .port = PORT_A },
>> > > +             { .port = PORT_B },
>> > > +             { .port = PORT_C },
>> > > +             { .port = PORT_NONE }
>> > > +     },
>> > > +};
>> > > +
>> > > +/*
>> > > + * Use a description-based approach for platforms that can be supported with a
>> > > + * static table
>> > > + */
>> > > +static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
>> > > +{
>> > > +     const struct intel_output *output;
>> > > +     const struct intel_ddi_port_info *port_info;
>> > > +
>> > > +     if (INTEL_GEN(i915) >= 12)
>> > > +             output = &tgl_output;
>> > > +     else if (IS_ELKHARTLAKE(i915))
>> > > +             output = &ehl_output;
>> > > +     else if (IS_GEN9_LP(i915))
>> > > +             output = &gen9lp_output;
>> > > +
>> > > +     for (port_info = output->ddi_ports;
>> > > +          port_info->port != PORT_NONE; port_info++)
>> > > +             intel_ddi_init(i915, port_info->port);
>> > > +
>> > > +     if (output->dsi_init)
>> > > +             output->dsi_init(i915);
>> > > +}
>> > > +
>> > >  static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>> > >  {
>> > >       struct intel_encoder *encoder;
>> > > @@ -16231,22 +16297,9 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>> > >       if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
>> > >               return;
>> > >
>> > > -     if (INTEL_GEN(dev_priv) >= 12) {
>> > > -             intel_ddi_init(dev_priv, PORT_A);
>> > > -             intel_ddi_init(dev_priv, PORT_B);
>> > > -             intel_ddi_init(dev_priv, PORT_D);
>> > > -             intel_ddi_init(dev_priv, PORT_E);
>> > > -             intel_ddi_init(dev_priv, PORT_F);
>> > > -             intel_ddi_init(dev_priv, PORT_G);
>> > > -             intel_ddi_init(dev_priv, PORT_H);
>> > > -             intel_ddi_init(dev_priv, PORT_I);
>> > > -             icl_dsi_init(dev_priv);
>> > > -     } else if (IS_ELKHARTLAKE(dev_priv)) {
>> > > -             intel_ddi_init(dev_priv, PORT_A);
>> > > -             intel_ddi_init(dev_priv, PORT_B);
>> > > -             intel_ddi_init(dev_priv, PORT_C);
>> > > -             intel_ddi_init(dev_priv, PORT_D);
>> > > -             icl_dsi_init(dev_priv);
>> > > +     if (INTEL_GEN(dev_priv) >= 12 || IS_ELKHARTLAKE(dev_priv) ||
>> > > +         IS_GEN9_LP(dev_priv)) {
>> > > +             setup_ddi_outputs_desc(dev_priv);
>> > >       } else if (IS_GEN(dev_priv, 11)) {
>> > >               intel_ddi_init(dev_priv, PORT_A);
>> > >               intel_ddi_init(dev_priv, PORT_B);
>> > > @@ -16263,17 +16316,6 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>> > >                       intel_ddi_init(dev_priv, PORT_F);
>> > >
>> > >               icl_dsi_init(dev_priv);
>> > > -     } else if (IS_GEN9_LP(dev_priv)) {
>> > > -             /*
>> > > -              * FIXME: Broxton doesn't support port detection via the
>> > > -              * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
>> > > -              * detect the ports.
>> > > -              */
>> > > -             intel_ddi_init(dev_priv, PORT_A);
>> > > -             intel_ddi_init(dev_priv, PORT_B);
>> > > -             intel_ddi_init(dev_priv, PORT_C);
>> > > -
>> > > -             vlv_dsi_init(dev_priv);
>> > >       } else if (HAS_DDI(dev_priv)) {
>> > >               int found;
>> > >
>> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
>> > > index a3a067dacf84..4d2f4ee35812 100644
>> > > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
>> > > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
>> > > @@ -1376,6 +1376,10 @@ struct intel_dp_mst_encoder {
>> > >       struct intel_connector *connector;
>> > >  };
>> > >
>> > > +struct intel_ddi_port_info {
>> > > +     enum port port;
>> > > +};
>> > > +
>> > >  static inline enum dpio_channel
>> > >  vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
>> > >  {
>> >
>> > --
>> > Jani Nikula, Intel Open Source Graphics Center
>> > _______________________________________________
>> > Intel-gfx mailing list
>> > Intel-gfx@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>>
>>
>>
>> --
>> Lucas De Marchi

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-07-03 13:23 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 1/9] drm/i915/display: nuke skl workaround for pre-production hw Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 2/9] drm/i915/display: remove alias to dig_port Lucas De Marchi
2019-12-23 21:05   ` Matt Roper
2019-12-23 19:58 ` [Intel-gfx] [PATCH 3/9] drm/i915/display: prefer the more common dig_port name Lucas De Marchi
2019-12-23 21:16   ` Matt Roper
2019-12-23 21:25     ` Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization Lucas De Marchi
2019-12-31  9:58   ` Jani Nikula
2020-01-02  7:19     ` Lucas De Marchi
2020-06-22 23:50       ` Lucas De Marchi
2020-07-03 13:22         ` Jani Nikula
2019-12-23 19:58 ` [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init Lucas De Marchi
2019-12-24  0:00   ` Matt Roper
2019-12-31 10:14   ` Jani Nikula
2020-01-02  7:32     ` Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms Lucas De Marchi
2019-12-31 10:25   ` Jani Nikula
2019-12-31 10:26     ` Jani Nikula
2020-01-02  7:23     ` Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes Lucas De Marchi
2019-12-24  0:10   ` Matt Roper
2019-12-24  0:17     ` Lucas De Marchi
2019-12-31 10:33   ` Jani Nikula
2020-01-02  7:50     ` Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 8/9] drm/i915/display: refer to vbt info as vbt_port_info Lucas De Marchi
2019-12-31 10:39   ` Jani Nikula
2019-12-23 19:58 ` [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init Lucas De Marchi
2019-12-24  0:16   ` Matt Roper
2019-12-31 11:20     ` Jani Nikula
2020-06-23  1:11       ` Lucas De Marchi
2019-12-31 11:22   ` Jani Nikula
2019-12-23 20:14 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for RFC: display/ddi: keep register indexes in a table Patchwork
2019-12-23 20:57 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

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.