[PATCH 11/17] i3c: mipi-i3c-hci: Add DMA suspend and resume support

Adrian Hunter
2025-12-19T14:46:15Z

Introduce helper functions to suspend and resume DMA operations. These
are required to prepare for upcoming Runtime PM support, ensuring that
DMA state is properly managed during power transitions.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/i3c/master/mipi-i3c-hci/dma.c | 25 +++++++++++++++++++++++++
drivers/i3c/master/mipi-i3c-hci/hci.h | 2 ++
2 files changed, 27 insertions(+)

diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
index d0fc245f8e8f..6be97f0782d8 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dma.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
@@ -275,6 +275,29 @@ static void hci_dma_init_rings(struct i3c_hci *hci)
hci_dma_init_rh(hci, &rings->headers[i], i);
}

+static void hci_dma_suspend(struct i3c_hci *hci)
+{
+ struct hci_rings_data *rings = hci->io_data;
+ int n = rings ? rings->total : 0;
+
+ for (int i = 0; i < n; i++) {
+ struct hci_rh_data *rh = &rings->headers[i];
+
+ rh_reg_write(INTR_SIGNAL_ENABLE, 0);
+ rh_reg_write(RING_CONTROL, 0);
+ }
+
+ i3c_hci_sync_irq_inactive(hci);
+}
+
+static void hci_dma_resume(struct i3c_hci *hci)
+{
+ struct hci_rings_data *rings = hci->io_data;
+
+ if (rings)
+ hci_dma_init_rings(hci);
+}
+
static int hci_dma_init(struct i3c_hci *hci)
{
struct hci_rings_data *rings;
@@ -865,4 +888,6 @@ const struct hci_io_ops mipi_i3c_hci_dma = {
.request_ibi = hci_dma_request_ibi,
.free_ibi = hci_dma_free_ibi,
.recycle_ibi_slot = hci_dma_recycle_ibi_slot,
+ .suspend = hci_dma_suspend,
+ .resume = hci_dma_resume,
};
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
index aa8a03594e64..38f927685d3b 100644
--- a/drivers/i3c/master/mipi-i3c-hci/hci.h
+++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
@@ -125,6 +125,8 @@ struct hci_io_ops {
struct i3c_ibi_slot *slot);
int (*init)(struct i3c_hci *hci);
void (*cleanup)(struct i3c_hci *hci);
+ void (*suspend)(struct i3c_hci *hci);
+ void (*resume)(struct i3c_hci *hci);
};

extern const struct hci_io_ops mipi_i3c_hci_pio;
--
2.51.0