Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dhinakaran.pandiyan@intel.com
Subject: Re: [PATCH v4 01/11] drm/i915/dp: use the sink rates array for max sink rates
Date: Thu, 6 Apr 2017 17:24:53 +0300	[thread overview]
Message-ID: <20170406142453.GW30290@intel.com> (raw)
In-Reply-To: <3e8baadb406d59f414cab36fed9f0b35d207fde5.1491485983.git.jani.nikula@intel.com>

On Thu, Apr 06, 2017 at 04:44:09PM +0300, Jani Nikula wrote:
> Looking at DPCD DP_MAX_LINK_RATE may be completely bogus for eDP 1.4
> which is allowed to use link rate select method and have 0 in max link
> rate. With this change, it makes sense to store the max rate as the
> actual rate rather than as a bw code.
> 
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/intel_dp.c  | 28 +++++++---------------------
>  drivers/gpu/drm/i915/intel_drv.h |  2 +-
>  2 files changed, 8 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index b38cba7d5abc..e4650f1625cc 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -161,23 +161,9 @@ static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
>  	intel_dp->num_sink_rates = num_rates;
>  }
>  
> -static int
> -intel_dp_max_link_bw(struct intel_dp  *intel_dp)
> +static int intel_dp_max_sink_rate(struct intel_dp *intel_dp)
>  {
> -	int max_link_bw = intel_dp->dpcd[DP_MAX_LINK_RATE];
> -
> -	switch (max_link_bw) {
> -	case DP_LINK_BW_1_62:
> -	case DP_LINK_BW_2_7:
> -	case DP_LINK_BW_5_4:
> -		break;
> -	default:
> -		WARN(1, "invalid max DP link bw val %x, using 1.62Gbps\n",
> -		     max_link_bw);
> -		max_link_bw = DP_LINK_BW_1_62;
> -		break;
> -	}
> -	return max_link_bw;
> +	return intel_dp->sink_rates[intel_dp->num_sink_rates - 1];
>  }
>  
>  static u8 intel_dp_max_lane_count(struct intel_dp *intel_dp)
> @@ -301,7 +287,7 @@ static int intel_dp_rate_index(const int *rates, int len, int rate)
>  static int intel_dp_common_rates(struct intel_dp *intel_dp,
>  				 int *common_rates)
>  {
> -	int max_rate = drm_dp_bw_code_to_link_rate(intel_dp->max_sink_link_bw);
> +	int max_rate = intel_dp->max_sink_link_rate;
>  	int i, common_len;
>  
>  	common_len = intersect_rates(intel_dp->source_rates,
> @@ -339,10 +325,10 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
>  						   common_rates,
>  						   link_rate);
>  	if (link_rate_index > 0) {
> -		intel_dp->max_sink_link_bw = drm_dp_link_rate_to_bw_code(common_rates[link_rate_index - 1]);
> +		intel_dp->max_sink_link_rate = common_rates[link_rate_index - 1];
>  		intel_dp->max_sink_lane_count = lane_count;
>  	} else if (lane_count > 1) {
> -		intel_dp->max_sink_link_bw = intel_dp_max_link_bw(intel_dp);
> +		intel_dp->max_sink_link_rate = intel_dp_max_sink_rate(intel_dp);
>  		intel_dp->max_sink_lane_count = lane_count >> 1;
>  	} else {
>  		DRM_ERROR("Link Training Unsuccessful\n");
> @@ -4652,8 +4638,8 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
>  		/* Set the max lane count for sink */
>  		intel_dp->max_sink_lane_count = drm_dp_max_lane_count(intel_dp->dpcd);
>  
> -		/* Set the max link BW for sink */
> -		intel_dp->max_sink_link_bw = intel_dp_max_link_bw(intel_dp);
> +		/* Set the max link rate for sink */
> +		intel_dp->max_sink_link_rate = intel_dp_max_sink_rate(intel_dp);
>  
>  		intel_dp->reset_link_params = false;
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 7bc0c25b3396..92e353dc61bf 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -959,7 +959,7 @@ struct intel_dp {
>  	/* Max lane count for the sink as per DPCD registers */
>  	uint8_t max_sink_lane_count;
>  	/* Max link BW for the sink as per DPCD registers */
> -	int max_sink_link_bw;
> +	int max_sink_link_rate;
>  	/* sink or branch descriptor */
>  	struct intel_dp_desc desc;
>  	struct drm_dp_aux aux;
> -- 
> 2.1.4

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-04-06 14:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 13:44 [PATCH v4 00/11] drm/i915/dp: rest of refactoring, link rate fallback Jani Nikula
2017-04-06 13:44 ` [PATCH v4 01/11] drm/i915/dp: use the sink rates array for max sink rates Jani Nikula
2017-04-06 14:24   ` Ville Syrjälä [this message]
2017-04-06 13:44 ` [PATCH v4 02/11] drm/i915/dp: cache common rates with " Jani Nikula
2017-04-06 13:44 ` [PATCH v4 03/11] drm/i915/dp: do not limit rate seek when not needed Jani Nikula
2017-04-06 13:44 ` [PATCH v4 04/11] drm/i915/dp: don't call the link parameters sink parameters Jani Nikula
2017-04-06 13:44 ` [PATCH v4 05/11] drm/i915/dp: add functions for max common link rate and lane count Jani Nikula
2017-04-06 13:44 ` [PATCH v4 06/11] drm/i915/mst: use max link not sink " Jani Nikula
2017-04-06 13:44 ` [PATCH v4 07/11] drm/i915/dp: localize link rate index variable more Jani Nikula
2017-04-06 13:44 ` [PATCH v4 08/11] drm/i915/dp: use readb and writeb calls for single byte DPCD access Jani Nikula
2017-04-06 13:44 ` [PATCH v4 09/11] drm/i915/dp: read sink count to a temporary variable first Jani Nikula
2017-04-06 14:25   ` Ville Syrjälä
2017-04-11 14:19     ` Jani Nikula
2017-04-11 15:44       ` Navare, Manasi D
2017-04-06 13:44 ` [PATCH v4 10/11] drm/i915/dp: Validate cached link rate and lane count before retraining Jani Nikula
2017-04-06 14:31   ` Ville Syrjälä
2017-04-06 18:29     ` Manasi Navare
2017-04-06 20:43     ` [PATCH v5] " Manasi Navare
2017-04-06 21:00       ` [PATCH v6] " Manasi Navare
2017-04-12 14:00         ` Ville Syrjälä
2017-04-12 14:13           ` Jani Nikula
2017-04-12 16:50             ` Navare, Manasi D
2017-04-06 13:44 ` [PATCH v4 11/11] drm/i915: Implement Link Rate fallback on Link training failure Jani Nikula
2017-04-13 17:25   ` Manasi Navare
2017-04-13 19:16     ` Jani Nikula
2017-04-06 14:35 ` ✓ Fi.CI.BAT: success for drm/i915/dp: rest of refactoring, link rate fallback Patchwork
2017-04-06 20:42 ` ✗ Fi.CI.BAT: failure for drm/i915/dp: rest of refactoring, link rate fallback (rev2) Patchwork
2017-04-06 21:54 ` ✓ Fi.CI.BAT: success for drm/i915/dp: rest of refactoring, link rate fallback (rev3) 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=20170406142453.GW30290@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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