[Intel-gfx] [PATCH 02/15] drm/i915: Check max number of lanes when registering DDI ports

Daniel Vetter daniel at ffwll.ch
Thu Dec 10 05:19:33 PST 2015


On Tue, Dec 08, 2015 at 07:59:37PM +0200, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> DDI A and E share some of the lanes, so check that we have enough
> lanes for the purpose we need before registering the encoders.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Oh, trusting the VBT. Indeed better to double-check.

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index b9d6b038ea0c..e903d9c87680 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3278,6 +3278,33 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
>  	struct intel_encoder *intel_encoder;
>  	struct drm_encoder *encoder;
>  	bool init_hdmi, init_dp;
> +	int max_lanes;
> +
> +	if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) {
> +		switch (port) {
> +		case PORT_A:
> +			max_lanes = 4;
> +			break;
> +		case PORT_E:
> +			max_lanes = 0;
> +			break;
> +		default:
> +			max_lanes = 4;
> +			break;
> +		}
> +	} else {
> +		switch (port) {
> +		case PORT_A:
> +			max_lanes = 2;
> +			break;
> +		case PORT_E:
> +			max_lanes = 2;
> +			break;
> +		default:
> +			max_lanes = 4;
> +			break;
> +		}
> +	}
>  
>  	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
>  		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
> @@ -3288,6 +3315,15 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
>  		return;
>  	}
>  
> +	if (WARN(max_lanes == 0,
> +		 "No lanes for port %c\n", port_name(port)))
> +		return;
> +
> +	if (WARN(init_hdmi && max_lanes < 4,
> +		 "Not enough lanes (%d) for HDMI on port %c\n",
> +		 max_lanes, port_name(port)))
> +		init_hdmi = false;
> +
>  	intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL);
>  	if (!intel_dig_port)
>  		return;
> -- 
> 2.4.10
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list