summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuibin Chang <Ruibin.Chang@ite.com.tw>2021-12-01 11:55:58 +0800
committerCommit Bot <commit-bot@chromium.org>2021-12-02 00:53:10 +0000
commit842ea9739676871d955fb21bde36d62c901ef715 (patch)
tree00117efca029f555fa8a2cd425483776c6fc376d
parentf6ce56e1b09c5b77f383cd0c1363637ce681223a (diff)
downloadchrome-ec-842ea9739676871d955fb21bde36d62c901ef715.tar.gz
zephyr: enable tachometer for fan
Enable tachometer for fan. BRANCH=none BUG=none TEST=on board it8xxx2_evb, console cmd "fanset 3000" -> fan spin and "faninfo" Actual: 3150 rpm Target: 3000 rpm Duty: 36%% Status: 2 (locked) Mode: rpm Auto: no Enable: yes Cq-Depend: chromium:3307946 Change-Id: I876649ad9c5d75ffaa064b13b3defe39e74bb418 Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3255094 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts20
-rw-r--r--zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig3
-rw-r--r--zephyr/projects/it8xxx2_evb/prj.conf3
3 files changed, 26 insertions, 0 deletions
diff --git a/zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts b/zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts
index 173a33b697..5bde541a6f 100644
--- a/zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts
+++ b/zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts
@@ -211,6 +211,19 @@
frequency = <30000>;
};
};
+
+ named-fans {
+ compatible = "named-fans";
+
+ fan_0 {
+ label = "FAN_0";
+ pwm = <&pwm_fan>;
+ tach = <&tach0>;
+ rpm_min = <1500>;
+ rpm_start = <1500>;
+ rpm_max = <6500>;
+ };
+ };
};
&adc0 {
@@ -258,3 +271,10 @@
status = "okay";
prescaler-cx = <PWM_PRESCALER_C4>;
};
+
+/* fan tachometer sensor */
+&tach0 {
+ status = "okay";
+ channel = <IT8XXX2_TACH_CHANNEL_A>;
+ pulses-per-round = <2>;
+};
diff --git a/zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig b/zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig
index d667fac5a1..a6ddf649b7 100644
--- a/zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig
+++ b/zephyr/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig
@@ -31,6 +31,9 @@ CONFIG_PWM_SHELL=n
CONFIG_PLATFORM_EC_PWM=y
CONFIG_PWM_ITE_IT8XXX2=y
+# Fan
+CONFIG_SENSOR=y
+
# GPIO Controller
CONFIG_GPIO=y
CONFIG_GPIO_ITE_IT8XXX2=y
diff --git a/zephyr/projects/it8xxx2_evb/prj.conf b/zephyr/projects/it8xxx2_evb/prj.conf
index 23a7ab2275..ffc59fb420 100644
--- a/zephyr/projects/it8xxx2_evb/prj.conf
+++ b/zephyr/projects/it8xxx2_evb/prj.conf
@@ -16,6 +16,9 @@ CONFIG_PLATFORM_EC_ADC=y
# I2C
CONFIG_PLATFORM_EC_I2C=y
+# Fan
+CONFIG_PLATFORM_EC_FAN=y
+
# Flash
CONFIG_PLATFORM_EC_FLASH_CROS=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_FLASH=y