[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251102100402.9477-1-jszhang@kernel.org>
Date: Sun,  2 Nov 2025 18:04:02 +0800
From: Jisheng Zhang <jszhang@...nel.org>
To: Peter Rosin <peda@...ntia.se>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] mux: mmio: add suspend and resume support
During suspend, nothing to do; During resume, since the mux mmio reg
may be reset, so we have to reset mux->cached_state as
MUX_CACHE_UNKNOWN which is actual MUX_IDLE_AS_IS. See the comments of
MUX_CACHE_UNKNOWN in core.c ".. indication that the cached state of
the multiplexer is unknown."
Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
---
 drivers/mux/mmio.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
index 9993ce38a818..86f7e7d31983 100644
--- a/drivers/mux/mmio.c
+++ b/drivers/mux/mmio.c
@@ -141,13 +141,31 @@ static int mux_mmio_probe(struct platform_device *pdev)
 
 	mux_chip->ops = &mux_mmio_ops;
 
+	platform_set_drvdata(pdev, mux_chip);
+
 	return devm_mux_chip_register(dev, mux_chip);
 }
 
+static int mux_mmio_resume(struct device *dev)
+{
+	int i;
+	struct mux_chip *mux_chip = dev_get_drvdata(dev);
+
+	for (i = 0; i < mux_chip->controllers; ++i) {
+		struct mux_control *mux = &mux_chip->mux[i];
+		mux->cached_state = MUX_IDLE_AS_IS;
+	}
+
+	return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(mux_mmio_pm_ops, NULL, mux_mmio_resume);
+
 static struct platform_driver mux_mmio_driver = {
 	.driver = {
 		.name = "mmio-mux",
 		.of_match_table	= mux_mmio_dt_ids,
+		.pm = pm_sleep_ptr(&mux_mmio_pm_ops),
 	},
 	.probe = mux_mmio_probe,
 };
-- 
2.51.0
Powered by blists - more mailing lists