diff mbox series

[v2,4/4] drm/i915/icl: Add fallback detection method for TypeC legacy ports

Message ID 20181214182703.18865-5-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/icl: Fix TypeC Legacy HPD handling | expand

Commit Message

Imre Deak Dec. 14, 2018, 6:27 p.m. UTC
Add a fallback detection method for TypeC legacy ports in case the
VBT port information used to detect normally such ports is
incorrect.

For the fallback method we use the TypeC legacy mode specific HPD
interrupt flag which should only be raised for a legacy port.

WARN if the VBT port info is incorrect.

In a case where we'd detect the port in a contradicting way both as a
legacy and also as a USB DP and/or TBT alternate port treat the port
as legacy (by also emitting a WARN from icl_update_tc_port_type).

v2:
- Repurpose the detection as a fallback method instead of using
  it only for the DP legacy case. By now we should normally use VBT to
  detect DP legacy ports as well.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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> (v1)
---
 drivers/gpu/drm/i915/intel_dp.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Kahola, Mika Dec. 18, 2018, 11:05 a.m. UTC | #1
The v2 looks ok to me.

On Fri, 2018-12-14 at 20:27 +0200, Imre Deak wrote:
> Add a fallback detection method for TypeC legacy ports in case the
> VBT port information used to detect normally such ports is
> incorrect.
> 
> For the fallback method we use the TypeC legacy mode specific HPD
> interrupt flag which should only be raised for a legacy port.
> 
> WARN if the VBT port info is incorrect.
> 
> In a case where we'd detect the port in a contradicting way both as a
> legacy and also as a USB DP and/or TBT alternate port treat the port
> as legacy (by also emitting a WARN from icl_update_tc_port_type).
> 
> v2:
> - Repurpose the detection as a fallback method instead of using
>   it only for the DP legacy case. By now we should normally use VBT
> to
>   detect DP legacy ports as well.
> 
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 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> (v1)
Reviewed-by: Mika Kahola <mika.kahola@intel.com> (v2)

> ---
>  drivers/gpu/drm/i915/intel_dp.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c
> b/drivers/gpu/drm/i915/intel_dp.c
> index b2a3012478ca..d00af92cd089 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5220,8 +5220,14 @@ static bool icl_tc_port_connected(struct
> drm_i915_private *dev_priv,
>  	bool is_legacy, is_typec, is_tbt;
>  	u32 dpsp;
>  
> -	is_legacy = intel_dig_port->tc_legacy_port ||
> -		I915_READ(SDEISR) & SDE_TC_HOTPLUG_ICP(tc_port);
> +	/*
> +	 * WARN if we got a legacy port HPD, but VBT didn't mark the
> port as
> +	 * legacy. Treat the port as legacy from now on.
> +	 */
> +	if (WARN_ON(!intel_dig_port->tc_legacy_port &&
> +		    I915_READ(SDEISR) & SDE_TC_HOTPLUG_ICP(tc_port)))
> +		intel_dig_port->tc_legacy_port = true;
> +	is_legacy = intel_dig_port->tc_legacy_port;
>  
>  	/*
>  	 * The spec says we shouldn't be using the ISR bits for
> detecting
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index b2a3012478ca..d00af92cd089 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5220,8 +5220,14 @@  static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
 	bool is_legacy, is_typec, is_tbt;
 	u32 dpsp;
 
-	is_legacy = intel_dig_port->tc_legacy_port ||
-		I915_READ(SDEISR) & SDE_TC_HOTPLUG_ICP(tc_port);
+	/*
+	 * WARN if we got a legacy port HPD, but VBT didn't mark the port as
+	 * legacy. Treat the port as legacy from now on.
+	 */
+	if (WARN_ON(!intel_dig_port->tc_legacy_port &&
+		    I915_READ(SDEISR) & SDE_TC_HOTPLUG_ICP(tc_port)))
+		intel_dig_port->tc_legacy_port = true;
+	is_legacy = intel_dig_port->tc_legacy_port;
 
 	/*
 	 * The spec says we shouldn't be using the ISR bits for detecting