dm: extcon: add an uclass for extcon
authorSvyatoslav Ryhel <clamor95@gmail.com>
Tue, 25 Apr 2023 07:57:20 +0000 (10:57 +0300)
committerTom Rini <trini@konsulko.com>
Tue, 2 May 2023 18:23:34 +0000 (14:23 -0400)
Add a new simple uclass for extcon. Currently all setup is done
in the probe. Uclass struct and ops are empty for now.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/Kconfig
drivers/Makefile
drivers/extcon/Kconfig [new file with mode: 0644]
drivers/extcon/Makefile [new file with mode: 0644]
drivers/extcon/extcon-uclass.c [new file with mode: 0644]
include/dm/uclass-id.h
include/extcon.h [new file with mode: 0644]

index 9101e53..75937fb 100644 (file)
@@ -36,6 +36,8 @@ source "drivers/dfu/Kconfig"
 
 source "drivers/dma/Kconfig"
 
+source "drivers/extcon/Kconfig"
+
 source "drivers/fastboot/Kconfig"
 
 source "drivers/firmware/Kconfig"
index 58be410..ed1e71c 100644 (file)
@@ -9,6 +9,7 @@ obj-$(CONFIG_$(SPL_TPL_)DM) += core/
 obj-$(CONFIG_$(SPL_TPL_)DMA) += dma/
 obj-$(CONFIG_$(SPL_TPL_)DMA_LEGACY) += dma/
 obj-$(CONFIG_$(SPL_TPL_)DFU) += dfu/
+obj-$(CONFIG_$(SPL_TPL_)EXTCON) += extcon/
 obj-$(CONFIG_$(SPL_TPL_)GPIO) += gpio/
 obj-$(CONFIG_$(SPL_TPL_)DRIVERS_MISC) += misc/
 obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += sysreset/
diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
new file mode 100644 (file)
index 0000000..8a50250
--- /dev/null
@@ -0,0 +1,15 @@
+menu "Extcon Support"
+
+config EXTCON
+       bool "External Connector Class (extcon) support"
+       depends on DM
+       help
+         Say Y here to enable external connector class (extcon) support.
+         This allows monitoring external connectors and supports external
+         connectors with multiple states; i.e., an extcon that may have
+         multiple cables attached. For example, an external connector
+         of a device may be used to connect an HDMI cable and a AC adaptor,
+         and to host USB ports. Many of 30-pin connectors including PDMI
+         are also good examples.
+
+endmenu
diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
new file mode 100644 (file)
index 0000000..2510e91
--- /dev/null
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Svyatoslav Ryhel <clamor95@gmail.com>
+
+obj-$(CONFIG_EXTCON) += extcon-uclass.o
diff --git a/drivers/extcon/extcon-uclass.c b/drivers/extcon/extcon-uclass.c
new file mode 100644 (file)
index 0000000..9dd22b5
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023 Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#define LOG_CATEGORY UCLASS_EXTCON
+
+#include <common.h>
+#include <extcon.h>
+#include <dm.h>
+
+UCLASS_DRIVER(extcon) = {
+       .id                     = UCLASS_EXTCON,
+       .name                   = "extcon",
+       .per_device_plat_auto   = sizeof(struct extcon_uc_plat),
+};
index 5386c3f..307ad69 100644 (file)
@@ -56,6 +56,7 @@ enum uclass_id {
        UCLASS_EFI_MEDIA,       /* Devices provided by UEFI firmware */
        UCLASS_ETH,             /* Ethernet device */
        UCLASS_ETH_PHY,         /* Ethernet PHY device */
+       UCLASS_EXTCON,          /* External Connector Class */
        UCLASS_FIRMWARE,        /* Firmware */
        UCLASS_FPGA,            /* FPGA device */
        UCLASS_FUZZING_ENGINE,  /* Fuzzing engine */
diff --git a/include/extcon.h b/include/extcon.h
new file mode 100644 (file)
index 0000000..d060f5a
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2023 Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#ifndef __EXTCON_H
+#define __EXTCON_H
+
+struct udevice;
+
+/**
+ * struct extcon_uc_plat - Platform data the uclass stores about each device
+ *
+ * To be filled
+ */
+struct extcon_uc_plat {
+};
+
+#endif