linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: qup: Handle clocks in pm_runtime suspend and resume
@ 2016-05-02 12:14 Pramod Gurav
       [not found] ` <1462191244-30758-1-git-send-email-pramod.gurav-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2016-05-02 15:47 ` Applied "spi: qup: Handle clocks in pm_runtime suspend and resume" " Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Pramod Gurav @ 2016-05-02 12:14 UTC (permalink / raw)
  To: broonie, rjw, ulf.hansson, andy.gross
  Cc: linux-spi, linux-kernel, linux-pm, Pramod Gurav

Clocks must ne disabled in pm_runtime to achieve some power saving.
Enable the clocks when the device is runtime resumed during a transfer.

Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org>
---
 drivers/spi/spi-qup.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 810a7fa..e42ff61 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -937,6 +937,10 @@ static int spi_qup_pm_suspend_runtime(struct device *device)
 	config = readl(controller->base + QUP_CONFIG);
 	config |= QUP_CONFIG_CLOCK_AUTO_GATE;
 	writel_relaxed(config, controller->base + QUP_CONFIG);
+
+	clk_disable_unprepare(controller->cclk);
+	clk_disable_unprepare(controller->iclk);
+
 	return 0;
 }
 
@@ -945,6 +949,15 @@ static int spi_qup_pm_resume_runtime(struct device *device)
 	struct spi_master *master = dev_get_drvdata(device);
 	struct spi_qup *controller = spi_master_get_devdata(master);
 	u32 config;
+	int ret;
+
+	ret = clk_prepare_enable(controller->iclk);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(controller->cclk);
+	if (ret)
+		return ret;
 
 	/* Disable clocks auto gaiting */
 	config = readl_relaxed(controller->base + QUP_CONFIG);
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-02 15:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-02 12:14 [PATCH 1/2] spi: qup: Handle clocks in pm_runtime suspend and resume Pramod Gurav
     [not found] ` <1462191244-30758-1-git-send-email-pramod.gurav-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-05-02 12:14   ` [PATCH 2/2] spi: qup: Add spi_master_put in remove function Pramod Gurav
2016-05-02 15:47     ` Applied "spi: qup: Add spi_master_put in remove function" to the spi tree Mark Brown
2016-05-02 15:47 ` Applied "spi: qup: Handle clocks in pm_runtime suspend and resume" " Mark Brown

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).