public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 06/10] drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
Date: Wed, 18 Oct 2017 14:11:46 -0700	[thread overview]
Message-ID: <20171018211146.GB10621@intel.com> (raw)
In-Reply-To: <20171016145705.11780-7-ville.syrjala@linux.intel.com>

On Mon, Oct 16, 2017 at 05:57:01PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> encoder->type is unreliable for DP/HDMI, so pass it in explicity into
> cnl_ddi_vswing_sequence(). This matches what we do for BXT.
>

I still dont get why we cant use encoder->type reliably?
Since if I trace back on the caller of intel_ddi_pre_enable_hdmi or
intel_ddi_pre_enable_dp, the caler intel_ddi_pre_enable() calls
either of these based on encoder->type itself.
So why do we explicitly need to pass encoder->type instead
of deriving it from encoder inside the vswing_sequenc_ functions?

May be I am missing something?

Manasi
 
> v2: Pass intel_encoder down to cnl_ddi_vswing_program(), and
>     clean up the argument types while at it
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 53 +++++++++++++++++++---------------------
>  1 file changed, 25 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 2d886148a653..cab72177299c 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1920,20 +1920,21 @@ u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder)
>  		DP_TRAIN_VOLTAGE_SWING_MASK;
>  }
>  
> -static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
> -				    u32 level, enum port port, int type)
> +static void cnl_ddi_vswing_program(struct intel_encoder *encoder,
> +				   int level, enum intel_output_type type)
>  {
> -	const struct cnl_ddi_buf_trans *ddi_translations = NULL;
> -	u32 n_entries, val;
> -	int ln;
> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +	enum port port = intel_ddi_get_encoder_port(encoder);
> +	const struct cnl_ddi_buf_trans *ddi_translations;
> +	int n_entries, ln;
> +	u32 val;
>  
> -	if (type == INTEL_OUTPUT_HDMI) {
> +	if (type == INTEL_OUTPUT_HDMI)
>  		ddi_translations = cnl_get_buf_trans_hdmi(dev_priv, &n_entries);
> -	} else if (type == INTEL_OUTPUT_DP) {
> -		ddi_translations = cnl_get_buf_trans_dp(dev_priv, &n_entries);
> -	} else if (type == INTEL_OUTPUT_EDP) {
> +	else if (type == INTEL_OUTPUT_EDP)
>  		ddi_translations = cnl_get_buf_trans_edp(dev_priv, &n_entries);
> -	}
> +	else
> +		ddi_translations = cnl_get_buf_trans_dp(dev_priv, &n_entries);
>  
>  	if (WARN_ON(ddi_translations == NULL))
>  		return;
> @@ -1986,26 +1987,22 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
>  	I915_WRITE(CNL_PORT_TX_DW7_GRP(port), val);
>  }
>  
> -static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder, u32 level)
> +static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder,
> +				    int level, enum intel_output_type type)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> -	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	enum port port = intel_ddi_get_encoder_port(encoder);
> -	int type = encoder->type;
> -	int width = 0;
> -	int rate = 0;
> +	int width, rate, ln;
>  	u32 val;
> -	int ln = 0;
>  
> -	if ((intel_dp) && (type == INTEL_OUTPUT_EDP || type == INTEL_OUTPUT_DP)) {
> +	if (type == INTEL_OUTPUT_HDMI) {
> +		width = 4;
> +		rate = 0; /* Rate is always < than 6GHz for HDMI */
> +	} else {
> +		struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> +
>  		width = intel_dp->lane_count;
>  		rate = intel_dp->link_rate;
> -	} else if (type == INTEL_OUTPUT_HDMI) {
> -		width = 4;
> -		/* Rate is always < than 6GHz for HDMI */
> -	} else {
> -		MISSING_CASE(type);
> -		return;
>  	}
>  
>  	/*
> @@ -2014,7 +2011,7 @@ static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder, u32 level)
>  	 * else clear to 0b.
>  	 */
>  	val = I915_READ(CNL_PORT_PCS_DW1_LN0(port));
> -	if (type == INTEL_OUTPUT_EDP || type == INTEL_OUTPUT_DP)
> +	if (type != INTEL_OUTPUT_HDMI)
>  		val |= COMMON_KEEPER_EN;
>  	else
>  		val &= ~COMMON_KEEPER_EN;
> @@ -2049,7 +2046,7 @@ static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder, u32 level)
>  	I915_WRITE(CNL_PORT_TX_DW5_GRP(port), val);
>  
>  	/* 5. Program swing and de-emphasis */
> -	cnl_ddi_vswing_program(dev_priv, level, port, type);
> +	cnl_ddi_vswing_program(encoder, level, type);
>  
>  	/* 6. Set training enable to trigger update */
>  	val = I915_READ(CNL_PORT_TX_DW5_LN0(port));
> @@ -2089,7 +2086,7 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp)
>  	u32 level = intel_ddi_dp_level(intel_dp);
>  
>  	if (IS_CANNONLAKE(dev_priv))
> -		cnl_ddi_vswing_sequence(encoder, level);
> +		cnl_ddi_vswing_sequence(encoder, level, encoder->type);
>  	else
>  		bxt_ddi_vswing_sequence(encoder, level, encoder->type);
>  
> @@ -2188,7 +2185,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
>  	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
>  
>  	if (IS_CANNONLAKE(dev_priv))
> -		cnl_ddi_vswing_sequence(encoder, level);
> +		cnl_ddi_vswing_sequence(encoder, level, encoder->type);
>  	else if (IS_GEN9_LP(dev_priv))
>  		bxt_ddi_vswing_sequence(encoder, level, encoder->type);
>  	else
> @@ -2219,7 +2216,7 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
>  	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
>  
>  	if (IS_CANNONLAKE(dev_priv))
> -		cnl_ddi_vswing_sequence(encoder, level);
> +		cnl_ddi_vswing_sequence(encoder, level, INTEL_OUTPUT_HDMI);
>  	else if (IS_GEN9_LP(dev_priv))
>  		bxt_ddi_vswing_sequence(encoder, level, INTEL_OUTPUT_HDMI);
>  	else
> -- 
> 2.13.6
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-10-18 21:07 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 14:56 [PATCH 00/10] DDI buf trans cleanup Ville Syrjala
2017-10-16 14:56 ` [PATCH v2 01/10] drm/i915: Relocate intel_ddi_get_buf_trans_*() functions Ville Syrjala
2017-10-16 23:30   ` Ausmus, James
2017-10-16 14:56 ` [PATCH 02/10] drm/i915: Extract intel_ddi_get_buf_trans_hdmi() Ville Syrjala
2017-10-16 23:41   ` Ausmus, James
2017-10-18 17:09     ` Ville Syrjälä
2017-10-18 17:50       ` James Ausmus
2017-10-18 20:43       ` Manasi Navare
2017-10-16 14:56 ` [PATCH v2 03/10] drm/i915: Pass the encoder type explicitly to skl_set_iboost() Ville Syrjala
2017-10-17  0:02   ` Ausmus, James
2017-10-16 14:56 ` [PATCH 04/10] drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers() Ville Syrjala
2017-10-17  0:06   ` Ausmus, James
2017-10-16 14:57 ` [PATCH v2 05/10] drm/i915: Integrate BXT into intel_ddi_dp_voltage_max() Ville Syrjala
2017-10-18 16:51   ` James Ausmus
2017-10-16 14:57 ` [PATCH v2 06/10] drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly Ville Syrjala
2017-10-18 16:59   ` James Ausmus
2017-10-18 21:11   ` Manasi Navare [this message]
2017-10-19 10:38     ` Ville Syrjälä
2017-10-19 23:58       ` Manasi Navare
2017-10-16 14:57 ` [PATCH 07/10] drm/i915: Kill off the BXT buf_trans default_index Ville Syrjala
2017-10-18 17:05   ` James Ausmus
2017-10-16 14:57 ` [PATCH 08/10] drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling Ville Syrjala
2017-10-18 17:21   ` James Ausmus
2017-10-16 14:57 ` [PATCH 09/10] drm/i915: Unify error handling for missing DDI buf trans tables Ville Syrjala
2017-10-18 17:41   ` James Ausmus
2017-10-18 17:52     ` Ville Syrjälä
2017-10-18 18:15       ` Ville Syrjälä
2017-10-18 18:33         ` James Ausmus
2017-10-18 18:19   ` [PATCH v2 " Ville Syrjala
2017-10-18 19:59     ` James Ausmus
2017-10-16 14:57 ` [PATCH 10/10] drm/i915: Drop the redundant hdmi prefix/suffix from a lot of variables Ville Syrjala
2017-10-18 17:43   ` James Ausmus
2017-10-18 17:54     ` Ville Syrjälä
2017-10-18 19:58       ` James Ausmus
2017-10-18 18:19   ` [PATCH v2 " Ville Syrjala
2017-10-18 19:59     ` James Ausmus
2017-10-19 12:47       ` Ville Syrjälä
2017-10-16 15:43 ` ✓ Fi.CI.BAT: success for DDI buf trans cleanup Patchwork
2017-10-17  3:07 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-10-18 18:38 ` ✓ Fi.CI.BAT: success for DDI buf trans cleanup (rev3) Patchwork
2017-10-19  3:06 ` ✓ Fi.CI.IGT: " 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=20171018211146.GB10621@intel.com \
    --to=manasi.d.navare@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox