thermal: cooldev: fix cpucore cool devices driver issue [1/1]
authorHuan Biao <huan.biao@amlogic.com>
Thu, 20 Dec 2018 09:42:24 +0000 (17:42 +0800)
committerLuan Yuan <luan.yuan@amlogic.com>
Wed, 26 Dec 2018 12:12:58 +0000 (20:12 +0800)
PD#SWPL-3334

Problem:
cpucore cool devices upper date type no match
cpucore num set error

Solution:
modify cpucore upper num check

Verify:
w400 pass

Change-Id: I83f829d31cab565d5ca3b892bb58a4a68b8f0f20
Signed-off-by: Huan Biao <huan.biao@amlogic.com>
drivers/amlogic/thermal/cpucore_cooling.c

index 0c67c32..0b0c7fc 100644 (file)
@@ -197,7 +197,7 @@ static int cpucore_notify_state(struct thermal_cooling_device *cdev,
                                struct thermal_zone_device *tz,
                                enum thermal_trip_type type)
 {
-       unsigned long  ins_upper;
+       unsigned long  ins_upper, target_upper = 0;
        long cur_state;
        long upper = -1;
        int i;
@@ -206,8 +206,11 @@ static int cpucore_notify_state(struct thermal_cooling_device *cdev,
        case THERMAL_TRIP_HOT:
                for (i = 0; i < tz->trips; i++) {
                        ins_upper = thermal_get_upper(tz, cdev, i);
-                       if (ins_upper > upper)
-                               upper = ins_upper;
+                       if (!IS_ERR_VALUE(ins_upper)
+                               && (ins_upper >= target_upper)) {
+                               target_upper = ins_upper;
+                               upper = target_upper;
+                       }
                }
                cur_state = tz->hot_step;
                /* do not exceed levels */