[Intel-gfx] [PATCH] drm/i915: Make intel_digital_port_connected() work for any port

Manasi Navare manasi.d.navare at intel.com
Mon Jun 19 19:06:07 UTC 2017


I have tested this for PORT A and works great to give HPD live status.
Thanks for the patch. Looks good to me.

On Thu, Jun 15, 2017 at 08:12:52PM +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Add the missing port A handling to intel_digital_port_connected()
> and also separate SPT from the CPT/LPT code a bit.
> 
 Reviewed-by: Manasi Navare <manasi.d.navare at intel.com>
> Cc: Manasi Navare <manasi.d.navare at intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 83 ++++++++++++++++++++++++++++++++++-------
>  1 file changed, 70 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 64fa774c855b..bca4ac12f950 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4418,8 +4418,6 @@ static bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
>  	u32 bit;
>  
>  	switch (port->port) {
> -	case PORT_A:
> -		return true;
>  	case PORT_B:
>  		bit = SDE_PORTB_HOTPLUG;
>  		break;
> @@ -4443,8 +4441,6 @@ static bool cpt_digital_port_connected(struct drm_i915_private *dev_priv,
>  	u32 bit;
>  
>  	switch (port->port) {
> -	case PORT_A:
> -		return true;
>  	case PORT_B:
>  		bit = SDE_PORTB_HOTPLUG_CPT;
>  		break;
> @@ -4454,12 +4450,28 @@ static bool cpt_digital_port_connected(struct drm_i915_private *dev_priv,
>  	case PORT_D:
>  		bit = SDE_PORTD_HOTPLUG_CPT;
>  		break;
> +	default:
> +		MISSING_CASE(port->port);
> +		return false;
> +	}
> +
> +	return I915_READ(SDEISR) & bit;
> +}
> +
> +static bool spt_digital_port_connected(struct drm_i915_private *dev_priv,
> +				       struct intel_digital_port *port)
> +{
> +	u32 bit;
> +
> +	switch (port->port) {
> +	case PORT_A:
> +		bit = SDE_PORTA_HOTPLUG_SPT;
> +		break;
>  	case PORT_E:
>  		bit = SDE_PORTE_HOTPLUG_SPT;
>  		break;
>  	default:
> -		MISSING_CASE(port->port);
> -		return false;
> +		return cpt_digital_port_connected(dev_priv, port);
>  	}
>  
>  	return I915_READ(SDEISR) & bit;
> @@ -4511,6 +4523,42 @@ static bool gm45_digital_port_connected(struct drm_i915_private *dev_priv,
>  	return I915_READ(PORT_HOTPLUG_STAT) & bit;
>  }
>  
> +static bool ilk_digital_port_connected(struct drm_i915_private *dev_priv,
> +				       struct intel_digital_port *port)
> +{
> +	if (port->port == PORT_A)
> +		return I915_READ(DEISR) & DE_DP_A_HOTPLUG;
> +	else
> +		return ibx_digital_port_connected(dev_priv, port);
> +}
> +
> +static bool snb_digital_port_connected(struct drm_i915_private *dev_priv,
> +				       struct intel_digital_port *port)
> +{
> +	if (port->port == PORT_A)
> +		return I915_READ(DEISR) & DE_DP_A_HOTPLUG;
> +	else
> +		return cpt_digital_port_connected(dev_priv, port);
> +}
> +
> +static bool ivb_digital_port_connected(struct drm_i915_private *dev_priv,
> +				       struct intel_digital_port *port)
> +{
> +	if (port->port == PORT_A)
> +		return I915_READ(DEISR) & DE_DP_A_HOTPLUG_IVB;
> +	else
> +		return cpt_digital_port_connected(dev_priv, port);
> +}
> +
> +static bool bdw_digital_port_connected(struct drm_i915_private *dev_priv,
> +				       struct intel_digital_port *port)
> +{
> +	if (port->port == PORT_A)
> +		return I915_READ(GEN8_DE_PORT_ISR) & GEN8_PORT_DP_A_HOTPLUG;
> +	else
> +		return cpt_digital_port_connected(dev_priv, port);
> +}
> +
>  static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
>  				       struct intel_digital_port *intel_dig_port)
>  {
> @@ -4547,16 +4595,25 @@ static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
>  bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
>  				  struct intel_digital_port *port)
>  {
> -	if (HAS_PCH_IBX(dev_priv))
> -		return ibx_digital_port_connected(dev_priv, port);
> -	else if (HAS_PCH_SPLIT(dev_priv))
> -		return cpt_digital_port_connected(dev_priv, port);
> +	if (HAS_GMCH_DISPLAY(dev_priv)) {
> +		if (IS_GM45(dev_priv))
> +			return gm45_digital_port_connected(dev_priv, port);
> +		else
> +			return g4x_digital_port_connected(dev_priv, port);
> +	}
> +
> +	if (IS_GEN5(dev_priv))
> +		return ilk_digital_port_connected(dev_priv, port);
> +	else if (IS_GEN6(dev_priv))
> +		return snb_digital_port_connected(dev_priv, port);
> +	else if (IS_GEN7(dev_priv))
> +		return ivb_digital_port_connected(dev_priv, port);
> +	else if (IS_GEN8(dev_priv))
> +		return bdw_digital_port_connected(dev_priv, port);
>  	else if (IS_GEN9_LP(dev_priv))
>  		return bxt_digital_port_connected(dev_priv, port);
> -	else if (IS_GM45(dev_priv))
> -		return gm45_digital_port_connected(dev_priv, port);
>  	else
> -		return g4x_digital_port_connected(dev_priv, port);
> +		return spt_digital_port_connected(dev_priv, port);
>  }
>  
>  static struct edid *
> -- 
> 2.13.0
> 


More information about the Intel-gfx mailing list