public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 04/12] drm/i915: Clean up the CPT DP .get_hw_state() port readout
Date: Thu, 21 May 2015 12:16:56 -0700	[thread overview]
Message-ID: <555E2F28.5050801@virtuousgeek.org> (raw)
In-Reply-To: <1430835458-11187-5-git-send-email-ville.syrjala@linux.intel.com>

On 05/05/2015 07:17 AM, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Define a TRANS_DP_PIPE_TO_PORT() to make the CPT DP .get_hw_state()
> pipe readout neater.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h |  1 +
>  drivers/gpu/drm/i915/intel_dp.c | 26 +++++---------------------
>  2 files changed, 6 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index dcd93b5..0538b24 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -6410,6 +6410,7 @@ enum skl_disp_power_wells {
>  #define  TRANS_DP_PORT_SEL_D	(2<<29)
>  #define  TRANS_DP_PORT_SEL_NONE	(3<<29)
>  #define  TRANS_DP_PORT_SEL_MASK	(3<<29)
> +#define  TRANS_DP_PIPE_TO_PORT(val)	((((val) & TRANS_DP_PORT_SEL_MASK) >> 29) + PORT_B)
>  #define  TRANS_DP_AUDIO_ONLY	(1<<26)
>  #define  TRANS_DP_ENH_FRAMING	(1<<18)
>  #define  TRANS_DP_8BPC		(0<<9)
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 0971a5d..dc89931 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2177,28 +2177,12 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder,
>  	if (IS_GEN7(dev) && port == PORT_A) {
>  		*pipe = PORT_TO_PIPE_CPT(tmp);
>  	} else if (HAS_PCH_CPT(dev) && port != PORT_A) {
> -		u32 trans_sel;
> -		u32 trans_dp;
> -		int i;
> -
> -		switch (intel_dp->output_reg) {
> -		case PCH_DP_B:
> -			trans_sel = TRANS_DP_PORT_SEL_B;
> -			break;
> -		case PCH_DP_C:
> -			trans_sel = TRANS_DP_PORT_SEL_C;
> -			break;
> -		case PCH_DP_D:
> -			trans_sel = TRANS_DP_PORT_SEL_D;
> -			break;
> -		default:
> -			return true;
> -		}
> +		enum pipe p;
>  
> -		for_each_pipe(dev_priv, i) {
> -			trans_dp = I915_READ(TRANS_DP_CTL(i));
> -			if ((trans_dp & TRANS_DP_PORT_SEL_MASK) == trans_sel) {
> -				*pipe = i;
> +		for_each_pipe(dev_priv, p) {
> +			u32 trans_dp = I915_READ(TRANS_DP_CTL(p));
> +			if (TRANS_DP_PIPE_TO_PORT(trans_dp) == port) {
> +				*pipe = p;
>  				return true;
>  			}
>  		}
> 

Nice.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-05-21 19:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 14:17 [PATCH 00/12] drm/i915: PCH modeset sequence fixes ville.syrjala
2015-05-05 14:17 ` [PATCH 01/12] drm/i915: Remove a bogus 12bpc "toggle" from intel_disable_hdmi() ville.syrjala
2015-05-21 19:04   ` Jesse Barnes
2015-05-05 14:17 ` [PATCH 02/12] drm/i915: Remove the double register write " ville.syrjala
2015-05-21 19:04   ` Jesse Barnes
2015-05-05 14:17 ` [PATCH 03/12] drm/i915: Clarfify the DP code platform checks ville.syrjala
2015-05-21 19:10   ` Jesse Barnes
2015-05-05 14:17 ` [PATCH 04/12] drm/i915: Clean up the CPT DP .get_hw_state() port readout ville.syrjala
2015-05-21 19:16   ` Jesse Barnes [this message]
2015-05-05 14:17 ` [PATCH 05/12] drm/i915: Fix DP enhanced framing for CPT ville.syrjala
2015-05-21 19:19   ` Jesse Barnes
2015-05-05 14:17 ` [PATCH 06/12] drm/i915: Use POSTING_READ() in intel_sdvo_write_sdvox() ville.syrjala
2015-05-06 11:30   ` Daniel Vetter
2015-05-05 14:17 ` [PATCH 07/12] drm/i915: Write the SDVO reg twice on IBX ville.syrjala
2015-05-21 19:20   ` Jesse Barnes
2015-05-05 14:17 ` [PATCH 08/12] drm/i915: Fix the IBX transcoder B workarounds ville.syrjala
2015-05-21 19:23   ` Jesse Barnes
2015-05-05 14:17 ` [PATCH 09/12] drm/i915: Disable HDMI port after the pipe on PCH platforms ville.syrjala
2015-05-21 19:24   ` Jesse Barnes
2015-05-05 14:17 ` [PATCH 10/12] drm/i915: Disable SDVO " ville.syrjala
2015-05-21 19:26   ` Jesse Barnes
2015-05-21 21:24     ` Daniel Vetter
2015-05-05 14:17 ` [PATCH 11/12] drm/i915: Disable CRT port after " ville.syrjala
2015-05-21 19:26   ` Jesse Barnes
2015-05-05 14:17 ` [PATCH 12/12] drm/i915: Disable FDI RX/TX before the ports ville.syrjala
2015-05-21 19:27   ` Jesse Barnes

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=555E2F28.5050801@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --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