Commit 81695872 authored by Adrian Hunter's avatar Adrian Hunter Committed by Alexandre Belloni
Browse files

i3c: mipi-i3c-hci: Add DMA suspend and resume support



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: default avatarAdrian Hunter <adrian.hunter@intel.com>
Reviewed-by: default avatarFrank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260113072702.16268-12-adrian.hunter@intel.com


Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent f5401c97
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -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,
};
+2 −0
Original line number Diff line number Diff line
@@ -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;