test: Add tests for the extcon
Provide tests to the simple extcon device.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index 8a50250..6fd3d2b 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -12,4 +12,11 @@
and to host USB ports. Many of 30-pin connectors including PDMI
are also good examples.
+config EXTCON_SANDBOX
+ bool "Sandbox extcon"
+ depends on EXTCON
+ help
+ Enable extcon support for sandbox. This is an emulation of a real
+ extcon. Currectly all configuration is done in the probe.
+
endmenu
diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
index 2510e91..c4223d9 100644
--- a/drivers/extcon/Makefile
+++ b/drivers/extcon/Makefile
@@ -3,3 +3,4 @@
# Copyright (C) 2023 Svyatoslav Ryhel <clamor95@gmail.com>
obj-$(CONFIG_EXTCON) += extcon-uclass.o
+obj-$(CONFIG_EXTCON_SANDBOX) += extcon-sandbox.o
diff --git a/drivers/extcon/extcon-sandbox.c b/drivers/extcon/extcon-sandbox.c
new file mode 100644
index 0000000..ab6a6c1
--- /dev/null
+++ b/drivers/extcon/extcon-sandbox.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#include <dm.h>
+
+static const struct udevice_id sandbox_extcon_ids[] = {
+ { .compatible = "sandbox,extcon" },
+ { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(extcon_sandbox) = {
+ .name = "extcon_sandbox",
+ .id = UCLASS_EXTCON,
+ .of_match = sandbox_extcon_ids,
+};