Skip to content

Commit e8758eb

Browse files
JianyuWang0623xiaoxiang781216
authored andcommitted
Thermal/step_wise: Increase cooling state in case of "stable" trend and "hot" trip.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
1 parent 68d5516 commit e8758eb

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

drivers/thermal/thermal_dummy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static int dummy_cpufreq_resume (FAR struct cpufreq_policy *driver);
102102
static const struct thermal_zone_trip_s g_dummy_trips[] =
103103
{
104104
{.name = "cpu_crit", .temp = 90, .hyst = 10, .type = THERMAL_CRITICAL},
105-
{.name = "cpu_alert1", .temp = 70, .hyst = 10, .type = THERMAL_NORMAL},
105+
{.name = "cpu_alert1", .temp = 70, .hyst = 10, .type = THERMAL_HOT},
106106
{.name = "cpu_alert0", .temp = 60, .hyst = 10, .type = THERMAL_NORMAL},
107107
};
108108

drivers/thermal/thermal_step_wise.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,21 @@ static unsigned int get_target_state(FAR struct thermal_instance_s *instance,
8484
bool throttle)
8585
{
8686
FAR struct thermal_cooling_device_s *cdev = instance->cdev;
87-
unsigned int next_state = THERMAL_NO_TARGET;
8887
unsigned int cur_state = instance->target;
8988

9089
if (!cdev->ops || !cdev->ops->get_state)
9190
{
92-
return next_state;
91+
return THERMAL_NO_TARGET;
9392
}
9493

9594
if (cur_state == THERMAL_NO_TARGET)
9695
{
9796
if (throttle)
9897
{
99-
next_state = validate_state(instance, throttle, cur_state, 1);
98+
return validate_state(instance, throttle, cur_state, 1);
10099
}
101100

102-
return next_state;
101+
return THERMAL_NO_TARGET;
103102
}
104103

105104
/* Update Cooling State */
@@ -109,25 +108,37 @@ static unsigned int get_target_state(FAR struct thermal_instance_s *instance,
109108
case THERMAL_TREND_RAISING:
110109
if (throttle)
111110
{
112-
next_state = validate_state(instance, throttle, cur_state, 1);
111+
return validate_state(instance, throttle, cur_state, 1);
113112
}
114113
break;
115114

116115
case THERMAL_TREND_DROPPING:
117116
if (!throttle)
118117
{
119-
next_state = validate_state(instance, throttle, cur_state, -1);
118+
return validate_state(instance, throttle, cur_state, -1);
120119
}
121120
break;
122121

123122
case THERMAL_TREND_STABLE:
123+
if (throttle)
124+
{
125+
enum thermal_trip_type_e type;
126+
int ret;
127+
128+
ret = thermal_zone_get_trip_type(instance->zdev, instance->trip,
129+
&type);
130+
if (ret >= 0 && type == THERMAL_HOT)
131+
{
132+
return validate_state(instance, throttle, cur_state, 1);
133+
}
134+
}
124135
break;
125136

126137
default:
127138
break;
128139
}
129140

130-
return next_state;
141+
return THERMAL_NO_TARGET;
131142
}
132143

133144
/* step_wise */

0 commit comments

Comments
 (0)