public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 03/15] drm/i915: Store max lane count in intel_digital_port
Date: Thu, 10 Dec 2015 14:22:01 +0100	[thread overview]
Message-ID: <20151210132201.GA20822@phenom.ffwll.local> (raw)
In-Reply-To: <1449597590-6971-4-git-send-email-ville.syrjala@linux.intel.com>

On Tue, Dec 08, 2015 at 07:59:38PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Rather than having open coded checks for the DDI A/E configuration,
> just store the max supported lane count in intel_digital_port.
> 
> We had an open coded check for DDI A, but not for DDI E. So we may
> have been vilating the DDI E max lane count.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Isn't this going to break on non-DDI platforms?
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_ddi.c  | 10 +---------
>  drivers/gpu/drm/i915/intel_dp.c   | 13 +++++++------
>  drivers/gpu/drm/i915/intel_drv.h  |  1 +
>  drivers/gpu/drm/i915/intel_hdmi.c |  6 ++++++
>  4 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index e903d9c87680..fdb4aaa084d6 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3315,15 +3315,6 @@ 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;
> @@ -3346,6 +3337,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
>  	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
>  					  (DDI_BUF_PORT_REVERSAL |
>  					   DDI_A_4_LANES);
> +	intel_dig_port->max_lanes = max_lanes;
>  
>  	/*
>  	 * Bspec says that DDI_A_4_LANES is the only supported configuration
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index f335c92b4fa7..7d354b1e5e5f 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -157,14 +157,9 @@ intel_dp_max_link_bw(struct intel_dp  *intel_dp)
>  static u8 intel_dp_max_lane_count(struct intel_dp *intel_dp)
>  {
>  	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> -	struct drm_device *dev = intel_dig_port->base.base.dev;
>  	u8 source_max, sink_max;
>  
> -	source_max = 4;
> -	if (HAS_DDI(dev) && intel_dig_port->port == PORT_A &&
> -	    (intel_dig_port->saved_port_bits & DDI_A_4_LANES) == 0)
> -		source_max = 2;
> -
> +	source_max = intel_dig_port->max_lanes;
>  	sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
>  
>  	return min(source_max, sink_max);
> @@ -5820,6 +5815,11 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
>  	enum port port = intel_dig_port->port;
>  	int type, ret;
>  
> +	if (WARN(intel_dig_port->max_lanes < 1,
> +		 "Not enough lanes (%d) for DP on port %c\n",
> +		 intel_dig_port->max_lanes, port_name(port)))
> +		return false;
> +
>  	intel_dp->pps_pipe = INVALID_PIPE;
>  
>  	/* intel_dp vfuncs */
> @@ -6016,6 +6016,7 @@ intel_dp_init(struct drm_device *dev,
>  
>  	intel_dig_port->port = port;
>  	intel_dig_port->dp.output_reg = output_reg;
> +	intel_dig_port->max_lanes = 4;
>  
>  	intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
>  	if (IS_CHERRYVIEW(dev)) {
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 8963a8a53b0b..43d451c7c366 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -818,6 +818,7 @@ struct intel_digital_port {
>  	struct intel_hdmi hdmi;
>  	enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
>  	bool release_cl2_override;
> +	uint8_t max_lanes;
>  };
>  
>  struct intel_dp_mst_encoder {
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index c3978bad5ca0..895189abfd56 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -2034,6 +2034,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  	enum port port = intel_dig_port->port;
>  	uint8_t alternate_ddc_pin;
>  
> +	if (WARN(intel_dig_port->max_lanes < 4,
> +		 "Not enough lanes (%d) for HDMI on port %c\n",
> +		 intel_dig_port->max_lanes, port_name(port)))
> +		return;
> +
>  	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
>  			   DRM_MODE_CONNECTOR_HDMIA);
>  	drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
> @@ -2217,6 +2222,7 @@ void intel_hdmi_init(struct drm_device *dev,
>  	intel_dig_port->port = port;
>  	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
>  	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
> +	intel_dig_port->max_lanes = 4;
>  
>  	intel_hdmi_init_connector(intel_dig_port, intel_connector);
>  }
> -- 
> 2.4.10
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-12-10 13:22 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 17:59 [PATCH 00/15] drm/i915: Cure DDI from multiple personality disorder ville.syrjala
2015-12-08 17:59 ` [PATCH 01/15] drm/i915: Pass the correct encoder to intel_ddi_clk_select() with MST ville.syrjala
2015-12-10 13:17   ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 02/15] drm/i915: Check max number of lanes when registering DDI ports ville.syrjala
2015-12-10 13:19   ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 03/15] drm/i915: Store max lane count in intel_digital_port ville.syrjala
2015-12-10 13:22   ` Daniel Vetter [this message]
2015-12-10 13:31     ` Ville Syrjälä
2015-12-10 14:08       ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 04/15] drm/i915: Remove pointless 'ddi_translations' local variable ville.syrjala
2015-12-10 13:22   ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 05/15] drm/i915: Eliminate duplicated skl_get_buf_trans_dp() ville.syrjala
2015-12-10 13:24   ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 06/15] drm/i915: Pass around dev_priv for ddi buffer programming ville.syrjala
2015-12-10 13:25   ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 07/15] drm/i915: Add BUILD_BUG_ON()s for DDI translation table sizes ville.syrjala
2015-12-10 13:28   ` Daniel Vetter
2015-12-10 14:43     ` Ville Syrjälä
2015-12-08 17:59 ` [PATCH 08/15] drm/i915: Reject >9 ddi translation entried if port != A/E on SKL ville.syrjala
2015-12-10 13:30   ` Daniel Vetter
2015-12-10 13:42     ` Ville Syrjälä
2015-12-10 14:09       ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 09/15] drm/i915: Kill intel_prepare_ddi() ville.syrjala
2015-12-10 13:37   ` Daniel Vetter
2015-12-10 14:00     ` Ville Syrjälä
2015-12-08 17:59 ` [PATCH 10/15] drm/i915: Split the problematic dual-role DDI encoder into two encoders ville.syrjala
2015-12-08 18:21   ` kbuild test robot
2015-12-10 13:47   ` Daniel Vetter
2015-12-10 14:10     ` Ville Syrjälä
2015-12-10 14:20       ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 11/15] drm/i915: Explicitly use ddi bug trans entry 9 for hdmi ville.syrjala
2015-12-10 13:48   ` Daniel Vetter
2015-12-10 14:41     ` Ville Syrjälä
2015-12-11 17:22       ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 12/15] drm/i915: Split DP/eDP/FDI and HDMI/DVI DDI buffer programming apart ville.syrjala
2015-12-10 13:52   ` Daniel Vetter
2015-12-10 14:15     ` Ville Syrjälä
2015-12-08 17:59 ` [PATCH 13/15] drm/i915: Add a sanity check for 'hdmi_default_entry' ville.syrjala
2015-12-10 13:54   ` Daniel Vetter
2015-12-08 17:59 ` [PATCH 14/15] drm/i915: Get the iboost setting based on the port type ville.syrjala
2015-12-10 13:55   ` Daniel Vetter
2015-12-10 14:17     ` Ville Syrjälä
2015-12-08 17:59 ` [PATCH 15/15] drm/i915: Simplify intel_ddi_get_encoder_port() ville.syrjala
2015-12-10 13:57   ` Daniel Vetter
2015-12-10 14:19     ` Ville Syrjälä
2016-01-12 14:52 ` [PATCH 00/15] drm/i915: Cure DDI from multiple personality disorder Ville Syrjälä

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=20151210132201.GA20822@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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