From 6277f7e336f0dc96b676905a4c420f9d53951603 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Thu, 19 Sep 2013 16:55:40 -0700 Subject: Fix thermal.c compilation if fans are not present. Currently, it doesn't compile unless CONFIG_FAN is defined. BUG=chrome-os-partner:22803 BRANCH=none TEST=temporarily undefine CONFIG_FAN in board/link/board.h; code compiles and all unit tests pass Change-Id: I251d670ccd299f7a50b1455364a817e07fad4cb1 Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/170106 --- chip/lm4/fan.c | 2 +- common/thermal.c | 2 ++ test/test_config.h | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/chip/lm4/fan.c b/chip/lm4/fan.c index cf109573ff..663bcdab1d 100644 --- a/chip/lm4/fan.c +++ b/chip/lm4/fan.c @@ -134,7 +134,7 @@ static void fan_set_thermal_control_enabled(int enable) } /* The thermal task will only call this function with pct in [0,100]. */ -void pwm_fan_set_percent_needed(int pct) +test_mockable void pwm_fan_set_percent_needed(int pct) { int rpm; diff --git a/common/thermal.c b/common/thermal.c index c51b5dc01a..c6c49868d2 100644 --- a/common/thermal.c +++ b/common/thermal.c @@ -146,8 +146,10 @@ static void thermal_control(void) throttle_ap(THROTTLE_OFF, THROTTLE_SOFT, THROTTLE_SRC_THERMAL); } +#ifdef CONFIG_FAN /* Max fan needed is what's needed. */ pwm_fan_set_percent_needed(fmax); +#endif } /* Wait until after the sensors have been read */ diff --git a/test/test_config.h b/test/test_config.h index 0310e80e40..28aedd1474 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -32,6 +32,9 @@ int board_discharge_on_ac(int enabled); #ifdef TEST_thermal #define CONFIG_CHIPSET_CAN_THROTTLE +#define CONFIG_FAN +#define CONFIG_FAN_RPM_MAX 5000 +#define CONFIG_FAN_RPM_MIN 1000 #define CONFIG_TEMP_SENSOR #endif @@ -42,6 +45,9 @@ int board_discharge_on_ac(int enabled); #define CONFIG_CHARGER_INPUT_CURRENT 4032 #define CONFIG_CHIPSET_CAN_THROTTLE #define CONFIG_EXTPOWER_FALCO +#define CONFIG_FAN +#define CONFIG_FAN_RPM_MAX 5000 +#define CONFIG_FAN_RPM_MIN 1000 #define CONFIG_TEMP_SENSOR #define I2C_PORT_BATTERY 1 #define I2C_PORT_CHARGER 1 -- cgit v1.2.1