diff options
author | Devin Lu <Devin.Lu@quantatw.com> | 2021-09-03 14:10:22 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-25 17:06:44 +0000 |
commit | 21bee5e63a9c7bc010e7d7dea1b888f074c21116 (patch) | |
tree | bf444de5faa085deb09a163b08c722b29ac00f53 /common/thermal.c | |
parent | a68c82ec57de9e427e2151431378310b0e119fa3 (diff) | |
download | chrome-ec-21bee5e63a9c7bc010e7d7dea1b888f074c21116.tar.gz |
thermal: Don't check fan off/max with custom fan control.
Currently fan off and fan max only applied for legacy fan control
method. Those parameters do not affect the fan curve if
CONFIG_CUSTOM_FAN_CONTROL. The patch will not check the fan off/max
threshold with custom fan control.
BUG=none
BRANCH=none
TEST=make buildall
TEST=On Jinlon. Verify fan curve still work well.
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Change-Id: I49c204aba1468f793da0b890072e600e842be03f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141333
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/thermal.c')
-rw-r--r-- | common/thermal.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/common/thermal.c b/common/thermal.c index 50047c96bb..dba7334b74 100644 --- a/common/thermal.c +++ b/common/thermal.c @@ -61,17 +61,20 @@ static int first_read_delay = CONFIG_TEMP_SENSOR_FIRST_READ_DELAY_MS; static void thermal_control(void) { - int i, j, t, rv, f; + int i, j, t, rv; int count_over[EC_TEMP_THRESH_COUNT]; int count_under[EC_TEMP_THRESH_COUNT]; int num_valid_limits[EC_TEMP_THRESH_COUNT]; int num_sensors_read; - int fmax; - int temp_fan_configured; - -#ifdef CONFIG_CUSTOM_FAN_CONTROL +#ifdef CONFIG_FANS +#ifndef CONFIG_CUSTOM_FAN_CONTROL + int f = 0; + int fmax = 0; + int temp_fan_configured = 0; +#else int temp[TEMP_SENSOR_COUNT]; #endif +#endif /* add delay to ensure thermal sensor is ready when EC boot */ #if defined(CONFIG_TEMP_SENSOR_POWER_GPIO) && \ @@ -87,8 +90,6 @@ static void thermal_control(void) memset(count_under, 0, sizeof(count_under)); memset(num_valid_limits, 0, sizeof(num_valid_limits)); num_sensors_read = 0; - fmax = 0; - temp_fan_configured = 0; /* go through all the sensors */ for (i = 0; i < TEMP_SENSOR_COUNT; ++i) { @@ -96,7 +97,7 @@ static void thermal_control(void) /* read one */ rv = temp_sensor_read(i, &t); -#ifdef CONFIG_CUSTOM_FAN_CONTROL +#if defined(CONFIG_FANS) && defined(CONFIG_CUSTOM_FAN_CONTROL) /* Store all sensors value */ temp[i] = K_TO_C(t); #endif @@ -123,6 +124,8 @@ static void thermal_control(void) } } +#ifdef CONFIG_FANS +#ifndef CONFIG_CUSTOM_FAN_CONTROL /* figure out the max fan needed, too */ if (thermal_params[i].temp_fan_off && thermal_params[i].temp_fan_max) { @@ -134,6 +137,8 @@ static void thermal_control(void) temp_fan_configured = 1; } +#endif +#endif } if (!num_sensors_read) { @@ -208,16 +213,16 @@ static void thermal_control(void) throttle_ap(THROTTLE_OFF, THROTTLE_SOFT, THROTTLE_SRC_THERMAL); } - if (temp_fan_configured) { #ifdef CONFIG_FANS #ifdef CONFIG_CUSTOM_FAN_CONTROL - for (i = 0; i < fan_get_count(); i++) { - if (!is_thermal_control_enabled(i)) - continue; + for (i = 0; i < fan_get_count(); i++) { + if (!is_thermal_control_enabled(i)) + continue; - board_override_fan_control(i, temp); - } + board_override_fan_control(i, temp); + } #else + if (temp_fan_configured) { /* TODO(crosbug.com/p/23797): For now, we just treat all * fans the same. It would be better if we could assign * different thermal profiles to each fan - in case one @@ -226,9 +231,9 @@ static void thermal_control(void) */ for (i = 0; i < fan_get_count(); i++) fan_set_percent_needed(i, fmax); + } #endif #endif - } } /* Wait until after the sensors have been read */ |