diff options
59 files changed, 2151 insertions, 1517 deletions
diff --git a/board/akemi/board.c b/board/akemi/board.c index 5b88f82fb5..1cfdedb626 100644 --- a/board/akemi/board.c +++ b/board/akemi/board.c @@ -332,20 +332,25 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * for Hatch. They matter when the EC is controlling the fan as opposed to DPTF * control. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/ambassador/board.c b/board/ambassador/board.c index 94ceac98e4..698acf70bb 100644 --- a/board/ambassador/board.c +++ b/board/ambassador/board.c @@ -379,36 +379,46 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(78), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [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), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(78), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [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), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(78), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(78), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_CORE] = thermal_a, + [TEMP_SENSOR_CORE] = THERMAL_A, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/anahera/sensors.c b/board/anahera/sensors.c index 3d3b58eeae..7f388579e2 100644 --- a/board/anahera/sensors.c +++ b/board/anahera/sensors.c @@ -74,15 +74,20 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* * TODO(b/199246802): Need to update for Alder Lake/anahera */ -static const struct ec_thermal_config thermal_fan = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_FAN \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN; /* * TODO(b/199246802): Need to update for Alder Lake/anahera @@ -91,47 +96,64 @@ static const struct ec_thermal_config thermal_fan = { * 130 C. However, sensor is located next to SOC, so we need to use the lower * SOC temperature limit (85 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/199246802): Need to update for Alder Lake/anahera */ -static const struct ec_thermal_config thermal_charger = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CHARGER \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_charger = + THERMAL_CHARGER; /* * TODO(b/199246802): Need to update for Alder Lake/anahera */ -static const struct ec_thermal_config thermal_regulator = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_REGULATOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_regulator = + THERMAL_REGULATOR; /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_FAN] = thermal_fan, - [TEMP_SENSOR_2_SOC] = thermal_cpu, - [TEMP_SENSOR_3_CHARGER] = thermal_charger, - [TEMP_SENSOR_4_REGULATOR] = thermal_regulator, + [TEMP_SENSOR_1_FAN] = THERMAL_FAN, + [TEMP_SENSOR_2_SOC] = THERMAL_CPU, + [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER, + [TEMP_SENSOR_4_REGULATOR] = THERMAL_REGULATOR, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/berknip/board.c b/board/berknip/board.c index a119007de6..36b6b4f68f 100644 --- a/board/berknip/board.c +++ b/board/berknip/board.c @@ -484,51 +484,74 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_thermistor_soc = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(62), - [EC_TEMP_THRESH_HALT] = C_TO_K(66), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(57), - }, - .temp_fan_off = C_TO_K(39), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_THERMISTOR_SOC \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(62), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(66), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(57), \ + }, \ + .temp_fan_off = C_TO_K(39), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_thermistor_soc = + THERMAL_THERMISTOR_SOC; -const static struct ec_thermal_config thermal_thermistor_charger = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(99), - [EC_TEMP_THRESH_HALT] = C_TO_K(99), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(98), - }, - .temp_fan_off = C_TO_K(98), - .temp_fan_max = C_TO_K(99), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_THERMISTOR_CHARGER \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(99), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(99), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(98), \ + }, \ + .temp_fan_off = C_TO_K(98), \ + .temp_fan_max = C_TO_K(99), \ + } +__maybe_unused static const struct ec_thermal_config + thermal_thermistor_charger = THERMAL_THERMISTOR_CHARGER; -const static struct ec_thermal_config thermal_thermistor_5v = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(60), - [EC_TEMP_THRESH_HALT] = C_TO_K(99), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(50), - }, - .temp_fan_off = C_TO_K(98), - .temp_fan_max = C_TO_K(99), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_THERMISTOR_5V \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(60), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(99), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(50), \ + }, \ + .temp_fan_off = C_TO_K(98), \ + .temp_fan_max = C_TO_K(99), \ + } +__maybe_unused static const struct ec_thermal_config thermal_thermistor_5v = + THERMAL_THERMISTOR_5V; -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(100), - [EC_TEMP_THRESH_HALT] = C_TO_K(105), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(99), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(100), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(105), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(99), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/boldar/board.c b/board/boldar/board.c index 49a3a79831..2e412fe0d7 100644 --- a/board/boldar/board.c +++ b/board/boldar/board.c @@ -108,41 +108,51 @@ const struct fan_t fans[FAN_CH_COUNT] = { /******************************************************************************/ /* EC thermal management configuration */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(15), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(15), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator * * Need to use the lower of the charger IC, PP3300 regulator, and the inductors */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(15), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(15), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/brask/sensors.c b/board/brask/sensors.c index 72b8297aa1..7071c89f54 100644 --- a/board/brask/sensors.c +++ b/board/brask/sensors.c @@ -85,26 +85,31 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/197478860): add the thermal sensor setting */ /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CPU] = thermal_cpu, - [TEMP_SENSOR_2_CPU_VR] = thermal_cpu, - [TEMP_SENSOR_3_WIFI] = thermal_cpu, - [TEMP_SENSOR_4_DIMM] = thermal_cpu, + [TEMP_SENSOR_1_CPU] = THERMAL_CPU, + [TEMP_SENSOR_2_CPU_VR] = THERMAL_CPU, + [TEMP_SENSOR_3_WIFI] = THERMAL_CPU, + [TEMP_SENSOR_4_DIMM] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/brya/sensors.c b/board/brya/sensors.c index d4fd905884..0a4b0198bd 100644 --- a/board/brya/sensors.c +++ b/board/brya/sensors.c @@ -294,17 +294,22 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/180681346): update for Alder Lake/brya @@ -319,17 +324,23 @@ static const struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -static const struct ec_thermal_config thermal_ambient = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_AMBIENT \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_ambient = + THERMAL_AMBIENT; /* * Inductor limits - used for both charger and PP3300 regulator @@ -342,38 +353,50 @@ static const struct ec_thermal_config thermal_ambient = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_charger = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(105), - [EC_TEMP_THRESH_HALT] = C_TO_K(120), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(65), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CHARGER \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(105), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(120), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(65), \ + } +__maybe_unused static const struct ec_thermal_config thermal_charger = + THERMAL_CHARGER; /* * TODO(b/180681346): update for brya WWAN module */ -static const struct ec_thermal_config thermal_wwan = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(130), - [EC_TEMP_THRESH_HALT] = C_TO_K(130), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(100), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_WWAN \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(130), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(130), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(100), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_wwan = + THERMAL_WWAN; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_2_AMBIENT] = thermal_ambient, - [TEMP_SENSOR_3_CHARGER] = thermal_charger, - [TEMP_SENSOR_4_WWAN] = thermal_wwan, + [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_2_AMBIENT] = THERMAL_AMBIENT, + [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER, + [TEMP_SENSOR_4_WWAN] = THERMAL_WWAN, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/chronicler/board.c b/board/chronicler/board.c index c86ad462e1..af352e1e1e 100644 --- a/board/chronicler/board.c +++ b/board/chronicler/board.c @@ -66,34 +66,46 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (80 C) */ -const static struct ec_thermal_config thermal_config_without_fan = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(77), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CONFIG_WITHOUT_FAN \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(77), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config + thermal_config_without_fan = THERMAL_CONFIG_WITHOUT_FAN; -const static struct ec_thermal_config thermal_config_with_fan = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(77), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - /* For real temperature fan_table (0 ~ 99C) */ - .temp_fan_off = C_TO_K(0), - .temp_fan_max = C_TO_K(99), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CONFIG_WITH_FAN \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(77), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + /* For real temperature fan_table (0 ~ 99C) */ \ + .temp_fan_off = C_TO_K(0), \ + .temp_fan_max = C_TO_K(99), \ + } +__maybe_unused static const struct ec_thermal_config thermal_config_with_fan = + THERMAL_CONFIG_WITH_FAN; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_config_with_fan, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_config_without_fan, - [TEMP_SENSOR_3_DDR_SOC] = thermal_config_without_fan, - [TEMP_SENSOR_4_FAN] = thermal_config_without_fan, + [TEMP_SENSOR_1_CHARGER] = THERMAL_CONFIG_WITH_FAN, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_CONFIG_WITHOUT_FAN, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CONFIG_WITHOUT_FAN, + [TEMP_SENSOR_4_FAN] = THERMAL_CONFIG_WITHOUT_FAN, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/collis/board.c b/board/collis/board.c index 42a0f1469a..3076c2692f 100644 --- a/board/collis/board.c +++ b/board/collis/board.c @@ -176,17 +176,22 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -199,24 +204,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/copano/board.c b/board/copano/board.c index 9a20eee45f..efcde2c177 100644 --- a/board/copano/board.c +++ b/board/copano/board.c @@ -177,17 +177,22 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -200,24 +205,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/corori/board.c b/board/corori/board.c index 1ecbeeff25..03f9641d9f 100644 --- a/board/corori/board.c +++ b/board/corori/board.c @@ -165,31 +165,41 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(73), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(73), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/delbin/board.c b/board/delbin/board.c index 5984c4d157..92c5ebe839 100644 --- a/board/delbin/board.c +++ b/board/delbin/board.c @@ -111,17 +111,22 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(65), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(65), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -134,24 +139,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(65), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(65), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/dooly/board.c b/board/dooly/board.c index 50cc9fd647..5f854ca647 100644 --- a/board/dooly/board.c +++ b/board/dooly/board.c @@ -627,23 +627,28 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(78), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(41), - .temp_fan_max = C_TO_K(72), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(78), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(41), \ + .temp_fan_max = C_TO_K(72), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1] = thermal_a, + [TEMP_SENSOR_1] = THERMAL_A, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/dratini/board.c b/board/dratini/board.c index 53fbe4b3d5..a32dfe9104 100644 --- a/board/dratini/board.c +++ b/board/dratini/board.c @@ -343,35 +343,45 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* Dratini Temperature sensors */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(73), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(70), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(73), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(70), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(68), - [EC_TEMP_THRESH_HALT] = C_TO_K(70), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(68), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(70), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/driblee/board.c b/board/driblee/board.c index d40ebe25a6..e204632024 100644 --- a/board/driblee/board.c +++ b/board/driblee/board.c @@ -176,31 +176,41 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(73), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(73), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/drobit/board.c b/board/drobit/board.c index b08294bd24..fdfab38b52 100644 --- a/board/drobit/board.c +++ b/board/drobit/board.c @@ -128,17 +128,22 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(72), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(75), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(72), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(75), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -151,24 +156,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(72), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(75), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(72), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(75), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/eldrid/thermal.c b/board/eldrid/thermal.c index e44bcbc75c..3f20b16d70 100644 --- a/board/eldrid/thermal.c +++ b/board/eldrid/thermal.c @@ -27,15 +27,20 @@ * TODO(b/170143672): Have different sensor placement. The temperature need to * be changed. */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -48,21 +53,27 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/elemi/board.c b/board/elemi/board.c index bb59308213..6bca0e577d 100644 --- a/board/elemi/board.c +++ b/board/elemi/board.c @@ -98,47 +98,64 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(68), - [EC_TEMP_THRESH_HALT] = C_TO_K(70), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(58), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(68), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(70), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(58), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; -const static struct ec_thermal_config thermal_charger = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(78), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(68), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(70), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CHARGER \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(78), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(68), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(70), \ + } +__maybe_unused static const struct ec_thermal_config thermal_charger = + THERMAL_CHARGER; -const static struct ec_thermal_config thermal_regulator = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(68), - [EC_TEMP_THRESH_HALT] = C_TO_K(70), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(58), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_REGULATOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(68), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(70), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(58), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_regulator = + THERMAL_REGULATOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_charger, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_regulator, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_CHARGER, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_REGULATOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c index 418ca353c9..2244a7146a 100644 --- a/board/ezkinil/board.c +++ b/board/ezkinil/board.c @@ -715,29 +715,40 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_thermistor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - [EC_TEMP_THRESH_HALT] = C_TO_K(95), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - }, - .temp_fan_off = 0, - .temp_fan_max = 0, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_THERMISTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(95), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + }, \ + .temp_fan_off = 0, \ + .temp_fan_max = 0, \ + } +__maybe_unused static const struct ec_thermal_config thermal_thermistor = + THERMAL_THERMISTOR; -const static struct ec_thermal_config thermal_soc = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(32), - .temp_fan_max = C_TO_K(75), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_SOC \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(32), \ + .temp_fan_max = C_TO_K(75), \ + } +__maybe_unused static const struct ec_thermal_config thermal_soc = THERMAL_SOC; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/felwinter/sensors.c b/board/felwinter/sensors.c index 87025c017e..febf54d407 100644 --- a/board/felwinter/sensors.c +++ b/board/felwinter/sensors.c @@ -174,17 +174,22 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/180681346): update for Alder Lake/brya @@ -199,21 +204,26 @@ static const struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -static const struct ec_thermal_config thermal_fan = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_FAN \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN; /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_2_FAN] = thermal_fan, + [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_2_FAN] = THERMAL_FAN, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/galtic/board.c b/board/galtic/board.c index 1adcc7f77c..a54655dec2 100644 --- a/board/galtic/board.c +++ b/board/galtic/board.c @@ -816,37 +816,56 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_charger = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - [EC_TEMP_THRESH_HALT] = C_TO_K(98), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; -const static struct ec_thermal_config thermal_vcore = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(50), - }, -}; -const static struct ec_thermal_config thermal_ambient = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(50), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CHARGER \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(98), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_charger = + THERMAL_CHARGER; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_VCORE \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(50), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_vcore = + THERMAL_VCORE; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_AMBIENT \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(50), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_ambient = + THERMAL_AMBIENT; + struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1] = thermal_charger, - [TEMP_SENSOR_2] = thermal_vcore, - [TEMP_SENSOR_3] = thermal_ambient, + [TEMP_SENSOR_1] = THERMAL_CHARGER, + [TEMP_SENSOR_2] = THERMAL_VCORE, + [TEMP_SENSOR_3] = THERMAL_AMBIENT, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/genesis/board.c b/board/genesis/board.c index 2a44d4416a..a846478ecb 100644 --- a/board/genesis/board.c +++ b/board/genesis/board.c @@ -227,23 +227,28 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(78), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [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), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(78), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [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), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_CORE] = thermal_a, + [TEMP_SENSOR_CORE] = THERMAL_A, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/gimble/sensors.c b/board/gimble/sensors.c index f0818429e4..07f18950f0 100644 --- a/board/gimble/sensors.c +++ b/board/gimble/sensors.c @@ -316,15 +316,20 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/194318801): confirm thermal limits setting for gimble @@ -339,21 +344,27 @@ static const struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -static const struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_DDR_SOC] = thermal_cpu, + [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU, /* TODO(b/194318801): confirm thermal limits setting for gimble */ - [TEMP_SENSOR_2_FAN] = thermal_inductor, - [TEMP_SENSOR_3_CHARGER] = thermal_inductor, + [TEMP_SENSOR_2_FAN] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_CHARGER] = THERMAL_INDUCTOR, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/halvor/board.c b/board/halvor/board.c index 53828b5318..7291a026d5 100644 --- a/board/halvor/board.c +++ b/board/halvor/board.c @@ -230,17 +230,22 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -253,24 +258,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/hatch/board.c b/board/hatch/board.c index 75f3b5f6cb..025702a291 100644 --- a/board/hatch/board.c +++ b/board/hatch/board.c @@ -410,20 +410,25 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * for Hatch. They matter when the EC is controlling the fan as opposed to DPTF * control. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/helios/board.c b/board/helios/board.c index cd2fb7e798..5858447edc 100644 --- a/board/helios/board.c +++ b/board/helios/board.c @@ -445,20 +445,25 @@ const struct temp_sensor_t temp_sensors[] = { BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* Helios temperature control thresholds */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(60), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(65), - .temp_fan_max = C_TO_K(80), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(60), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(65), \ + .temp_fan_max = C_TO_K(80), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/jinlon/board.c b/board/jinlon/board.c index c0022e970f..183e0dbd75 100644 --- a/board/jinlon/board.c +++ b/board/jinlon/board.c @@ -349,29 +349,39 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* Dratini Temperature sensors */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(86), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(86), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/kano/sensors.c b/board/kano/sensors.c index 442400a12a..3981053993 100644 --- a/board/kano/sensors.c +++ b/board/kano/sensors.c @@ -176,17 +176,22 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/180681346): update for Alder Lake/brya @@ -201,21 +206,26 @@ static const struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -static const struct ec_thermal_config thermal_fan = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_FAN \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN; /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_2_FAN] = thermal_fan, + [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_2_FAN] = THERMAL_FAN, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/kindred/board.c b/board/kindred/board.c index c17ddb1b8a..79d197bdcc 100644 --- a/board/kindred/board.c +++ b/board/kindred/board.c @@ -439,20 +439,25 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * for Hatch. They matter when the EC is controlling the fan as opposed to DPTF * control. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = C_TO_K(75), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(55), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(55), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(75), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(55), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/kohaku/board.c b/board/kohaku/board.c index 0204cdd87f..aa5441e6f5 100644 --- a/board/kohaku/board.c +++ b/board/kohaku/board.c @@ -420,26 +420,31 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * for Kohaku. They matter when the EC is controlling the fan as opposed to DPTF * control. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1] = thermal_a, - [TEMP_SENSOR_2] = thermal_a, - [TEMP_SENSOR_3] = thermal_a, - [TEMP_SENSOR_4] = thermal_a, + [TEMP_SENSOR_1] = THERMAL_A, + [TEMP_SENSOR_2] = THERMAL_A, + [TEMP_SENSOR_3] = THERMAL_A, + [TEMP_SENSOR_4] = THERMAL_A, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/lalala/board.c b/board/lalala/board.c index a664a9266e..89383ed8eb 100644 --- a/board/lalala/board.c +++ b/board/lalala/board.c @@ -237,31 +237,41 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(73), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(73), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/lindar/board.c b/board/lindar/board.c index 030940cfb1..e1975260df 100644 --- a/board/lindar/board.c +++ b/board/lindar/board.c @@ -262,17 +262,22 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (100 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - [EC_TEMP_THRESH_HALT] = C_TO_K(100), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - }, - .temp_fan_off = C_TO_K(30), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + }, \ + .temp_fan_off = C_TO_K(30), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -285,24 +290,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 100c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - [EC_TEMP_THRESH_HALT] = C_TO_K(100), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - }, - .temp_fan_off = C_TO_K(30), - .temp_fan_max = C_TO_K(60), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + }, \ + .temp_fan_off = C_TO_K(30), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/lingcod/board.c b/board/lingcod/board.c index c294100b02..833eb69b8d 100644 --- a/board/lingcod/board.c +++ b/board/lingcod/board.c @@ -249,17 +249,22 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -272,24 +277,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/magolor/board.c b/board/magolor/board.c index 75c965b2e0..3d3765dbe0 100644 --- a/board/magolor/board.c +++ b/board/magolor/board.c @@ -336,31 +336,41 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(73), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(73), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/malefor/board.c b/board/malefor/board.c index 663c5bace9..7cf56fa63f 100644 --- a/board/malefor/board.c +++ b/board/malefor/board.c @@ -250,17 +250,22 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -273,24 +278,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/metaknight/board.c b/board/metaknight/board.c index 9b583503fe..253ce31571 100644 --- a/board/metaknight/board.c +++ b/board/metaknight/board.c @@ -196,31 +196,42 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_memory = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_MEMORY \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_memory = + THERMAL_MEMORY; -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/moonbuggy/board.c b/board/moonbuggy/board.c index f7a972c329..0ebf1380cb 100644 --- a/board/moonbuggy/board.c +++ b/board/moonbuggy/board.c @@ -229,23 +229,28 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [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), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [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), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_CORE] = thermal_a, + [TEMP_SENSOR_CORE] = THERMAL_A, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/morphius/board.c b/board/morphius/board.c index 4680109e18..d9717bbe05 100644 --- a/board/morphius/board.c +++ b/board/morphius/board.c @@ -581,15 +581,20 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - [EC_TEMP_THRESH_HALT] = C_TO_K(105), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(105), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/mushu/board.c b/board/mushu/board.c index 353875e9f5..2003f7ef85 100644 --- a/board/mushu/board.c +++ b/board/mushu/board.c @@ -455,35 +455,45 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * for Hatch. They matter when the EC is controlling the fan as opposed to DPTF * control. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(0), - .temp_fan_max = C_TO_K(70), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(0), \ + .temp_fan_max = C_TO_K(70), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(0), - .temp_fan_max = C_TO_K(70), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(0), \ + .temp_fan_max = C_TO_K(70), \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/nami/board.c b/board/nami/board.c index c45d11bd25..70e85fd83b 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -366,132 +366,172 @@ const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = { struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; /* Nami/Vayne Remote 1, 2 */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(39), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(39), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; /* Sona Remote 1 */ -const static struct ec_thermal_config thermal_b1 = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(82), - [EC_TEMP_THRESH_HALT] = C_TO_K(89), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(72), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(38), - .temp_fan_max = C_TO_K(58), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B1 \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(82), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(89), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(72), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(38), \ + .temp_fan_max = C_TO_K(58), \ + } +__maybe_unused static const struct ec_thermal_config thermal_b1 = THERMAL_B1; /* Sona Remote 2 */ -const static struct ec_thermal_config thermal_b2 = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(84), - [EC_TEMP_THRESH_HALT] = C_TO_K(91), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(74), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B2 \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(84), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(91), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(74), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_b2 = THERMAL_B2; /* Pantheon Remote 1 */ -const static struct ec_thermal_config thermal_c1 = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(66), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(56), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(38), - .temp_fan_max = C_TO_K(61), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_C1 \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(66), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(56), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(38), \ + .temp_fan_max = C_TO_K(61), \ + } +__maybe_unused static const struct ec_thermal_config thermal_c1 = THERMAL_C1; /* Pantheon Remote 2 */ -const static struct ec_thermal_config thermal_c2 = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(74), - [EC_TEMP_THRESH_HALT] = C_TO_K(82), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(64), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(38), - .temp_fan_max = C_TO_K(61), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_C2 \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(74), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(82), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(64), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(38), \ + .temp_fan_max = C_TO_K(61), \ + } +__maybe_unused static const struct ec_thermal_config thermal_c2 = THERMAL_C2; /* Akali Local */ -const static struct ec_thermal_config thermal_d0 = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = C_TO_K(79), - [EC_TEMP_THRESH_HIGH] = 0, - [EC_TEMP_THRESH_HALT] = C_TO_K(81), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = C_TO_K(80), - [EC_TEMP_THRESH_HIGH] = 0, - [EC_TEMP_THRESH_HALT] = C_TO_K(82), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(70), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_D0 \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = C_TO_K(79), \ + [EC_TEMP_THRESH_HIGH] = 0, \ + [EC_TEMP_THRESH_HALT] = C_TO_K(81), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = C_TO_K(80), \ + [EC_TEMP_THRESH_HIGH] = 0, \ + [EC_TEMP_THRESH_HALT] = C_TO_K(82), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(70), \ + } +__maybe_unused static const struct ec_thermal_config thermal_d0 = THERMAL_D0; /* Akali Remote 1 */ -const static struct ec_thermal_config thermal_d1 = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = C_TO_K(59), - [EC_TEMP_THRESH_HIGH] = 0, - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = C_TO_K(60), - [EC_TEMP_THRESH_HIGH] = 0, - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = 0, - .temp_fan_max = 0, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_D1 \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = C_TO_K(59), \ + [EC_TEMP_THRESH_HIGH] = 0, \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = C_TO_K(60), \ + [EC_TEMP_THRESH_HIGH] = 0, \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = 0, \ + .temp_fan_max = 0, \ + } +__maybe_unused static const struct ec_thermal_config thermal_d1 = THERMAL_D1; /* Akali Remote 2 */ -const static struct ec_thermal_config thermal_d2 = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = C_TO_K(59), - [EC_TEMP_THRESH_HIGH] = 0, - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = C_TO_K(60), - [EC_TEMP_THRESH_HIGH] = 0, - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = 0, - .temp_fan_max = 0, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_D2 \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = C_TO_K(59), \ + [EC_TEMP_THRESH_HIGH] = 0, \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = C_TO_K(60), \ + [EC_TEMP_THRESH_HIGH] = 0, \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = 0, \ + .temp_fan_max = 0, \ + } +__maybe_unused static const struct ec_thermal_config thermal_d2 = THERMAL_D2; #define I2C_PMIC_READ(reg, data) \ i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS,\ diff --git a/board/nightfury/board.c b/board/nightfury/board.c index bed17b834c..bab0988c78 100644 --- a/board/nightfury/board.c +++ b/board/nightfury/board.c @@ -379,25 +379,30 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * for Nightfury. They matter when the EC is controlling the fan as opposed to DPTF * control. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1] = thermal_a, - [TEMP_SENSOR_2] = thermal_a, - [TEMP_SENSOR_3] = thermal_a, + [TEMP_SENSOR_1] = THERMAL_A, + [TEMP_SENSOR_2] = THERMAL_A, + [TEMP_SENSOR_3] = THERMAL_A, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/palkia/board.c b/board/palkia/board.c index 7586478724..ebb4239979 100644 --- a/board/palkia/board.c +++ b/board/palkia/board.c @@ -222,20 +222,25 @@ const struct temp_sensor_t temp_sensors[] = { BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* Palkia temperature control thresholds */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(60), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(65), - .temp_fan_max = C_TO_K(80), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(60), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(65), \ + .temp_fan_max = C_TO_K(80), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/pirika/board.c b/board/pirika/board.c index a17d19bf88..098e6baa9b 100644 --- a/board/pirika/board.c +++ b/board/pirika/board.c @@ -690,37 +690,56 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_charger = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(68), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(50), - }, -}; -const static struct ec_thermal_config thermal_vcore = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(53), - }, -}; -const static struct ec_thermal_config thermal_ambient = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(50), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CHARGER \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(68), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(50), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_charger = + THERMAL_CHARGER; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_VCORE \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(53), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_vcore = + THERMAL_VCORE; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_AMBIENT \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(50), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_ambient = + THERMAL_AMBIENT; + struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1] = thermal_charger, - [TEMP_SENSOR_2] = thermal_vcore, - [TEMP_SENSOR_3] = thermal_ambient, + [TEMP_SENSOR_1] = THERMAL_CHARGER, + [TEMP_SENSOR_2] = THERMAL_VCORE, + [TEMP_SENSOR_3] = THERMAL_AMBIENT, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/primus/sensors.c b/board/primus/sensors.c index d297912772..60cfa1428f 100644 --- a/board/primus/sensors.c +++ b/board/primus/sensors.c @@ -99,29 +99,39 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; -static const struct ec_thermal_config thermal_ssd = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(92), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_SSD \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(92), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_ssd = THERMAL_SSD; /* * TODO(b/195901486): update for Alder Lake/primus @@ -136,26 +146,32 @@ static const struct ec_thermal_config thermal_ssd = { * Inductors: limit of 125c * PCB: limit is 80c */ -static const struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; /* * TODO(b/195901486): Thermal table need to be fine tuned. */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_2_SSD] = thermal_ssd, - [TEMP_SENSOR_3_CHARGER] = thermal_inductor, - [TEMP_SENSOR_4_MEMORY] = thermal_inductor, - [TEMP_SENSOR_5_USBC] = thermal_inductor, + [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_2_SSD] = THERMAL_SSD, + [TEMP_SENSOR_3_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_4_MEMORY] = THERMAL_INDUCTOR, + [TEMP_SENSOR_5_USBC] = THERMAL_INDUCTOR, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/puff/board.c b/board/puff/board.c index d25323faba..b30ca74221 100644 --- a/board/puff/board.c +++ b/board/puff/board.c @@ -381,36 +381,46 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(68), - [EC_TEMP_THRESH_HALT] = C_TO_K(78), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(58), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(41), - .temp_fan_max = C_TO_K(72), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(68), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(78), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(58), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(41), \ + .temp_fan_max = C_TO_K(72), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(78), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(78), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_CORE] = thermal_a, + [TEMP_SENSOR_CORE] = THERMAL_A, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/redrix/sensors.c b/board/redrix/sensors.c index b8446b1c4d..8a92b8825f 100644 --- a/board/redrix/sensors.c +++ b/board/redrix/sensors.c @@ -284,15 +284,20 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* * TODO(b/195673113): Need to update for Alder Lake/redrix */ -static const struct ec_thermal_config thermal_ddr = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_DDR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_ddr = THERMAL_DDR; /* * TODO(b/195673113): Need to update for Alder Lake/redrix @@ -301,47 +306,64 @@ static const struct ec_thermal_config thermal_ddr = { * 130 C. However, sensor is located next to SOC, so we need to use the lower * SOC temperature limit (85 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/195673113): Need to update for Alder Lake/redrix */ -static const struct ec_thermal_config thermal_charger = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CHARGER \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_charger = + THERMAL_CHARGER; /* * TODO(b/195673113): Need to update for Alder Lake/redrix */ -static const struct ec_thermal_config thermal_regulator = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_REGULATOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_regulator = + THERMAL_REGULATOR; /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_DDR] = thermal_ddr, - [TEMP_SENSOR_2_SOC] = thermal_cpu, - [TEMP_SENSOR_3_CHARGER] = thermal_charger, - [TEMP_SENSOR_4_REGULATOR] = thermal_regulator, + [TEMP_SENSOR_1_DDR] = THERMAL_DDR, + [TEMP_SENSOR_2_SOC] = THERMAL_CPU, + [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER, + [TEMP_SENSOR_4_REGULATOR] = THERMAL_REGULATOR, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/scout/board.c b/board/scout/board.c index 3b8554c6ac..d45b627ce1 100644 --- a/board/scout/board.c +++ b/board/scout/board.c @@ -339,37 +339,47 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - [EC_TEMP_THRESH_HALT] = C_TO_K(90), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [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), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(90), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [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), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(78), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(78), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_CORE] = thermal_a, - [TEMP_SENSOR_WIFI] = thermal_a, + [TEMP_SENSOR_CORE] = THERMAL_A, + [TEMP_SENSOR_WIFI] = THERMAL_A, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/stryke/board.c b/board/stryke/board.c index 3275ff7fa9..525de7f69f 100644 --- a/board/stryke/board.c +++ b/board/stryke/board.c @@ -328,20 +328,25 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * for Stryke. They matter when the EC is controlling the fan as opposed to DPTF * control. */ -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/taeko/sensors.c b/board/taeko/sensors.c index 6a35ed0e5d..b5d75460fe 100644 --- a/board/taeko/sensors.c +++ b/board/taeko/sensors.c @@ -391,17 +391,22 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (100 C) */ -static const struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - [EC_TEMP_THRESH_HALT] = C_TO_K(100), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/201021109): update for Alder Lake/brya @@ -416,24 +421,29 @@ static const struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 100c */ -static const struct ec_thermal_config thermal_fan = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - [EC_TEMP_THRESH_HALT] = C_TO_K(100), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(85), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(60), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_FAN \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(60), \ + } +__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN; /* this should really be "const" */ struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_2_FAN] = thermal_fan, - [TEMP_SENSOR_3_CHARGER] = thermal_fan, - [TEMP_SENSOR_4_CPUCHOKE] = thermal_fan, + [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_2_FAN] = THERMAL_FAN, + [TEMP_SENSOR_3_CHARGER] = THERMAL_FAN, + [TEMP_SENSOR_4_CPUCHOKE] = THERMAL_FAN, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/terrador/board.c b/board/terrador/board.c index 5adc65fc70..d6378d6aaa 100644 --- a/board/terrador/board.c +++ b/board/terrador/board.c @@ -170,17 +170,22 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -193,24 +198,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/todor/board.c b/board/todor/board.c index c4e2395adc..ac486b05d3 100644 --- a/board/todor/board.c +++ b/board/todor/board.c @@ -196,17 +196,22 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -219,24 +224,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/trembyle/board.c b/board/trembyle/board.c index 89a62f3411..3e6a561dc6 100644 --- a/board/trembyle/board.c +++ b/board/trembyle/board.c @@ -447,29 +447,40 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_thermistor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - [EC_TEMP_THRESH_HALT] = C_TO_K(92), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(58), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_THERMISTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(92), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(58), \ + } +__maybe_unused static const struct ec_thermal_config thermal_thermistor = + THERMAL_THERMISTOR; -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - [EC_TEMP_THRESH_HALT] = C_TO_K(92), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(80), - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(58), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(92), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(58), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/trondo/board.c b/board/trondo/board.c index 0493c603e0..6e6b7884e7 100644 --- a/board/trondo/board.c +++ b/board/trondo/board.c @@ -142,17 +142,22 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -165,24 +170,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/voema/board.c b/board/voema/board.c index ef428089a4..3fd41081de 100644 --- a/board/voema/board.c +++ b/board/voema/board.c @@ -121,15 +121,20 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -142,22 +147,27 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/volet/board.c b/board/volet/board.c index a47bd3d8c6..66772a7656 100644 --- a/board/volet/board.c +++ b/board/volet/board.c @@ -181,23 +181,28 @@ const struct fan_t fans[FAN_CH_COUNT] = { * Reference that temperature and fan settings * are derived from data in b/167523658#39 */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(68), - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(90), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(68), \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(90), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_cpu, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_cpu, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_CPU, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_CPU, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/volteer/board.c b/board/volteer/board.c index 8c1be1bf64..22c1eea0a4 100644 --- a/board/volteer/board.c +++ b/board/volteer/board.c @@ -96,17 +96,22 @@ const struct fan_t fans[FAN_CH_COUNT] = { * 130 C. However, sensor is located next to DDR, so we need to use the lower * DDR temperature limit (85 C) */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(35), \ + .temp_fan_max = C_TO_K(50), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * Inductor limits - used for both charger and PP3300 regulator @@ -119,24 +124,29 @@ const static struct ec_thermal_config thermal_cpu = { * Inductors: limit of 125c * PCB: limit is 80c */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_INDUCTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + }, \ + .temp_fan_off = C_TO_K(40), \ + .temp_fan_max = C_TO_K(55), \ + } +__maybe_unused static const struct ec_thermal_config thermal_inductor = + THERMAL_INDUCTOR; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_inductor, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_INDUCTOR, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_INDUCTOR, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/voxel/board.c b/board/voxel/board.c index 830300620f..c57d03b9d3 100644 --- a/board/voxel/board.c +++ b/board/voxel/board.c @@ -180,23 +180,28 @@ const struct fan_t fans[FAN_CH_COUNT] = { * Reference that temperature and fan settings * are derived from data in b/167523658#39 */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(68), - }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(90), -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(68), \ + }, \ + .temp_fan_off = C_TO_K(25), \ + .temp_fan_max = C_TO_K(90), \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; struct ec_thermal_config thermal_params[] = { - [TEMP_SENSOR_1_CHARGER] = thermal_cpu, - [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_cpu, - [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu, - [TEMP_SENSOR_4_FAN] = thermal_cpu, + [TEMP_SENSOR_1_CHARGER] = THERMAL_CPU, + [TEMP_SENSOR_2_PP3300_REGULATOR] = THERMAL_CPU, + [TEMP_SENSOR_3_DDR_SOC] = THERMAL_CPU, + [TEMP_SENSOR_4_FAN] = THERMAL_CPU, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/waddledoo2/board.c b/board/waddledoo2/board.c index e2d3bd8249..7a00064898 100644 --- a/board/waddledoo2/board.c +++ b/board/waddledoo2/board.c @@ -237,31 +237,41 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(73), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(73), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; diff --git a/board/woomax/board.c b/board/woomax/board.c index f10bb227da..e45fd91623 100644 --- a/board/woomax/board.c +++ b/board/woomax/board.c @@ -755,25 +755,36 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_thermistor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(95), - [EC_TEMP_THRESH_HALT] = C_TO_K(100), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_THERMISTOR \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(95), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_thermistor = + THERMAL_THERMISTOR; -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(95), - [EC_TEMP_THRESH_HALT] = C_TO_K(100), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(90), - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_CPU \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(95), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; |