Commit 66a990dd authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Prefer encoder->name over port_name()

enum port is a mess now because it no longer matches the spec
at all. Let's start to dig ourselves out of this hole by
reducing our reliance on port_name(). This should at least make
a bunch of debug messages a bit more sensible while we think how
to fill the the hole properly.

Based on the following cocci script with a lot of manual cleanup
(all the format strings etc.):
@@
expression E;
@@
(
- port_name(E->port)
+ E->base.base.id, E->base.name
|
- port_name(E.port)
+ E.base.base.id, E.base.name
)

@@
enum port P;
expression E;
@@
  P = E->port
<...
- port_name(P)
+ E->base.base.id, E->base.name
...>

@@
enum port P;
expression E;
@@
  P = E.port
<...
- port_name(P)
+ E.base.base.id, E.base.name
...>

@@
expression E;
@@
{
- enum port P = E;
... when != P
}
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190830182719.32608-1-ville.syrjala@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 75427b2a
...@@ -560,8 +560,9 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder, ...@@ -560,8 +560,9 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder,
u32 tmp, eldv; u32 tmp, eldv;
i915_reg_t aud_config, aud_cntrl_st2; i915_reg_t aud_config, aud_cntrl_st2;
DRM_DEBUG_KMS("Disable audio codec on port %c, pipe %c\n", DRM_DEBUG_KMS("Disable audio codec on [ENCODER:%d:%s], pipe %c\n",
port_name(port), pipe_name(pipe)); encoder->base.base.id, encoder->base.name,
pipe_name(pipe));
if (WARN_ON(port == PORT_A)) if (WARN_ON(port == PORT_A))
return; return;
...@@ -609,8 +610,9 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder, ...@@ -609,8 +610,9 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder,
int len, i; int len, i;
i915_reg_t hdmiw_hdmiedid, aud_config, aud_cntl_st, aud_cntrl_st2; i915_reg_t hdmiw_hdmiedid, aud_config, aud_cntl_st, aud_cntrl_st2;
DRM_DEBUG_KMS("Enable audio codec on port %c, pipe %c, %u bytes ELD\n", DRM_DEBUG_KMS("Enable audio codec on [ENCODER:%d:%s], pipe %c, %u bytes ELD\n",
port_name(port), pipe_name(pipe), drm_eld_size(eld)); encoder->base.base.id, encoder->base.name,
pipe_name(pipe), drm_eld_size(eld));
if (WARN_ON(port == PORT_A)) if (WARN_ON(port == PORT_A))
return; return;
......
...@@ -2080,18 +2080,20 @@ static void intel_ddi_get_encoder_pipes(struct intel_encoder *encoder, ...@@ -2080,18 +2080,20 @@ static void intel_ddi_get_encoder_pipes(struct intel_encoder *encoder,
} }
if (!*pipe_mask) if (!*pipe_mask)
DRM_DEBUG_KMS("No pipe for ddi port %c found\n", DRM_DEBUG_KMS("No pipe for [ENCODER:%d:%s] found\n",
port_name(port)); encoder->base.base.id, encoder->base.name);
if (!mst_pipe_mask && hweight8(*pipe_mask) > 1) { if (!mst_pipe_mask && hweight8(*pipe_mask) > 1) {
DRM_DEBUG_KMS("Multiple pipes for non DP-MST port %c (pipe_mask %02x)\n", DRM_DEBUG_KMS("Multiple pipes for [ENCODER:%d:%s] (pipe_mask %02x)\n",
port_name(port), *pipe_mask); encoder->base.base.id, encoder->base.name,
*pipe_mask);
*pipe_mask = BIT(ffs(*pipe_mask) - 1); *pipe_mask = BIT(ffs(*pipe_mask) - 1);
} }
if (mst_pipe_mask && mst_pipe_mask != *pipe_mask) if (mst_pipe_mask && mst_pipe_mask != *pipe_mask)
DRM_DEBUG_KMS("Conflicting MST and non-MST encoders for port %c (pipe_mask %02x mst_pipe_mask %02x)\n", DRM_DEBUG_KMS("Conflicting MST and non-MST state for [ENCODER:%d:%s] (pipe_mask %02x mst_pipe_mask %02x)\n",
port_name(port), *pipe_mask, mst_pipe_mask); encoder->base.base.id, encoder->base.name,
*pipe_mask, mst_pipe_mask);
else else
*is_dp_mst = mst_pipe_mask; *is_dp_mst = mst_pipe_mask;
...@@ -2101,8 +2103,9 @@ static void intel_ddi_get_encoder_pipes(struct intel_encoder *encoder, ...@@ -2101,8 +2103,9 @@ static void intel_ddi_get_encoder_pipes(struct intel_encoder *encoder,
if ((tmp & (BXT_PHY_CMNLANE_POWERDOWN_ACK | if ((tmp & (BXT_PHY_CMNLANE_POWERDOWN_ACK |
BXT_PHY_LANE_POWERDOWN_ACK | BXT_PHY_LANE_POWERDOWN_ACK |
BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED) BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED)
DRM_ERROR("Port %c enabled but PHY powered down? " DRM_ERROR("[ENCODER:%d:%s] enabled but PHY powered down? "
"(PHY_CTL %08x)\n", port_name(port), tmp); "(PHY_CTL %08x)\n", encoder->base.base.id,
encoder->base.name, tmp);
} }
intel_display_power_put(dev_priv, encoder->power_domain, wakeref); intel_display_power_put(dev_priv, encoder->power_domain, wakeref);
......
...@@ -1612,8 +1612,8 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, ...@@ -1612,8 +1612,8 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
if (intel_de_wait_for_register(dev_priv, dpll_reg, if (intel_de_wait_for_register(dev_priv, dpll_reg,
port_mask, expected_mask, 1000)) port_mask, expected_mask, 1000))
WARN(1, "timed out waiting for port %c ready: got 0x%x, expected 0x%x\n", WARN(1, "timed out waiting for [ENCODER:%d:%s] port ready: got 0x%x, expected 0x%x\n",
port_name(dport->base.port), dport->base.base.base.id, dport->base.base.name,
I915_READ(dpll_reg) & port_mask, expected_mask); I915_READ(dpll_reg) & port_mask, expected_mask);
} }
......
This diff is collapsed.
...@@ -2910,8 +2910,8 @@ static bool icl_get_combo_phy_dpll(struct intel_atomic_state *state, ...@@ -2910,8 +2910,8 @@ static bool icl_get_combo_phy_dpll(struct intel_atomic_state *state,
has_dpll4 ? DPLL_ID_EHL_DPLL4 has_dpll4 ? DPLL_ID_EHL_DPLL4
: DPLL_ID_ICL_DPLL1); : DPLL_ID_ICL_DPLL1);
if (!port_dpll->pll) { if (!port_dpll->pll) {
DRM_DEBUG_KMS("No combo PHY PLL found for port %c\n", DRM_DEBUG_KMS("No combo PHY PLL found for [ENCODER:%d:%s]\n",
port_name(encoder->port)); encoder->base.base.id, encoder->base.name);
return false; return false;
} }
......
...@@ -3075,12 +3075,13 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, ...@@ -3075,12 +3075,13 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
enum port port = intel_encoder->port; enum port port = intel_encoder->port;
DRM_DEBUG_KMS("Adding HDMI connector on port %c\n", DRM_DEBUG_KMS("Adding HDMI connector on [ENCODER:%d:%s]\n",
port_name(port)); intel_encoder->base.base.id, intel_encoder->base.name);
if (WARN(intel_dig_port->max_lanes < 4, if (WARN(intel_dig_port->max_lanes < 4,
"Not enough lanes (%d) for HDMI on port %c\n", "Not enough lanes (%d) for HDMI on [ENCODER:%d:%s]\n",
intel_dig_port->max_lanes, port_name(port))) intel_dig_port->max_lanes, intel_encoder->base.base.id,
intel_encoder->base.name))
return; return;
drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
......
...@@ -481,7 +481,8 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, ...@@ -481,7 +481,8 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
long_hpd = long_mask & BIT(pin); long_hpd = long_mask & BIT(pin);
DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port), DRM_DEBUG_DRIVER("digital hpd on [ENCODER:%d:%s] - %s\n",
encoder->base.base.id, encoder->base.name,
long_hpd ? "long" : "short"); long_hpd ? "long" : "short");
queue_dig = true; queue_dig = true;
......
...@@ -3114,8 +3114,9 @@ static int i915_dp_mst_info(struct seq_file *m, void *unused) ...@@ -3114,8 +3114,9 @@ static int i915_dp_mst_info(struct seq_file *m, void *unused)
if (!intel_dig_port->dp.can_mst) if (!intel_dig_port->dp.can_mst)
continue; continue;
seq_printf(m, "MST Source Port %c\n", seq_printf(m, "MST Source Port [ENCODER:%d:%s]\n",
port_name(intel_dig_port->base.port)); intel_dig_port->base.base.base.id,
intel_dig_port->base.base.name);
drm_dp_mst_dump_topology(m, &intel_dig_port->dp.mst_mgr); drm_dp_mst_dump_topology(m, &intel_dig_port->dp.mst_mgr);
} }
drm_connector_list_iter_end(&conn_iter); drm_connector_list_iter_end(&conn_iter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment