diff options
Diffstat (limited to 'board/anahera/sensors.c')
-rw-r--r-- | board/anahera/sensors.c | 110 |
1 files changed, 62 insertions, 48 deletions
diff --git a/board/anahera/sensors.c b/board/anahera/sensors.c index bb86af940b..7f388579e2 100644 --- a/board/anahera/sensors.c +++ b/board/anahera/sensors.c @@ -74,17 +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), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; +/* + * 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 @@ -93,53 +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), - }, - .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/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), - }, - .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/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), - }, - .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_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); |