From: Jani Nikula <jani.nikula@linux.intel.com>
To: Mika Kahola <mika.kahola@intel.com>,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: Imre Deak <imre.deak@intel.com>
Subject: Re: [RFC PATCH 12/39] drm/i915/display: Track the C20 PHY VDR state in the PLL state
Date: Wed, 01 Oct 2025 12:03:17 +0300 [thread overview]
Message-ID: <86dd5dc9193aecbd95f92a05d504e694fe49ffa0@intel.com> (raw)
In-Reply-To: <20251001082839.2585559-13-mika.kahola@intel.com>
On Wed, 01 Oct 2025, Mika Kahola <mika.kahola@intel.com> wrote:
> From: Imre Deak <imre.deak@intel.com>
>
> The Cx0 PLL enable programming needs to know if the PLL is in DP or HDMI
> mode. The PLL manager framework doesn't pass the CRTC state to the PLL's
> enable hook, so prepare here for the conversion to use the PLL manager
> for Cx0 PHY PLLs by tracking the DP/HDMI mode in the PLL state.
>
> This change has the advantage, that the VDR HW/SW state can be verified
> now.
>
> A follow up change will convert the PLL enable function to retrieve the
> DP/HDMI mode parameter from the PLL state.
>
> This also allows dropping the is_dp and port clock params from the
> intel_c20_pll_program() function, since it can retrieve these now from
> the PLL state.
>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_cx0_phy.c | 115 +++++++++++++-----
> drivers/gpu/drm/i915/display/intel_dpll_mgr.h | 5 +
> 2 files changed, 89 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> index b2fc93954933..3f426f5b4929 100644
> --- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> @@ -2362,6 +2362,76 @@ intel_c20_pll_tables_get(const struct intel_crtc_state *crtc_state,
> return NULL;
> }
>
> +static u8 intel_c20_get_dp_rate(u32 clock);
> +static u8 intel_c20_get_hdmi_rate(u32 clock);
> +static bool is_hdmi_frl(u32 clock);
> +static int intel_get_c20_custom_width(u32 clock, bool dp);
> +
> +static void intel_c20_calc_vdr_params(struct intel_c20pll_vdr_state *vdr, bool is_dp,
> + int port_clock)
> +{
> + vdr->custom_width = intel_get_c20_custom_width(port_clock, is_dp);
> +
> + vdr->serdes_rate = 0;
> + vdr->hdmi_rate = 0;
> +
> + if (is_dp) {
> + vdr->serdes_rate = PHY_C20_IS_DP |
> + PHY_C20_DP_RATE(intel_c20_get_dp_rate(port_clock));
> + } else {
> + if (is_hdmi_frl(port_clock))
> + vdr->serdes_rate = PHY_C20_IS_HDMI_FRL;
> +
> + vdr->hdmi_rate = intel_c20_get_hdmi_rate(port_clock);
> + }
> +}
> +
> +#define PHY_C20_SERDES_RATE_MASK (PHY_C20_IS_DP | PHY_C20_DP_RATE_MASK | PHY_C20_IS_HDMI_FRL)
> +
> +static void intel_c20_readout_vdr_params(struct intel_encoder *encoder,
> + struct intel_c20pll_vdr_state *vdr, bool *cntx)
> +{
> + u8 serdes;
> +
> + serdes = intel_cx0_read(encoder, INTEL_CX0_LANE0, PHY_C20_VDR_CUSTOM_SERDES_RATE);
> + *cntx = serdes & PHY_C20_CONTEXT_TOGGLE;
> +
> + vdr->custom_width = intel_cx0_read(encoder, INTEL_CX0_LANE0, PHY_C20_VDR_CUSTOM_WIDTH) &
> + PHY_C20_CUSTOM_WIDTH_MASK;
> +
> + vdr->serdes_rate = serdes & PHY_C20_SERDES_RATE_MASK;
I'm not a huge fan of storing ŕegister contents directly in state. This
sounds like three separate fields, is_dp, rate, and is_hdmi_frl, or
similar.
> + if (!(vdr->serdes_rate & PHY_C20_IS_DP))
> + vdr->hdmi_rate = intel_cx0_read(encoder, INTEL_CX0_LANE0, PHY_C20_VDR_HDMI_RATE) &
> + PHY_C20_HDMI_RATE_MASK;
> + else
> + vdr->hdmi_rate = 0;
> +}
> +
> +static void intel_c20_program_vdr_params(struct intel_encoder *encoder,
> + const struct intel_c20pll_vdr_state *vdr,
> + u8 owned_lane_mask)
> +{
> + struct intel_display *display = to_intel_display(encoder);
> +
> + drm_WARN_ON(display->drm, vdr->custom_width & ~PHY_C20_CUSTOM_WIDTH_MASK);
> + intel_cx0_rmw(encoder, owned_lane_mask, PHY_C20_VDR_CUSTOM_WIDTH,
> + PHY_C20_CUSTOM_WIDTH_MASK, vdr->custom_width,
> + MB_WRITE_COMMITTED);
> +
> + drm_WARN_ON(display->drm, vdr->serdes_rate & ~PHY_C20_SERDES_RATE_MASK);
> + intel_cx0_rmw(encoder, owned_lane_mask, PHY_C20_VDR_CUSTOM_SERDES_RATE,
> + PHY_C20_SERDES_RATE_MASK, vdr->serdes_rate,
> + MB_WRITE_COMMITTED);
> +
> + if (vdr->serdes_rate & PHY_C20_IS_DP)
Case in point. Please let's not mix software state and hardware register
definitions.
> + return;
> +
> + drm_WARN_ON(display->drm, vdr->hdmi_rate & ~PHY_C20_HDMI_RATE_MASK);
> + intel_cx0_rmw(encoder, INTEL_CX0_BOTH_LANES, PHY_C20_VDR_HDMI_RATE,
> + PHY_C20_HDMI_RATE_MASK, vdr->hdmi_rate,
> + MB_WRITE_COMMITTED);
> +}
> +
> static const struct intel_c20pll_state *
> intel_c20_pll_find_table(const struct intel_crtc_state *crtc_state,
> struct intel_encoder *encoder)
> @@ -2400,19 +2470,26 @@ static int intel_c20pll_calc_state_from_table(struct intel_crtc_state *crtc_stat
> static int intel_c20pll_calc_state(struct intel_crtc_state *crtc_state,
> struct intel_encoder *encoder)
> {
> + bool is_dp = intel_crtc_has_dp_encoder(crtc_state);
> int err = -ENOENT;
>
> crtc_state->dpll_hw_state.cx0pll.use_c10 = false;
>
> /* try computed C20 HDMI tables before using consolidated tables */
> - if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
> + if (!is_dp)
> /* TODO: Update SSC state for HDMI as well */
> err = intel_c20_compute_hdmi_tmds_pll(crtc_state);
>
> if (err)
> err = intel_c20pll_calc_state_from_table(crtc_state, encoder);
>
> - return err;
> + if (err)
> + return err;
> +
> + intel_c20_calc_vdr_params(&crtc_state->dpll_hw_state.cx0pll.c20.vdr,
> + is_dp, crtc_state->port_clock);
> +
> + return 0;
> }
>
> int intel_cx0pll_calc_state(struct intel_crtc_state *crtc_state,
> @@ -2486,8 +2563,8 @@ static void intel_c20pll_readout_hw_state(struct intel_encoder *encoder,
>
> wakeref = intel_cx0_phy_transaction_begin(encoder);
>
> - /* 1. Read current context selection */
> - cntx = intel_cx0_read(encoder, INTEL_CX0_LANE0, PHY_C20_VDR_CUSTOM_SERDES_RATE) & PHY_C20_CONTEXT_TOGGLE;
> + /* 1. Read VDR params and current context selection */
> + intel_c20_readout_vdr_params(encoder, &pll_state->vdr, &cntx);
>
> /* Read Tx configuration */
> for (i = 0; i < ARRAY_SIZE(pll_state->tx); i++) {
> @@ -2676,11 +2753,9 @@ static int intel_get_c20_custom_width(u32 clock, bool dp)
>
> static void intel_c20_pll_program(struct intel_display *display,
> struct intel_encoder *encoder,
> - const struct intel_c20pll_state *pll_state,
> - bool is_dp, int port_clock)
> + const struct intel_c20pll_state *pll_state)
> {
> u8 owned_lane_mask = intel_cx0_get_owned_lane_mask(encoder);
> - u8 serdes;
> bool cntx;
> int i;
>
> @@ -2750,30 +2825,8 @@ static void intel_c20_pll_program(struct intel_display *display,
> }
>
> /* 4. Program custom width to match the link protocol */
> - intel_cx0_rmw(encoder, owned_lane_mask, PHY_C20_VDR_CUSTOM_WIDTH,
> - PHY_C20_CUSTOM_WIDTH_MASK,
> - PHY_C20_CUSTOM_WIDTH(intel_get_c20_custom_width(port_clock, is_dp)),
> - MB_WRITE_COMMITTED);
> -
> /* 5. For DP or 6. For HDMI */
> - serdes = 0;
> -
> - if (is_dp)
> - serdes = PHY_C20_IS_DP |
> - PHY_C20_DP_RATE(intel_c20_get_dp_rate(port_clock));
> - else if (is_hdmi_frl(port_clock))
> - serdes = PHY_C20_IS_HDMI_FRL;
> -
> - intel_cx0_rmw(encoder, owned_lane_mask, PHY_C20_VDR_CUSTOM_SERDES_RATE,
> - PHY_C20_IS_DP | PHY_C20_DP_RATE_MASK | PHY_C20_IS_HDMI_FRL,
> - serdes,
> - MB_WRITE_COMMITTED);
> -
> - if (!is_dp)
> - intel_cx0_rmw(encoder, INTEL_CX0_BOTH_LANES, PHY_C20_VDR_HDMI_RATE,
> - PHY_C20_HDMI_RATE_MASK,
> - intel_c20_get_hdmi_rate(port_clock),
> - MB_WRITE_COMMITTED);
> + intel_c20_program_vdr_params(encoder, &pll_state->vdr, owned_lane_mask);
>
> /*
> * 7. Write Vendor specific registers to toggle context setting to load
> @@ -3098,7 +3151,7 @@ static void __intel_cx0pll_enable(struct intel_encoder *encoder,
> if (intel_encoder_is_c10phy(encoder))
> intel_c10_pll_program(display, encoder, &pll_state->c10);
> else
> - intel_c20_pll_program(display, encoder, &pll_state->c20, is_dp, port_clock);
> + intel_c20_pll_program(display, encoder, &pll_state->c20);
>
> /*
> * 6. Program the enabled and disabled owned PHY lane
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.h b/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> index f131bdd1c975..43c7200050e9 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.h
> @@ -255,6 +255,11 @@ struct intel_c20pll_state {
> u16 mplla[10];
> u16 mpllb[11];
> };
> + struct intel_c20pll_vdr_state {
> + u8 custom_width;
> + u8 serdes_rate;
> + u8 hdmi_rate;
> + } vdr;
> };
>
> struct intel_cx0pll_state {
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-10-01 9:03 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 8:28 [RFC PATCH 00/39] drm/i915/display: Add MTL+ platforms to support dpll framework Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 01/39] drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/DP_RATE field macros Mika Kahola
2025-10-01 8:52 ` Jani Nikula
2025-10-01 8:57 ` Raag Jadav
2025-10-01 9:57 ` Jani Nikula
2025-10-01 10:01 ` Kahola, Mika
2025-10-01 8:28 ` [RFC PATCH 02/39] drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_DP flag macro Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 03/39] drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/CONTEXT_TOGGLE " Mika Kahola
2025-10-01 8:49 ` Jani Nikula
2025-10-01 8:28 ` [RFC PATCH 04/39] drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_HDMI_FRL " Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 05/39] drm/i915/display: Fix PHY_C20_VDR_CUSTOM_SERDES_RATE programming Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 06/39] drm/i915/display: Fix PHY_C20_VDR_HDMI_RATE programming Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 07/39] drm/i915/display: Add missing clock to C10 PHY state compute/HW readout Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 08/39] drm/i915/display: Rename TBT functions to be ICL specific Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 09/39] drm/i915/display: Factor out C10 msgbus access start/end helpers Mika Kahola
2025-10-01 8:55 ` Jani Nikula
2025-10-01 8:28 ` [RFC PATCH 10/39] drm/i915/display: Sanitize setting the Cx0 PLL use_c10 flag Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 11/39] drm/i915/display: Sanitize calculating C20 PLL state from tables Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 12/39] drm/i915/display: Track the C20 PHY VDR state in the PLL state Mika Kahola
2025-10-01 9:03 ` Jani Nikula [this message]
2025-10-01 8:28 ` [RFC PATCH 13/39] drm/i915/display: Move definition of Cx0 PHY functions earlier Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 14/39] drm/i915/display: Add macro to get DDI port width from a register value Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 15/39] drm/i915/display: Track the Cx0 PHY enabled lane count in the PLL state Mika Kahola
2025-10-01 9:13 ` Jani Nikula
2025-10-01 12:09 ` Imre Deak
2025-10-01 8:28 ` [RFC PATCH 16/39] drm/i915/display: Sanitize C10 PHY PLL SSC register setup Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 17/39] drm/i915/display: Read out the Cx0 PHY SSC enabled state Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 18/39] drm/i915/display: Determine Cx0 PLL DP mode from PLL state Mika Kahola
2025-10-01 9:16 ` Jani Nikula
2025-10-16 18:04 ` Ville Syrjälä
2025-10-20 10:51 ` Jani Nikula
2025-10-01 8:28 ` [RFC PATCH 19/39] drm/i915/display: Determine Cx0 PLL port clock " Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 20/39] drm/i915/display: Zero Cx0 PLL state before compute and HW readout Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 21/39] drm/i915/display: Print additional Cx0 PLL HW state Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 22/39] drm/i915/display: Remove state verification Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 23/39] drm/i915/display: PLL information for MTL+ Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 24/39] drm/i915/display: Update C10/C20 state calculation Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 25/39] drm/i915/display: Compute plls for MTL+ platform Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 26/39] drm/i915/display: MTL+ .get_dplls Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 27/39] drm/i915/display: MTL+ .put_dplls Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 28/39] drm/i915/display: Add .update_active_dpll Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 29/39] drm/i915/display: Add .update_dpll_ref_clks Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 30/39] drm/i915/display: Add .dump_hw_state Mika Kahola
2025-10-01 9:33 ` Jani Nikula
2025-10-02 9:12 ` Kahola, Mika
2025-10-01 8:28 ` [RFC PATCH 31/39] drm/i915/display: Add .compare_hw_state Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 32/39] drm/i915/display: Add .get_hw_state to MTL+ platforms Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 33/39] drm/i915/display: Add .get_freq " Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 34/39] drm/i915/display: Add .crtc_get_dpll hook Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 35/39] drm/i915/display: PLL verify debug state print Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 36/39] drm/i915/display: Add .enable_clock on DDI for MTL+ platforms Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 37/39] drm/i915/display: Get configuration for C10 and C20 Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 38/39] drm/i915/display: Add Thunderbolt support Mika Kahola
2025-10-01 8:28 ` [RFC PATCH 39/39] drm/i915/display: Enable dpll framework for MTL+ Mika Kahola
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=86dd5dc9193aecbd95f92a05d504e694fe49ffa0@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=mika.kahola@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