diff options
| author | Anshul Jain <anshulj@nvidia.com> | 2013-01-11 21:16:34 -0500 |
|---|---|---|
| committer | Nicolin Chen <nicolinc@nvidia.com> | 2017-08-14 21:38:52 -0400 |
| commit | f60879c3e5384141759f4350b742d4f1d6523bf5 (patch) | |
| tree | c8cc6a70630b6243fc7e3a778039e3637b530b10 | |
| parent | 6ec2c7a6ed4f82ddd7ec1aa204cf823a291f9484 (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
| -rw-r--r-- | drivers/misc/therm_fan_est.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/misc/therm_fan_est.c b/drivers/misc/therm_fan_est.c index 3d261376d..7dcd2069a 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) | |||
| 335 | 335 | ||
| 336 | if (!est) | 336 | if (!est) |
| 337 | return -EINVAL; | 337 | return -EINVAL; |
| 338 | |||
| 339 | cancel_delayed_work(&est->therm_fan_est_work); | ||
| 338 | thermal_zone_device_unregister(est->thz); | 340 | thermal_zone_device_unregister(est->thz); |
| 341 | |||
| 342 | return 0; | ||
| 343 | } | ||
| 344 | |||
| 345 | #if CONFIG_PM | ||
| 346 | static int therm_fan_est_suspend(struct platform_device *pdev, | ||
| 347 | pm_message_t state) | ||
| 348 | { | ||
| 349 | struct therm_fan_estimator *est = platform_get_drvdata(pdev); | ||
| 350 | |||
| 351 | if (!est) | ||
| 352 | return -EINVAL; | ||
| 353 | |||
| 354 | cancel_delayed_work(&est->therm_fan_est_work); | ||
| 355 | |||
| 356 | return 0; | ||
| 357 | } | ||
| 358 | |||
| 359 | static int therm_fan_est_resume(struct platform_device *pdev) | ||
| 360 | { | ||
| 361 | struct therm_fan_estimator *est = platform_get_drvdata(pdev); | ||
| 362 | |||
| 363 | if (!est) | ||
| 364 | return -EINVAL; | ||
| 365 | |||
| 366 | queue_delayed_work(est->workqueue, | ||
| 367 | &est->therm_fan_est_work, | ||
| 368 | msecs_to_jiffies(est->polling_period)); | ||
| 339 | return 0; | 369 | return 0; |
| 340 | } | 370 | } |
| 371 | #endif | ||
| 341 | 372 | ||
| 342 | static struct platform_driver therm_fan_est_driver = { | 373 | static struct platform_driver therm_fan_est_driver = { |
| 343 | .driver = { | 374 | .driver = { |
| @@ -346,6 +377,10 @@ static struct platform_driver therm_fan_est_driver = { | |||
| 346 | }, | 377 | }, |
| 347 | .probe = therm_fan_est_probe, | 378 | .probe = therm_fan_est_probe, |
| 348 | .remove = __devexit_p(therm_fan_est_remove), | 379 | .remove = __devexit_p(therm_fan_est_remove), |
| 380 | #if CONFIG_PM | ||
| 381 | .suspend = therm_fan_est_suspend, | ||
| 382 | .resume = therm_fan_est_resume, | ||
| 383 | #endif | ||
| 349 | }; | 384 | }; |
| 350 | 385 | ||
| 351 | module_platform_driver(therm_fan_est_driver); | 386 | module_platform_driver(therm_fan_est_driver); |
