]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i3c: mipi-i3c-hci: Add DMA suspend and resume support
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 13 Jan 2026 07:26:52 +0000 (09:26 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 14 Jan 2026 16:21:10 +0000 (17:21 +0100)
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>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260113072702.16268-12-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/mipi-i3c-hci/dma.c
drivers/i3c/master/mipi-i3c-hci/hci.h

index 9ed69da529777963e7cd6c211a7576fe9a03e182..2e5b4974d431e71aca51b8974d9003c3fd38d41b 100644 (file)
@@ -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,
 };
index aa8a03594e64402fd5dba9e2e9f1e8ede34a950c..38f927685d3b1cd742fc244713190318996db309 100644 (file)
@@ -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;