Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: [PATCH 1/3] drm/i915/pps: Add helpers to lock PPS for AUX transfers
Date: Fri, 21 Mar 2025 16:56:24 +0200	[thread overview]
Message-ID: <20250321145626.94101-2-imre.deak@intel.com> (raw)
In-Reply-To: <20250321145626.94101-1-imre.deak@intel.com>

Factor out from the DP AUX transfer function the logic to lock/unlock
the Panel Power Sequencer state and enable/disable the VDD power
required for the AUX transfer, adding these to helpers in intel_pps.c .
This prepares for a follow-up change making these steps dependent on the
platform and output type.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp_aux.c | 16 ++----------
 drivers/gpu/drm/i915/display/intel_pps.c    | 29 ++++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_pps.h    |  3 ++-
 3 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.c b/drivers/gpu/drm/i915/display/intel_dp_aux.c
index ec27bbd70bcf0..bf5ccfa24ca0b 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
@@ -272,15 +272,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
 	aux_domain = intel_aux_power_domain(dig_port);
 
 	aux_wakeref = intel_display_power_get(display, aux_domain);
-	pps_wakeref = intel_pps_lock(intel_dp);
-
-	/*
-	 * We will be called with VDD already enabled for dpcd/edid/oui reads.
-	 * In such cases we want to leave VDD enabled and it's up to upper layers
-	 * to turn it off. But for eg. i2c-dev access we need to turn it on/off
-	 * ourselves.
-	 */
-	vdd = intel_pps_vdd_on_unlocked(intel_dp);
+	pps_wakeref = intel_pps_lock_for_aux(intel_dp, &vdd);
 
 	/*
 	 * dp aux is extremely sensitive to irq latency, hence request the
@@ -289,8 +281,6 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
 	 */
 	cpu_latency_qos_update_request(&intel_dp->pm_qos, 0);
 
