From: Jisheng Zhang <jszhang@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] spi: dw-mmio: support suspend/resume
Date: Thu, 22 Jan 2026 23:50:46 +0800 [thread overview]
Message-ID: <20260122155046.12848-1-jszhang@kernel.org> (raw)
Add system wide suspend and resume support, the implementation is
straightforward, just call spi_controller_suspend() then assert the
reset and disable clks for suspend, enable clks and deassert reset
then call spi_controller_resume() for resume.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
drivers/spi/spi-dw-mmio.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
index 33239b4778cb..b8123db4ad55 100644
--- a/drivers/spi/spi-dw-mmio.c
+++ b/drivers/spi/spi-dw-mmio.c
@@ -392,6 +392,38 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
return ret;
}
+static int dw_spi_mmio_suspend(struct device *dev)
+{
+ struct dw_spi_mmio *dwsmmio = dev_get_drvdata(dev);
+ int ret;
+
+ ret = dw_spi_suspend_controller(&dwsmmio->dws);
+ if (ret)
+ return ret;
+
+ reset_control_assert(dwsmmio->rstc);
+
+ clk_disable_unprepare(dwsmmio->pclk);
+ clk_disable_unprepare(dwsmmio->clk);
+
+ return 0;
+}
+
+static int dw_spi_mmio_resume(struct device *dev)
+{
+ struct dw_spi_mmio *dwsmmio = dev_get_drvdata(dev);
+
+ clk_prepare_enable(dwsmmio->clk);
+ clk_prepare_enable(dwsmmio->pclk);
+
+ reset_control_deassert(dwsmmio->rstc);
+
+ return dw_spi_resume_controller(&dwsmmio->dws);
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(dw_spi_mmio_pm_ops,
+ dw_spi_mmio_suspend, dw_spi_mmio_resume);
+
static void dw_spi_mmio_remove(struct platform_device *pdev)
{
struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev);
@@ -435,6 +467,7 @@ static struct platform_driver dw_spi_mmio_driver = {
.name = DRIVER_NAME,
.of_match_table = dw_spi_mmio_of_match,
.acpi_match_table = ACPI_PTR(dw_spi_mmio_acpi_match),
+ .pm = pm_sleep_ptr(&dw_spi_mmio_pm_ops),
},
};
module_platform_driver(dw_spi_mmio_driver);
--
2.51.0
next reply other threads:[~2026-01-22 16:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 15:50 Jisheng Zhang [this message]
2026-01-22 17:57 ` [PATCH] spi: dw-mmio: support suspend/resume Mark Brown
2026-01-27 16:01 ` Andy Shevchenko
2026-01-27 16:07 ` Mark Brown
2026-01-27 20:51 ` Andy Shevchenko
2026-01-27 22:10 ` Mark Brown
2026-01-27 16:01 ` Andy Shevchenko
2026-01-27 22:36 ` Mark Brown
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=20260122155046.12848-1-jszhang@kernel.org \
--to=jszhang@kernel.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/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