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 3/4] lib: Add new chamelium method: UnplugHPD
Date: Fri, 28 Jun 2019 14:40:08 -0700	[thread overview]
Message-ID: <20190628214009.16962-3-jose.souza@intel.com> (raw)
In-Reply-To: <20190628214009.16962-1-jose.souza@intel.com>

This is a recently added method that will just unplug the hotplug
detection pin in chamelium, the regular Unplug also unplug the
DDC and EDID.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 lib/igt_chamelium.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_chamelium.h |  2 ++
 2 files changed, 53 insertions(+)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index d3ddba6a..f407e395 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -326,6 +326,31 @@ static xmlrpc_value *__chamelium_rpc(struct chamelium *chamelium,
 	return res;
 }
 
+/*
+ * Same as chamelium_rpc() but it returns 0 when successfully executed
+ * otherwise it return the error code instead of fail the test.
+ */
+static int chamelium_try_rpc(struct chamelium *chamelium,
+			     struct chamelium_port *fsm_port,
+			     xmlrpc_value **res,
+			     const char *method_name,
+			     const char *format_str,
+			     ...)
+{
+	va_list va_args;
+
+	va_start(va_args, format_str);
+	*res = __chamelium_rpc_va(chamelium, fsm_port, method_name,
+				 format_str, va_args);
+	va_end(va_args);
+
+	if (chamelium->env.fault_occurred)
+		igt_debug("Chamelium RPC call failed: %s\n",
+			  chamelium->env.fault_string);
+
+	return chamelium->env.fault_code;
+}
+
 static xmlrpc_value *chamelium_rpc(struct chamelium *chamelium,
 				   struct chamelium_port *fsm_port,
 				   const char *method_name,
@@ -376,6 +401,32 @@ void chamelium_unplug(struct chamelium *chamelium, struct chamelium_port *port)
 				    port->id));
 }
 
+/*
+ * Unplug only the hotplug detection pin, leaving the data lanes intact.
+ */
+void chamelium_unplug_hpd(struct chamelium *chamelium,
+			  struct chamelium_port *port)
+{
+	xmlrpc_value *res;
+	int ret;
+
+	igt_debug("Unplugging hpd port %s\n", port->name);
+	ret = chamelium_try_rpc(chamelium, NULL, &res, "UnplugHPD", "(i)",
+				port->id);
+	if (ret) {
+		/*
+		 * This is a new method so if chamelium daemon still do not
+		 * support it, skip the test otherwise fail the test.
+		 */
+		igt_require(ret != XMLRPC_NO_SUCH_METHOD_ERROR);
+		igt_assert_f(ret == XMLRPC_NO_SUCH_METHOD_ERROR,
+			     "Chamelium RPC call failed: %s\n",
+			     chamelium->env.fault_string);
+	} else {
+		xmlrpc_DECREF(res);
+	}
+}
+
 /**
  * chamelium_is_plugged:
  * @chamelium: The Chamelium instance to use
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index ce9e9ced..61efca20 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -87,6 +87,8 @@ const char *chamelium_port_get_name(struct chamelium_port *port);
 
 void chamelium_plug(struct chamelium *chamelium, struct chamelium_port *port);
 void chamelium_unplug(struct chamelium *chamelium, struct chamelium_port *port);
+void chamelium_unplug_hpd(struct chamelium *chamelium,
+			  struct chamelium_port *port);
 bool chamelium_is_plugged(struct chamelium *chamelium,
 			  struct chamelium_port *port);
 bool chamelium_port_wait_video_input_stable(struct chamelium *chamelium,
-- 
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 ` José Roberto de Souza [this message]
2019-06-28 21:40 ` [igt-dev] [PATCH i-g-t v2 4/4] test/chamelium: Add HDMI slow unplug workaround José Roberto de Souza
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-3-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