intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 24/31] drm/i915: asserts for lvds pre_enable
Date: Thu, 13 Jun 2013 23:26:04 +0300	[thread overview]
Message-ID: <1371155164.24509.20.camel@ideak-mobl> (raw)
In-Reply-To: <1370432073-27634-25-git-send-email-daniel.vetter@ffwll.ch>

On Wed, 2013-06-05 at 13:34 +0200, Daniel Vetter wrote:
> Lots of bangin my head against the wall^UExperiments have shown that
> we really need to enable the lvds port before we enable plls. Strangely
> that seems to include the fdi rx pll on the pch.
> 
> Anyway, encode this new evidence with a few nice WARNs.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++-------------
>  drivers/gpu/drm/i915/intel_drv.h     | 16 ++++++++++++++++
>  drivers/gpu/drm/i915/intel_lvds.c    | 17 ++++++++++++-----
>  3 files changed, 38 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 5d84fea..7b34a92 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -874,8 +874,8 @@ static const char *state_string(bool enabled)
>  }
>  
>  /* Only for pre-ILK configs */
> -static void assert_pll(struct drm_i915_private *dev_priv,
> -		       enum pipe pipe, bool state)
> +void assert_pll(struct drm_i915_private *dev_priv,
> +		enum pipe pipe, bool state)
>  {
>  	int reg;
>  	u32 val;
> @@ -888,10 +888,8 @@ static void assert_pll(struct drm_i915_private *dev_priv,
>  	     "PLL state assertion failure (expected %s, current %s)\n",
>  	     state_string(state), state_string(cur_state));
>  }
> -#define assert_pll_enabled(d, p) assert_pll(d, p, true)
> -#define assert_pll_disabled(d, p) assert_pll(d, p, false)
>  
> -static struct intel_shared_dpll *
> +struct intel_shared_dpll *
>  intel_crtc_to_shared_dpll(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
> @@ -903,9 +901,9 @@ intel_crtc_to_shared_dpll(struct intel_crtc *crtc)
>  }
>  
>  /* For ILK+ */
> -static void assert_shared_dpll(struct drm_i915_private *dev_priv,
> -			       struct intel_shared_dpll *pll,
> -			       bool state)
> +void assert_shared_dpll(struct drm_i915_private *dev_priv,
> +			struct intel_shared_dpll *pll,
> +			bool state)
>  {
>  	bool cur_state;
>  	struct intel_dpll_hw_state hw_state;
> @@ -924,8 +922,6 @@ static void assert_shared_dpll(struct drm_i915_private *dev_priv,
>  	     "%s assertion failure (expected %s, current %s)\n",
>  	     pll->name, state_string(state), state_string(cur_state));
>  }
> -#define assert_shared_dpll_enabled(d, p) assert_shared_dpll(d, p, true)
> -#define assert_shared_dpll_disabled(d, p) assert_shared_dpll(d, p, false)
>  
>  static void assert_fdi_tx(struct drm_i915_private *dev_priv,
>  			  enum pipe pipe, bool state)
> @@ -989,15 +985,16 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv,
>  	WARN(!(val & FDI_TX_PLL_ENABLE), "FDI TX PLL assertion failure, should be active but is disabled\n");
>  }
>  
> -static void assert_fdi_rx_pll_enabled(struct drm_i915_private *dev_priv,
> -				      enum pipe pipe)
> +void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,
> +		       enum pipe pipe, bool state)
>  {
>  	int reg;
>  	u32 val;
>  
>  	reg = FDI_RX_CTL(pipe);
>  	val = I915_READ(reg);
> -	WARN(!(val & FDI_RX_PLL_ENABLE), "FDI RX PLL assertion failure, should be active but is disabled\n");
> +	WARN(!!(val & FDI_RX_PLL_ENABLE) != state,
> +	     "FDI RX PLL assertion failure, should be active but is disabled\n");

The message should be updated too.

>  }
>  
>  static void assert_panel_unlocked(struct drm_i915_private *dev_priv,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 6f28375..ea8aa5e 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -732,6 +732,22 @@ extern int intel_overlay_attrs(struct drm_device *dev, void *data,
>  extern void intel_fb_output_poll_changed(struct drm_device *dev);
>  extern void intel_fb_restore_mode(struct drm_device *dev);
>  
> +struct intel_shared_dpll *
> +intel_crtc_to_shared_dpll(struct intel_crtc *crtc);
> +
> +void assert_shared_dpll(struct drm_i915_private *dev_priv,
> +			struct intel_shared_dpll *pll,
> +			bool state);
> +#define assert_shared_dpll_enabled(d, p) assert_shared_dpll(d, p, true)
> +#define assert_shared_dpll_disabled(d, p) assert_shared_dpll(d, p, false)
> +void assert_pll(struct drm_i915_private *dev_priv,
> +		enum pipe pipe, bool state);
> +#define assert_pll_enabled(d, p) assert_pll(d, p, true)
> +#define assert_pll_disabled(d, p) assert_pll(d, p, false)
> +void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,
> +		       enum pipe pipe, bool state);
> +#define assert_fdi_rx_pll_enabled(d, p) assert_fdi_rx_pll(d, p, true)
> +#define assert_fdi_rx_pll_disabled(d, p) assert_fdi_rx_pll(d, p, false)
>  extern void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
>  			bool state);
>  #define assert_pipe_enabled(d, p) assert_pipe(d, p, true)
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 159aa9f..36f8901 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -120,12 +120,20 @@ static void intel_pre_pll_enable_lvds(struct intel_encoder *encoder)
>  	struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> +	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
>  	struct drm_display_mode *fixed_mode =
>  		lvds_encoder->attached_connector->base.panel.fixed_mode;
> -	int pipe = intel_crtc->pipe;
> +	int pipe = crtc->pipe;
>  	u32 temp;
>  
> +	if (HAS_PCH_SPLIT(dev)) {
> +		assert_fdi_rx_pll_disabled(dev_priv, pipe);
> +		assert_shared_dpll_disabled(dev_priv,
> +					    intel_crtc_to_shared_dpll(crtc));

I think if we pick a shared PLL that is currently used by another port
this will trigger. Should the PLL selection be limited to non-shared
PLLs for LVDS?

> +	} else {
> +		assert_pll_disabled(dev_priv, pipe);
> +	}
> +
>  	temp = I915_READ(lvds_encoder->reg);
>  	temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
>  
> @@ -142,7 +150,7 @@ static void intel_pre_pll_enable_lvds(struct intel_encoder *encoder)
>  
>  	/* set the corresponsding LVDS_BORDER bit */
>  	temp &= ~LVDS_BORDER_ENABLE;
> -	temp |= intel_crtc->config.gmch_pfit.lvds_border_bits;
> +	temp |= crtc->config.gmch_pfit.lvds_border_bits;
>  	/* Set the B0-B3 data pairs corresponding to whether we're going to
>  	 * set the DPLLs for dual-channel mode or not.
>  	 */
> @@ -162,8 +170,7 @@ static void intel_pre_pll_enable_lvds(struct intel_encoder *encoder)
>  	if (INTEL_INFO(dev)->gen == 4) {
>  		/* Bspec wording suggests that LVDS port dithering only exists
>  		 * for 18bpp panels. */
> -		if (intel_crtc->config.dither &&
> -		    intel_crtc->config.pipe_bpp == 18)
> +		if (crtc->config.dither && crtc->config.pipe_bpp == 18)
>  			temp |= LVDS_ENABLE_DITHER;
>  		else
>  			temp &= ~LVDS_ENABLE_DITHER;

  reply	other threads:[~2013-06-13 20:26 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 11:34 [PATCH 00/31] shared pch display pll rework Daniel Vetter
2013-06-05 11:34 ` [PATCH 01/31] drm/i915: fix up pch pll handling in ->mode_set Daniel Vetter
2013-06-05 11:34 ` [PATCH 02/31] drm/i915: conditionally disable pch resources in ilk_crtc_disable Daniel Vetter
2013-06-05 11:34 ` [PATCH 03/31] drm/i915: lock down pch pll accouting some more Daniel Vetter
2013-06-07 16:32   ` Ville Syrjälä
2013-06-07 20:03     ` Daniel Vetter
2013-06-07 20:46       ` Ville Syrjälä
2013-06-07 21:13         ` Daniel Vetter
2013-06-10 10:11           ` Ville Syrjälä
2013-06-10 14:34             ` Daniel Vetter
2013-06-10 14:47               ` Ville Syrjälä
2013-06-10 15:28                 ` [PATCH] " Daniel Vetter
2013-06-07 21:09     ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 04/31] drm/i915: s/pch_pll/shared_dpll/ Daniel Vetter
2013-06-05 11:34 ` [PATCH 05/31] drm/i915: switch crtc->shared_dpll from a pointer to an enum Daniel Vetter
2013-06-07 16:48   ` Ville Syrjälä
2013-06-07 21:10     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 06/31] drm/i915: move shared_dpll into the pipe config Daniel Vetter
2013-06-07 17:03   ` Ville Syrjälä
2013-06-07 21:10     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 07/31] drm/i915: refactor PCH_DPLL_SEL #defines Daniel Vetter
2013-06-05 11:34 ` [PATCH 08/31] drm/i915: hw state readout for shared pch plls Daniel Vetter
2013-06-07 17:23   ` Ville Syrjälä
2013-06-07 20:11     ` Daniel Vetter
2013-06-07 21:11     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 09/31] drm/i915: consolidate ->num_shared_dplls assignement Daniel Vetter
2013-06-05 11:34 ` [PATCH 10/31] drm/i915: metadata for shared dplls Daniel Vetter
2013-06-05 11:34 ` [PATCH 11/31] drm/i915: scrap register address storage Daniel Vetter
2013-06-05 11:34 ` [PATCH 12/31] drm/i915: enable/disable hooks for shared dplls Daniel Vetter
2013-06-05 11:34 ` [PATCH 13/31] drm/i915: drop crtc checking from assert_shared_dpll Daniel Vetter
2013-06-05 11:34 ` [PATCH 14/31] drm/i915: display pll hw state readout and checking Daniel Vetter
2013-06-12 13:31   ` Damien Lespiau
2013-06-12 13:39     ` Ville Syrjälä
2013-06-12 13:49       ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 15/31] drm/i915: extract readout_hw_state from setup_hw_state Daniel Vetter
2013-06-12 13:32   ` Damien Lespiau
2013-06-12 14:26   ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 16/31] drm/i915: split up intel_modeset_check_state Daniel Vetter
2013-06-12 13:33   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 17/31] drm/i915: WARN on lack of shared dpll Daniel Vetter
2013-06-12 13:38   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 18/31] drm/i915: hw state readout and cross-checking for shared dplls Daniel Vetter
2013-06-12 15:04   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 19/31] drm/i915: fix up pch pll enabling for pixel multipliers Daniel Vetter
2013-06-12 15:12   ` Damien Lespiau
2013-06-12 19:34     ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 20/31] drm/i915: simplify the reduced clock handling for pch plls Daniel Vetter
2013-06-13 11:26   ` Damien Lespiau
2013-06-13 11:35     ` Daniel Vetter
2013-06-13 12:32       ` Damien Lespiau
2013-06-13 14:33         ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 21/31] drm/i915: consolidate pch pll enable sequence Daniel Vetter
2013-06-24 14:30   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 22/31] drm/i915: use sw tracked state to select shared dplls Daniel Vetter
2013-06-12 15:20   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 23/31] drm/i915: duplicate intel_enable_pll into i9xx and vlv versions Daniel Vetter
2013-06-05 15:12   ` Jani Nikula
2013-06-05 22:52     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 24/31] drm/i915: asserts for lvds pre_enable Daniel Vetter
2013-06-13 20:26   ` Imre Deak [this message]
2013-06-13 20:46     ` Daniel Vetter
2013-06-14 10:45       ` Imre Deak
2013-06-16 19:42     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 25/31] drm/i915: move encoder pre enable hooks togther on ilk+ Daniel Vetter
2013-06-05 11:34 ` [PATCH 26/31] drm/i915: hw state readout for i9xx dplls Daniel Vetter
2013-06-05 11:34 ` [PATCH 27/31] drm/i915: move i9xx dpll enabling into crtc enable function Daniel Vetter
2013-06-05 15:13   ` Jani Nikula
2013-06-06  8:20     ` [PATCH] " Daniel Vetter
2013-06-14 16:02   ` [PATCH 27/31] " Imre Deak
2013-06-16 19:15     ` Daniel Vetter
2013-06-16 19:24     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 28/31] drm/i915: s/pre_pll/pre/ on the lvds port " Daniel Vetter
2013-06-15  8:32   ` Imre Deak
2013-06-26 10:02     ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 29/31] drm/i915: clean up vlv ->pre_pll_enable and pll enable sequence Daniel Vetter
2013-06-06  8:22   ` [PATCH] " Daniel Vetter
2013-07-11 14:11     ` Imre Deak
2013-07-11 20:13       ` Daniel Vetter
2013-07-12 16:27       ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 30/31] drm/i915: Fix up cpt pixel multiplier " Daniel Vetter
2013-06-05 11:34 ` [PATCH 31/31] drm/i915: clear DPLL reg when disabling i9xx dplls Daniel Vetter
2013-06-07 17:46 ` [PATCH 00/31] shared pch display pll rework Ville Syrjälä
2013-06-10 15:57   ` Ville Syrjälä
2013-06-10 18:16     ` Daniel Vetter

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=1371155164.24509.20.camel@ideak-mobl \
    --to=imre.deak@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /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;
as well as URLs for NNTP newsgroup(s).