diff options
author | Bitan Biswas <bbiswas@nvidia.com> | 2012-06-14 23:02:18 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-07-09 03:10:38 -0700 |
commit | 26d0cb1bae979bbc59dfb413da3fd336d07a5ce7 (patch) | |
tree | f88cef3733df17d58b0fb97f706a1598e71ad2b6 | |
parent | 95139f5189204ab3ccc2cd3ae7a375fbac606463 (diff) |
ARM: tegra: thermal framework notifier
Tegra thermal framework notifier is used to bypass
driver callbacks after suspend is initiated.
bug 999175
Signed-off-by: Linqiang Pu <dpu@nvidia.com>
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
(cherry picked from commit de6b3b3e4b05edf05ceeda820a8aac548a83d410)
Change-Id: I93bee5d6a4e2738db0d4db821035900b64a850be
Reviewed-on: http://git-master/r/108924
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/tegra3_thermal.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/tegra3_thermal.c b/arch/arm/mach-tegra/tegra3_thermal.c index dcd07dd41c21..788a5d7b26f8 100644 --- a/arch/arm/mach-tegra/tegra3_thermal.c +++ b/arch/arm/mach-tegra/tegra3_thermal.c @@ -28,6 +28,7 @@ #include <mach/thermal.h> #include <mach/edp.h> #include <linux/slab.h> +#include <linux/suspend.h> #include "clock.h" #include "cpu-tegra.h" @@ -49,6 +50,7 @@ static int skin_devs_bitmap; static struct therm_est_subdevice *skin_devs[THERMAL_DEVICE_MAX]; static int skin_devs_count; #endif +static bool tegra_thermal_suspend; #ifdef CONFIG_DEBUG_FS static struct dentry *thermal_debugfs_root; @@ -132,7 +134,8 @@ static int tegra_thermal_zone_get_temp(struct thermal_zone_device *thz, { struct tegra_thermal_device *device = thz->devdata; - device->get_temp(device->data, temp); + if (!tegra_thermal_suspend) + device->get_temp(device->data, temp); return 0; } @@ -178,6 +181,25 @@ static struct thermal_zone_device_ops tegra_thermal_zone_ops = { }; #endif +static int tegra_thermal_pm_notify(struct notifier_block *nb, + unsigned long event, void *data) +{ + switch (event) { + case PM_SUSPEND_PREPARE: + tegra_thermal_suspend = true; + break; + case PM_POST_SUSPEND: + tegra_thermal_suspend = false; + break; + } + + return NOTIFY_OK; +}; + +static struct notifier_block tegra_thermal_nb = { + .notifier_call = tegra_thermal_pm_notify, +}; + static void tegra_thermal_alert_unlocked(void *data) { struct tegra_thermal_device *device = data; @@ -194,7 +216,7 @@ static void tegra_thermal_alert_unlocked(void *data) #ifdef CONFIG_TEGRA_THERMAL_THROTTLE if (device->thz) { - if (!device->thz->passive) + if ((!device->thz->passive) && (!tegra_thermal_suspend)) thermal_zone_device_update(device->thz); } #endif @@ -409,6 +431,7 @@ int tegra_thermal_device_register(struct tegra_thermal_device *device) tegra_skin_device_register(device); #endif + register_pm_notifier(&tegra_thermal_nb); return 0; } |