[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240102-j7200-pcie-s2r-v1-4-84e55da52400@bootlin.com>
Date: Mon, 15 Jan 2024 17:14:45 +0100
From: Thomas Richard <thomas.richard@...tlin.com>
To: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, Andy Shevchenko <andy@...nel.org>,
Tony Lindgren <tony@...mide.com>,
Haojian Zhuang <haojian.zhuang@...aro.org>, Vignesh R <vigneshr@...com>,
Aaro Koskinen <aaro.koskinen@....fi>,
Janusz Krzysztofik <jmkrzyszt@...il.com>,
Andi Shyti <andi.shyti@...nel.org>, Peter Rosin <peda@...ntia.se>,
Vinod Koul <vkoul@...nel.org>, Kishon Vijay Abraham I <kishon@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>, Tom Joseph <tjoseph@...ence.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof Wilczyński <kw@...ux.com>,
Rob Herring <robh@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-omap@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-pci@...r.kernel.org, gregory.clement@...tlin.com,
theo.lebrun@...tlin.com, thomas.petazzoni@...tlin.com, u-kumar1@...com,
Thomas Richard <thomas.richard@...tlin.com>
Subject: [PATCH 04/14] mux: mmio: Add resume support
From: Théo Lebrun <theo.lebrun@...tlin.com>
Implement resume support
Signed-off-by: Théo Lebrun <theo.lebrun@...tlin.com>
Signed-off-by: Thomas Richard <thomas.richard@...tlin.com>
---
drivers/mux/mmio.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
index fd1d121a584b..ab4ef195fc0d 100644
--- a/drivers/mux/mmio.c
+++ b/drivers/mux/mmio.c
@@ -125,13 +125,47 @@ static int mux_mmio_probe(struct platform_device *pdev)
mux_chip->ops = &mux_mmio_ops;
+ dev_set_drvdata(dev, mux_chip);
+
return devm_mux_chip_register(dev, mux_chip);
}
+#ifdef CONFIG_PM
+static int mux_mmio_resume_noirq(struct device *dev)
+{
+ struct mux_chip *mux_chip = dev_get_drvdata(dev);
+ int global_ret = 0;
+ unsigned int i;
+
+ for (i = 0; i < mux_chip->controllers; i++) {
+ struct mux_control *mux = &mux_chip->mux[i];
+ int val = mux->cached_state;
+ int ret;
+
+ if (val == MUX_IDLE_AS_IS)
+ continue;
+
+ ret = mux_mmio_set(mux, val);
+ if (ret) {
+ dev_err(dev, "control %u: error restoring mux: %d\n", i, ret);
+ if (!global_ret)
+ global_ret = ret;
+ }
+ }
+
+ return global_ret;
+}
+#endif
+
+static const struct dev_pm_ops mux_mmio_pm_ops = {
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, mux_mmio_resume_noirq)
+};
+
static struct platform_driver mux_mmio_driver = {
.driver = {
.name = "mmio-mux",
.of_match_table = mux_mmio_dt_ids,
+ .pm = &mux_mmio_pm_ops,
},
.probe = mux_mmio_probe,
};
--
2.39.2
Powered by blists - more mailing lists