Thread (23 messages) 23 messages, 9 authors, 2014-01-17
STALE4512d
Revisions (9)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 [diff vs current]
  4. v1 [diff vs current]
  5. v1 [diff vs current]
  6. v1 [diff vs current]
  7. v1 current
  8. v1 [diff vs current]
  9. v1 [diff vs current]

[PATCH 3/4] thermal: rcar: Add missing clock handling

From: Ben Dooks <hidden>
Date: 2014-01-08 12:23:42
Also in: linux-pm, linux-sh

On 07/01/14 18:57, Geert Uytterhoeven wrote:
quoted hunk ↗ jump to hunk
From: Geert Uytterhoeven <redacted>

When using DT to instantiate the rcar-thermal device, it prints the
following error:

     rcar_thermal e61f0000.thermal: thermal sensor was broken

Explicitly request and enable the thermal clock to fix this.

Signed-off-by: Geert Uytterhoeven <redacted>
---
  drivers/thermal/rcar_thermal.c |   40 +++++++++++++++++++++++++++++++++-------
  1 file changed, 33 insertions(+), 7 deletions(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 88f92e1a9944..a5629500723a 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -17,6 +17,7 @@
   *  with this program; if not, write to the Free Software Foundation, Inc.,
   *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
   */
+#include <linux/clk.h>
  #include <linux/delay.h>
  #include <linux/err.h>
  #include <linux/irq.h>
@@ -53,6 +54,7 @@ struct rcar_thermal_common {
  	struct device *dev;
  	struct list_head head;
  	spinlock_t lock;
+	struct clk *clk;
  };

  struct rcar_thermal_priv {
@@ -378,23 +380,38 @@ static int rcar_thermal_probe(struct platform_device *pdev)
  	spin_lock_init(&common->lock);
  	common->dev = dev;

+	common->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(common->clk)) {
+		dev_err(&pdev->dev, "cannot get clock\n");
+		return PTR_ERR(common->clk);
+	}
+
+	ret = clk_prepare(common->clk);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "unable to prepare clock\n");
+		return ret;
+	}
+
+	clk_enable(common->clk);
+
  	pm_runtime_enable(dev);
  	pm_runtime_get_sync(dev);

  	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  	if (irq) {
-		int ret;
+		int ret2;

  		/*
  		 * platform has IRQ support.
  		 * Then, drier use common register
  		 */

-		ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0,
-				       dev_name(dev), common);
-		if (ret) {
+		ret2 = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0,
+					dev_name(dev), common);
+		if (ret2) {
  			dev_err(dev, "irq request failed\n ");
-			return ret;
+			ret = ret2;
+			goto error_unpm;
  		}
I'd suggest not renaming ret2 and just use the original ret.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help