Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dae1a770 authored by Pramod Gurav's avatar Pramod Gurav Committed by Mark Brown
Browse files

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: default avatarPramod Gurav <pramod.gurav@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f55532a0
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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);