-	intel_pps_check_power_unlocked(intel_dp);
-
 	/*
 	 * FIXME PSR should be disabled here to prevent
 	 * it using the same AUX CH simultaneously
@@ -427,10 +417,8 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
 out:
 	cpu_latency_qos_update_request(&intel_dp->pm_qos, PM_QOS_DEFAULT_VALUE);
 
-	if (vdd)
-		intel_pps_vdd_off_unlocked(intel_dp, false);
+	intel_pps_unlock_for_aux(intel_dp, pps_wakeref, vdd);
 
-	intel_pps_unlock(intel_dp, pps_wakeref);
 	intel_display_power_put_async(display, aux_domain, aux_wakeref);
 out_unlock:
 	intel_digital_port_unlock(encoder);
diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
index 617ce49931726..3c078fd53fbfa 100644
--- a/drivers/gpu/drm/i915/display/intel_pps.c
+++ b/drivers/gpu/drm/i915/display/intel_pps.c
@@ -571,7 +571,7 @@ static bool edp_have_panel_vdd(struct intel_dp *intel_dp)
 	return intel_de_read(display, _pp_ctrl_reg(intel_dp)) & EDP_FORCE_VDD;
 }
 
-void intel_pps_check_power_unlocked(struct intel_dp *intel_dp)
+static void intel_pps_check_power_unlocked(struct intel_dp *intel_dp)
 {
 	struct intel_display *display = to_intel_display(intel_dp);
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
@@ -955,6 +955,33 @@ void intel_pps_vdd_off(struct intel_dp *intel_dp)
 		intel_pps_vdd_off_unlocked(intel_dp, false);
 }
 
+intel_wakeref_t intel_pps_lock_for_aux(struct intel_dp *intel_dp, bool *vdd_ref)
+{
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_pps_lock(intel_dp);
+
+	/*
+	 * We will be called with VDD already enabled for dpcd/edid/oui reads.
+	 * In such cases we want to leave VDD enabled and it's up to upper layers
+	 * to turn it off. But for eg. i2c-dev access we need to turn it on/off
+	 * ourselves.
+	 */
+	*vdd_ref = intel_pps_vdd_on_unlocked(intel_dp);
+
+	intel_pps_check_power_unlocked(intel_dp);
+
+	return wakeref;
+}
+
+void intel_pps_unlock_for_aux(struct intel_dp *intel_dp, intel_wakeref_t wakeref, bool vdd_ref)
+{
+	if (vdd_ref)
+		intel_pps_vdd_off_unlocked(intel_dp, false);
+
+	intel_pps_unlock(intel_dp, wakeref);
+}
+
 void intel_pps_on_unlocked(struct intel_dp *intel_dp)
 {
 	struct intel_display *display = to_intel_display(intel_dp);
diff --git a/drivers/gpu/drm/i915/display/intel_pps.h b/drivers/gpu/drm/i915/display/intel_pps.h
index c83007152f07d..4390d05892325 100644
--- a/drivers/gpu/drm/i915/display/intel_pps.h
+++ b/drivers/gpu/drm/i915/display/intel_pps.h
@@ -31,10 +31,11 @@ bool intel_pps_vdd_on_unlocked(struct intel_dp *intel_dp);
 void intel_pps_vdd_off_unlocked(struct intel_dp *intel_dp, bool sync);
 void intel_pps_on_unlocked(struct intel_dp *intel_dp);
 void intel_pps_off_unlocked(struct intel_dp *intel_dp);
-void intel_pps_check_power_unlocked(struct intel_dp *intel_dp);
 
 void intel_pps_vdd_on(struct intel_dp *intel_dp);
 void intel_pps_vdd_off(struct intel_dp *intel_dp);
+intel_wakeref_t intel_pps_lock_for_aux(struct intel_dp *intel_dp, bool *vdd_ref);
+void intel_pps_unlock_for_aux(struct intel_dp *intel_dp, intel_wakeref_t wakeref, bool vdd_ref);
 void intel_pps_on(struct intel_dp *intel_dp);
 void intel_pps_off(struct intel_dp *intel_dp);
 void intel_pps_vdd_off_sync(struct intel_dp *intel_dp);
-- 
2.44.2


  reply	other threads:[~2025-03-21 14:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 14:56 [PATCH 0/3] drm/i915: Fix DP MST SB message timeouts due to PPS delays Imre Deak
2025-03-21 14:56 ` Imre Deak [this message]
2025-03-24 10:33   ` [PATCH 1/3] drm/i915/pps: Add helpers to lock PPS for AUX transfers Jani Nikula
2025-03-24 12:01     ` Imre Deak
2025-03-24 12:28       ` Jani Nikula
2025-03-24 13:52         ` Imre Deak
2025-03-24 13:59           ` Jani Nikula
2025-03-24 14:04             ` Imre Deak
2025-03-24 14:32               ` Jani Nikula
2025-03-21 14:56 ` [PATCH 2/3] drm/i915/dp_mst: Fix side-band message timeouts due to long PPS delays Imre Deak
2025-03-21 18:00   ` Ville Syrjälä
2025-03-21 18:38     ` Imre Deak
2025-03-21 18:44       ` Ville Syrjälä
2025-03-21 19:11         ` Imre Deak
2025-03-24 10:36           ` Jani Nikula
2025-03-21 14:56 ` [PATCH 3/3] drm/i915/pps: Use intel_pps_is_pipe_instance() instead of open-coding it Imre Deak
2025-03-21 18:03   ` Ville Syrjälä
2025-03-21 18:43     ` Imre Deak
2025-03-24  9:59       ` Jani Nikula
2025-03-21 15:01 ` ✓ CI.Patch_applied: success for drm/i915: Fix DP MST SB message timeouts due to PPS delays Patchwork
2025-03-21 15:01 ` ✓ CI.checkpatch: " Patchwork
2025-03-21 15:02 ` ✓ CI.KUnit: " Patchwork
2025-03-21 15:19 ` ✓ CI.Build: " Patchwork
2025-03-21 15:21 ` ✓ CI.Hooks: " Patchwork
2025-03-21 15:23 ` ✓ CI.checksparse: " Patchwork
2025-03-21 15:44 ` ✓ Xe.CI.BAT: " Patchwork
2025-03-21 17:05 ` ✗ 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=20250321145626.94101-2-imre.deak@intel.com \
    --to=imre.deak@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