diff options
| author | Pramod Gurav <pramod.gurav@linaro.org> | 2016-05-02 08:14:03 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2016-05-02 10:27:28 -0400 |
| commit | dae1a7700b34eceae049cf8f1567a640528ca4c1 (patch) | |
| tree | b03cbe5502dfe7f7e116f6c46e98f8cbc9d6c4bb | |
| parent | f55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff) | |
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>
| -rw-r--r-- | drivers/spi/spi-qup.c | 13 |
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) | |||
| 937 | config = readl(controller->base + QUP_CONFIG); | 937 | config = readl(controller->base + QUP_CONFIG); |
| 938 | config |= QUP_CONFIG_CLOCK_AUTO_GATE; | 938 | config |= QUP_CONFIG_CLOCK_AUTO_GATE; |
| 939 | writel_relaxed(config, controller->base + QUP_CONFIG); | 939 | writel_relaxed(config, controller->base + QUP_CONFIG); |
| 940 | |||
| 941 | clk_disable_unprepare(controller->cclk); | ||
| 942 | clk_disable_unprepare(controller->iclk); | ||
| 943 | |||
| 940 | return 0; | 944 | return 0; |
| 941 | } | 945 | } |
| 942 | 946 | ||
| @@ -945,6 +949,15 @@ static int spi_qup_pm_resume_runtime(struct device *device) | |||
| 945 | struct spi_master *master = dev_get_drvdata(device); | 949 | struct spi_master *master = dev_get_drvdata(device); |
| 946 | struct spi_qup *controller = spi_master_get_devdata(master); | 950 | struct spi_qup *controller = spi_master_get_devdata(master); |
| 947 | u32 config; | 951 | u32 config; |
| 952 | int ret; | ||
| 953 | |||
| 954 | ret = clk_prepare_enable(controller->iclk); | ||
| 955 | if (ret) | ||
| 956 | return ret; | ||
| 957 | |||
| 958 | ret = clk_prepare_enable(controller->cclk); | ||
| 959 | if (ret) | ||
| 960 | return ret; | ||
| 948 | 961 | ||
| 949 | /* Disable clocks auto gaiting */ | 962 | /* Disable clocks auto gaiting */ |
| 950 | config = readl_relaxed(controller->base + QUP_CONFIG); | 963 | config = readl_relaxed(controller->base + QUP_CONFIG); |
