@@ -84,22 +84,21 @@ static unsigned int get_target_state(FAR struct thermal_instance_s *instance,
84
84
bool throttle )
85
85
{
86
86
FAR struct thermal_cooling_device_s * cdev = instance -> cdev ;
87
- unsigned int next_state = THERMAL_NO_TARGET ;
88
87
unsigned int cur_state = instance -> target ;
89
88
90
89
if (!cdev -> ops || !cdev -> ops -> get_state )
91
90
{
92
- return next_state ;
91
+ return THERMAL_NO_TARGET ;
93
92
}
94
93
95
94
if (cur_state == THERMAL_NO_TARGET )
96
95
{
97
96
if (throttle )
98
97
{
99
- next_state = validate_state (instance , throttle , cur_state , 1 );
98
+ return validate_state (instance , throttle , cur_state , 1 );
100
99
}
101
100
102
- return next_state ;
101
+ return THERMAL_NO_TARGET ;
103
102
}
104
103
105
104
/* Update Cooling State */
@@ -109,25 +108,37 @@ static unsigned int get_target_state(FAR struct thermal_instance_s *instance,
109
108
case THERMAL_TREND_RAISING :
110
109
if (throttle )
111
110
{
112
- next_state = validate_state (instance , throttle , cur_state , 1 );
111
+ return validate_state (instance , throttle , cur_state , 1 );
113
112
}
114
113
break ;
115
114
116
115
case THERMAL_TREND_DROPPING :
117
116
if (!throttle )
118
117
{
119
- next_state = validate_state (instance , throttle , cur_state , -1 );
118
+ return validate_state (instance , throttle , cur_state , -1 );
120
119
}
121
120
break ;
122
121
123
122
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
+ }
124
135
break ;
125
136
126
137
default :
127
138
break ;
128
139
}
129
140
130
- return next_state ;
141
+ return THERMAL_NO_TARGET ;
131
142
}
132
143
133
144
/* step_wise */
0 commit comments