summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeffrey <jeffrey_lin@pegatron.corp-partner.google.com>2022-08-17 15:16:02 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-19 02:43:27 +0000
commit916f8c58ba6709be4912a07910c6d9819cc436fa (patch)
tree2e5d3ec7fd097334bdb3fcec56ce27f6283903c8
parent5d46012d2db9185ee849c5f6d202430e15d31d0c (diff)
downloadchrome-ec-916f8c58ba6709be4912a07910c6d9819cc436fa.tar.gz
tentacruel : Config the thermal sensor setting
Add thermistor 3V3_30K9_47K_NCP15WB for ambient temperature. BUG=b:242815295 TEST=zmake build tentacruel --clobber Use ectool temps all to check can read thermistor temperature. BRANCH=None Signed-off-by: jeffrey <jeffrey_lin@pegatron.corp-partner.google.com> Change-Id: Ie4d2299ce37f59607099aac5cdd29e43306a6c71 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3834908 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--zephyr/include/cros/thermistor/thermistor.dtsi82
-rw-r--r--zephyr/projects/corsola/BUILD.py2
-rw-r--r--zephyr/projects/corsola/adc_tentacruel.dts60
-rw-r--r--zephyr/projects/corsola/gpio_tentacruel.dts1
-rw-r--r--zephyr/projects/corsola/prj_tentacruel.conf4
5 files changed, 147 insertions, 2 deletions
diff --git a/zephyr/include/cros/thermistor/thermistor.dtsi b/zephyr/include/cros/thermistor/thermistor.dtsi
index a482aab2fc..fb86c4f79a 100644
--- a/zephyr/include/cros/thermistor/thermistor.dtsi
+++ b/zephyr/include/cros/thermistor/thermistor.dtsi
@@ -304,4 +304,86 @@
sample-index = <12>;
};
};
+
+ /omit-if-no-ref/ thermistor_3V3_30K9_47K_NCP15WB:
+ thermistor-3V3-30K9-47K-NCP15WB {
+ status = "disabled";
+ compatible = "cros-ec,thermistor";
+ scaling-factor = <11>;
+ num-pairs = <13>;
+ steinhart-reference-mv = <3300>;
+ steinhart-reference-res = <30900>;
+
+ /*
+ * Data derived from Steinhart-Hart equation in a resistor
+ * divider circuit with Vdd=3300mV, R = 30.9Kohm,
+ * and Murata NCP15WB-series thermistor
+ * (B = 4050, T0 = 298.15 K, nominal resistance (R0) = 47Kohm).
+ */
+ sample-datum-0 {
+ milivolt = <(2761 / 11)>;
+ temp = <0>;
+ sample-index = <0>;
+ };
+ sample-datum-1 {
+ milivolt = <(2492 / 11)>;
+ temp = <10>;
+ sample-index = <1>;
+ };
+ sample-datum-2 {
+ milivolt = <(2167 / 11)>;
+ temp = <20>;
+ sample-index = <2>;
+ };
+ sample-datum-3 {
+ milivolt = <(1812 / 11)>;
+ temp = <30>;
+ sample-index = <3>;
+ };
+ sample-datum-4 {
+ milivolt = <(1462 / 11)>;
+ temp = <40>;
+ sample-index = <4>;
+ };
+ sample-datum-5 {
+ milivolt = <(1146 / 11)>;
+ temp = <50>;
+ sample-index = <5>;
+ };
+ sample-datum-6 {
+ milivolt = <(878 / 11)>;
+ temp = <60>;
+ sample-index = <6>;
+ };
+ sample-datum-7 {
+ milivolt = <(665 / 11)>;
+ temp = <70>;
+ sample-index = <7>;
+ };
+ sample-datum-8 {
+ milivolt = <(500 / 11)>;
+ temp = <80>;
+ sample-index = <8>;
+ };
+ sample-datum-9 {
+ milivolt = <(434 / 11)>;
+ temp = <85>;
+ sample-index = <9>;
+ };
+ sample-datum-10 {
+ milivolt = <( 376 / 11)>;
+ temp = <90>;
+ sample-index = <10>;
+ };
+ sample-datum-11 {
+ milivolt = <( 326 / 11)>;
+ temp = <95>;
+ sample-index = <11>;
+ };
+ sample-datum-12 {
+ milivolt = <( 283 / 11)>;
+ temp = <100>;
+ sample-index = <12>;
+ };
+ };
};
diff --git a/zephyr/projects/corsola/BUILD.py b/zephyr/projects/corsola/BUILD.py
index d31f8cee4f..69b7a8a826 100644
--- a/zephyr/projects/corsola/BUILD.py
+++ b/zephyr/projects/corsola/BUILD.py
@@ -103,7 +103,7 @@ register_corsola_project(
register_corsola_project(
"tentacruel",
extra_dts_overlays=[
- here / "adc_krabby.dts",
+ here / "adc_tentacruel.dts",
here / "battery_tentacruel.dts",
here / "cbi_tentacruel.dts",
here / "gpio_tentacruel.dts",
diff --git a/zephyr/projects/corsola/adc_tentacruel.dts b/zephyr/projects/corsola/adc_tentacruel.dts
new file mode 100644
index 0000000000..d09ccc3a30
--- /dev/null
+++ b/zephyr/projects/corsola/adc_tentacruel.dts
@@ -0,0 +1,60 @@
+/* Copyright 2022 The ChromiumOS Authors.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <cros/thermistor/thermistor.dtsi>
+
+/ {
+ named-adc-channels {
+ compatible = "named-adc-channels";
+ adc_vbus_c0 {
+ enum-name = "ADC_VBUS_C0";
+ io-channels = <&adc0 0>;
+ mul = <10>;
+ };
+ adc_board_id0 {
+ enum-name = "ADC_BOARD_ID_0";
+ io-channels = <&adc0 1>;
+ };
+ adc_board_id1 {
+ enum-name = "ADC_BOARD_ID_1";
+ io-channels = <&adc0 2>;
+ };
+ adc_vbus_c1 {
+ enum-name = "ADC_VBUS_C1";
+ io-channels = <&adc0 7>;
+ mul = <10>;
+ };
+ adc_ambient: ambient {
+ enum-name = "ADC_TEMP_SENSOR_2_AMBIENT";
+ io-channels = <&adc0 5>;
+ };
+ };
+};
+
+&adc0 {
+ status = "okay";
+ pinctrl-0 = <&adc0_ch0_gpi0_default
+ &adc0_ch1_gpi1_default
+ &adc0_ch2_gpi2_default
+ &adc0_ch5_gpi5_default
+ &adc0_ch7_gpi7_default>;
+ pinctrl-names = "default";
+};
+
+/ {
+ named-temp-sensors {
+ ambient {
+ compatible = "cros-ec,temp-sensor-thermistor",
+ "cros-ec,temp-sensor";
+ thermistor = <&thermistor_3V3_30K9_47K_NCP15WB>;
+ enum-name = "TEMP_SENSOR_AMB";
+ adc = <&adc_ambient>;
+ };
+ };
+};
+
+&thermistor_3V3_30K9_47K_NCP15WB {
+ status = "okay";
+};
diff --git a/zephyr/projects/corsola/gpio_tentacruel.dts b/zephyr/projects/corsola/gpio_tentacruel.dts
index 459ca33dd6..fa30265c6e 100644
--- a/zephyr/projects/corsola/gpio_tentacruel.dts
+++ b/zephyr/projects/corsola/gpio_tentacruel.dts
@@ -191,7 +191,6 @@
<&gpioh 0 GPIO_INPUT_PULL_DOWN>,
<&gpioh 6 GPIO_INPUT_PULL_DOWN>,
<&gpioi 3 GPIO_INPUT_PULL_DOWN>,
- <&gpioi 5 GPIO_INPUT_PULL_DOWN>,
<&gpioi 6 GPIO_INPUT_PULL_DOWN>,
<&gpiom 6 (GPIO_INPUT_PULL_DOWN | GPIO_VOLTAGE_1P8)>,
/* spi_clk_gpg6 */
diff --git a/zephyr/projects/corsola/prj_tentacruel.conf b/zephyr/projects/corsola/prj_tentacruel.conf
index e75c642757..dad5f5dec1 100644
--- a/zephyr/projects/corsola/prj_tentacruel.conf
+++ b/zephyr/projects/corsola/prj_tentacruel.conf
@@ -16,3 +16,7 @@ CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
# Sensor
CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=y
CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=y
+
+# Temperature sensors
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y