mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: Peter Rosin <peda@axentia.se>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] mux: mmio: add suspend and resume support
Date: Sun,  2 Nov 2025 18:04:02 +0800	[thread overview]
Message-ID: <20251102100402.9477-1-jszhang@kernel.org> (raw)

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


                 reply	other threads:[~2025-11-02 10:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251102100402.9477-1-jszhang@kernel.org \
    --to=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®