All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915/dp: Extract intel_edp_set_sink_rates()
Date: Thu, 26 Sep 2024 10:48:18 +0300	[thread overview]
Message-ID: <871q163lfh.fsf@intel.com> (raw)
In-Reply-To: <20240918190441.29071-3-ville.syrjala@linux.intel.com>

On Wed, 18 Sep 2024, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Declutter intel_edp_init_dpcd() a bit by extracting the sink
> rates probing into its own function.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 76 +++++++++++++------------
>  1 file changed, 40 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 6a1b0e93a1fc..ae3f242fa925 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -4066,6 +4066,45 @@ static void intel_edp_mso_init(struct intel_dp *intel_dp)
>  	intel_dp->mso_pixel_overlap = mso ? info->mso_pixel_overlap : 0;
>  }
>  
> +static void
> +intel_edp_set_sink_rates(struct intel_dp *intel_dp)
> +{
> +	intel_dp->num_sink_rates = 0;
> +
> +	if (intel_dp->edp_dpcd[0] >= DP_EDP_14) {
> +		__le16 sink_rates[DP_MAX_SUPPORTED_RATES];
> +		int i;
> +
> +		drm_dp_dpcd_read(&intel_dp->aux, DP_SUPPORTED_LINK_RATES,
> +				 sink_rates, sizeof(sink_rates));
> +
> +		for (i = 0; i < ARRAY_SIZE(sink_rates); i++) {
> +			int val = le16_to_cpu(sink_rates[i]);
> +
> +			if (val == 0)
> +				break;
> +
> +			/* Value read multiplied by 200kHz gives the per-lane
> +			 * link rate in kHz. The source rates are, however,
> +			 * stored in terms of LS_Clk kHz. The full conversion
> +			 * back to symbols is
> +			 * (val * 200kHz)*(8/10 ch. encoding)*(1/8 bit to Byte)
> +			 */
> +			intel_dp->sink_rates[i] = (val * 200) / 10;
> +		}
> +		intel_dp->num_sink_rates = i;
> +	}
> +
> +	/*
> +	 * Use DP_LINK_RATE_SET if DP_SUPPORTED_LINK_RATES are available,
> +	 * default to DP_MAX_LINK_RATE and DP_LINK_BW_SET otherwise.
> +	 */
> +	if (intel_dp->num_sink_rates)
> +		intel_dp->use_rate_select = true;
> +	else
> +		intel_dp_set_sink_rates(intel_dp);

Isn't this kind of in the wrong place, it's not eDP?

> +}
> +
>  static bool
>  intel_edp_init_dpcd(struct intel_dp *intel_dp, struct intel_connector *connector)
>  {
> @@ -4110,42 +4149,7 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp, struct intel_connector *connector
>  	 */
>  	intel_psr_init_dpcd(intel_dp);
>  
> -	/* Clear the default sink rates */
> -	intel_dp->num_sink_rates = 0;
> -
> -	/* Read the eDP 1.4+ supported link rates. */
> -	if (intel_dp->edp_dpcd[0] >= DP_EDP_14) {
> -		__le16 sink_rates[DP_MAX_SUPPORTED_RATES];
> -		int i;
> -
> -		drm_dp_dpcd_read(&intel_dp->aux, DP_SUPPORTED_LINK_RATES,
> -				sink_rates, sizeof(sink_rates));
> -
> -		for (i = 0; i < ARRAY_SIZE(sink_rates); i++) {
> -			int val = le16_to_cpu(sink_rates[i]);
> -
> -			if (val == 0)
> -				break;
> -
> -			/* Value read multiplied by 200kHz gives the per-lane
> -			 * link rate in kHz. The source rates are, however,
> -			 * stored in terms of LS_Clk kHz. The full conversion
> -			 * back to symbols is
> -			 * (val * 200kHz)*(8/10 ch. encoding)*(1/8 bit to Byte)
> -			 */
> -			intel_dp->sink_rates[i] = (val * 200) / 10;
> -		}
> -		intel_dp->num_sink_rates = i;
> -	}
> -
> -	/*
> -	 * Use DP_LINK_RATE_SET if DP_SUPPORTED_LINK_RATES are available,
> -	 * default to DP_MAX_LINK_RATE and DP_LINK_BW_SET otherwise.
> -	 */
> -	if (intel_dp->num_sink_rates)
> -		intel_dp->use_rate_select = true;
> -	else
> -		intel_dp_set_sink_rates(intel_dp);
> +	intel_edp_set_sink_rates(intel_dp);
>  	intel_dp_set_max_sink_lane_count(intel_dp);
>  
>  	/* Read the eDP DSC DPCD registers */

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2024-09-26  7:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18 19:04 [PATCH 1/3] drm/i915/dp: Fix colorimetry detection Ville Syrjala
2024-09-18 19:04 ` [PATCH 2/3] drm/i915/dp: Make intel_dp_get_colorimetry_status() static Ville Syrjala
2024-09-25 14:21   ` Luca Coelho
2024-09-18 19:04 ` [PATCH 3/3] drm/i915/dp: Extract intel_edp_set_sink_rates() Ville Syrjala
2024-09-25 14:22   ` Luca Coelho
2024-09-26  7:48   ` Jani Nikula [this message]
2024-09-26  7:49     ` Jani Nikula
2024-09-18 20:14 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm/i915/dp: Fix colorimetry detection Patchwork
2024-09-18 20:15 ` ✓ Fi.CI.BAT: success " Patchwork
2024-09-19  6:09 ` [PATCH 1/3] " Hogander, Jouni
2024-09-19  7:43 ` ✗ Fi.CI.IGT: failure for series starting with [1/3] " 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=871q163lfh.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --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 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.