summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-qup.c
diff options
context:
space:
mode:
authorPramod Gurav <pramod.gurav@linaro.org>2016-05-02 17:44:03 +0530
committerMark Brown <broonie@kernel.org>2016-05-02 15:27:28 +0100
commitdae1a7700b34eceae049cf8f1567a640528ca4c1 (patch)
treeb03cbe5502dfe7f7e116f6c46e98f8cbc9d6c4bb /drivers/spi/spi-qup.c
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
downloadtalos-op-linux-dae1a7700b34eceae049cf8f1567a640528ca4c1.tar.gz
talos-op-linux-dae1a7700b34eceae049cf8f1567a640528ca4c1.zip
spi: qup: Handle clocks in pm_runtime suspend and resume
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> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-qup.c')
-rw-r--r--drivers/spi/spi-qup.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 810a7fae3479..e42ff613c0e0 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);
OpenPOWER on IntegriCloud