All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [RFC] drm/i915/dp: move link rate arrays where they're used
Date: Wed, 28 Feb 2018 13:17:38 -0800	[thread overview]
Message-ID: <20180228211736.GE11481@intel.com> (raw)
In-Reply-To: <20180227105911.4485-1-jani.nikula@intel.com>

On Tue, Feb 27, 2018 at 12:59:11PM +0200, Jani Nikula wrote:
> Localize link rate arrays by moving them to the functions where they're
> used. Further clarify the distinction between source and sink
> capabilities. Split pre and post Haswell arrays, and get rid of the
> array size arithmetics. Use a direct rate value in the paranoia case of
> no common rates find.
> 
> 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: Manasi Navare <manasi.d.navare@intel.com>

manasi

> ---
>  drivers/gpu/drm/i915/intel_dp.c | 44 +++++++++++++++++++++++++----------------
>  1 file changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 801a21b16004..6fa6583b16bd 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -96,15 +96,6 @@ static const struct dp_link_dpll chv_dpll[] = {
>  		{ .p1 = 2, .p2 = 1, .n = 1, .m1 = 2, .m2 = 0x6c00000 } }
>  };
>  
> -static const int bxt_rates[] = { 162000, 216000, 243000, 270000,
> -				  324000, 432000, 540000 };
> -static const int skl_rates[] = { 162000, 216000, 270000,
> -				  324000, 432000, 540000 };
> -static const int cnl_rates[] = { 162000, 216000, 270000,
> -				 324000, 432000, 540000,
> -				 648000, 810000 };
> -static const int default_rates[] = { 162000, 270000, 540000 };
> -
>  /**
>   * intel_dp_is_edp - is the given port attached to an eDP panel (either CPU or PCH)
>   * @intel_dp: DP struct
> @@ -144,14 +135,17 @@ static void intel_dp_unset_edid(struct intel_dp *intel_dp);
>  /* update sink rates from dpcd */
>  static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
>  {
> +	static const int dp_rates[] = {
> +		162000, 270000, 540000
> +	};
>  	int i, max_rate;
>  
>  	max_rate = drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]);
>  
> -	for (i = 0; i < ARRAY_SIZE(default_rates); i++) {
> -		if (default_rates[i] > max_rate)
> +	for (i = 0; i < ARRAY_SIZE(dp_rates); i++) {
> +		if (dp_rates[i] > max_rate)
>  			break;
> -		intel_dp->sink_rates[i] = default_rates[i];
> +		intel_dp->sink_rates[i] = dp_rates[i];
>  	}
>  
>  	intel_dp->num_sink_rates = i;
> @@ -268,6 +262,22 @@ static int cnl_max_source_rate(struct intel_dp *intel_dp)
>  static void
>  intel_dp_set_source_rates(struct intel_dp *intel_dp)
>  {
> +	/* The values must be in increasing order */
> +	static const int cnl_rates[] = {
> +		162000, 216000, 270000, 324000, 432000, 540000, 648000, 810000
> +	};
> +	static const int bxt_rates[] = {
> +		162000, 216000, 243000, 270000, 324000, 432000, 540000
> +	};
> +	static const int skl_rates[] = {
> +		162000, 216000, 270000, 324000, 432000, 540000
> +	};
> +	static const int hsw_rates[] = {
> +		162000, 270000, 540000
> +	};
> +	static const int g4x_rates[] = {
> +		162000, 270000
> +	};
>  	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
>  	const struct ddi_vbt_port_info *info =
> @@ -290,11 +300,11 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
>  		size = ARRAY_SIZE(skl_rates);
>  	} else if ((IS_HASWELL(dev_priv) && !IS_HSW_ULX(dev_priv)) ||
>  		   IS_BROADWELL(dev_priv)) {
> -		source_rates = default_rates;
> -		size = ARRAY_SIZE(default_rates);
> +		source_rates = hsw_rates;
> +		size = ARRAY_SIZE(hsw_rates);
>  	} else {
> -		source_rates = default_rates;
> -		size = ARRAY_SIZE(default_rates) - 1;
> +		source_rates = g4x_rates;
> +		size = ARRAY_SIZE(g4x_rates);
>  	}
>  
>  	if (max_rate && vbt_max_rate)
> @@ -356,7 +366,7 @@ static void intel_dp_set_common_rates(struct intel_dp *intel_dp)
>  
>  	/* Paranoia, there should always be something in common. */
>  	if (WARN_ON(intel_dp->num_common_rates == 0)) {
> -		intel_dp->common_rates[0] = default_rates[0];
> +		intel_dp->common_rates[0] = 162000;
>  		intel_dp->num_common_rates = 1;
>  	}
>  }
> -- 
> 2.11.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-02-28 21:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 10:59 [RFC] drm/i915/dp: move link rate arrays where they're used Jani Nikula
2018-02-27 13:27 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-02-27 18:05 ` [RFC] " Pandiyan, Dhinakaran
2018-02-27 18:52   ` Jani Nikula
2018-02-27 21:10     ` Manasi Navare
2018-02-27 18:22 ` Manasi Navare
2018-02-27 18:51   ` Jani Nikula
2018-02-27 20:05 ` ✗ Fi.CI.IGT: failure for " Patchwork
2018-02-28  9:51 ` ✓ Fi.CI.BAT: success " Patchwork
2018-02-28 10:53 ` ✗ Fi.CI.IGT: warning " Patchwork
2018-02-28 21:02 ` [RFC] " Ville Syrjälä
2018-02-28 21:17 ` Manasi Navare [this message]
2018-02-28 21:23   ` Jani Nikula

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=20180228211736.GE11481@intel.com \
    --to=manasi.d.navare@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.