[PATCH i-g-t v2 17/26] lib/unigraf: Add plug/unplug helpers

Louis Chauvet louis.chauvet at bootlin.com
Thu Jul 17 18:46:37 UTC 2025


The unigraf can emulate a full cable plug/unplug, so add helper to emulate
this.
---
 lib/unigraf/unigraf.c | 14 ++++++++++++++
 lib/unigraf/unigraf.h | 14 ++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/lib/unigraf/unigraf.c b/lib/unigraf/unigraf.c
index 3998a3af1bef4490bf9d3c796876d268957e87e2..565d63d985b1ea99e839c377d7b87876ba2a12c4 100644
--- a/lib/unigraf/unigraf.c
+++ b/lib/unigraf/unigraf.c
@@ -299,3 +299,17 @@ void unigraf_hpd_deassert(void) {
 	igt_assert(unigraf_device);
 	unigraf_write(TSI_FORCE_HOT_PLUG_STATE_W, &d, sizeof(d));
 }
+
+void unigraf_unplug(void)
+{
+       int d = 2 << 2;
+       igt_assert(unigraf_device);
+       unigraf_write(TSI_DPRX_HPD_FORCE, &d, sizeof(d));
+}
+
+void unigraf_plug(void)
+{
+       int d = 3 << 2;
+       igt_assert(unigraf_device);
+       unigraf_write(TSI_DPRX_HPD_FORCE, &d, sizeof(d));
+}
diff --git a/lib/unigraf/unigraf.h b/lib/unigraf/unigraf.h
index 0a872b6e5859347be371b6a28db5516f4c854d2f..7f6438da66b688b4b7d8aaa6f124474bd2c1d042 100644
--- a/lib/unigraf/unigraf.h
+++ b/lib/unigraf/unigraf.h
@@ -67,4 +67,18 @@ void unigraf_hpd_pulse(int duration);
  */
 void unigraf_hpd_assert(void);
 
+/**
+ * unigraf_plug() - Emulate a cable plug
+ *
+ * This function will emulate a full cable plug (not a simple HPD line change)
+ */
+void unigraf_plug(void);
+
+/**
+ * unigraf_plug() - Emulate a cable unplug
+ *
+ * This function will emulate a full cable unplug (not a simple HPD line change)
+ */
+void unigraf_unplug(void);
+
 #endif // UNIGRAF_H

-- 
2.50.0



More information about the igt-dev mailing list