diff options
author | Puthikorn Voravootivat <puthik@google.com> | 2020-10-26 09:13:59 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-24 12:59:46 +0000 |
commit | ea6413290f1b4488fa2f2c7dfa303e19ce6f8bfd (patch) | |
tree | a9ad290c34bc2496da43632089d658d820d5e692 /driver/temp_sensor | |
parent | 57d97c6a8d47ce3dc2883a2b14232fd7085e2ec6 (diff) | |
download | chrome-ec-ea6413290f1b4488fa2f2c7dfa303e19ce6f8bfd.tar.gz |
amd_r19me4070: Set GPU temp to 0 when read failed
This avoids returning bogus temperature that caused
thermal shutdown.
BRANCH=none
BUG=b:171325612
TEST=no more thermal shutdown when suspend
Change-Id: Ie72d7798431636f23ae528ec9fbf8c9125ea32cc
Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2544571
Reviewed-by: Shelley Chen <shchen@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Diffstat (limited to 'driver/temp_sensor')
-rw-r--r-- | driver/temp_sensor/amd_r19me4070.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/driver/temp_sensor/amd_r19me4070.c b/driver/temp_sensor/amd_r19me4070.c index ec606604a5..b331a1a3eb 100644 --- a/driver/temp_sensor/amd_r19me4070.c +++ b/driver/temp_sensor/amd_r19me4070.c @@ -53,17 +53,21 @@ int get_temp_R19ME4070(int idx, int *temp_ptr) * We shouldn't read the GPU temperature when the state * is not in S0, because GPU is enabled in S0. */ - if ((power_get_state()) != POWER_S0) + if ((power_get_state()) != POWER_S0) { + *temp_ptr = C_TO_K(0); return EC_ERROR_BUSY; + } /* if no INIT GPU, must init it first and wait 1 sec. */ if (!initialized) { gpu_init_temp_sensor(); + *temp_ptr = C_TO_K(0); return EC_ERROR_BUSY; } rv = i2c_read_block(I2C_PORT_GPU, GPU_ADDR_FLAGS, GPU_TEMPERATURE_OFFSET, reg, ARRAY_SIZE(reg)); if (rv) { CPRINTS("read GPU Temperature fail"); + *temp_ptr = C_TO_K(0); return rv; } /* @@ -81,5 +85,6 @@ int get_temp_R19ME4070(int idx, int *temp_ptr) * reg[0] = 0x04 */ *temp_ptr = C_TO_K(reg[3] >> 1); + return EC_SUCCESS; } |