mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mux: mmio: add suspend and resume support
@ 2025-11-02 10:04 Jisheng Zhang
  0 siblings, 0 replies; only message in thread
From: Jisheng Zhang @ 2025-11-02 10:04 UTC (permalink / raw)
  To: Peter Rosin; +Cc: linux-kernel

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@kernel.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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-02 10:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-02 10:04 [PATCH] mux: mmio: add suspend and resume support Jisheng Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®