[PATCH i-g-t v2 19/39] lib/chamelium/v3: Implement Chamelium reinitialization via Reset RPC call

Louis Chauvet louis.chauvet at bootlin.com
Tue Jul 9 15:34:35 UTC 2024


Introduce the Reset RPC function to reinitialize the Chamelium, ensuring
it returns to a known state. This feature is particularly useful for
testing and debugging purposes.

Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
 lib/chamelium/v3/igt_chamelium.c | 16 ++++++++++++++++
 lib/chamelium/v3/igt_chamelium.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/lib/chamelium/v3/igt_chamelium.c b/lib/chamelium/v3/igt_chamelium.c
index 5a7e42334e81..af6ab5c6c9b7 100644
--- a/lib/chamelium/v3/igt_chamelium.c
+++ b/lib/chamelium/v3/igt_chamelium.c
@@ -188,6 +188,22 @@ static xmlrpc_value *__chamelium_rpc(struct igt_chamelium_v3 *chamelium,
  * [1]: https://chromium.googlesource.com/chromiumos/platform/chameleon/+/refs/heads/main/v3/chameleond/v3.py
  */
 
+/**
+ * chamelium_v3_reset - Reset the chamelium
+ *
+ * @chamelium: Chamelium to reset
+ *
+ * Reset the chamelium to a know state (no plugged ports, no EDID applied...).
+ *
+ * Note: The current chamelium firmware does not reset scheduled hot plug, this may cause issue in
+ * some situations.
+ */
+void chamelium_v3_reset(struct igt_chamelium_v3 *chamelium)
+{
+	igt_debug("RPC Reset()\n");
+	xmlrpc_DECREF(__chamelium_rpc(chamelium, "Reset", "()"));
+}
+
 /**
  * chamelium_v3_get_supported_ports - Get the list of ports on the chamelium
  *
diff --git a/lib/chamelium/v3/igt_chamelium.h b/lib/chamelium/v3/igt_chamelium.h
index ae3225873bfb..88b407dfd1ae 100644
--- a/lib/chamelium/v3/igt_chamelium.h
+++ b/lib/chamelium/v3/igt_chamelium.h
@@ -42,6 +42,7 @@ struct igt_chamelium_v3 *chamelium_v3_init_from_config(void);
 
 void chamelium_v3_uninit(struct igt_chamelium_v3 *chamelium);
 
+void chamelium_v3_reset(struct igt_chamelium_v3 *chamelium);
 int chamelium_v3_get_supported_ports(struct igt_chamelium_v3 *chamelium,
 				     chamelium_v3_port_id **port_ids);
 int chamelium_v3_get_children(struct igt_chamelium_v3 *chamelium, chamelium_v3_port_id port_id,

-- 
2.44.2



More information about the igt-dev mailing list