summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2022-04-28 11:30:59 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-02 15:57:02 +0000
commitec36c0d8dd87a2fa4c85c65cdcd54b3203967f70 (patch)
tree9f2c871ad9622276ae2e244c3f6d897335a869be
parent8e51ac6168794eeafb3e7ad57c672eac61114bac (diff)
downloadchrome-ec-ec36c0d8dd87a2fa4c85c65cdcd54b3203967f70.tar.gz
Zephyr: Add CONFIG_FANS to config_chip.h scope
Multiple files need access to CONFIG_FANS in order to ascertain whether the fans are a supported feature. Add this to the config_chip.h logic and add a default Kconfig option of 1 for it. BRANCH=None BUG=b:230694498 TEST=on skyrim, ensure ectool pwmgetnumfans now returns 1 Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I926ab8682fa1c76039ceb610edaf2d9ca98b0a24 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3615030 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--include/fan.h2
-rw-r--r--zephyr/Kconfig.temperature11
-rw-r--r--zephyr/shim/include/config_chip.h5
3 files changed, 17 insertions, 1 deletions
diff --git a/include/fan.h b/include/fan.h
index 6b0067cf1c..573cc89aba 100644
--- a/include/fan.h
+++ b/include/fan.h
@@ -20,7 +20,7 @@ enum fan_channel {
FAN_CH_COUNT
};
-#define CONFIG_FANS FAN_CH_COUNT
+BUILD_ASSERT(FAN_CH_COUNT == CONFIG_PLATFORM_EC_NUM_FANS);
#endif /* CONFIG_PLATFORM_EC_FAN */
#endif /* CONFIG_ZEPHYR */
diff --git a/zephyr/Kconfig.temperature b/zephyr/Kconfig.temperature
index 6963b6ecf5..1718a8dc53 100644
--- a/zephyr/Kconfig.temperature
+++ b/zephyr/Kconfig.temperature
@@ -90,3 +90,14 @@ config PLATFORM_EC_FAN
EC_CMD_PWM_SET_FAN_DUTY, EC_CMD_THERMAL_AUTO_FAN_CTRL are
available. Also enables a periodic task (1s) to verify fan is
running (is not stalled).
+
+if PLATFORM_EC_FAN
+
+config PLATFORM_EC_NUM_FANS
+ int "Number of fans"
+ default 1
+ help
+ Declare the number of fans supported on this board and avilable
+ for control through fan APIs.
+
+endif # PLATFORM_EC_FAN
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index ceaaa17193..a81c78eeb7 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -612,6 +612,11 @@ extern struct jump_data mock_jump_data;
#define CONFIG_TEMP_SENSOR_TMP112
#endif
+#undef CONFIG_FANS
+#ifdef CONFIG_PLATFORM_EC_NUM_FANS
+#define CONFIG_FANS CONFIG_PLATFORM_EC_NUM_FANS
+#endif
+
#ifdef CONFIG_PLATFORM_EC_I2C
/* Also see shim/include/i2c/i2c.h which defines the ports enum */
#define CONFIG_I2C_CONTROLLER