diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/ambassador/board.c | 39 | ||||
-rw-r--r-- | board/ambassador/board.h | 1 | ||||
-rw-r--r-- | board/genesis/board.c | 39 | ||||
-rw-r--r-- | board/genesis/board.h | 1 | ||||
-rw-r--r-- | board/moonbuggy/board.c | 39 | ||||
-rw-r--r-- | board/moonbuggy/board.h | 1 | ||||
-rw-r--r-- | board/scout/board.c | 39 | ||||
-rw-r--r-- | board/scout/board.h | 1 |
8 files changed, 152 insertions, 8 deletions
diff --git a/board/ambassador/board.c b/board/ambassador/board.c index 866623b4d8..8ecd03688a 100644 --- a/board/ambassador/board.c +++ b/board/ambassador/board.c @@ -380,6 +380,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ +static const int temp_fan_off = C_TO_K(35); +static const int temp_fan_max = C_TO_K(55); const static struct ec_thermal_config thermal_a = { .temp_host = { [EC_TEMP_THRESH_WARN] = 0, @@ -391,8 +393,8 @@ const static struct ec_thermal_config thermal_a = { [EC_TEMP_THRESH_HIGH] = C_TO_K(70), [EC_TEMP_THRESH_HALT] = 0, }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(84), + .temp_fan_off = temp_fan_off, + .temp_fan_max = temp_fan_max, }; const static struct ec_thermal_config thermal_b = { @@ -413,6 +415,39 @@ struct ec_thermal_config thermal_params[] = { }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); +static const struct fan_step_1_1 fan_table0[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(35), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(41), + .rpm = 2500 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 2900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 3400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .rpm = 3900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .rpm = 4400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(52), + .rpm = 4900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(55), + .rpm = 5200 }, +}; +#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0) + +static const struct fan_step_1_1 *fan_table = fan_table0; + +int fan_percent_to_rpm(int fan_index, int temp_ratio) +{ + return temp_ratio_to_rpm_hysteresis(fan_table, NUM_FAN_LEVELS, + fan_index, temp_ratio, NULL); +} + /* Power sensors */ const struct ina3221_t ina3221[] = { { I2C_PORT_INA, 0x40, { "PP3300_G", "PP5000_A", "PP3300_WLAN" } }, diff --git a/board/ambassador/board.h b/board/ambassador/board.h index db9463a276..da7906ad58 100644 --- a/board/ambassador/board.h +++ b/board/ambassador/board.h @@ -120,6 +120,7 @@ #define CONFIG_FANS 1 #undef CONFIG_FAN_INIT_SPEED #define CONFIG_FAN_INIT_SPEED 0 +#define CONFIG_FAN_RPM_CUSTOM #define CONFIG_TEMP_SENSOR #define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS #define CONFIG_THERMISTOR diff --git a/board/genesis/board.c b/board/genesis/board.c index 22bed97fe7..7c56544390 100644 --- a/board/genesis/board.c +++ b/board/genesis/board.c @@ -228,6 +228,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ +static const int temp_fan_off = C_TO_K(35); +static const int temp_fan_max = C_TO_K(55); const static struct ec_thermal_config thermal_a = { .temp_host = { [EC_TEMP_THRESH_WARN] = 0, @@ -239,8 +241,8 @@ const static struct ec_thermal_config thermal_a = { [EC_TEMP_THRESH_HIGH] = C_TO_K(70), [EC_TEMP_THRESH_HALT] = 0, }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(84), + .temp_fan_off = temp_fan_off, + .temp_fan_max = temp_fan_max, }; struct ec_thermal_config thermal_params[] = { @@ -248,6 +250,39 @@ struct ec_thermal_config thermal_params[] = { }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); +static const struct fan_step_1_1 fan_table0[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(35), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(41), + .rpm = 2500 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 2900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 3400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .rpm = 3900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .rpm = 4400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(52), + .rpm = 4900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(55), + .rpm = 5200 }, +}; +#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0) + +static const struct fan_step_1_1 *fan_table = fan_table0; + +int fan_percent_to_rpm(int fan_index, int temp_ratio) +{ + return temp_ratio_to_rpm_hysteresis(fan_table, NUM_FAN_LEVELS, + fan_index, temp_ratio, NULL); +} + /* Power sensors */ const struct ina3221_t ina3221[] = { { I2C_PORT_INA, 0x40, { "PP3300_G", "PP5000_A", "PP3300_WLAN" } }, diff --git a/board/genesis/board.h b/board/genesis/board.h index eba2fd52e4..1688152739 100644 --- a/board/genesis/board.h +++ b/board/genesis/board.h @@ -106,6 +106,7 @@ #define CONFIG_FANS 1 #undef CONFIG_FAN_INIT_SPEED #define CONFIG_FAN_INIT_SPEED 0 +#define CONFIG_FAN_RPM_CUSTOM #define CONFIG_TEMP_SENSOR #define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS #define CONFIG_THERMISTOR diff --git a/board/moonbuggy/board.c b/board/moonbuggy/board.c index 5a9069135e..6f55a206e0 100644 --- a/board/moonbuggy/board.c +++ b/board/moonbuggy/board.c @@ -264,6 +264,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ +static const int temp_fan_off = C_TO_K(35); +static const int temp_fan_max = C_TO_K(55); const static struct ec_thermal_config thermal_a = { .temp_host = { [EC_TEMP_THRESH_WARN] = 0, @@ -275,8 +277,8 @@ const static struct ec_thermal_config thermal_a = { [EC_TEMP_THRESH_HIGH] = C_TO_K(78), [EC_TEMP_THRESH_HALT] = 0, }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(89), + .temp_fan_off = temp_fan_off, + .temp_fan_max = temp_fan_max, }; struct ec_thermal_config thermal_params[] = { @@ -284,6 +286,39 @@ struct ec_thermal_config thermal_params[] = { }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); +static const struct fan_step_1_1 fan_table0[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(35), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(41), + .rpm = 2500 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 2900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 3400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .rpm = 3900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .rpm = 4400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(52), + .rpm = 4900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(55), + .rpm = 5300 }, +}; +#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0) + +static const struct fan_step_1_1 *fan_table = fan_table0; + +int fan_percent_to_rpm(int fan_index, int temp_ratio) +{ + return temp_ratio_to_rpm_hysteresis(fan_table, NUM_FAN_LEVELS, + fan_index, temp_ratio, NULL); +} + /* Power sensors */ const struct ina3221_t ina3221[] = { { I2C_PORT_INA, 0x40, { "PP3300_G", "PP5000_A", "PP3300_WLAN" } }, diff --git a/board/moonbuggy/board.h b/board/moonbuggy/board.h index 993719a70c..598c1bf940 100644 --- a/board/moonbuggy/board.h +++ b/board/moonbuggy/board.h @@ -106,6 +106,7 @@ #define CONFIG_FANS 1 #undef CONFIG_FAN_INIT_SPEED #define CONFIG_FAN_INIT_SPEED 0 +#define CONFIG_FAN_RPM_CUSTOM #define CONFIG_TEMP_SENSOR #define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS #define CONFIG_THERMISTOR diff --git a/board/scout/board.c b/board/scout/board.c index 6758828ae0..5ca703c76b 100644 --- a/board/scout/board.c +++ b/board/scout/board.c @@ -341,6 +341,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ +static const int temp_fan_off = C_TO_K(35); +static const int temp_fan_max = C_TO_K(55); const static struct ec_thermal_config thermal_a = { .temp_host = { [EC_TEMP_THRESH_WARN] = 0, @@ -352,8 +354,8 @@ const static struct ec_thermal_config thermal_a = { [EC_TEMP_THRESH_HIGH] = C_TO_K(78), [EC_TEMP_THRESH_HALT] = 0, }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(89), + .temp_fan_off = temp_fan_off, + .temp_fan_max = temp_fan_max, }; const static struct ec_thermal_config thermal_b = { @@ -375,6 +377,39 @@ struct ec_thermal_config thermal_params[] = { }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); +static const struct fan_step_1_1 fan_table0[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(35), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(41), + .rpm = 2400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 2900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 3400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .rpm = 3900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .rpm = 4400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(52), + .rpm = 4900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(55), + .rpm = 5300 }, +}; +#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0) + +static const struct fan_step_1_1 *fan_table = fan_table0; + +int fan_percent_to_rpm(int fan_index, int temp_ratio) +{ + return temp_ratio_to_rpm_hysteresis(fan_table, NUM_FAN_LEVELS, + fan_index, temp_ratio, NULL); +} + /* Power sensors */ const struct ina3221_t ina3221[] = { { I2C_PORT_INA, 0x40, { "PP3300_G", "PP5000_A", "PP3300_WLAN" } }, diff --git a/board/scout/board.h b/board/scout/board.h index 802a4a3b1f..d83ccfd1d7 100644 --- a/board/scout/board.h +++ b/board/scout/board.h @@ -128,6 +128,7 @@ #define CONFIG_FANS 1 #undef CONFIG_FAN_INIT_SPEED #define CONFIG_FAN_INIT_SPEED 0 +#define CONFIG_FAN_RPM_CUSTOM #define CONFIG_TEMP_SENSOR #define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS #define CONFIG_THERMISTOR |