public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 1/3] drm/i915/icl: Add a debug print for TypeC port disconnection
Date: Thu, 13 Dec 2018 12:27:44 -0800	[thread overview]
Message-ID: <20181213202744.GB1681@intel.com> (raw)
In-Reply-To: <20181213194850.25406-2-imre.deak@intel.com>

On Thu, Dec 13, 2018 at 09:48:48PM +0200, Imre Deak wrote:
> It's useful to see at which point a TypeC port gets disconnected, so add
> add a debug print for it.
> 
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_dp.c | 34 ++++++++++++++++++++++++----------
>  1 file changed, 24 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index e94faa0a42eb..082594bb65a7 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5066,28 +5066,38 @@ static bool icl_combo_port_connected(struct drm_i915_private *dev_priv,
>  	return I915_READ(SDEISR) & SDE_DDI_HOTPLUG_ICP(port);
>  }
>  
> +static const char *tc_type_name(enum tc_port_type type)
> +{
> +	static const char *names[] = {
> +		[TC_PORT_UNKNOWN] = "unknown",
> +		[TC_PORT_LEGACY] = "legacy",
> +		[TC_PORT_TYPEC] = "typec",
> +		[TC_PORT_TBT] = "tbt",
> +	};
> +
> +	if (WARN_ON(type >= ARRAY_SIZE(names)))
> +		type = TC_PORT_UNKNOWN;
> +
> +	return names[type];
> +}
> +
>  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_type old_type = intel_dig_port->tc_type;
> -	const char *type_str;
>  
>  	WARN_ON(is_legacy + is_typec + is_tbt != 1);
>  
> -	if (is_legacy) {
> +	if (is_legacy)
>  		intel_dig_port->tc_type = TC_PORT_LEGACY;
> -		type_str = "legacy";
> -	} else if (is_typec) {
> +	else if (is_typec)
>  		intel_dig_port->tc_type = TC_PORT_TYPEC;
> -		type_str = "typec";
> -	} else if (is_tbt) {
> +	else if (is_tbt)
>  		intel_dig_port->tc_type = TC_PORT_TBT;
> -		type_str = "tbt";
> -	} else {
> +	else
>  		return;
> -	}
>  
>  	/* Types are not supposed to be changed at runtime. */
>  	WARN_ON(old_type != TC_PORT_UNKNOWN &&
> @@ -5095,7 +5105,7 @@ static void icl_update_tc_port_type(struct drm_i915_private *dev_priv,
>  
>  	if (old_type != intel_dig_port->tc_type)
>  		DRM_DEBUG_KMS("Port %c has TC type %s\n", port_name(port),
> -			      type_str);
> +			      tc_type_name(intel_dig_port->tc_type));
>  }
>  
>  static void icl_tc_phy_disconnect(struct drm_i915_private *dev_priv,
> @@ -5187,6 +5197,10 @@ static void icl_tc_phy_disconnect(struct drm_i915_private *dev_priv,
>  		I915_WRITE(PORT_TX_DFLEXDPCSSS, val);
>  	}
>  
> +	DRM_DEBUG_KMS("Port %c TC type %s disconnected\n",
> +		      port_name(dig_port->base.port),
> +		      tc_type_name(dig_port->tc_type));
> +
>  	dig_port->tc_type = TC_PORT_UNKNOWN;
>  }
>  
> -- 
> 2.13.2
> 
> _______________________________________________
> 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

  reply	other threads:[~2018-12-13 20:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 19:48 [PATCH 0/3] drm/i915/icl: Fix TypeC legacy HPD handling Imre Deak
2018-12-13 19:48 ` [PATCH 1/3] drm/i915/icl: Add a debug print for TypeC port disconnection Imre Deak
2018-12-13 20:27   ` Rodrigo Vivi [this message]
2018-12-13 19:48 ` [PATCH 2/3] drm/i915/icl: Fix TypeC legacy HDMI HPD handling Imre Deak
2018-12-13 21:06   ` Rodrigo Vivi
2018-12-13 23:25     ` Imre Deak
2018-12-14 22:22       ` Rodrigo Vivi
2018-12-14 23:25         ` Imre Deak
2018-12-17  7:05           ` Rodrigo Vivi
2018-12-17 17:38             ` Imre Deak
2018-12-13 19:48 ` [PATCH 3/3] drm/i915/icl: Fix TypeC legacy DP " Imre Deak
2018-12-13 21:08   ` Rodrigo Vivi
2018-12-13 19:54 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/icl: Fix TypeC legacy " Patchwork
2018-12-13 20:18 ` ✗ Fi.CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181213202744.GB1681@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox