[Intel-gfx] [PATCH v2 5/6] drm/i915/display: use port_info in intel_ddi_init
Lucas De Marchi
lucas.demarchi at intel.com
Thu Jun 25 00:11:19 UTC 2020
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 at intel.com>
---
drivers/gpu/drm/i915/display/intel_ddi.c | 39 ++++++++++++-------
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, 37 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index ca7bb2294d2b..27e2f29f47a2 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4844,12 +4844,24 @@ intel_ddi_max_lanes(struct intel_digital_port *intel_dport)
return max_lanes;
}
-void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
+bool intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port)
{
+ return dig_port->port_info->phy_type == PHY_TYPE_MG ||
+ dig_port->port_info->phy_type == PHY_TYPE_DKL;
+}
+
+bool 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 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 = intel_bios_port_supports_dvi(dev_priv, port) ||
intel_bios_port_supports_hdmi(dev_priv, port);
@@ -4864,14 +4876,14 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
init_dp = true;
init_lspcon = true;
init_hdmi = false;
- drm_dbg_kms(&dev_priv->drm, "VBT says port %c has lspcon\n",
- port_name(port));
+ drm_dbg_kms(&dev_priv->drm, "VBT says port %s has lspcon\n",
+ port_info->name);
}
if (!init_dp && !init_hdmi) {
drm_dbg_kms(&dev_priv->drm,
- "VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
- port_name(port));
+ "VBT says port %s is not DVI/HDMI/DP compatible, respect it\n",
+ port_info->name);
return;
}
@@ -4882,7 +4894,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;
@@ -4917,8 +4929,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 =
!intel_bios_port_supports_typec_usb(dev_priv, port) &&
!intel_bios_port_supports_tbt(dev_priv, port);
@@ -4951,20 +4964,20 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
if (lspcon_init(intel_dig_port))
/* TODO: handle hdmi info frame part */
drm_dbg_kms(&dev_priv->drm,
- "LSPCON init success on port %c\n",
- port_name(port));
+ "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_err(&dev_priv->drm,
- "LSPCON init failed on port %c\n",
- port_name(port));
+ "LSPCON init failed on port %s\n",
+ port_info->name);
}
if (INTEL_GEN(dev_priv) >= 11) {
- if (intel_phy_is_tc(dev_priv, phy))
+ if (intel_ddi_has_tc_phy(intel_dig_port))
intel_dig_port->connected = intel_tc_port_connected;
else
intel_dig_port->connected = lpt_digital_port_connected;
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h b/drivers/gpu/drm/i915/display/intel_ddi.h
index 077e9dbbe367..059d87171c81 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.h
+++ b/drivers/gpu/drm/i915/display/intel_ddi.h
@@ -13,6 +13,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;
@@ -23,7 +24,8 @@ void intel_ddi_fdi_post_disable(struct intel_atomic_state *state,
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(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state);
@@ -46,4 +48,8 @@ int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
bool enable);
void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
+
+bool intel_ddi_has_tc_phy(const struct intel_digital_port *dig_port);
+bool 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 d591063502c5..001b44c004ab 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16880,7 +16880,7 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915,
if (test_bit(port_info->port, &disable_mask))
continue;
- intel_ddi_init(i915, port_info->port);
+ intel_ddi_init(i915, port_info);
}
}
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index df587219c744..7f2156e6966f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1402,6 +1402,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.26.2
More information about the Intel-gfx
mailing list