Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/4] drm/i915: Introduce intel_dpll_get_hw_state()
Date: Tue, 10 Nov 2020 13:25:45 +0200	[thread overview]
Message-ID: <20201110112545.GC425411@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20201109231239.17002-1-ville.syrjala@linux.intel.com>

On Tue, Nov 10, 2020 at 01:12:36AM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a wrapper for the pll .get_hw_state() vfunc. Makes life
> a bit less miserable when you don't have to worry where the
> function pointer is stored.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

There's also assert_shared_dpll().

> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 14 +++++++------
>  drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 20 ++++++++++++++++---
>  drivers/gpu/drm/i915/display/intel_dpll_mgr.h |  3 +++
>  3 files changed, 28 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 2729c852c668..a7c4cd7a8a31 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -10927,6 +10927,7 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc,
>  	if (intel_de_read(dev_priv, PCH_TRANSCONF(crtc->pipe)) & TRANS_ENABLE) {
>  		struct intel_shared_dpll *pll;
>  		enum intel_dpll_id pll_id;
> +		bool pll_active;
>  
>  		pipe_config->has_pch_encoder = true;
>  
> @@ -10954,8 +10955,9 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc,
>  			intel_get_shared_dpll_by_id(dev_priv, pll_id);
>  		pll = pipe_config->shared_dpll;
>  
> -		drm_WARN_ON(dev, !pll->info->funcs->get_hw_state(dev_priv, pll,
> -						 &pipe_config->dpll_hw_state));
> +		pll_active = intel_dpll_get_hw_state(dev_priv, pll,
> +						     &pipe_config->dpll_hw_state);
> +		drm_WARN_ON(dev, !pll_active);
>  
>  		tmp = pipe_config->dpll_hw_state.dpll;
>  		pipe_config->pixel_multiplier =
> @@ -11346,9 +11348,9 @@ static void hsw_get_ddi_port_state(struct intel_crtc *crtc,
>  
>  	pll = pipe_config->shared_dpll;
>  	if (pll) {
> -		drm_WARN_ON(&dev_priv->drm,
> -			    !pll->info->funcs->get_hw_state(dev_priv, pll,
> -						&pipe_config->dpll_hw_state));
> +		bool pll_active = intel_dpll_get_hw_state(dev_priv, pll,
> +							  &pipe_config->dpll_hw_state);
> +		drm_WARN_ON(&dev_priv->drm, !pll_active);
>  	}
>  
>  	/*
> @@ -14587,7 +14589,7 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
>  
>  	drm_dbg_kms(&dev_priv->drm, "%s\n", pll->info->name);
>  
> -	active = pll->info->funcs->get_hw_state(dev_priv, pll, &dpll_hw_state);
> +	active = intel_dpll_get_hw_state(dev_priv, pll, &dpll_hw_state);
>  
>  	if (!(pll->info->flags & INTEL_DPLL_ALWAYS_ON)) {
>  		I915_STATE_WARN(!pll->on && pll->active_mask,
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> index a95e6a2ac698..1604c20bac33 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> @@ -141,7 +141,7 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv,
>  		     "asserting DPLL %s with no DPLL\n", onoff(state)))
>  		return;
>  
> -	cur_state = pll->info->funcs->get_hw_state(dev_priv, pll, &hw_state);
> +	cur_state = intel_dpll_get_hw_state(dev_priv, pll, &hw_state);
>  	I915_STATE_WARN(cur_state != state,
>  	     "%s assertion failure (expected %s, current %s)\n",
>  			pll->info->name, onoff(state), onoff(cur_state));
> @@ -4527,13 +4527,27 @@ int intel_dpll_get_freq(struct drm_i915_private *i915,
>  	return pll->info->funcs->get_freq(i915, pll);
>  }
>  
> +/**
> + * intel_dpll_get_hw_state - readout the DPLL's hardware state
> + * @i915: i915 device
> + * @pll: DPLL for which to calculate the output frequency
> + * @hw_state: DPLL's hardware state
> + *
> + * Read out @pll's hardware state into @hw_state.
> + */
> +bool intel_dpll_get_hw_state(struct drm_i915_private *i915,
> +			     struct intel_shared_dpll *pll,
> +			     struct intel_dpll_hw_state *hw_state)
> +{
> +	return pll->info->funcs->get_hw_state(i915, pll, hw_state);
> +}
> +
>  static void readout_dpll_hw_state(struct drm_i915_private *i915,
>  				  struct intel_shared_dpll *pll)
>  {
>  	struct intel_crtc *crtc;
>  
> -	pll->on = pll->info->funcs->get_hw_state(i915, pll,
> -						 &pll->state.hw_state);
> +	pll->on = intel_dpll_get_hw_state(i915, pll, &pll->state.hw_state);
>  
>  	if (IS_JSL_EHL(i915) && pll->on &&
>  	    pll->info->id == DPLL_ID_EHL_DPLL4) {
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.h b/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> index 205542fb8dc7..4357f92eafd6 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> @@ -400,6 +400,9 @@ void intel_update_active_dpll(struct intel_atomic_state *state,
>  			      struct intel_encoder *encoder);
>  int intel_dpll_get_freq(struct drm_i915_private *i915,
>  			const struct intel_shared_dpll *pll);
> +bool intel_dpll_get_hw_state(struct drm_i915_private *i915,
> +			     struct intel_shared_dpll *pll,
> +			     struct intel_dpll_hw_state *hw_state);
>  void intel_prepare_shared_dpll(const struct intel_crtc_state *crtc_state);
>  void intel_enable_shared_dpll(const struct intel_crtc_state *crtc_state);
>  void intel_disable_shared_dpll(const struct intel_crtc_state *crtc_state);
> -- 
> 2.26.2
> 
> _______________________________________________
> 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:[~2020-11-10 11:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 23:12 [Intel-gfx] [PATCH 1/4] drm/i915: Introduce intel_dpll_get_hw_state() Ville Syrjala
2020-11-09 23:12 ` [Intel-gfx] [PATCH 2/4] drm/i915: Move intel_dpll_get_hw_state() into the hsw+ platform specific functions Ville Syrjala
2020-11-10 13:13   ` Imre Deak
2020-11-09 23:12 ` [Intel-gfx] [PATCH 3/4] drm/i915: Use actual readout results for .get_freq() Ville Syrjala
2020-11-10 13:38   ` Imre Deak
2020-11-09 23:12 ` [Intel-gfx] [PATCH 4/4] drm/i915: Relocate cnl_get_ddi_pll() Ville Syrjala
2020-11-10 13:42   ` Imre Deak
2020-11-10 11:25 ` Imre Deak [this message]
2020-11-10 11:34   ` [Intel-gfx] [PATCH 1/4] drm/i915: Introduce intel_dpll_get_hw_state() Imre Deak
2020-11-11 10:12 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/4] " Patchwork
2020-11-11 10:41 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-11-11 12:27 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=20201110112545.GC425411@ideak-desk.fi.intel.com \
    --to=imre.deak@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