summaryrefslogtreecommitdiff
path: root/drivers/misc/therm_fan_est.c
diff options
context:
space:
mode:
authorAnshul Jain <anshulj@nvidia.com>2013-01-11 18:16:34 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:57:51 -0700
commite5a5daebf246a44d4374152bfb7d64fb12e5b8f3 (patch)
tree1f18b7ed5a51e17050931f8aef909f9552688a62 /drivers/misc/therm_fan_est.c
parenta5ec31cd0546bb9493fe9c65713e2da4329724d9 (diff)
drivers: misc: Suspend and resume in fan therm est
Bug 1205034 Bug 1210575 Change-Id: Ia639634a1a20ab7bc56ed941bc7efe1426509f83 Signed-off-by: Anshul Jain <anshulj@nvidia.com> Reviewed-on: http://git-master/r/190815 (cherry picked from commit 49ecc8470a28345ec3ed932766a5f1776a8bf15b) Signed-off-by: Richard Zhao <rizhao@nvidia.com> Change-Id: Ib464f5a44aa61629a6d4e1211f492657b7f76e7b Reviewed-on: http://git-master/r/199325 Reviewed-by: Riham Haidar <rhaidar@nvidia.com> Tested-by: Riham Haidar <rhaidar@nvidia.com>
Diffstat (limited to 'drivers/misc/therm_fan_est.c')
-rw-r--r--drivers/misc/therm_fan_est.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/misc/therm_fan_est.c b/drivers/misc/therm_fan_est.c
index 3d261376d47f..7dcd2069a199 100644
--- a/drivers/misc/therm_fan_est.c
+++ b/drivers/misc/therm_fan_est.c
@@ -335,9 +335,40 @@ static int __devexit therm_fan_est_remove(struct platform_device *pdev)
if (!est)
return -EINVAL;
+
+ cancel_delayed_work(&est->therm_fan_est_work);
thermal_zone_device_unregister(est->thz);
+
+ return 0;
+}
+
+#if CONFIG_PM
+static int therm_fan_est_suspend(struct platform_device *pdev,
+ pm_message_t state)
+{
+ struct therm_fan_estimator *est = platform_get_drvdata(pdev);
+
+ if (!est)
+ return -EINVAL;
+
+ cancel_delayed_work(&est->therm_fan_est_work);
+
+ return 0;
+}
+
+static int therm_fan_est_resume(struct platform_device *pdev)
+{
+ struct therm_fan_estimator *est = platform_get_drvdata(pdev);
+
+ if (!est)
+ return -EINVAL;
+
+ queue_delayed_work(est->workqueue,
+ &est->therm_fan_est_work,
+ msecs_to_jiffies(est->polling_period));
return 0;
}
+#endif
static struct platform_driver therm_fan_est_driver = {
.driver = {
@@ -346,6 +377,10 @@ static struct platform_driver therm_fan_est_driver = {
},
.probe = therm_fan_est_probe,
.remove = __devexit_p(therm_fan_est_remove),
+#if CONFIG_PM
+ .suspend = therm_fan_est_suspend,
+ .resume = therm_fan_est_resume,
+#endif
};
module_platform_driver(therm_fan_est_driver);