Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: dw-mmio: support suspend/resume

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>
Link: https://patch.msgid.link/20260122155046.12848-1-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jisheng Zhang and committed by
Mark Brown
a8b6e373 db6a59cf

+33
+33
drivers/spi/spi-dw-mmio.c
··· 392 392 return ret; 393 393 } 394 394 395 + static int dw_spi_mmio_suspend(struct device *dev) 396 + { 397 + struct dw_spi_mmio *dwsmmio = dev_get_drvdata(dev); 398 + int ret; 399 + 400 + ret = dw_spi_suspend_controller(&dwsmmio->dws); 401 + if (ret) 402 + return ret; 403 + 404 + reset_control_assert(dwsmmio->rstc); 405 + 406 + clk_disable_unprepare(dwsmmio->pclk); 407 + clk_disable_unprepare(dwsmmio->clk); 408 + 409 + return 0; 410 + } 411 + 412 + static int dw_spi_mmio_resume(struct device *dev) 413 + { 414 + struct dw_spi_mmio *dwsmmio = dev_get_drvdata(dev); 415 + 416 + clk_prepare_enable(dwsmmio->clk); 417 + clk_prepare_enable(dwsmmio->pclk); 418 + 419 + reset_control_deassert(dwsmmio->rstc); 420 + 421 + return dw_spi_resume_controller(&dwsmmio->dws); 422 + } 423 + 424 + static DEFINE_SIMPLE_DEV_PM_OPS(dw_spi_mmio_pm_ops, 425 + dw_spi_mmio_suspend, dw_spi_mmio_resume); 426 + 395 427 static void dw_spi_mmio_remove(struct platform_device *pdev) 396 428 { 397 429 struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev); ··· 467 435 .name = DRIVER_NAME, 468 436 .of_match_table = dw_spi_mmio_of_match, 469 437 .acpi_match_table = ACPI_PTR(dw_spi_mmio_acpi_match), 438 + .pm = pm_sleep_ptr(&dw_spi_mmio_pm_ops), 470 439 }, 471 440 }; 472 441 module_platform_driver(dw_spi_mmio_driver);