summaryrefslogtreecommitdiff
path: root/board/anahera/sensors.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/anahera/sensors.c')
-rw-r--r--board/anahera/sensors.c102
1 files changed, 62 insertions, 40 deletions
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);