Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Takashi Iwai <tiwai@suse.de>, Jani Nikula <jani.nikula@intel.com>
Subject: [Intel-gfx] [PATCH v3 11/15] drm/i915/sdvo: Do ELD hardware readout
Date: Thu, 10 Nov 2022 14:55:14 +0200	[thread overview]
Message-ID: <20221110125514.26102-1-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20221108151839.31567-12-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Read out the ELD from the hw so the state checker can verify it.

v2: Check the "ELD valid" bit separately
v3: Fix ELD tx rate handling during readout

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com> #v1
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 27 ++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
index c269cd6ddb63..91c3cb17e8c6 100644
--- a/drivers/gpu/drm/i915/display/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
@@ -1068,7 +1068,8 @@ static ssize_t intel_sdvo_read_infoframe(struct intel_sdvo *intel_sdvo,
 				  &tx_rate, 1))
 		return -ENXIO;
 
-	if (tx_rate == SDVO_HBUF_TX_DISABLED)
+	/* TX_DISABLED doesn't mean disabled for ELD */
+	if (if_index != SDVO_HBUF_INDEX_ELD && tx_rate == SDVO_HBUF_TX_DISABLED)
 		return 0;
 
 	if (!intel_sdvo_get_hbuf_size(intel_sdvo, &hbuf_size))
@@ -1185,6 +1186,28 @@ static void intel_sdvo_get_avi_infoframe(struct intel_sdvo *intel_sdvo,
 			      frame->any.type, HDMI_INFOFRAME_TYPE_AVI);
 }
 
+static void intel_sdvo_get_eld(struct intel_sdvo *intel_sdvo,
+			       struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(intel_sdvo->base.base.dev);
+	ssize_t len;
+	u8 val;
+
+	if (!crtc_state->has_audio)
+		return;
+
+	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_AUDIO_STAT, &val, 1))
+		return;
+
+	if ((val & SDVO_AUDIO_ELD_VALID) == 0)
+		return;
+
+	len = intel_sdvo_read_infoframe(intel_sdvo, SDVO_HBUF_INDEX_ELD,
+					crtc_state->eld, sizeof(crtc_state->eld));
+	if (len < 0)
+		drm_dbg_kms(&i915->drm, "failed to read ELD\n");
+}
+
 static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo,
 				     const struct drm_connector_state *conn_state)
 {
@@ -1742,6 +1765,8 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
 	}
 
 	intel_sdvo_get_avi_infoframe(intel_sdvo, pipe_config);
+
+	intel_sdvo_get_eld(intel_sdvo, pipe_config);
 }
 
 static void intel_sdvo_disable_audio(struct intel_sdvo *intel_sdvo)
-- 
2.37.4


  reply	other threads:[~2022-11-10 12:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 15:18 [Intel-gfx] [PATCH v2 00/15] drm/i915: ELD precompute and readout Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 01/15] drm/i915/audio: Don't program the hardware ELD buffer on ilk+ Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 02/15] drm/i915/audio: Don't program the hardware ELD buffer on hsw+ Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 03/15] drm/i915/audio: Unify get_saved_enc() Ville Syrjala
2022-11-08 16:11   ` Jani Nikula
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 04/15] drm/i915/audio: Realign some function arguments Ville Syrjala
2022-11-08 16:11   ` Jani Nikula
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 05/15] drm/i915/audio: Introduce a struct for the acomp audio state Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 06/15] drm/i915/audio: Precompute the ELD Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 07/15] drm/i915/audio: Don't enable audio with bogus ELD Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 08/15] drm/i915/audio: Hardware ELD readout Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 09/15] drm/i915/sdvo: Precompute the ELD Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 10/15] drm/i915/sdvo: Only use "presence detect" for has_audio readout Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 11/15] drm/i915/sdvo: Do ELD hardware readout Ville Syrjala
2022-11-10 12:55   ` Ville Syrjala [this message]
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 12/15] drm/i915/audio: Hook up ELD into the state checker Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 13/15] drm/i915/audio: Include ELD in the state dump Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 14/15] drm/i915/audio: s/ilk/ibx/ Ville Syrjala
2022-11-08 15:18 ` [Intel-gfx] [PATCH v2 15/15] drm/i915/audio: Clean up the PCH type checks Ville Syrjala
2022-11-08 17:37 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: ELD precompute and readout (rev3) Patchwork
2022-11-08 17:37 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-11-08 17:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-11-08 23:58 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-11-11  2:43 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: ELD precompute and readout (rev4) Patchwork
2022-11-11  2:43 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-11  3:39 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-11-11 17:54 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-01-18 19:30 ` [Intel-gfx] [PATCH v2 00/15] drm/i915: ELD precompute and readout Kai Vehmanen

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=20221110125514.26102-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=tiwai@suse.de \
    /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