Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>,
	intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com, arun.r.murthy@intel.com,
	Suraj Kandpal <suraj.kandpal@intel.com>
Subject: Re: [PATCH 09/18] drm/i915/dpll: Change argument for enable hook in intel_dpll_funcs
Date: Fri, 09 May 2025 13:22:44 +0300	[thread overview]
Message-ID: <87msbmkrrf.fsf@intel.com> (raw)
In-Reply-To: <20250509042729.1152004-10-suraj.kandpal@intel.com>

On Fri, 09 May 2025, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> Change the arguments for enable hook in intel_dpll_funcs to only
> accept crtc_state.

But that does not match the patch! You also add encoder parameter...

> This is because we really don't need those extra
> arguments everything can be derived from crtc_state and we need both
> intel_encoder and crtc_state for PLL enablement when DISPLAY_VER() >= 14

...and you mention it here too.

> which requires us to pass this crtc state if we want the future
> PLL framework to fit into the existing one and not use the intel_ddi
> hooks
>
> --v2
> -Rename global_dpll to dpll_global to keep consistency with filename
> [Jani/Ville]
>
> --v3
> -Just use intel_dpll [Jani]
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 100 ++++++++++--------
>  1 file changed, 54 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> index f1b704f369f9..21080abc6d42 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> @@ -69,9 +69,8 @@ struct intel_dpll_funcs {
>  	 * Hook for enabling the pll, called from intel_enable_dpll() if
>  	 * the pll is not already enabled.
>  	 */
> -	void (*enable)(struct intel_display *display,
> -		       struct intel_dpll *pll,
> -		       const struct intel_dpll_hw_state *dpll_hw_state);
> +	void (*enable)(const struct intel_crtc_state *state,
> +		       struct intel_encoder *encoder);

You pass in NULL encoder. Why? What does it mean? The comment should
mention that. Or pass in the proper encoder always to reduce special
casing?

BR,
Jani.

>  
>  	/*
>  	 * Hook for disabling the pll, called from intel_disable_dpll()
> @@ -229,13 +228,15 @@ intel_tc_pll_enable_reg(struct intel_display *display,
>  	return MG_PLL_ENABLE(tc_port);
>  }
>  
> -static void _intel_enable_shared_dpll(struct intel_display *display,
> -				      struct intel_dpll *pll)
> +static void _intel_enable_shared_dpll(const struct intel_crtc_state *crtc_state)
>  {
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +
>  	if (pll->info->power_domain)
>  		pll->wakeref = intel_display_power_get(display, pll->info->power_domain);
>  
> -	pll->info->funcs->enable(display, pll, &pll->state.hw_state);
> +	pll->info->funcs->enable(crtc_state, NULL);
>  	pll->on = true;
>  }
>  
> @@ -289,7 +290,7 @@ void intel_enable_dpll(const struct intel_crtc_state *crtc_state)
>  
>  	drm_dbg_kms(display->drm, "enabling %s\n", pll->info->name);
>  
> -	_intel_enable_shared_dpll(display, pll);
> +	_intel_enable_shared_dpll(crtc_state);
>  
>  out:
>  	mutex_unlock(&display->dpll.lock);
> @@ -561,11 +562,12 @@ static void ibx_assert_pch_refclk_enabled(struct intel_display *display)
>  				 "PCH refclk assertion failure, should be active but is disabled\n");
>  }
>  
> -static void ibx_pch_dpll_enable(struct intel_display *display,
> -				struct intel_dpll *pll,
> -				const struct intel_dpll_hw_state *dpll_hw_state)
> +static void ibx_pch_dpll_enable(const struct intel_crtc_state *crtc_state,
> +				struct intel_encoder *encoder)
>  {
> -	const struct i9xx_dpll_hw_state *hw_state = &dpll_hw_state->i9xx;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +	const struct i9xx_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.i9xx;
>  	const enum intel_dpll_id id = pll->info->id;
>  
>  	/* PCH refclock must be enabled first */
> @@ -691,11 +693,12 @@ static const struct intel_dpll_mgr pch_pll_mgr = {
>  	.compare_hw_state = ibx_compare_hw_state,
>  };
>  
> -static void hsw_ddi_wrpll_enable(struct intel_display *display,
> -				 struct intel_dpll *pll,
> -				 const struct intel_dpll_hw_state *dpll_hw_state)
> +static void hsw_ddi_wrpll_enable(const struct intel_crtc_state *crtc_state,
> +				 struct intel_encoder *encoder)
>  {
> -	const struct hsw_dpll_hw_state *hw_state = &dpll_hw_state->hsw;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +	const struct hsw_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.hsw;
>  	const enum intel_dpll_id id = pll->info->id;
>  
>  	intel_de_write(display, WRPLL_CTL(id), hw_state->wrpll);
> @@ -703,11 +706,11 @@ static void hsw_ddi_wrpll_enable(struct intel_display *display,
>  	udelay(20);
>  }
>  
> -static void hsw_ddi_spll_enable(struct intel_display *display,
> -				struct intel_dpll *pll,
> -				const struct intel_dpll_hw_state *dpll_hw_state)
> +static void hsw_ddi_spll_enable(const struct intel_crtc_state *crtc_state,
> +				struct intel_encoder *encoder)
>  {
> -	const struct hsw_dpll_hw_state *hw_state = &dpll_hw_state->hsw;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	const struct hsw_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.hsw;
>  
>  	intel_de_write(display, SPLL_CTL, hw_state->spll);
>  	intel_de_posting_read(display, SPLL_CTL);
> @@ -1284,9 +1287,8 @@ static const struct intel_dpll_funcs hsw_ddi_spll_funcs = {
>  	.get_freq = hsw_ddi_spll_get_freq,
>  };
>  
> -static void hsw_ddi_lcpll_enable(struct intel_display *display,
> -				 struct intel_dpll *pll,
> -				 const struct intel_dpll_hw_state *hw_state)
> +static void hsw_ddi_lcpll_enable(const struct intel_crtc_state *crtc_state,
> +				 struct intel_encoder *encoder)
>  {
>  }
>  
> @@ -1377,11 +1379,12 @@ static void skl_ddi_pll_write_ctrl1(struct intel_display *display,
>  	intel_de_posting_read(display, DPLL_CTRL1);
>  }
>  
> -static void skl_ddi_pll_enable(struct intel_display *display,
> -			       struct intel_dpll *pll,
> -			       const struct intel_dpll_hw_state *dpll_hw_state)
> +static void skl_ddi_pll_enable(const struct intel_crtc_state *crtc_state,
> +			       struct intel_encoder *encoder)
>  {
> -	const struct skl_dpll_hw_state *hw_state = &dpll_hw_state->skl;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +	const struct skl_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.skl;
>  	const struct skl_dpll_regs *regs = skl_dpll_regs;
>  	const enum intel_dpll_id id = pll->info->id;
>  
> @@ -1399,11 +1402,12 @@ static void skl_ddi_pll_enable(struct intel_display *display,
>  		drm_err(display->drm, "DPLL %d not locked\n", id);
>  }
>  
> -static void skl_ddi_dpll0_enable(struct intel_display *display,
> -				 struct intel_dpll *pll,
> -				 const struct intel_dpll_hw_state *dpll_hw_state)
> +static void skl_ddi_dpll0_enable(const struct intel_crtc_state *crtc_state,
> +				 struct intel_encoder *encoder)
>  {
> -	const struct skl_dpll_hw_state *hw_state = &dpll_hw_state->skl;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +	const struct skl_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.skl;
>  
>  	skl_ddi_pll_write_ctrl1(display, pll, hw_state);
>  }
> @@ -2037,11 +2041,12 @@ static const struct intel_dpll_mgr skl_pll_mgr = {
>  	.compare_hw_state = skl_compare_hw_state,
>  };
>  
> -static void bxt_ddi_pll_enable(struct intel_display *display,
> -			       struct intel_dpll *pll,
> -			       const struct intel_dpll_hw_state *dpll_hw_state)
> +static void bxt_ddi_pll_enable(const struct intel_crtc_state *crtc_state,
> +			       struct intel_encoder *encoder)
>  {
> -	const struct bxt_dpll_hw_state *hw_state = &dpll_hw_state->bxt;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +	const struct bxt_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.bxt;
>  	enum port port = (enum port)pll->info->id; /* 1:1 port->PLL mapping */
>  	enum dpio_phy phy = DPIO_PHY0;
>  	enum dpio_channel ch = DPIO_CH0;
> @@ -3953,11 +3958,12 @@ static void adlp_cmtg_clock_gating_wa(struct intel_display *display, struct inte
>  		drm_dbg_kms(display->drm, "Unexpected flags in TRANS_CMTG_CHICKEN: %08x\n", val);
>  }
>  
> -static void combo_pll_enable(struct intel_display *display,
> -			     struct intel_dpll *pll,
> -			     const struct intel_dpll_hw_state *dpll_hw_state)
> +static void combo_pll_enable(const struct intel_crtc_state *crtc_state,
> +			     struct intel_encoder *encoder)
>  {
> -	const struct icl_dpll_hw_state *hw_state = &dpll_hw_state->icl;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +	const struct icl_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.icl;
>  	i915_reg_t enable_reg = intel_combo_pll_enable_reg(display, pll);
>  
>  	icl_pll_power_enable(display, pll, enable_reg);
> @@ -3977,11 +3983,12 @@ static void combo_pll_enable(struct intel_display *display,
>  	/* DVFS post sequence would be here. See the comment above. */
>  }
>  
> -static void tbt_pll_enable(struct intel_display *display,
> -			   struct intel_dpll *pll,
> -			   const struct intel_dpll_hw_state *dpll_hw_state)
> +static void tbt_pll_enable(const struct intel_crtc_state *crtc_state,
> +			   struct intel_encoder *encoder)
>  {
> -	const struct icl_dpll_hw_state *hw_state = &dpll_hw_state->icl;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +	const struct icl_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.icl;
>  
>  	icl_pll_power_enable(display, pll, TBT_PLL_ENABLE);
>  
> @@ -3998,11 +4005,12 @@ static void tbt_pll_enable(struct intel_display *display,
>  	/* DVFS post sequence would be here. See the comment above. */
>  }
>  
> -static void mg_pll_enable(struct intel_display *display,
> -			  struct intel_dpll *pll,
> -			  const struct intel_dpll_hw_state *dpll_hw_state)
> +static void mg_pll_enable(const struct intel_crtc_state *crtc_state,
> +			  struct intel_encoder *encoder)
>  {
> -	const struct icl_dpll_hw_state *hw_state = &dpll_hw_state->icl;
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_dpll *pll = crtc_state->intel_dpll;
> +	const struct icl_dpll_hw_state *hw_state = &crtc_state->dpll_hw_state.icl;
>  	i915_reg_t enable_reg = intel_tc_pll_enable_reg(display, pll);
>  
>  	icl_pll_power_enable(display, pll, enable_reg);

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-05-09 10:22 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-09  4:27 [PATCH 00/18] DPLL framework redesign Suraj Kandpal
2025-05-09  4:27 ` [PATCH 01/18] drm/i915/dpll: Rename intel_dpll Suraj Kandpal
2025-05-09 10:04   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 02/18] drm/i915/dpll: Rename intel_dpll_funcs Suraj Kandpal
2025-05-09 10:05   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 03/18] drm/i915/dpll: Rename intel_shared_dpll_state Suraj Kandpal
2025-05-09 10:07   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 04/18] drm/i915/dpll: Rename macro for_each_shared_dpll Suraj Kandpal
2025-05-09 10:07   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 05/18] drm/i915/dpll: Rename intel_shared_dpll_funcs Suraj Kandpal
2025-05-09 10:08   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 06/18] drm/i915/dpll: Rename intel_shared_dpll Suraj Kandpal
2025-05-09 10:13   ` Jani Nikula
2025-05-12  4:00     ` Kandpal, Suraj
2025-05-09  4:27 ` [PATCH 07/18] drm/i915/dpll: Move away from using shared dpll Suraj Kandpal
2025-05-09 10:17   ` Jani Nikula
2025-05-12  4:02     ` Kandpal, Suraj
2025-05-09  4:27 ` [PATCH 08/18] drm/i915/dpll: Rename crtc_get_shared_dpll Suraj Kandpal
2025-05-09 10:19   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 09/18] drm/i915/dpll: Change argument for enable hook in intel_dpll_funcs Suraj Kandpal
2025-05-09 10:22   ` Jani Nikula [this message]
2025-05-09  4:27 ` [PATCH 10/18] drm/i915/drm: Rename disable hook in intel_dpll_global_func Suraj Kandpal
2025-05-09 10:24   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 11/18] drm/i915/dpll: Introduce new hook in intel_dpll_funcs Suraj Kandpal
2025-05-09 10:25   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 12/18] drm/i915/dpll: Add intel_encoder argument to get_hw_state hook Suraj Kandpal
2025-05-09 10:25   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 13/18] drm/i915/dpll: Change arguments for get_freq hook Suraj Kandpal
2025-05-09 10:27   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 14/18] drm/i915/dpll: Rename intel_[enable/disable]_dpll Suraj Kandpal
2025-05-09 10:29   ` Jani Nikula
2025-05-12  3:19     ` Kandpal, Suraj
2025-05-09  4:27 ` [PATCH 15/18] drm/i915/dpll: Rename intel_unreference_dpll__crtc Suraj Kandpal
2025-05-09 10:31   ` Jani Nikula
2025-05-12  4:27     ` Kandpal, Suraj
2025-05-09  4:27 ` [PATCH 16/18] drm/i915/dpll: Rename intel_<release/reserve>_dpll Suraj Kandpal
2025-05-09 10:32   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 17/18] drm/i915/dpll: Rename intel_compute_dpll Suraj Kandpal
2025-05-09 10:33   ` Jani Nikula
2025-05-09  4:27 ` [PATCH 18/18] drm/i915/dpll: Rename intel_update_active_dpll Suraj Kandpal
2025-05-09 10:33   ` Jani Nikula
  -- strict thread matches above, loose matches on Subject: below --
2025-04-07  8:16 [PATCH 00/18] DPLL framework redesign Suraj Kandpal
2025-04-07  8:16 ` [PATCH 09/18] drm/i915/dpll: Change argument for enable hook in intel_dpll_funcs Suraj Kandpal

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=87msbmkrrf.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=suraj.kandpal@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