All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi/pl022: Enable clock in probe an use runtime_idle
@ 2011-10-21 14:08 ` Ulf Hansson
  0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2011-10-21 14:08 UTC (permalink / raw)
  To: Grant Likely, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Lee Jones, Ulf Hansson,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Since we are always runtime resumed when leaving probe
the clock must be enabled. To accomplish that we are able
to be runtime suspended after probe in the case when no
request is going to be recieved, a runtime_idle function
has been implemented.

Change-Id: I6cb86f2cad30ecaab16f512daf4674b039b18213
Signed-off-by: Ulf Hansson <ulf.hansson-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34447
---
 drivers/spi/spi-pl022.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index f103e47..ad48fba 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -2184,6 +2184,12 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
 		goto  err_clk_prep;
 	}
 
+	status = clk_enable(pl022->clk);
+	if (status) {
+		dev_err(&adev->dev, "could not enable SSP/SPI bus clock\n");
+		goto err_no_clk_en;
+	}
+
 	/* Disable SSP */
 	writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)),
 	       SSP_CR1(pl022->virtbase));
@@ -2237,6 +2243,8 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
 
 	free_irq(adev->irq[0], pl022);
  err_no_irq:
+	clk_disable(pl022->clk);
+ err_no_clk_en:
 	clk_unprepare(pl022->clk);
  err_clk_prep:
 	clk_put(pl022->clk);
@@ -2342,11 +2350,19 @@ static int pl022_runtime_resume(struct device *dev)
 
 	return 0;
 }
+
+static int pl022_runtime_idle(struct device *dev)
+{
+	pm_runtime_suspend(dev);
+	return 0;
+}
 #endif
 
 static const struct dev_pm_ops pl022_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pl022_suspend, pl022_resume)
-	SET_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
+	SET_RUNTIME_PM_OPS(pl022_runtime_suspend,
+			   pl022_runtime_resume,
+			   pl022_runtime_idle)
 };
 
 static struct vendor_data vendor_arm = {
-- 
1.7.5.4


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev

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

end of thread, other threads:[~2011-11-03 15:47 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-21 14:08 [PATCH] spi/pl022: Enable clock in probe an use runtime_idle Ulf Hansson
2011-10-21 14:08 ` Ulf Hansson
2011-10-24 12:03 ` Grant Likely
2011-10-24 12:03   ` Grant Likely
     [not found]   ` <20111024120342.GQ8708-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-10-24 12:50     ` Russell King - ARM Linux
2011-10-24 12:50       ` Russell King - ARM Linux
2011-10-24 14:58       ` Linus Walleij
2011-10-24 14:58         ` Linus Walleij
     [not found] ` <1319206124-17549-1-git-send-email-ulf.hansson-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2011-10-22 16:41   ` Linus Walleij
2011-10-22 16:41     ` Linus Walleij
     [not found]     ` <CACRpkdY2Csh58QbtnfYikr-VtYR_wDRfC2_X_+wR3OPhgTBE3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-24  7:38       ` Ulf Hansson
2011-10-24  7:38         ` Ulf Hansson
2011-11-02 14:16   ` Russell King - ARM Linux
2011-11-02 14:16     ` Russell King - ARM Linux
     [not found]     ` <20111102141628.GG19187-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-11-03 13:59       ` Ulf Hansson
2011-11-03 13:59         ` Ulf Hansson
2011-11-03 14:13         ` Russell King - ARM Linux
2011-11-03 14:13           ` Russell King - ARM Linux
2011-11-03 15:47           ` Ulf Hansson
2011-11-03 15:47             ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.