[PATCH i-g-t 5/6] tests/kms_feature_discovery: add basic usb4 switch discovery

Kunal Joshi
2026-02-25T19:21:25Z

Add a 'usb4-switch' subtest that verifies the Microsoft USB4 Switch
3141 is reachable. The test initializes the switch library and queries
the active port to confirm communication works.

This enables CI to detect when USB4 switch hardware is available
before running the full kms_usb4_switch test suite.

Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
tests/kms_feature_discovery.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/tests/kms_feature_discovery.c b/tests/kms_feature_discovery.c
index f0216a4ce..b05055186 100644
--- a/tests/kms_feature_discovery.c
+++ b/tests/kms_feature_discovery.c
@@ -40,6 +40,7 @@
#include "igt_psr.h"
#include "igt_sysfs.h"
#include "igt_types.h"
+#include "igt_usb4_switch.h"

/**
* SUBTEST: display
@@ -63,6 +64,9 @@
* SUBTEST: dp-mst
* Description: Make sure that we have DP-MST configuration.
*
+ * SUBTEST: usb4-switch
+ * Description: Verify that USB4 Switch 3141 is available and responding.
+ *
* arg[1].values: 1, 2, 3, 4
*/

@@ -147,6 +151,25 @@ int igt_main() {
}
#endif

+ igt_describe("Verify that USB4 Switch 3141 is available and responding.");
+ igt_subtest("usb4-switch") {
+ struct usb4switch *sw;
+ int port;
+
+ sw = usb4switch_init(fd);
+ igt_require_f(sw,
+ "USB4 Switch 3141 not available\n");
+
+ /* Verify communication works by querying active port */
+ port = usb4switch_get_active_port(sw);
+ igt_assert_f(port >= 0,
+ "Cannot communicate with USB4 switch\n");
+
+ igt_info("USB4 Switch 3141 available (active port: %d)\n",
+ port);
+ usb4switch_deinit(sw);
+ }
+
igt_describe("Make sure that we have eDP panel with PSR1 support.");
igt_subtest("psr1") {
igt_require(psr_sink_support(fd, debugfs_fd, PSR_MODE_1, NULL));
--
2.25.1