intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Jouni Högander" <jouni.hogander@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: "Jouni Högander" <jouni.hogander@intel.com>
Subject: [PATCH 1/4] drm/i915/alpm: Calculate silence period
Date: Wed, 13 Aug 2025 10:06:14 +0300	[thread overview]
Message-ID: <20250813070617.480793-2-jouni.hogander@intel.com> (raw)
In-Reply-To: <20250813070617.480793-1-jouni.hogander@intel.com>

Calculate silence period instead of hardcoding it in switch case.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_alpm.c | 37 +++++++++++------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c b/drivers/gpu/drm/i915/display/intel_alpm.c
index dfdde8e4eabe..e48a4218c163 100644
--- a/drivers/gpu/drm/i915/display/intel_alpm.c
+++ b/drivers/gpu/drm/i915/display/intel_alpm.c
@@ -16,6 +16,12 @@
 #include "intel_psr.h"
 #include "intel_psr_regs.h"
 
+#define SILENCE_PERIOD_MIN_TIME	80
+#define SILENCE_PERIOD_MAX_TIME	180
+#define SILENCE_PERIOD_TIME	(SILENCE_PERIOD_MIN_TIME +	\
+				(SILENCE_PERIOD_MAX_TIME -	\
+				 SILENCE_PERIOD_MIN_TIME) / 2)
+
 bool intel_alpm_aux_wake_supported(struct intel_dp *intel_dp)
 {
 	return intel_dp->alpm_dpcd & DP_ALPM_CAP;
@@ -44,11 +50,15 @@ void intel_alpm_init(struct intel_dp *intel_dp)
 	mutex_init(&intel_dp->alpm_parameters.lock);
 }
 
+static int get_silence_period_symbols(const struct intel_crtc_state *crtc_state)
+{
+	return SILENCE_PERIOD_TIME * intel_dp_link_symbol_clock(crtc_state->port_clock) /
+		1000 / 1000;
+}
+
 /*
  * See Bspec: 71632 for the table
  *
- * Silence_period = tSilence,Min + ((tSilence,Max - tSilence,Min) / 2)
- *
  * Half cycle duration:
  *
  * Link rates 1.62 - 4.32 and tLFPS_Cycle = 70 ns
@@ -60,53 +70,41 @@ void intel_alpm_init(struct intel_dp *intel_dp)
  * FLOOR( LFPS Period in Symbol clocks /
  * (2 * PORT_ALPM_LFPS_CTL[ LFPS Cycle Count ]) )
  */
-static bool _lnl_get_silence_period_and_lfps_half_cycle(int link_rate,
-							int *silence_period,
-							int *lfps_half_cycle)
+static bool _lnl_get_lfps_half_cycle(int link_rate, int *lfps_half_cycle)
 {
 	switch (link_rate) {
 	case 162000:
-		*silence_period = 20;
 		*lfps_half_cycle = 5;
 		break;
 	case 216000:
-		*silence_period = 27;
 		*lfps_half_cycle = 7;
 		break;
 	case 243000:
-		*silence_period = 31;
 		*lfps_half_cycle = 8;
 		break;
 	case 270000:
-		*silence_period = 34;
 		*lfps_half_cycle = 9;
 		break;
 	case 324000:
-		*silence_period = 41;
 		*lfps_half_cycle = 11;
 		break;
 	case 432000:
-		*silence_period = 56;
 		*lfps_half_cycle = 15;
 		break;
 	case 540000:
-		*silence_period = 69;
 		*lfps_half_cycle = 12;
 		break;
 	case 648000:
-		*silence_period = 84;
 		*lfps_half_cycle = 15;
 		break;
 	case 675000:
-		*silence_period = 87;
 		*lfps_half_cycle = 15;
 		break;
 	case 810000:
-		*silence_period = 104;
 		*lfps_half_cycle = 19;
 		break;
 	default:
-		*silence_period = *lfps_half_cycle = -1;
+		*lfps_half_cycle = -1;
 		return false;
 	}
 	return true;
@@ -160,10 +158,9 @@ _lnl_compute_aux_less_alpm_params(struct intel_dp *intel_dp,
 		_lnl_compute_aux_less_wake_time(crtc_state->port_clock);
 	aux_less_wake_lines = intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode,
 						       aux_less_wake_time);
-
-	if (!_lnl_get_silence_period_and_lfps_half_cycle(crtc_state->port_clock,
-							 &silence_period,
-							 &lfps_half_cycle))
+	silence_period = get_silence_period_symbols(crtc_state);
+	if (!_lnl_get_lfps_half_cycle(crtc_state->port_clock,
+				      &lfps_half_cycle))
 		return false;
 
 	if (aux_less_wake_lines > ALPM_CTL_AUX_LESS_WAKE_TIME_MASK ||
-- 
2.43.0


  reply	other threads:[~2025-08-13  7:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13  7:06 [PATCH 0/4] ALPM LFPS and silence period calculation Jouni Högander
2025-08-13  7:06 ` Jouni Högander [this message]
2025-08-28  6:39   ` [PATCH 1/4] drm/i915/alpm: Calculate silence period Manna, Animesh
2025-08-13  7:06 ` [PATCH 2/4] drm/i915/alpm: Add own define for LFPS count Jouni Högander
2025-08-28  7:00   ` Manna, Animesh
2025-08-13  7:06 ` [PATCH 3/4] drm/i915/alpm: Replace hardcoded LFPS cycle with proper calculation Jouni Högander
2025-08-28  7:35   ` Manna, Animesh
2025-08-28  9:39     ` Hogander, Jouni
2025-08-13  7:06 ` [PATCH 4/4] drm/i915/alpm: Use actual lfps cycle and silence periods in wake time Jouni Högander
2025-08-28  7:54   ` Manna, Animesh
2025-08-28  9:48     ` Hogander, Jouni
2025-08-13  7:31 ` ✓ CI.KUnit: success for ALPM LFPS and silence period calculation Patchwork
2025-08-13  8:41 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-13  9:38 ` ✗ Xe.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=20250813070617.480793-2-jouni.hogander@intel.com \
    --to=jouni.hogander@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@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).