# it won't get automatically build in packages using it (that would break these automatically as file list
# would no longer match).
BUILD_dm_bow ?= n
+BUILD_extcon_usb_fixed ?= n
BUILD_inform_reboot ?= n
BUILD_logger ?= n
BUILD_proc_tsm ?= n
BUILD_zlogger ?= n
obj-$(BUILD_dm_bow) += dm-bow.o
+obj-$(BUILD_extcon_usb_fixed) += extcon-usb-fixed.o
obj-$(BUILD_inform_reboot) += inform-reboot.o
obj-$(BUILD_logger) += logger.o
obj-$(BUILD_proc_tsm) += proc-tsm.o
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * extcon_usb_fixed.c - Fixed state (always connected) USB extcon driver
+ *
+ * Copyright (C) 2024 Samsung Electrnoics
+ * Author: Marek Szyprowski <m.szyprowski@samsung.com>
+ */
+
+#include <linux/extcon-provider.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+static struct extcon_dev *edev;
+
+static const unsigned int supported_cable[] = {
+ EXTCON_USB,
+ EXTCON_NONE,
+};
+
+static struct platform_device extcon_usb_fixed_dev = {
+ .name = "extcon_usb_fixed",
+};
+
+static int fixed_usb_extcon_init(void)
+{
+ int ret;
+
+ ret = platform_device_register(&extcon_usb_fixed_dev);
+ if (ret)
+ return ret;
+
+ edev = devm_extcon_dev_allocate(&extcon_usb_fixed_dev.dev, supported_cable);
+ if (IS_ERR(edev))
+ return PTR_ERR(edev);
+
+ ret = devm_extcon_dev_register(&extcon_usb_fixed_dev.dev, edev);
+ if (ret)
+ return ret;
+
+ extcon_set_state_sync(edev, EXTCON_USB, true);
+
+ return 0;
+}
+
+static void fixed_usb_extcon_exit(void)
+{
+ platform_device_unregister(&extcon_usb_fixed_dev);
+}
+
+module_init(fixed_usb_extcon_init);
+module_exit(fixed_usb_extcon_exit);
+
+MODULE_AUTHOR("Marek Szyprowski <m.szyprowski@samsung.com>");
+MODULE_DESCRIPTION("Fixed USB extcon driver");
+MODULE_LICENSE("GPL");