Thermal: pid_thermal_gov: Apply compenstaion even if sum_err is 0 or max
Jinyoung Park [Fri, 22 Mar 2013 04:41:05 +0000 (13:41 +0900)]
Applied compensation even if sum_err is 0 or max to prevent determining
target state to 0 in short time.

Bug 1200111

Change-Id: I52a8bbeb4ae8553f14401cd0eaa4508337111955
Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/211960
GVS: Gerrit_Virtual_Submit
Reviewed-by: Edward Riegelsberger <eriegels@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Tested-by: Diwakar Tundlam <dtundlam@nvidia.com>

drivers/thermal/pid_thermal_gov.c

index cce12d1..7912f18 100644 (file)
@@ -385,15 +385,8 @@ pid_thermal_gov_get_target(struct thermal_zone_device *tz,
                        derivative = min_t(s64, derivative, max_dout);
        }
 
-       sum_err = proportional + derivative;
-       sum_err = max_t(s64, sum_err, 0);
-       if (sum_err == 0)
-               return 0;
-
+       sum_err = max_t(s64, proportional + derivative, 0);
        sum_err = min_t(s64, sum_err, max_err);
-       if (sum_err == max_err)
-               return max_state;
-
        sum_err = sum_err * max_state + max_err - 1;
        target = (unsigned long)div64_s64(sum_err, max_err);