linux-kernel.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
  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: 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

* [PATCH 2/2] spi: qup: Add spi_master_put in remove function
  2016-05-02 12:14 [PATCH 1/2] spi: qup: Handle clocks in pm_runtime suspend and resume Pramod Gurav
@ 2016-05-02 12:14 ` 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
  1 sibling, 1 reply; 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

Release memory allocated for spi master by calling spi_master_put in
.remove function.

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

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index e42ff61..c338ef1 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -1030,6 +1030,8 @@ static int spi_qup_remove(struct platform_device *pdev)
 
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
+	spi_master_put(master);
+
 	return 0;
 }
 
-- 
1.8.2.1

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

* Applied "spi: qup: Add spi_master_put in remove function" to the spi tree
  2016-05-02 12:14 ` [PATCH 2/2] spi: qup: Add spi_master_put in remove function Pramod Gurav
@ 2016-05-02 15:47   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-05-02 15:47 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: Mark Brown, broonie, rjw, ulf.hansson, andy.gross, linux-spi,
	linux-kernel, linux-pm

The patch

   spi: qup: Add spi_master_put in remove function

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d2442287e77926ee3552acf3bf31a6047ecb0ac1 Mon Sep 17 00:00:00 2001
From: Pramod Gurav <pramod.gurav@linaro.org>
Date: Mon, 2 May 2016 17:44:04 +0530
Subject: [PATCH] spi: qup: Add spi_master_put in remove function

Release memory allocated for spi master by calling spi_master_put in
.remove function.

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

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index e42ff613c0e0..c338ef1136f6 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -1030,6 +1030,8 @@ static int spi_qup_remove(struct platform_device *pdev)
 
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
+	spi_master_put(master);
+
 	return 0;
 }
 
-- 
2.8.1

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

* Applied "spi: qup: Handle clocks in pm_runtime suspend and resume" to the spi tree
  2016-05-02 12:14 [PATCH 1/2] spi: qup: Handle clocks in pm_runtime suspend and resume Pramod Gurav
  2016-05-02 12:14 ` [PATCH 2/2] spi: qup: Add spi_master_put in remove function Pramod Gurav
@ 2016-05-02 15:47 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-05-02 15:47 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: Mark Brown, broonie, rjw, ulf.hansson, andy.gross, linux-spi,
	linux-kernel, linux-pm

The patch

   spi: qup: Handle clocks in pm_runtime suspend and resume

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From dae1a7700b34eceae049cf8f1567a640528ca4c1 Mon Sep 17 00:00:00 2001
From: Pramod Gurav <pramod.gurav@linaro.org>
Date: Mon, 2 May 2016 17:44:03 +0530
Subject: [PATCH] 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>
---
 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 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);
-- 
2.8.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
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).