[PATCH] i2c: xiic: Fix broken PM suspend/resume

tumic at gpxsee.org tumic at gpxsee.org
Fri Nov 20 05:04:14 PST 2026


From: Martin Tůma <martin.tuma at digiteqautomotive.com>

Add the missing PM suspend/resume callbacks that properly reconfigure
the XDMA HW on PCIe suspend/resume.

This is required in cases where the HW is on a PCIe card connected using
one of the Xilinx PCIe cores (e.g. XDMA) like in the case of the Digiteq
Automotive FG4 grabber card (mgb4 module).

Signed-off-by: Martin Tůma <martin.tuma at digiteqautomotive.com>
---
 drivers/i2c/busses/i2c-xiic.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index ab7916745ad3..fc122ceb5631 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -252,6 +252,8 @@ static const struct timing_regs timing_reg_values[] = {
 
 static int xiic_start_xfer(struct xiic_i2c *i2c, struct i2c_msg *msgs, int num);
 static void __xiic_start_xfer(struct xiic_i2c *i2c);
+static int xiic_reinit(struct xiic_i2c *i2c);
+static void xiic_deinit(struct xiic_i2c *i2c);
 
 static int xiic_i2c_runtime_suspend(struct device *dev)
 {
@@ -276,6 +278,27 @@ static int xiic_i2c_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int xiic_i2c_suspend(struct device *dev)
+{
+	struct xiic_i2c *i2c = dev_get_drvdata(dev);
+
+	xiic_deinit(i2c);
+
+	return 0;
+}
+
+static int xiic_i2c_resume(struct device *dev)
+{
+	struct xiic_i2c *i2c = dev_get_drvdata(dev);
+	int ret;
+
+	ret = xiic_reinit(i2c);
+	if (ret)
+		dev_err(dev, "Reinitialization failed.\n");
+
+	return ret;
+}
+
 /*
  * For the register read and write functions, a little-endian and big-endian
  * version are necessary. Endianness is detected during the probe function.
@@ -1610,6 +1633,8 @@ static void xiic_i2c_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops xiic_dev_pm_ops = {
+	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(xiic_i2c_suspend,
+				      xiic_i2c_resume)
 	SET_RUNTIME_PM_OPS(xiic_i2c_runtime_suspend,
 			   xiic_i2c_runtime_resume, NULL)
 };

base-commit: 65e4fd942f72a9dba0e4e257290c4fa1aa756854
-- 
2.56.1




More information about the linux-arm-kernel mailing list