Skip to content

Commit be94500

Browse files
committed
azalea: fix thermal warn
1. set sppt not spl when thermal warn. 2. using flag to show thermal warn action. Signed-off-by: elmo_lan <hplan1112@gmail.com>
1 parent eea52e0 commit be94500

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

common/thermal.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ BUILD_ASSERT(EC_TEMP_THRESH_COUNT == 3);
5252

5353
/* Keep track of which thresholds have triggered */
5454
static cond_t cond_hot[EC_TEMP_THRESH_COUNT];
55+
#ifdef CONFIG_PLATFORM_EC_CUSTOMIZED_DESIGN
56+
static bool thermal_warn_active;
57+
#endif
5558

5659
/* thermal sensor read delay */
5760
#if defined(CONFIG_TEMP_SENSOR_POWER) && \
@@ -207,9 +210,15 @@ static void thermal_control(void)
207210
if (cond_went_true(&cond_hot[EC_TEMP_THRESH_WARN])) {
208211
CPRINTS("thermal WARN");
209212
throttle_ap(THROTTLE_ON, THROTTLE_SOFT, THROTTLE_SRC_THERMAL);
213+
#ifdef CONFIG_PLATFORM_EC_CUSTOMIZED_DESIGN
214+
thermal_warn_active = true;
215+
#endif
210216
} else if (cond_went_false(&cond_hot[EC_TEMP_THRESH_WARN])) {
211217
CPRINTS("thermal no longer warn");
212218
throttle_ap(THROTTLE_OFF, THROTTLE_SOFT, THROTTLE_SRC_THERMAL);
219+
#ifdef CONFIG_PLATFORM_EC_CUSTOMIZED_DESIGN
220+
thermal_warn_active = false;
221+
#endif
213222
}
214223

215224
#ifdef CONFIG_FANS
@@ -242,10 +251,7 @@ DECLARE_HOOK(HOOK_SECOND, thermal_control, HOOK_PRIO_TEMP_SENSOR_DONE);
242251
/* Project */
243252
bool thermal_warn_trigger(void)
244253
{
245-
if (cond_went_true(&cond_hot[EC_TEMP_THRESH_WARN]))
246-
return true;
247-
else
248-
return false;
254+
return thermal_warn_active;
249255
}
250256

251257
/*****************************************************************************/

driver/temp_sensor/f75303.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ void f75303_update_temperature(int idx)
141141
}
142142
if (rv == EC_SUCCESS)
143143
temps[idx] = temp_reg;
144+
145+
if (fake_temp[idx] != -1)
146+
temps[idx] = KELVIN_TO_MILLI_KELVIN(C_TO_K(fake_temp[idx]));
144147
}
145148
#endif /* CONFIG_ZEPHYR */
146149

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ void update_soc_power_limit(bool force_update, bool force_no_adapter)
278278

279279
/* when trigger thermal warm, reduce SPL to 15W */
280280
if (thermal_warn_trigger())
281-
power_limit[FUNCTION_THERMAL].mwatt[TYPE_SPL] = 15000;
281+
power_limit[FUNCTION_THERMAL].mwatt[TYPE_SPPT] = 15000;
282282
else
283-
power_limit[FUNCTION_THERMAL].mwatt[TYPE_SPL] = 0;
283+
power_limit[FUNCTION_THERMAL].mwatt[TYPE_SPPT] = 0;
284284

285285
/* choose the lowest one */
286286
for (int item = TYPE_SPL; item < TYPE_P3T; item++) {

0 commit comments

Comments
 (0)