summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2022-03-14 11:33:03 +0000
committerCommit Bot <commit-bot@chromium.org>2022-03-16 18:03:45 +0000
commita17c70ef114aa087ac36860ec4cd40fd62d536db (patch)
tree8646aabf354bd09c1f3e186e7ec7bf09cb188779
parent43500fe3d58fc9133923065a89fe4ccc8ba8221d (diff)
downloadchrome-ec-a17c70ef114aa087ac36860ec4cd40fd62d536db.tar.gz
zephyr: adlrvp_npcx: setup fan control
Setup a fan node for adlrvp_npcx. BRANCH=none BUG=none TEST=zmake -j2 configure -b adlrvp_npcx Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ib8575be3e621a8ff662d309a8658438cb5859fd4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3521942 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/projects/intelrvp/BUILD.py2
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/fan.dts34
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/pwm.dts21
-rw-r--r--zephyr/projects/intelrvp/prj.conf6
4 files changed, 41 insertions, 22 deletions
diff --git a/zephyr/projects/intelrvp/BUILD.py b/zephyr/projects/intelrvp/BUILD.py
index 8262c3bd2a..3c4a65c853 100644
--- a/zephyr/projects/intelrvp/BUILD.py
+++ b/zephyr/projects/intelrvp/BUILD.py
@@ -37,10 +37,10 @@ register_intelrvp_project(
chip="npcx9",
extra_dts_overlays=[
here / "adlrvp/adlrvp_npcx/adlrvp_npcx.dts",
+ here / "adlrvp/adlrvp_npcx/fan.dts",
here / "adlrvp/adlrvp_npcx/gpio.dts",
here / "adlrvp/adlrvp_npcx/interrupts.dts",
here / "adlrvp/adlrvp_npcx/keyboard.dts",
- here / "adlrvp/adlrvp_npcx/pwm.dts",
],
extra_kconfig_files=[here / "adlrvp/adlrvp_npcx/prj.conf"],
)
diff --git a/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/fan.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/fan.dts
new file mode 100644
index 0000000000..c37b81fe2f
--- /dev/null
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/fan.dts
@@ -0,0 +1,34 @@
+/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ named-fans {
+ compatible = "named-fans";
+
+ fan_0 {
+ label = "FAN_0";
+ pwms = <&pwm3 0 PWM_POLARITY_NORMAL>;
+ pwm-frequency = <30000>;
+ rpm_min = <2200>;
+ rpm_start = <2200>;
+ rpm_max = <4200>;
+ tach = <&tach2>;
+ };
+ };
+};
+
+/* Tachemeter for fan speed measurement */
+&tach2 {
+ status = "okay";
+ pinctrl-0 = <&altc_ta2_sl2>; /* Use TA2 as input pin */
+ port = <NPCX_TACH_PORT_A>; /* port-A is selected */
+ sample-clk = <NPCX_TACH_FREQ_LFCLK>; /* Use LFCLK as sampling clock */
+ pulses-per-round = <2>; /* number of pulses per round of encoder */
+};
+
+&pwm3 {
+ status = "okay";
+ drive-open-drain;
+};
diff --git a/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/pwm.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/pwm.dts
deleted file mode 100644
index f03eb01740..0000000000
--- a/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/pwm.dts
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/ {
- named-pwms {
- compatible = "named-pwms";
-
- pwm_fan: fan {
- pwms = <&pwm3 0 PWM_POLARITY_NORMAL>;
- frequency = <30000>;
- };
- };
-};
-
-/* Fan control */
-&pwm3 {
- status = "okay";
- drive-open-drain;
-};
diff --git a/zephyr/projects/intelrvp/prj.conf b/zephyr/projects/intelrvp/prj.conf
index 3fd45db131..913d62d093 100644
--- a/zephyr/projects/intelrvp/prj.conf
+++ b/zephyr/projects/intelrvp/prj.conf
@@ -53,6 +53,12 @@ CONFIG_PLATFORM_EC_POWERSEQ_S0IX=y
CONFIG_PLATFORM_EC_POWERSEQ_S4=y
CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=y
+# Fan
+CONFIG_PLATFORM_EC_FAN=y
+CONFIG_SENSOR=y
+CONFIG_SENSOR_SHELL=n
+CONFIG_TACH_NPCX=y
+
# TODO
# Below conf are disabled to compile successfully
# These will be enabled in upcoming CLs