* [PATCH 1/2] bus: mhi: host: Add loopback driver with sysfs interface
2025-09-23 6:37 [PATCH 0/2] bus: mhi: Add loopback driver for host & ep Sumit Kumar
@ 2025-09-23 6:37 ` Sumit Kumar
2025-09-29 9:14 ` Markus Elfring
2025-09-23 6:37 ` [PATCH 2/2] bus: mhi: ep: Add loopback driver for data path testing Sumit Kumar
1 sibling, 1 reply; 5+ messages in thread
From: Sumit Kumar @ 2025-09-23 6:37 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Krishna Chaitanya Chundru, Akhil Vinod,
Subramanian Ananthanarayanan, linux-kernel, mhi, linux-arm-msm,
quic_vpernami, Sumit Kumar
Add loopback driver for MHI host controllers that provides sysfs based
testing interface for data path validation. The driver supports the
"LOOPBACK" channel and offers configurable test parameters.
Sysfs interface provides:
- size: Configure TRE size
- num_tre: Set number of TREs for chained transfers
- start: Initiate loopback test
- status: Read test results
The driver is useful for testing TRE chaining functionality, and
verifying data integrity.
Co-developed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Sumit Kumar <sumit.kumar@oss.qualcomm.com>
---
drivers/bus/mhi/host/Kconfig | 7 +
drivers/bus/mhi/host/Makefile | 1 +
drivers/bus/mhi/host/mhi_loopback.c | 348 ++++++++++++++++++++++++++++++++++++
3 files changed, 356 insertions(+)
diff --git a/drivers/bus/mhi/host/Kconfig b/drivers/bus/mhi/host/Kconfig
index da5cd0c9fc620ab595e742c422f1a22a2a84c7b9..08a39ecb47f585bf39721c101ed5e2ff44bdd5f8 100644
--- a/drivers/bus/mhi/host/Kconfig
+++ b/drivers/bus/mhi/host/Kconfig
@@ -29,3 +29,10 @@ config MHI_BUS_PCI_GENERIC
This driver provides MHI PCI controller driver for devices such as
Qualcomm SDX55 based PCIe modems.
+config MHI_BUS_LOOPBACK
+ tristate "MHI loopback driver"
+ depends on MHI_BUS
+ help
+ MHI loopback driver for data path testing. This driver
+ provides a mechanism to test MHI data transfer functionality
+ by implementing an echo service between host and endpoint.
diff --git a/drivers/bus/mhi/host/Makefile b/drivers/bus/mhi/host/Makefile
index 859c2f38451c669b3d3014c374b2b957c99a1cfe..e5d6dccf5a976eaeb827c47924ad0614c9958f8b 100644
--- a/drivers/bus/mhi/host/Makefile
+++ b/drivers/bus/mhi/host/Makefile
@@ -4,3 +4,4 @@ mhi-$(CONFIG_MHI_BUS_DEBUG) += debugfs.o
obj-$(CONFIG_MHI_BUS_PCI_GENERIC) += mhi_pci_generic.o
mhi_pci_generic-y += pci_generic.o
+obj-$(CONFIG_MHI_BUS_LOOPBACK) += mhi_loopback.o
diff --git a/drivers/bus/mhi/host/mhi_loopback.c b/drivers/bus/mhi/host/mhi_loopback.c
new file mode 100644
index 0000000000000000000000000000000000000000..2936fc67e6ff1788263690e2649f2a55398f46d8
--- /dev/null
+++ b/drivers/bus/mhi/host/mhi_loopback.c
@@ -0,0 +1,348 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/mhi.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/completion.h>
+#include <linux/string.h>
+#include <linux/random.h>
+#include <linux/kernel.h>
+#include <linux/sysfs.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/mutex.h>
+#include <linux/atomic.h>
+#include <linux/cleanup.h>
+
+#define MHI_LOOPBACK_DEFAULT_TRE_SIZE 32
+#define MHI_LOOPBACK_DEFAULT_NUM_TRE 1
+#define MHI_LOOPBACK_TIMEOUT_MS 5000
+#define MHI_LOOPBACK_MAX_TRE_SIZE 65536
+
+struct mhi_loopback {
+ struct completion comp;
+ struct mhi_device *mdev;
+ struct mutex lb_mutex;
+ char result[32];
+ u32 size;
+ u32 num_tre;
+ bool loopback_in_progress;
+ atomic_t num_completions_received;
+};
+
+static ssize_t size_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct mhi_loopback *mhi_lb = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%u\n", mhi_lb->size);
+}
+
+static ssize_t size_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct mhi_loopback *mhi_lb = dev_get_drvdata(dev);
+ u32 val;
+
+ if (kstrtou32(buf, 0, &val)) {
+ dev_err(dev, "Invalid size value\n");
+ return -EINVAL;
+ }
+
+ if (val == 0 || val > MHI_LOOPBACK_MAX_TRE_SIZE) {
+ dev_err(dev, "Size must be between 1 and %u bytes\n",
+ MHI_LOOPBACK_MAX_TRE_SIZE);
+ return -EINVAL;
+ }
+
+ guard(mutex)(&mhi_lb->lb_mutex);
+ if (mhi_lb->loopback_in_progress)
+ return -EBUSY;
+
+ mhi_lb->size = val;
+ return count;
+}
+static DEVICE_ATTR_RW(size);
+
+static ssize_t num_tre_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct mhi_loopback *mhi_lb = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%u\n", mhi_lb->num_tre);
+}
+
+static ssize_t num_tre_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct mhi_loopback *mhi_lb = dev_get_drvdata(dev);
+ u32 val;
+ int el_num;
+
+ guard(mutex)(&mhi_lb->lb_mutex);
+ if (mhi_lb->loopback_in_progress)
+ return -EBUSY;
+
+ if (kstrtou32(buf, 0, &val)) {
+ dev_err(dev, "Invalid num_tre value\n");
+ return -EINVAL;
+ }
+
+ if (val == 0) {
+ dev_err(dev, "Number of TREs cannot be zero\n");
+ return -EINVAL;
+ }
+
+ el_num = mhi_get_free_desc_count(mhi_lb->mdev, DMA_TO_DEVICE);
+ if (val > el_num) {
+ dev_err(dev, "num_tre (%u) exceeds ring capacity (%d)\n", val, el_num);
+ return -EINVAL;
+ }
+
+ mhi_lb->num_tre = val;
+ return count;
+}
+static DEVICE_ATTR_RW(num_tre);
+
+static ssize_t start_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct mhi_loopback *mhi_lb = dev_get_drvdata(dev);
+ void *send_buf, *recv_buf;
+ u32 total_size, tre_count, tre_size;
+ int ret, i;
+
+ atomic_set(&mhi_lb->num_completions_received, 0);
+ guard(mutex)(&mhi_lb->lb_mutex);
+
+ if (mhi_lb->loopback_in_progress)
+ return -EBUSY;
+
+ mhi_lb->loopback_in_progress = true;
+
+ tre_size = mhi_lb->size;
+ tre_count = mhi_lb->num_tre;
+
+ strscpy(mhi_lb->result, "Loopback started", sizeof(mhi_lb->result));
+
+ total_size = tre_count * tre_size;
+
+ recv_buf = kzalloc(total_size, GFP_KERNEL);
+ if (!recv_buf) {
+ strscpy(mhi_lb->result, "Memory allocation failed", sizeof(mhi_lb->result));
+ ret = -ENOMEM;
+ goto unlock;
+ }
+
+ send_buf = kzalloc(total_size, GFP_KERNEL);
+ if (!send_buf) {
+ strscpy(mhi_lb->result, "Memory allocation failed", sizeof(mhi_lb->result));
+ ret = -ENOMEM;
+ goto free_recv_buf;
+ }
+
+ for (i = 0; i < tre_count; i++) {
+ ret = mhi_queue_buf(mhi_lb->mdev, DMA_FROM_DEVICE, recv_buf + (i * tre_size),
+ tre_size, MHI_EOT);
+ if (ret) {
+ dev_err(dev, "Unable to queue read TRE %d: %d\n", i, ret);
+ strscpy(mhi_lb->result, "Queue tre failed", sizeof(mhi_lb->result));
+ goto free_buf;
+ }
+ }
+
+ get_random_bytes(send_buf, total_size);
+
+ reinit_completion(&mhi_lb->comp);
+
+ for (i = 0; i < tre_count - 1; i++) {
+ ret = mhi_queue_buf(mhi_lb->mdev, DMA_TO_DEVICE, send_buf + (i * tre_size),
+ tre_size, MHI_CHAIN);
+ if (ret) {
+ dev_err(dev, "Unable to queue send TRE %d (chained): %d\n", i, ret);
+ strscpy(mhi_lb->result, "Queue send failed", sizeof(mhi_lb->result));
+ goto free_buf;
+ }
+ }
+
+ ret = mhi_queue_buf(mhi_lb->mdev, DMA_TO_DEVICE, send_buf + (i * tre_size),
+ tre_size, MHI_EOT);
+ if (ret) {
+ dev_err(dev, "Unable to queue final TRE: %d\n", ret);
+ strscpy(mhi_lb->result, "Queue final tre failed", sizeof(mhi_lb->result));
+ goto free_buf;
+ }
+
+ if (!wait_for_completion_timeout(&mhi_lb->comp,
+ msecs_to_jiffies(MHI_LOOPBACK_TIMEOUT_MS))) {
+ strscpy(mhi_lb->result, "Loopback timeout", sizeof(mhi_lb->result));
+ dev_err(dev, "Loopback test timed out\n");
+ ret = -ETIMEDOUT;
+ goto free_buf;
+ }
+
+ ret = memcmp(send_buf, recv_buf, total_size);
+ if (!ret) {
+ strscpy(mhi_lb->result, "Loopback successful", sizeof(mhi_lb->result));
+ dev_info(dev, "Loopback test passed\n");
+ ret = count;
+ } else {
+ strscpy(mhi_lb->result, "Loopback data mismatch", sizeof(mhi_lb->result));
+ dev_err(dev, "Loopback test failed\n");
+ ret = -EIO;
+ }
+
+free_buf:
+ kfree(send_buf);
+free_recv_buf:
+ kfree(recv_buf);
+unlock:
+ mhi_lb->loopback_in_progress = false;
+ return ret;
+}
+
+static DEVICE_ATTR_WO(start);
+
+static ssize_t status_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct mhi_loopback *mhi_lb = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%s\n", mhi_lb->result);
+}
+static DEVICE_ATTR_RO(status);
+
+static void mhi_loopback_dl_callback(struct mhi_device *mhi_dev,
+ struct mhi_result *mhi_res)
+{
+ struct mhi_loopback *mhi_lb = dev_get_drvdata(&mhi_dev->dev);
+
+ if (!mhi_res->transaction_status) {
+ if (atomic_inc_return(&mhi_lb->num_completions_received) >= mhi_lb->num_tre) {
+ atomic_set(&mhi_lb->num_completions_received, 0);
+ complete(&mhi_lb->comp);
+ }
+ } else {
+ dev_err(&mhi_dev->dev, "DL callback error: status %d\n",
+ mhi_res->transaction_status);
+ atomic_set(&mhi_lb->num_completions_received, 0);
+ complete(&mhi_lb->comp);
+ }
+}
+
+static void mhi_loopback_ul_callback(struct mhi_device *mhi_dev,
+ struct mhi_result *mhi_res)
+{
+}
+
+static int mhi_loopback_probe(struct mhi_device *mhi_dev,
+ const struct mhi_device_id *id)
+{
+ struct mhi_loopback *mhi_lb;
+ int rc;
+
+ mhi_lb = devm_kzalloc(&mhi_dev->dev, sizeof(*mhi_lb), GFP_KERNEL);
+ if (!mhi_lb)
+ return -ENOMEM;
+
+ mhi_lb->mdev = mhi_dev;
+
+ dev_set_drvdata(&mhi_dev->dev, mhi_lb);
+
+ mhi_lb->size = MHI_LOOPBACK_DEFAULT_TRE_SIZE;
+ mhi_lb->num_tre = MHI_LOOPBACK_DEFAULT_NUM_TRE;
+ mhi_lb->loopback_in_progress = false;
+
+ mutex_init(&mhi_lb->lb_mutex);
+ strscpy(mhi_lb->result, "Loopback not started", sizeof(mhi_lb->result));
+
+ rc = sysfs_create_file(&mhi_dev->dev.kobj, &dev_attr_size.attr);
+ if (rc) {
+ dev_err(&mhi_dev->dev, "failed to create size sysfs file\n");
+ goto out;
+ }
+
+ rc = sysfs_create_file(&mhi_dev->dev.kobj, &dev_attr_num_tre.attr);
+ if (rc) {
+ dev_err(&mhi_dev->dev, "failed to create num_tre sysfs file\n");
+ goto del_size_sysfs;
+ }
+
+ rc = sysfs_create_file(&mhi_dev->dev.kobj, &dev_attr_start.attr);
+ if (rc) {
+ dev_err(&mhi_dev->dev, "failed to create start sysfs file\n");
+ goto del_num_tre_sysfs;
+ }
+
+ rc = sysfs_create_file(&mhi_dev->dev.kobj, &dev_attr_status.attr);
+ if (rc) {
+ dev_err(&mhi_dev->dev, "failed to create status sysfs file\n");
+ goto del_start_sysfs;
+ }
+
+ rc = mhi_prepare_for_transfer(mhi_lb->mdev);
+ if (rc) {
+ dev_err(&mhi_dev->dev, "failed to prepare for transfers\n");
+ goto del_status_sysfs;
+ }
+
+ init_completion(&mhi_lb->comp);
+
+ return 0;
+
+del_status_sysfs:
+ sysfs_remove_file(&mhi_dev->dev.kobj, &dev_attr_status.attr);
+del_start_sysfs:
+ sysfs_remove_file(&mhi_dev->dev.kobj, &dev_attr_start.attr);
+del_num_tre_sysfs:
+ sysfs_remove_file(&mhi_dev->dev.kobj, &dev_attr_num_tre.attr);
+del_size_sysfs:
+ sysfs_remove_file(&mhi_dev->dev.kobj, &dev_attr_size.attr);
+out:
+ return rc;
+}
+
+static void mhi_loopback_remove(struct mhi_device *mhi_dev)
+{
+ struct mhi_loopback *mhi_lb = dev_get_drvdata(&mhi_dev->dev);
+
+ if (mhi_lb)
+ complete(&mhi_lb->comp);
+
+ sysfs_remove_file(&mhi_dev->dev.kobj, &dev_attr_status.attr);
+ sysfs_remove_file(&mhi_dev->dev.kobj, &dev_attr_start.attr);
+ sysfs_remove_file(&mhi_dev->dev.kobj, &dev_attr_num_tre.attr);
+ sysfs_remove_file(&mhi_dev->dev.kobj, &dev_attr_size.attr);
+ mhi_unprepare_from_transfer(mhi_dev);
+ dev_set_drvdata(&mhi_dev->dev, NULL);
+}
+
+static const struct mhi_device_id mhi_loopback_id_table[] = {
+ { .chan = "LOOPBACK"},
+ {}
+};
+MODULE_DEVICE_TABLE(mhi, mhi_loopback_id_table);
+
+static struct mhi_driver mhi_loopback_driver = {
+ .probe = mhi_loopback_probe,
+ .remove = mhi_loopback_remove,
+ .dl_xfer_cb = mhi_loopback_dl_callback,
+ .ul_xfer_cb = mhi_loopback_ul_callback,
+ .id_table = mhi_loopback_id_table,
+ .driver = {
+ .name = "mhi_loopback",
+ },
+};
+
+module_mhi_driver(mhi_loopback_driver);
+
+MODULE_AUTHOR("Krishna chaitanya chundru <krishna.chundru@oss.qualcomm.com>");
+MODULE_AUTHOR("Sumit Kumar <sumit.kumar@oss.qualcomm.com>");
+MODULE_DESCRIPTION("MHI Host Loopback Driver");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] bus: mhi: ep: Add loopback driver for data path testing
2025-09-23 6:37 [PATCH 0/2] bus: mhi: Add loopback driver for host & ep Sumit Kumar
2025-09-23 6:37 ` [PATCH 1/2] bus: mhi: host: Add loopback driver with sysfs interface Sumit Kumar
@ 2025-09-23 6:37 ` Sumit Kumar
2025-09-28 19:10 ` kernel test robot
1 sibling, 1 reply; 5+ messages in thread
From: Sumit Kumar @ 2025-09-23 6:37 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Krishna Chaitanya Chundru, Akhil Vinod,
Subramanian Ananthanarayanan, linux-kernel, mhi, linux-arm-msm,
quic_vpernami, Sumit Kumar
Add loopback driver for MHI endpoint devices. The driver receives
data on the uplink channel and echoes it back on the downlink
channel using a workqueue for asynchronous processing.
The driver is useful for testing MHI endpoint data path functionality
and debugging communication issues.
Co-developed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Sumit Kumar <sumit.kumar@oss.qualcomm.com>
---
drivers/bus/mhi/ep/Kconfig | 8 +++
drivers/bus/mhi/ep/Makefile | 1 +
drivers/bus/mhi/ep/mhi_ep_loopback.c | 132 +++++++++++++++++++++++++++++++++++
3 files changed, 141 insertions(+)
diff --git a/drivers/bus/mhi/ep/Kconfig b/drivers/bus/mhi/ep/Kconfig
index 90ab3b040672e0f04181d4802e3062afcc7cf782..ce7b63c2da82a6ca49528517687f4910552c35bb 100644
--- a/drivers/bus/mhi/ep/Kconfig
+++ b/drivers/bus/mhi/ep/Kconfig
@@ -8,3 +8,11 @@ config MHI_BUS_EP
MHI_BUS_EP implements the MHI protocol for the endpoint devices,
such as SDX55 modem connected to the host machine over PCIe.
+
+config MHI_BUS_EP_LOOPBACK
+ tristate "MHI Endpoint loopback driver"
+ depends on MHI_BUS_EP
+ help
+ MHI endpoint loopback driver for data path testing.
+ This driver receives data on the uplink channel and echoes
+ it back on the downlink channel for testing purposes.
diff --git a/drivers/bus/mhi/ep/Makefile b/drivers/bus/mhi/ep/Makefile
index aad85f180b707fb997fcb541837eda9bbbb67437..02e4700e8dc3f860d40290476b0a852286683f8f 100644
--- a/drivers/bus/mhi/ep/Makefile
+++ b/drivers/bus/mhi/ep/Makefile
@@ -1,2 +1,3 @@
obj-$(CONFIG_MHI_BUS_EP) += mhi_ep.o
mhi_ep-y := main.o mmio.o ring.o sm.o
+obj-$(CONFIG_MHI_BUS_EP_LOOPBACK) += mhi_ep_loopback.o
diff --git a/drivers/bus/mhi/ep/mhi_ep_loopback.c b/drivers/bus/mhi/ep/mhi_ep_loopback.c
new file mode 100644
index 0000000000000000000000000000000000000000..89244aca684ffc959a38f8a0c3ad577b2d127c48
--- /dev/null
+++ b/drivers/bus/mhi/ep/mhi_ep_loopback.c
@@ -0,0 +1,132 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/mhi_ep.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/skbuff.h>
+
+struct mhi_ep_loopback {
+ struct workqueue_struct *loopback_wq;
+ struct mhi_ep_device *mdev;
+};
+
+struct mhi_ep_loopback_work {
+ struct mhi_ep_device *mdev;
+ struct work_struct work;
+ struct sk_buff *skb;
+};
+
+static void mhi_ep_loopback_work_handler(struct work_struct *work)
+{
+ int ret;
+ struct mhi_ep_loopback_work *mhi_ep_lb_work = container_of(work,
+ struct mhi_ep_loopback_work, work);
+
+ ret = mhi_ep_queue_skb(mhi_ep_lb_work->mdev, mhi_ep_lb_work->skb);
+ if (ret) {
+ dev_err(&mhi_ep_lb_work->mdev->dev, "Failed to send the packet\n");
+ kfree_skb(mhi_ep_lb_work->skb);
+ }
+
+ kfree(mhi_ep_lb_work);
+}
+
+static void mhi_ep_loopback_ul_callback(struct mhi_ep_device *mhi_dev,
+ struct mhi_result *mhi_res)
+{
+ struct mhi_ep_loopback *mhi_ep_lb = dev_get_drvdata(&mhi_dev->dev);
+ struct mhi_ep_loopback_work *mhi_ep_lb_work;
+ struct sk_buff *skb;
+
+ if (!(mhi_res->transaction_status)) {
+ skb = alloc_skb(mhi_res->bytes_xferd, GFP_KERNEL);
+ if (!skb) {
+ dev_err(&mhi_dev->dev, "Failed to allocate skb\n");
+ return;
+ }
+
+ skb_put_data(skb, mhi_res->buf_addr, mhi_res->bytes_xferd);
+
+ mhi_ep_lb_work = kmalloc(sizeof(*mhi_ep_lb_work), GFP_KERNEL);
+ if (!mhi_ep_lb_work) {
+ dev_err(&mhi_dev->dev, "Unable to allocate the work structure\n");
+ kfree_skb(skb);
+ return;
+ }
+
+ INIT_WORK(&mhi_ep_lb_work->work, mhi_ep_loopback_work_handler);
+ mhi_ep_lb_work->mdev = mhi_dev;
+ mhi_ep_lb_work->skb = skb;
+
+ queue_work(mhi_ep_lb->loopback_wq, &mhi_ep_lb_work->work);
+ }
+}
+
+static void mhi_ep_loopback_dl_callback(struct mhi_ep_device *mhi_dev,
+ struct mhi_result *mhi_res)
+{
+ struct sk_buff *skb;
+
+ if (mhi_res->transaction_status)
+ return;
+
+ skb = mhi_res->buf_addr;
+ if (skb)
+ kfree_skb(skb);
+}
+
+static int mhi_ep_loopback_probe(struct mhi_ep_device *mhi_dev, const struct mhi_device_id *id)
+{
+ struct mhi_ep_loopback *mhi_ep_lb;
+
+ mhi_ep_lb = devm_kzalloc(&mhi_dev->dev, sizeof(struct mhi_ep_loopback), GFP_KERNEL);
+ if (!mhi_ep_lb)
+ return -ENOMEM;
+
+ mhi_ep_lb->loopback_wq = alloc_ordered_workqueue("mhi_loopback", WQ_MEM_RECLAIM);
+ if (!mhi_ep_lb->loopback_wq) {
+ dev_err(&mhi_dev->dev, "Failed to create workqueue.\n");
+ return -ENOMEM;
+ }
+
+ mhi_ep_lb->mdev = mhi_dev;
+ dev_set_drvdata(&mhi_dev->dev, mhi_ep_lb);
+
+ return 0;
+}
+
+static void mhi_ep_loopback_remove(struct mhi_ep_device *mhi_dev)
+{
+ struct mhi_ep_loopback *mhi_ep_lb = dev_get_drvdata(&mhi_dev->dev);
+
+ destroy_workqueue(mhi_ep_lb->loopback_wq);
+ dev_set_drvdata(&mhi_dev->dev, NULL);
+}
+
+static const struct mhi_device_id mhi_ep_loopback_id_table[] = {
+ { .chan = "LOOPBACK"},
+ {}
+};
+MODULE_DEVICE_TABLE(mhi, mhi_ep_loopback_id_table);
+
+static struct mhi_ep_driver mhi_ep_loopback_driver = {
+ .probe = mhi_ep_loopback_probe,
+ .remove = mhi_ep_loopback_remove,
+ .dl_xfer_cb = mhi_ep_loopback_dl_callback,
+ .ul_xfer_cb = mhi_ep_loopback_ul_callback,
+ .id_table = mhi_ep_loopback_id_table,
+ .driver = {
+ .name = "mhi_ep_loopback",
+ .owner = THIS_MODULE,
+ },
+};
+
+module_mhi_ep_driver(mhi_ep_loopback_driver);
+
+MODULE_AUTHOR("Krishna chaitanya chundru <krishna.chundru@oss.qualcomm.com>");
+MODULE_AUTHOR("Sumit Kumar <sumit.kumar@oss.qualcomm.com>");
+MODULE_DESCRIPTION("MHI Endpoint Loopback driver");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread