This adds support for the newly-introduced ScheduleHpdToggle XMLRPC
method of the Chamelium's interface. It allows scheduling an HPD toggle,
for which the call will return immediately.

This is especially useful for testing HPD during suspend/resume.

Signed-off-by: Paul Kocialkowski <paul.kocialkow...@linux.intel.com>
---
 lib/igt_chamelium.c | 22 ++++++++++++++++++++++
 lib/igt_chamelium.h |  3 +++
 2 files changed, 25 insertions(+)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 4a2af796..523cc853 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -447,6 +447,28 @@ void chamelium_fire_mixed_hpd_pulses(struct chamelium 
*chamelium,
        xmlrpc_DECREF(pulse_widths);
 }
 
+/**
+ * chamelium_schedule_hpd_toggle:
+ * @chamelium: The Chamelium instance to use
+ * @port: The port to fire the HPD pulses on
+ * @delay_ms: Delay in milli-second before the toggle takes place
+ * @rising_edge: Whether the toggle should be a rising edge or a falling edge
+ *
+ * Instructs the chamelium to schedule an hpd toggle (either a rising edge or
+ * a falling edge, depending on @rising_edg) after @delay_ms have passed.
+ * This is useful for testing things such as hpd after a suspend/resume cycle.
+ */
+void chamelium_schedule_hpd_toggle(struct chamelium *chamelium,
+                                  struct chamelium_port *port, int delay_ms,
+                                  bool rising_edge)
+{
+       igt_debug("Scheduling HPD toggle on %s in %d ms\n", port->name,
+                 delay_ms);
+
+       xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "ScheduleHpdToggle",
+                                   "(iii)", port->id, delay_ms, rising_edge));
+}
+
 static void async_rpc_handler(const char *server_url, const char *method_name,
                              xmlrpc_value *param_array, void *user_data,
                              xmlrpc_env *fault, xmlrpc_value *result)
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index 15f60246..408a4b85 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -61,6 +61,9 @@ void chamelium_fire_mixed_hpd_pulses(struct chamelium 
*chamelium,
 void chamelium_fire_hpd_pulses(struct chamelium *chamelium,
                               struct chamelium_port *port,
                               int width_msec, int count);
+void chamelium_schedule_hpd_toggle(struct chamelium *chamelium,
+                                  struct chamelium_port *port, int delay_ms,
+                                  bool rising_edge);
 void chamelium_async_hpd_pulse_start(struct chamelium *chamelium,
                                     struct chamelium_port *port,
                                     bool high, int delay_secs);
-- 
2.13.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to