Skip to content

Commit 078d62d

Browse files
tlebbroonie
authored andcommitted
spi: cadence-qspi: add system-wide suspend and resume callbacks
Each SPI controller is expected to call the spi_controller_suspend() and spi_controller_resume() callbacks at system-wide suspend and resume. It (1) handles the kthread worker for queued controllers and (2) marks the controller as suspended to have spi_sync() fail while the controller is unavailable. Those two operations do not require the controller to be active, we do not need to increment the runtime PM usage counter. Signed-off-by: Théo Lebrun <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 4efa125 commit 078d62d

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

drivers/spi/spi-cadence-quadspi.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,8 +1949,24 @@ static int cqspi_runtime_resume(struct device *dev)
19491949
return 0;
19501950
}
19511951

1952-
static DEFINE_RUNTIME_DEV_PM_OPS(cqspi_dev_pm_ops, cqspi_runtime_suspend,
1953-
cqspi_runtime_resume, NULL);
1952+
static int cqspi_suspend(struct device *dev)
1953+
{
1954+
struct cqspi_st *cqspi = dev_get_drvdata(dev);
1955+
1956+
return spi_controller_suspend(cqspi->host);
1957+
}
1958+
1959+
static int cqspi_resume(struct device *dev)
1960+
{
1961+
struct cqspi_st *cqspi = dev_get_drvdata(dev);
1962+
1963+
return spi_controller_resume(cqspi->host);
1964+
}
1965+
1966+
static const struct dev_pm_ops cqspi_dev_pm_ops = {
1967+
RUNTIME_PM_OPS(cqspi_runtime_suspend, cqspi_runtime_resume, NULL)
1968+
SYSTEM_SLEEP_PM_OPS(cqspi_suspend, cqspi_resume)
1969+
};
19541970

19551971
static const struct cqspi_driver_platdata cdns_qspi = {
19561972
.quirks = CQSPI_DISABLE_DAC_MODE,

0 commit comments

Comments
 (0)