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 2/3] drm/i915/lspcon: Separate out function to set pcon mode
Date: Mon,  8 Apr 2024 10:35:57 +0530	[thread overview]
Message-ID: <20240408050558.865396-3-ankit.k.nautiyal@intel.com> (raw)
In-Reply-To: <20240408050558.865396-1-ankit.k.nautiyal@intel.com>

Currently lspcon_probe tries to probe for LSPCON and also set the
PCON mode on the LSPCON. If any of these fails, it returns fail
resulting in error message. So even if there is nothing connected to
LSPCON port we get error messages for probe failure.

Separate out the function to set pcon mode from the lspcon_probe
function, and show the error message only when the set pcon mode fails.
Do not show error message if no LSPCON is detected.

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

diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
index 36e8d9fb2bbb..16ee0dc179f7 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
@@ -277,17 +277,22 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)
 	drm_dbg_kms(&i915->drm, "LSPCON detected\n");
 	lspcon->mode = lspcon_wait_mode(lspcon, expected_mode);
 
+	return true;
+}
+
+static bool lspcon_set_pcon_mode(struct intel_lspcon *lspcon)
+{
 	/*
 	 * In the SW state machine, lets Put LSPCON in PCON mode only.
 	 * In this way, it will work with both HDMI 1.4 sinks as well as HDMI
 	 * 2.0 sinks.
 	 */
-	if (lspcon->mode != DRM_LSPCON_MODE_PCON) {
-		if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0) {
-			drm_err(&i915->drm, "LSPCON mode change to PCON failed\n");
-			return false;
-		}
-	}
+	if (lspcon->mode == DRM_LSPCON_MODE_PCON)
+		return true;
+
+	if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0)
+		return false;
+
 	return true;
 }
 
@@ -671,8 +676,11 @@ bool lspcon_init(struct intel_digital_port *dig_port)
 	lspcon->active = false;
 	lspcon->mode = DRM_LSPCON_MODE_INVALID;
 
-	if (!lspcon_probe(lspcon)) {
-		drm_err(&i915->drm, "Failed to probe lspcon\n");
+	if (!lspcon_probe(lspcon))
+		return false;
+
+	if (!lspcon_set_pcon_mode(lspcon)) {
+		drm_err(&i915->drm, "LSPCON mode change to PCON failed\n");
 		return false;
 	}
 
-- 
2.40.1


  parent 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 ` [PATCH 1/3] drm/i915/lspcon: Separate out function to get expected mode Ankit Nautiyal
2024-04-08  9:46   ` Jani Nikula
2024-04-08  5:05 ` Ankit Nautiyal [this message]
2024-04-08  9:50   ` [PATCH 2/3] drm/i915/lspcon: Separate out function to set pcon mode 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-3-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.