drm/i915: Unify the TypeC port notation in debug/error messages
authorImre Deak <imre.deak@intel.com>
Fri, 28 Jun 2019 14:36:20 +0000 (17:36 +0300)
committerImre Deak <imre.deak@intel.com>
Mon, 1 Jul 2019 11:50:08 +0000 (14:50 +0300)
Unify the TypeC port notation in log messages, so that it matches the
spec. For instance the first ICL TypeC port will read as 'Port C/TC#1'.

v2:
- Format print the name only once. (José)

Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190628143635.22066-9-imre.deak@intel.com
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_tc.c
drivers/gpu/drm/i915/display/intel_tc.h
drivers/gpu/drm/i915/intel_drv.h

index c16fa789a931c8f3d270dfa9ec76cb4f8e61c351..c9143e2a6994a86d2335f2335e4b481638b9bbbf 100644 (file)
@@ -4265,9 +4265,12 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
        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->tc_legacy_port = intel_port_is_tc(dev_priv, port) &&
-                                        !port_info->supports_typec_usb &&
-                                        !port_info->supports_tbt;
+       if (intel_port_is_tc(dev_priv, port)) {
+               bool is_legacy = !port_info->supports_typec_usb &&
+                                !port_info->supports_tbt;
+
+               intel_tc_port_init(intel_dig_port, is_legacy);
+       }
 
        switch (port) {
        case PORT_A:
index 59aad3e49f93aa6bdc673177535fad7b38af65aa..ca3b11e26474cc1ad55883289a70da14f767090f 100644 (file)
@@ -86,7 +86,8 @@ static bool icl_tc_phy_connect(struct intel_digital_port *dig_port)
 
        val = I915_READ(PORT_TX_DFLEXDPPMS);
        if (!(val & DP_PHY_MODE_STATUS_COMPLETED(tc_port))) {
-               DRM_DEBUG_KMS("DP PHY for TC port %d not ready\n", tc_port);
+               DRM_DEBUG_KMS("Port %s: PHY not ready\n",
+                             dig_port->tc_port_name);
                WARN_ON(dig_port->tc_legacy_port);
                return false;
        }
@@ -107,7 +108,8 @@ static bool icl_tc_phy_connect(struct intel_digital_port *dig_port)
         */
        if (dig_port->tc_mode == TC_PORT_DP_ALT &&
            !(I915_READ(PORT_TX_DFLEXDPSP) & TC_LIVE_STATE_TC(tc_port))) {
-               DRM_DEBUG_KMS("TC PHY %d sudden disconnect.\n", tc_port);
+               DRM_DEBUG_KMS("Port %s: PHY sudden disconnect\n",
+                             dig_port->tc_port_name);
                icl_tc_phy_disconnect(dig_port);
                return false;
        }
@@ -137,8 +139,8 @@ void icl_tc_phy_disconnect(struct intel_digital_port *dig_port)
                I915_WRITE(PORT_TX_DFLEXDPCSSS, val);
        }
 
-       DRM_DEBUG_KMS("Port %c TC type %s disconnected\n",
-                     port_name(dig_port->base.port),
+       DRM_DEBUG_KMS("Port %s: mode %s disconnected\n",
+                     dig_port->tc_port_name,
                      tc_port_mode_name(dig_port->tc_mode));
 
        dig_port->tc_mode = TC_PORT_TBT_ALT;
@@ -148,7 +150,6 @@ static void icl_update_tc_port_type(struct drm_i915_private *dev_priv,
                                    struct intel_digital_port *intel_dig_port,
                                    bool is_legacy, bool is_typec, bool is_tbt)
 {
-       enum port port = intel_dig_port->base.port;
        enum tc_port_mode old_mode = intel_dig_port->tc_mode;
 
        WARN_ON(is_legacy + is_typec + is_tbt != 1);
@@ -163,7 +164,8 @@ static void icl_update_tc_port_type(struct drm_i915_private *dev_priv,
                return;
 
        if (old_mode != intel_dig_port->tc_mode)
-               DRM_DEBUG_KMS("Port %c has TC type %s\n", port_name(port),
+               DRM_DEBUG_KMS("Port %s: port has mode %s\n",
+                             intel_dig_port->tc_port_name,
                              tc_port_mode_name(intel_dig_port->tc_mode));
 }
 
@@ -191,8 +193,8 @@ bool intel_tc_port_connected(struct intel_digital_port *dig_port)
         */
        if (!dig_port->tc_legacy_port &&
            I915_READ(SDEISR) & SDE_TC_HOTPLUG_ICP(tc_port)) {
-               DRM_ERROR("VBT incorrectly claims port %c is not TypeC legacy\n",
-                         port_name(port));
+               DRM_ERROR("Port %s: VBT incorrectly claims port is not TypeC legacy\n",
+                         dig_port->tc_port_name);
                dig_port->tc_legacy_port = true;
        }
        is_legacy = dig_port->tc_legacy_port;
@@ -220,3 +222,17 @@ bool intel_tc_port_connected(struct intel_digital_port *dig_port)
        return true;
 }
 
+void intel_tc_port_init(struct intel_digital_port *dig_port, bool is_legacy)
+{
+       struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+       enum port port = dig_port->base.port;
+       enum tc_port tc_port = intel_port_to_tc(i915, port);
+
+       if (WARN_ON(tc_port == PORT_TC_NONE))
+               return;
+
+       snprintf(dig_port->tc_port_name, sizeof(dig_port->tc_port_name),
+                "%c/TC#%d", port_name(port), tc_port + 1);
+
+       dig_port->tc_legacy_port = is_legacy;
+}
index 0c65675394e54f659a933a5c508f81533207bdef..ca173530325261583b0219c17ee7df205665f42c 100644 (file)
@@ -15,4 +15,6 @@ void icl_tc_phy_disconnect(struct intel_digital_port *dig_port);
 bool intel_tc_port_connected(struct intel_digital_port *dig_port);
 int intel_tc_port_fia_max_lane_count(struct intel_digital_port *dig_port);
 
+void intel_tc_port_init(struct intel_digital_port *dig_port, bool is_legacy);
+
 #endif /* __INTEL_TC_H__ */
index 7159f709a7f294c3c5c673981cb2c320924333ae..19f6a360acdeb1dbdfaf16bea18dc613a1e3f343 100644 (file)
@@ -1225,6 +1225,7 @@ struct intel_digital_port {
        enum aux_ch aux_ch;
        enum intel_display_power_domain ddi_io_power_domain;
        bool tc_legacy_port:1;
+       char tc_port_name[8];
        enum tc_port_mode tc_mode;
 
        void (*write_infoframe)(struct intel_encoder *encoder,