summaryrefslogtreecommitdiff
path: root/common/thermal.c
diff options
context:
space:
mode:
authorYu-An Chen <yu-an.chen@quanta.corp-partner.google.com>2021-03-05 15:44:47 +0800
committerCommit Bot <commit-bot@chromium.org>2021-03-08 19:59:02 +0000
commitd603b7a1f844f6e7b4a7582c97fe7e1d9cc24279 (patch)
tree498410da6e20829b309978c87f5d4e065f644f87 /common/thermal.c
parentcfbbbb93b44799c61f5591b9658d650136ab5ac4 (diff)
downloadchrome-ec-d603b7a1f844f6e7b4a7582c97fe7e1d9cc24279.tar.gz
dedede/metaknight: delay thermal sensor read in the first time
Add CONFIG_TEMP_SENSOR_FIRST_READ_DELAY_MS to adjustment delay time of thermal sensor first read. Add 500 ms delay of thermal sensor first read in metaknight. BUG=b:181202521 BRANCH=dedede TEST=DUT do [ec reset|boot from G3] 20 time pass Signed-off-by: yu-an.chen@quanta.corp-partner.google.com Change-Id: I12f5411c8ac3866d7a52807c4eface9e6bdfd5a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2738505 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/thermal.c')
-rw-r--r--common/thermal.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/thermal.c b/common/thermal.c
index 40577c0d43..e9750931be 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -53,6 +53,12 @@ BUILD_ASSERT(EC_TEMP_THRESH_COUNT == 3);
/* Keep track of which thresholds have triggered */
static cond_t cond_hot[EC_TEMP_THRESH_COUNT];
+/* thermal sensor read delay */
+#if defined(CONFIG_TEMP_SENSOR_POWER_GPIO) && \
+ defined(CONFIG_TEMP_SENSOR_FIRST_READ_DELAY_MS)
+static int first_read_delay = CONFIG_TEMP_SENSOR_FIRST_READ_DELAY_MS;
+#endif
+
static void thermal_control(void)
{
int i, j, t, rv, f;
@@ -67,6 +73,15 @@ static void thermal_control(void)
int temp[TEMP_SENSOR_COUNT];
#endif
+ /* add delay to ensure thermal sensor is ready when EC boot */
+#if defined(CONFIG_TEMP_SENSOR_POWER_GPIO) && \
+ defined(CONFIG_TEMP_SENSOR_FIRST_READ_DELAY_MS)
+ if (first_read_delay != 0) {
+ msleep(first_read_delay);
+ first_read_delay = 0;
+ }
+#endif
+
/* Get ready to count things */
memset(count_over, 0, sizeof(count_over));
memset(count_under, 0, sizeof(count_under));