Skip to content

Commit 834fca4

Browse files
committed
azalea: add thermal warn action
When trigger thermal warn, set SPL to 15W. Signed-off-by: elmo_lan <hplan1112@gmail.com>
1 parent 5ee2317 commit 834fca4

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

common/thermal.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ static void thermal_control(void)
238238
/* Wait until after the sensors have been read */
239239
DECLARE_HOOK(HOOK_SECOND, thermal_control, HOOK_PRIO_TEMP_SENSOR_DONE);
240240

241+
/*****************************************************************************/
242+
/* Project */
243+
bool thermal_warn_trigger(void)
244+
{
245+
if (cond_went_true(&cond_hot[EC_TEMP_THRESH_WARN]))
246+
return true;
247+
else
248+
return false;
249+
}
250+
241251
/*****************************************************************************/
242252
/* Console commands */
243253

include/thermal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ int thermal_fan_percent(int low, int high, int cur);
2727
*/
2828
void board_override_fan_control(int fan, int *tmp);
2929

30+
bool thermal_warn_trigger(void);
31+
3032
#endif /* __CROS_EC_THERMAL_H */

zephyr/program/lotus/azalea/src/cpu_power.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ void update_soc_power_limit(bool force_update, bool force_no_adapter)
276276
powerlimit_restore = 0;
277277
}
278278

279+
/* when trigger thermal warm, reduce SPL to 15W */
280+
if (thermal_warn_trigger())
281+
power_limit[FUNCTION_THERMAL].mwatt[TYPE_SPL] = 15000;
282+
else
283+
power_limit[FUNCTION_THERMAL].mwatt[TYPE_SPL] = 0;
284+
279285
/* choose the lowest one */
280286
for (int item = TYPE_SPL; item < TYPE_P3T; item++) {
281287
/* use slider as default */

zephyr/program/lotus/include/cpu_power.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ struct power_limit_details {
4242

4343
void update_soc_power_limit(bool force_update, bool force_no_adapter);
4444

45+
extern bool thermal_warn_trigger(void);
46+
4547
#endif /* __CROS_EC_CPU_POWER_H */

0 commit comments

Comments
 (0)