All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/3] drm/i915/lspcon: Separate out function to get expected mode
Date: Mon,  8 Apr 2024 10:35:56 +0530	[thread overview]
Message-ID: <20240408050558.865396-2-ankit.k.nautiyal@intel.com> (raw)
In-Reply-To: <20240408050558.865396-1-ankit.k.nautiyal@intel.com>

Reuse code to wake native aux channel and get the expected lspcon
mode.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_lspcon.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
index 1d048fa98561..36e8d9fb2bbb 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
@@ -240,6 +240,13 @@ static bool lspcon_wake_native_aux_ch(struct intel_lspcon *lspcon)
 	return true;
 }
 
+static
+enum drm_lspcon_mode lspcon_get_expected_mode(struct intel_lspcon *lspcon)
+{
+	return lspcon_wake_native_aux_ch(lspcon) ?
+		DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
+}
+
 static bool lspcon_probe(struct intel_lspcon *lspcon)
 {
 	int retry;
@@ -249,9 +256,7 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)
 	struct i2c_adapter *ddc = &intel_dp->aux.ddc;
 	enum drm_lspcon_mode expected_mode;
 
-	expected_mode = lspcon_wake_native_aux_ch(lspcon) ?
-			DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
-
+	expected_mode = lspcon_get_expected_mode(lspcon);
 	/* Lets probe the adaptor and check its type */
 	for (retry = 0; retry < 6; retry++) {
 		if (retry)
@@ -713,12 +718,9 @@ void lspcon_resume(struct intel_digital_port *dig_port)
 		}
 	}
 
-	if (lspcon_wake_native_aux_ch(lspcon)) {
-		expected_mode = DRM_LSPCON_MODE_PCON;
+	expected_mode = lspcon_get_expected_mode(lspcon);
+	if (expected_mode == DRM_LSPCON_MODE_PCON)
 		lspcon_resume_in_pcon_wa(lspcon);
-	} else {
-		expected_mode = DRM_LSPCON_MODE_LS;
-	}
 
 	if (lspcon_wait_mode(lspcon, expected_mode) == DRM_LSPCON_MODE_PCON)
 		return;
-- 
2.40.1


  reply	other threads:[~2024-04-08  5:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  5:05 [PATCH 0/3] Avoid unwanted lspcon init and probe warnings Ankit Nautiyal
2024-04-08  5:05 ` Ankit Nautiyal [this message]
2024-04-08  9:46   ` [PATCH 1/3] drm/i915/lspcon: Separate out function to get expected mode Jani Nikula
2024-04-08  5:05 ` [PATCH 2/3] drm/i915/lspcon: Separate out function to set pcon mode Ankit Nautiyal
2024-04-08  9:50   ` Jani Nikula
2024-04-08  5:05 ` [PATCH 3/3] drm/915/lspcon: Reduce dmesg errors during lspcon_init failure Ankit Nautiyal
2024-04-08  9:52   ` Jani Nikula
2024-04-10  3:05   ` [PATCH v2 " Ankit Nautiyal
2024-04-08  5:47 ` ✓ Fi.CI.BAT: success for Avoid unwanted lspcon init and probe warnings (rev2) Patchwork
2024-04-08  7:08 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-04-10  3:59 ` ✓ Fi.CI.BAT: success for Avoid unwanted lspcon init and probe warnings (rev3) Patchwork
2024-04-10 20:45 ` ✗ Fi.CI.IGT: 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=20240408050558.865396-2-ankit.k.nautiyal@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.