summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_sys.c
diff options
context:
space:
mode:
authorRong Dian <b38775@freescale.com>2012-08-20 20:23:00 +0800
committerRong Dian <b38775@freescale.com>2012-08-21 14:46:17 +0800
commit1d80bd0d43df0561cf64d062a501aabe8a9cd44f (patch)
tree30f34599e1c3e6ad01f660d9e3c3e089fdd8e68f /drivers/thermal/thermal_sys.c
parent30b0b3d67d251ebaf916b2463cc8eda479ef5758 (diff)
ENGR00220794 imx6 thermal: add suspend and resume for thermal_sys class
1.Avoiding system wrong reboot caused by error temperature without cancel_delayed_work before entering into suspend,so to cancel thermal_zone_device temperature polling temperature delayed_work before entering into suspend, reenable polling temperature delayed_work after entering into resume. 2.In anatop_thermal_suspend, turn off alarm firstly Signed-off-by: Rong Dian <b38775@freescale.com>
Diffstat (limited to 'drivers/thermal/thermal_sys.c')
-rw-r--r--drivers/thermal/thermal_sys.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 04506f67ea45..745db5e9a33d 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -842,10 +842,33 @@ static void thermal_release(struct device *dev)
kfree(cdev);
}
}
+static int thermal_suspend(struct device *dev, pm_message_t state)
+{
+ struct thermal_zone_device *tz;
+ if (!strncmp(dev_name(dev), "thermal_zone", strlen("thermal_zone"))) {
+ tz = to_thermal_zone(dev);
+ thermal_zone_device_set_polling(tz, 0);
+ }
+ return 0;
+}
+static int themal_resume(struct device *dev)
+{
+ struct thermal_zone_device *tz;
+ if (!strncmp(dev_name(dev), "thermal_zone", strlen("thermal_zone"))) {
+ tz = to_thermal_zone(dev);
+ if (tz->passive)
+ thermal_zone_device_set_polling(tz, tz->passive_delay);
+ else if (tz->polling_delay)
+ thermal_zone_device_set_polling(tz, tz->polling_delay);
+ }
+ return 0;
+}
static struct class thermal_class = {
.name = "thermal",
.dev_release = thermal_release,
+ .suspend = thermal_suspend,
+ .resume = themal_resume,
};
/**