diff options
Diffstat (limited to 'common/thermal.c')
-rw-r--r-- | common/thermal.c | 15 |
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)); |