OSDN Git Service

thermal: consider emul_temperature while computing trend
authorEduardo Valentin <eduardo.valentin@ti.com>
Wed, 29 May 2013 21:37:00 +0000 (21:37 +0000)
committerZhang Rui <rui.zhang@intel.com>
Thu, 13 Jun 2013 02:29:28 +0000 (10:29 +0800)
In case emulated temperature is in use, using the trend
provided by driver layer can lead to bogus situation.
In this case, debugger user would set a temperature value,
but the trend would be from driver computation.

To avoid this situation, this patch changes the get_tz_trend()
to consider the emulated temperature whenever that is in use.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
Cc: Durgadoss R <durgadoss.r@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/thermal_core.c

index d755440..c00dc92 100644 (file)
@@ -155,7 +155,8 @@ int get_tz_trend(struct thermal_zone_device *tz, int trip)
 {
        enum thermal_trend trend;
 
-       if (!tz->ops->get_trend || tz->ops->get_trend(tz, trip, &trend)) {
+       if (tz->emul_temperature || !tz->ops->get_trend ||
+           tz->ops->get_trend(tz, trip, &trend)) {
                if (tz->temperature > tz->last_temperature)
                        trend = THERMAL_TREND_RAISING;
                else if (tz->temperature < tz->last_temperature)