summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-11-11 15:02:40 -0700
committerCommit Bot <commit-bot@chromium.org>2021-11-12 20:22:12 +0000
commit013f45930bf47f35e9d1d12f0c02c822fc783773 (patch)
treead94a6a26eb30a4e107059af997239f6c8cee2de
parente31de72a7e913fe67f865386c79cbbab6661da49 (diff)
downloadchrome-ec-013f45930bf47f35e9d1d12f0c02c822fc783773.tar.gz
Guybrush Zephyr: Add fan control
Add in first PWM and fan for guybrush to use. BRANCH=None BUG=b:195137794 TEST=load on guybrush and observe fan no longer sounds like a jet taking off Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic423f11168fd3654495b9b79bc39d312ccdf909e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3276903 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/projects/guybrush/BUILD.py2
-rw-r--r--zephyr/projects/guybrush/fan.dts29
-rw-r--r--zephyr/projects/guybrush/gpio.dts2
-rw-r--r--zephyr/projects/guybrush/prj.conf11
-rw-r--r--zephyr/projects/guybrush/pwm.dts22
5 files changed, 64 insertions, 2 deletions
diff --git a/zephyr/projects/guybrush/BUILD.py b/zephyr/projects/guybrush/BUILD.py
index 6b718fb788..03f3abe37f 100644
--- a/zephyr/projects/guybrush/BUILD.py
+++ b/zephyr/projects/guybrush/BUILD.py
@@ -5,5 +5,5 @@
register_npcx_project(
project_name="guybrush",
zephyr_board="npcx9",
- dts_overlays=["battery.dts", "gpio.dts", "i2c.dts"],
+ dts_overlays=["battery.dts", "fan.dts", "gpio.dts", "i2c.dts", "pwm.dts"],
)
diff --git a/zephyr/projects/guybrush/fan.dts b/zephyr/projects/guybrush/fan.dts
new file mode 100644
index 0000000000..7ab15229e1
--- /dev/null
+++ b/zephyr/projects/guybrush/fan.dts
@@ -0,0 +1,29 @@
+/* Copyright 2021 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";
+ pwm = <&pwm_fan>;
+ rpm_min = <1000>;
+ rpm_start = <1000>;
+ rpm_max = <6500>;
+ tach = <&tach1>;
+ pgood_gpio = <&gpio_s0_pgood>;
+ };
+ };
+};
+
+/* Tachemeter for fan speed measurement */
+&tach1 {
+ status = "okay";
+ pinctrl-0 = <&alt3_ta1_sl1>; /* Use TA1 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 */
+};
diff --git a/zephyr/projects/guybrush/gpio.dts b/zephyr/projects/guybrush/gpio.dts
index e3be6833c7..ce0b307686 100644
--- a/zephyr/projects/guybrush/gpio.dts
+++ b/zephyr/projects/guybrush/gpio.dts
@@ -45,7 +45,7 @@
label = "PG_PWR_S5";
enum-name = "GPIO_S5_PGOOD";
};
- pg_pcore_s0_r_od {
+ gpio_s0_pgood: pg_pcore_s0_r_od {
gpios = <&gpiob 6 GPIO_INPUT>;
label = "PG_PCORE_S0_R_OD";
enum-name = "GPIO_S0_PGOOD";
diff --git a/zephyr/projects/guybrush/prj.conf b/zephyr/projects/guybrush/prj.conf
index 8d077520eb..754f369abd 100644
--- a/zephyr/projects/guybrush/prj.conf
+++ b/zephyr/projects/guybrush/prj.conf
@@ -30,6 +30,12 @@ CONFIG_PLATFORM_EC_HOSTCMD=y
CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
+# Fan
+CONFIG_PLATFORM_EC_FAN=y
+CONFIG_SENSOR=y
+CONFIG_SENSOR_SHELL=n
+CONFIG_TACH_NPCX=y
+
# Lid switch
CONFIG_PLATFORM_EC_LID_ANGLE=y
CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
@@ -40,6 +46,11 @@ CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+CONFIG_PLATFORM_EC_PWM=y
+
CONFIG_SYSCON=y
# Battery
diff --git a/zephyr/projects/guybrush/pwm.dts b/zephyr/projects/guybrush/pwm.dts
new file mode 100644
index 0000000000..d31af74170
--- /dev/null
+++ b/zephyr/projects/guybrush/pwm.dts
@@ -0,0 +1,22 @@
+/* Copyright 2021 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 = <&pwm0 0 0>;
+ label = "FAN";
+ frequency = <25000>;
+ };
+ };
+};
+
+/* Fan control */
+&pwm0 {
+ status = "okay";
+ drive-open-drain;
+};