* [PATCH] spi: qup: Fix runtime and system PM callbacks.
@ 2017-01-27 6:32 Pramod Gurav
0 siblings, 0 replies; only message in thread
From: Pramod Gurav @ 2017-01-27 6:32 UTC (permalink / raw)
To: broonie, linux-spi
Cc: andy.gross, david.brown, linux-arm-msm, linux-soc, linux-kernel,
Pramod Gurav
The SPI clocks were being turned on every suspend/resume cycle.
This was increamenting the prepare/enable count after every resume.
Fix the same.
Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org>
---
Tested on db410c
drivers/spi/spi-qup.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 1bfa889..a9731e8 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -956,8 +956,10 @@ static int spi_qup_pm_resume_runtime(struct device *device)
return ret;
ret = clk_prepare_enable(controller->cclk);
- if (ret)
+ if (ret) {
+ clk_disable_unprepare(controller->iclk);
return ret;
+ }
/* Disable clocks auto gaiting */
config = readl_relaxed(controller->base + QUP_CONFIG);
@@ -983,8 +985,7 @@ static int spi_qup_suspend(struct device *device)
return ret;
if (!pm_runtime_suspended(device)) {
- clk_disable_unprepare(controller->cclk);
- clk_disable_unprepare(controller->iclk);
+ pm_runtime_put(device);
}
return 0;
}
@@ -995,18 +996,17 @@ static int spi_qup_resume(struct device *device)
struct spi_qup *controller = spi_master_get_devdata(master);
int ret;
- ret = clk_prepare_enable(controller->iclk);
- if (ret)
- return ret;
-
- ret = clk_prepare_enable(controller->cclk);
- if (ret)
+ ret = pm_runtime_get_sync(device);
+ if (ret < 0) {
+ dev_err(device, "pm runtime failed in resume\n");
return ret;
+ }
ret = spi_qup_set_state(controller, QUP_STATE_RESET);
if (ret)
return ret;
+ pm_runtime_put(device);
return spi_master_resume(master);
}
#endif /* CONFIG_PM_SLEEP */
--
2.10.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-01-27 6:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 6:32 [PATCH] spi: qup: Fix runtime and system PM callbacks Pramod Gurav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).