public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 4/4] test/chamelium: Add HDMI slow unplug workaround
Date: Fri, 28 Jun 2019 14:40:09 -0700	[thread overview]
Message-ID: <20190628214009.16962-4-jose.souza@intel.com> (raw)
In-Reply-To: <20190628214009.16962-1-jose.souza@intel.com>

HDMI specification states that the HPD should be shorter then the
other pins, so slowing unpluging will cause a HPD interruption that
can be processed before the other pins lose contact, so kernel will
be able to read the data lines and will keep the connector as
connected.
A workaround was added in kernel to retry the hotplug detection in
case we detect a hotplug and there is not change in the connector
state, so lets add a test to simulate that issue using chamelium.

Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 tests/kms_chamelium.c | 56 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 213686bf..0e680be2 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -308,6 +308,59 @@ test_fast_hotplug_handling(data_t *data, struct chamelium_port *port,
 	igt_require(status == DRM_MODE_DISCONNECTED);
 }
 
+static void
+test_slow_hdmi_unplug_wa(data_t *data, struct chamelium_port *port)
+{
+	struct udev_monitor *mon = igt_watch_hotplug();
+	drmModeConnection status;
+
+	/*
+	 * From gen11+ we check the HPD pin state in HDMI probe detection, if
+	 * disconnected it gives up as set connector as disconnected without
+	 * trying to read the data lines, so this WA is not needed for gen11+.
+	 */
+	igt_require(intel_gen(intel_get_drm_devid(data->drm_fd)) < 11);
+
+	/* Reset will unplug all connectors */
+	reset_state(data, NULL);
+
+	/* Check if it device can act on hotplugs fast enough for this test */
+	test_fast_hotplug_handling(data, port, mon);
+
+	/* It is fast enough, lets plug the port again */
+	igt_flush_hotplugs(mon);
+	chamelium_plug(data->chamelium, port);
+	igt_assert(igt_hotplug_detected(mon, FAST_HOTPLUG_TIMEOUT));
+	status = connector_status_get(data, port);
+	igt_assert(status == DRM_MODE_CONNECTED);
+
+	/*
+	 * Now lets just unplug the HPD, leaving DDC and EDID available so
+	 * kernel will keep the connector as connected
+	 */
+	igt_flush_hotplugs(mon);
+	chamelium_unplug_hpd(data->chamelium, port);
+	/* Going from connected to connected is fast */
+	igt_hotplug_detected(mon, FAST_HOTPLUG_TIMEOUT / 2);
+	status = connector_status_get(data, port);
+	igt_assert(status == DRM_MODE_CONNECTED);
+
+	/*
+	 * Now disconnected DDC, the kernel workaround should reprobe and
+	 * change connector status do disconnected.
+	 */
+	chamelium_port_set_ddc_state(data->chamelium, port, false);
+
+	/*
+	 * A bigger timeout is needed here because kernel will take at least
+	 * 256msec~640msec to go from connected to disconnected(see comment in
+	 * test_late_aux_wa to more information) + 1 sec to run the workaround
+	 */
+	igt_assert(igt_hotplug_detected(mon, FAST_HOTPLUG_TIMEOUT * 2));
+	status = connector_status_get(data, port);
+	igt_assert(status == DRM_MODE_DISCONNECTED);
+}
+
 /*
  * Test kernel workaround for sinks that takes some time to have the DDC/aux
  * channel responsive after the hotplug
@@ -2433,6 +2486,9 @@ igt_main
 		connector_subtest("hdmi-audio-edid", HDMIA)
 			test_display_audio_edid(&data, port,
 						TEST_EDID_HDMI_AUDIO);
+
+		connector_subtest("hdmi-slow-unplug-wa", HDMIA)
+			test_slow_hdmi_unplug_wa(&data, port);
 	}
 
 	igt_subtest_group {
-- 
2.22.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-06-28 21:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 21:40 [igt-dev] [PATCH i-g-t v2 1/4] tests/chamelium: Add test for type-c hotplug workaround José Roberto de Souza
2019-06-28 21:40 ` [igt-dev] [PATCH i-g-t v2 2/4] lib: Convert igt_hotplug_detected to msec José Roberto de Souza
2019-06-28 21:40 ` [igt-dev] [PATCH i-g-t v2 3/4] lib: Add new chamelium method: UnplugHPD José Roberto de Souza
2019-06-28 21:40 ` José Roberto de Souza [this message]
2019-06-28 23:23 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/4] tests/chamelium: Add test for type-c hotplug workaround Patchwork
2019-06-29 11:31 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20190628214009.16962-4-jose.souza@intel.com \
    --to=jose.souza@intel.com \
    --cc=igt-dev@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