Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: "Jouni Högander" <jouni.hogander@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 07/11] drm/i915/alpm: Move port alpm configuration
Date: Tue, 20 May 2025 14:30:57 +0530	[thread overview]
Message-ID: <eae1ec28-109a-41c6-a17e-3a45b50e6a0e@intel.com> (raw)
In-Reply-To: <20250502085902.154740-8-jouni.hogander@intel.com>


On 5/2/2025 2:28 PM, Jouni Högander wrote:
> It is specified in Bspec where port alpm configuration is supposed to be
> performed. Change accordingly.
>
> HAS: 14012758795
Lets drop references to HAS and add Bspec: 68849
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_alpm.c    | 53 +++++++++++++-------
>   drivers/gpu/drm/i915/display/intel_alpm.h    |  2 +
>   drivers/gpu/drm/i915/display/intel_cx0_phy.c |  1 +
>   drivers/gpu/drm/i915/display/intel_ddi.c     |  6 +++
>   4 files changed, 44 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c b/drivers/gpu/drm/i915/display/intel_alpm.c
> index 4a8d4b34fa89e..857ce83075d8d 100644
> --- a/drivers/gpu/drm/i915/display/intel_alpm.c
> +++ b/drivers/gpu/drm/i915/display/intel_alpm.c
> @@ -344,7 +344,6 @@ static void lnl_alpm_configure(struct intel_dp *intel_dp,
>   {
>   	struct intel_display *display = to_intel_display(intel_dp);
>   	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
> -	enum port port = dp_to_dig_port(intel_dp)->base.port;
>   	u32 alpm_ctl;
>   
>   	if (DISPLAY_VER(display) < 20 || (!intel_psr_needs_alpm(intel_dp, crtc_state) &&
> @@ -374,23 +373,6 @@ static void lnl_alpm_configure(struct intel_dp *intel_dp,
>   				       pr_alpm_ctl);
>   		}
>   
> -		intel_de_write(display,
> -			       PORT_ALPM_CTL(port),
> -			       PORT_ALPM_CTL_ALPM_AUX_LESS_ENABLE |
> -			       PORT_ALPM_CTL_MAX_PHY_SWING_SETUP(15) |
> -			       PORT_ALPM_CTL_MAX_PHY_SWING_HOLD(0) |
> -			       PORT_ALPM_CTL_SILENCE_PERIOD(
> -				       intel_dp->alpm_parameters.silence_period_sym_clocks));
> -
> -		intel_de_write(display,
> -			       PORT_ALPM_LFPS_CTL(port),
> -			       PORT_ALPM_LFPS_CTL_LFPS_CYCLE_COUNT(10) |
> -			       PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION(
> -				       intel_dp->alpm_parameters.lfps_half_cycle_num_of_syms) |
> -			       PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION(
> -				       intel_dp->alpm_parameters.lfps_half_cycle_num_of_syms) |
> -			       PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION(
> -				       intel_dp->alpm_parameters.lfps_half_cycle_num_of_syms));
>   	} else {
>   		alpm_ctl = ALPM_CTL_EXTENDED_FAST_WAKE_ENABLE |
>   			ALPM_CTL_EXTENDED_FAST_WAKE_TIME(intel_dp->alpm_parameters.fast_wake_lines);
> @@ -414,6 +396,41 @@ void intel_alpm_configure(struct intel_dp *intel_dp,
>   	intel_dp->alpm_parameters.transcoder = crtc_state->cpu_transcoder;
>   }
>   
> +/**
> + * intel_alpm_port_configure - Port ALPM configuration
> + * @intel_dp: Intel DP
> + * @crtc_state: CRTC state
> + *
> + * Perfrom port ALPM configuration based on crtc_state setup. This is called as
> + * a part of link training preparation.
> + */
> +void intel_alpm_port_configure(struct intel_dp *intel_dp,
> +			       const struct intel_crtc_state *crtc_state)
> +{
> +	struct intel_display *display = to_intel_display(intel_dp);
> +	enum port port = dp_to_dig_port(intel_dp)->base.port;
> +	u32 alpm_ctl_val = 0, lfps_ctl_val = 0;
> +
> +	if (intel_alpm_is_alpm_aux_less(intel_dp, crtc_state)) {
> +		alpm_ctl_val = PORT_ALPM_CTL_ALPM_AUX_LESS_ENABLE |
> +			PORT_ALPM_CTL_MAX_PHY_SWING_SETUP(15) |
> +			PORT_ALPM_CTL_MAX_PHY_SWING_HOLD(0) |
> +			PORT_ALPM_CTL_SILENCE_PERIOD(
> +				intel_dp->alpm_parameters.silence_period_sym_clocks);
> +		lfps_ctl_val = PORT_ALPM_LFPS_CTL_LFPS_CYCLE_COUNT(10) |
> +			PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION(
> +				intel_dp->alpm_parameters.lfps_half_cycle_num_of_syms) |
> +			PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION(
> +				intel_dp->alpm_parameters.lfps_half_cycle_num_of_syms) |
> +			PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION(
> +				intel_dp->alpm_parameters.lfps_half_cycle_num_of_syms);
> +	}
> +
> +	intel_de_write(display, PORT_ALPM_CTL(port), alpm_ctl_val);
> +
> +	intel_de_write(display, PORT_ALPM_LFPS_CTL(port), lfps_ctl_val);
> +}
> +
>   void intel_alpm_pre_plane_update(struct intel_atomic_state *state,
>   				 struct intel_crtc *crtc)
>   {
> diff --git a/drivers/gpu/drm/i915/display/intel_alpm.h b/drivers/gpu/drm/i915/display/intel_alpm.h
> index 83bbe0b7ff100..c9ddb2113fe0d 100644
> --- a/drivers/gpu/drm/i915/display/intel_alpm.h
> +++ b/drivers/gpu/drm/i915/display/intel_alpm.h
> @@ -25,6 +25,8 @@ void intel_alpm_configure(struct intel_dp *intel_dp,
>   			  const struct intel_crtc_state *crtc_state);
>   void intel_alpm_pre_plane_update(struct intel_atomic_state *state,
>   				 struct intel_crtc *crtc);
> +void intel_alpm_port_configure(struct intel_dp *intel_dp,
> +			       const struct intel_crtc_state *crtc_state);
>   void intel_alpm_post_plane_update(struct intel_atomic_state *state,
>   				  struct intel_crtc *crtc);
>   void intel_alpm_lobf_debugfs_add(struct intel_connector *connector);
> diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> index b09f724c3046b..1318886e34dd7 100644
> --- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
> @@ -10,6 +10,7 @@
>   
>   #include "i915_reg.h"
>   #include "i915_utils.h"
> +#include "intel_alpm.h"
>   #include "intel_cx0_phy.h"
>   #include "intel_cx0_phy_regs.h"
>   #include "intel_ddi.h"
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 74132c1d63858..ce7a4765b10ea 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3743,6 +3743,12 @@ static void mtl_ddi_prepare_link_retrain(struct intel_dp *intel_dp,
>   
>   	intel_ddi_buf_enable(encoder, intel_dp->DP);
>   	intel_dp->DP |= DDI_BUF_CTL_ENABLE;
> +
> +	/*
> +	 * 6.k If AUX-Less ALPM is going to be enabled
> +	 *     i. Configure PORT_ALPM_CTL and PORT_ALPM_LFPS_CTL here
> +	 */
> +	intel_alpm_port_configure(intel_dp, crtc_state);

I think we should add a check to ensure this code runs only on LNL+ 
platforms (which supports ALPM).

Otherwise, we might end up writing 
|PORT_ALPM_CTL|and|PORT_ALPM_LFPS_CTL| that are not defined on earlier 
platforms, which could lead to unintended behavior.

Regards,

Ankit

>   }
>   
>   static void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp,

  reply	other threads:[~2025-05-20  9:01 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02  8:58 [PATCH 00/11] Panel Replay + Adaptive sync Jouni Högander
2025-05-02  8:58 ` [PATCH 01/11] drm/dp: Add Panel Replay capability bits from DP2.1 specification Jouni Högander
2025-05-02  9:19   ` Jani Nikula
2025-05-02  9:28     ` Hogander, Jouni
2025-05-20  8:36   ` Nautiyal, Ankit K
2025-05-20 16:53     ` Hogander, Jouni
2025-05-02  8:58 ` [PATCH 02/11] drm/i915/psr: Read both Panel Replay capability registers from DPCD Jouni Högander
2025-05-20  8:45   ` Nautiyal, Ankit K
2025-05-20 16:54     ` Hogander, Jouni
2025-05-02  8:58 ` [PATCH 03/11] drm/i915/alpm: Add PR_ALPM_CTL register definitions Jouni Högander
2025-05-20  8:46   ` Nautiyal, Ankit K
2025-05-02  8:58 ` [PATCH 04/11] drm/i915/alpm: Write PR_ALPM_CTL register Jouni Högander
2025-05-20  8:49   ` Nautiyal, Ankit K
2025-05-20 16:55     ` Hogander, Jouni
2025-05-02  8:58 ` [PATCH 05/11] drm/i915/psr: Add interface to check if AUXLess ALPM is needed by PSR Jouni Högander
2025-05-20  8:52   ` Nautiyal, Ankit K
2025-05-20  9:19     ` Nautiyal, Ankit K
2025-05-20 16:56     ` Hogander, Jouni
2025-05-02  8:58 ` [PATCH 06/11] drm/i915/alpm: Add new interface to check if AUXLess ALPM is used Jouni Högander
2025-05-20  8:54   ` Nautiyal, Ankit K
2025-05-20 16:57     ` Hogander, Jouni
2025-05-02  8:58 ` [PATCH 07/11] drm/i915/alpm: Move port alpm configuration Jouni Högander
2025-05-20  9:00   ` Nautiyal, Ankit K [this message]
2025-05-20 16:59     ` Hogander, Jouni
2025-05-02  8:58 ` [PATCH 08/11] drm/i915/display: Add PHY_CMN1_CONTROL register definitions Jouni Högander
2025-05-20  9:01   ` Nautiyal, Ankit K
2025-05-02  8:59 ` [PATCH 09/11] drm/i915/display: Add function to configure LFPS sending Jouni Högander
2025-05-20  9:08   ` Nautiyal, Ankit K
2025-05-20 17:01     ` Hogander, Jouni
2025-05-02  8:59 ` [PATCH 10/11] drm/i915/psr: Fix using wrong mask in REG_FIELD_PREP Jouni Högander
2025-05-20  9:09   ` Nautiyal, Ankit K
2025-05-02  8:59 ` [PATCH 11/11] drm/i915/psr: Do not disable Panel Replay in case VRR is enabled Jouni Högander
2025-05-20  9:13   ` Nautiyal, Ankit K
2025-05-02 13:08 ` ✗ Fi.CI.CHECKPATCH: warning for Panel Replay + Adaptive sync Patchwork
2025-05-02 13:08 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-05-02 13:30 ` ✓ i915.CI.BAT: success " Patchwork
2025-05-02 18:19 ` ✗ i915.CI.Full: 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=eae1ec28-109a-41c6-a17e-3a45b50e6a0e@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jouni.hogander@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