Skip to content

Commit dae1a77

Browse files
Pramod Guravbroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent f55532a commit dae1a77

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/spi/spi-qup.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,10 @@ static int spi_qup_pm_suspend_runtime(struct device *device)
937937
config = readl(controller->base + QUP_CONFIG);
938938
config |= QUP_CONFIG_CLOCK_AUTO_GATE;
939939
writel_relaxed(config, controller->base + QUP_CONFIG);
940+
941+
clk_disable_unprepare(controller->cclk);
942+
clk_disable_unprepare(controller->iclk);
943+
940944
return 0;
941945
}
942946

@@ -945,6 +949,15 @@ static int spi_qup_pm_resume_runtime(struct device *device)
945949
struct spi_master *master = dev_get_drvdata(device);
946950
struct spi_qup *controller = spi_master_get_devdata(master);
947951
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;
948961

949962
/* Disable clocks auto gaiting */
950963
config = readl_relaxed(controller->base + QUP_CONFIG);

0 commit comments

Comments
 (0)