diff options
Diffstat (limited to 'board/redrix/sensors.c')
-rw-r--r-- | board/redrix/sensors.c | 110 |
1 files changed, 62 insertions, 48 deletions
diff --git a/board/redrix/sensors.c b/board/redrix/sensors.c index f720a7cd32..8a92b8825f 100644 --- a/board/redrix/sensors.c +++ b/board/redrix/sensors.c @@ -284,17 +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), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * 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 @@ -303,53 +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), - }, - .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), \ + }, \ + } +__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), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; +/* + * 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), - }, - .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(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); |