rk3368: thermal: add suspend judeg
authorDavid Wu <wdc@rock-chips.com>
Tue, 31 Mar 2015 04:05:32 +0000 (12:05 +0800)
committerDavid Wu <wdc@rock-chips.com>
Tue, 31 Mar 2015 04:07:04 +0000 (12:07 +0800)
Signed-off-by: David Wu <wdc@rock-chips.com>
drivers/thermal/rockchip_thermal.c

index 1532783c2f4b8663b67a2a644c07ad296c451259..5a435bf4f7019a401d9fb6d47ce15623fedc33e9 100755 (executable)
@@ -27,6 +27,7 @@
 #include <linux/regmap.h>
 #include <linux/gpio.h>
 #include <linux/of_gpio.h>
+#include <linux/rockchip/common.h>
 #include "../../arch/arm/mach-rockchip/efuse.h"
 
 #if 0
@@ -119,6 +120,7 @@ struct rockchip_thermal_data {
        int gpu_temp_adjust;
        int cpu_temp;
        bool logout;
+       bool b_suspend;
 
        void __iomem *regs;
 
@@ -849,7 +851,10 @@ int rockchip_tsadc_get_temp(int chn, int voltage)
        }
        else
        {
-               return rockchip_thermal_user_mode_get_temp(thermal, chn, voltage);
+               if(thermal->b_suspend)
+                       return INVALID_TEMP;
+               else
+                       return rockchip_thermal_user_mode_get_temp(thermal, chn, voltage);
        }
 }
 EXPORT_SYMBOL(rockchip_tsadc_get_temp);
@@ -1138,6 +1143,7 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
        struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
        int i;
 
+       thermal->b_suspend = true;
        if (thermal->chip->mode == TSADC_AUTO_MODE)
        {
                for (i = 0; i < ARRAY_SIZE(thermal->sensors); i++)
@@ -1185,6 +1191,8 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
                for (i = 0; i < ARRAY_SIZE(thermal->sensors); i++)
                        rockchip_thermal_toggle_sensor(&thermal->sensors[i], true);
        }
+
+       thermal->b_suspend = false;
        return 0;
 }