thermal: rcar: add pm_runtime_xxx() support
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 26 Mar 2013 06:08:52 +0000 (06:08 +0000)
committerZhang Rui <rui.zhang@intel.com>
Tue, 2 Apr 2013 13:18:39 +0000 (21:18 +0800)
Current rcar_thermal() didn't care about own power.
Without this patch, rcar_thermal doesn't work on APE6 board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/rcar_thermal.c

index 4d6095b9f9df60e702a79b4101a5b48cc9f8fb6e..8d7edd4c82285f2bce93fd811b013bb4f6a9a54a 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -377,6 +378,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
        spin_lock_init(&common->lock);
        common->dev = dev;
 
+       pm_runtime_enable(dev);
+       pm_runtime_get_sync(dev);
+
        irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        if (irq) {
                int ret;
@@ -465,12 +469,16 @@ error_unregister:
                        rcar_thermal_irq_disable(priv);
        }
 
+       pm_runtime_put_sync(dev);
+       pm_runtime_disable(dev);
+
        return ret;
 }
 
 static int rcar_thermal_remove(struct platform_device *pdev)
 {
        struct rcar_thermal_common *common = platform_get_drvdata(pdev);
+       struct device *dev = &pdev->dev;
        struct rcar_thermal_priv *priv;
 
        rcar_thermal_for_each_priv(priv, common) {
@@ -481,6 +489,9 @@ static int rcar_thermal_remove(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, NULL);
 
+       pm_runtime_put_sync(dev);
+       pm_runtime_disable(dev);
+
        return 0;
 }