summaryrefslogtreecommitdiff
path: root/driver/temp_sensor
diff options
context:
space:
mode:
authorloganliao <Logan_Liao@compal.corp-partner.google.com>2020-05-20 14:48:47 +0800
committerCommit Bot <commit-bot@chromium.org>2020-05-20 19:32:41 +0000
commit3faccef8d5d88c2901e67aebe8fe62282338da2d (patch)
treed51c265b8b68052b690241429691e9864598c67b /driver/temp_sensor
parent192f1de90e1e6d97f24dd56b361ba9ddc3e110c2 (diff)
downloadchrome-ec-3faccef8d5d88c2901e67aebe8fe62282338da2d.tar.gz
Driver : Read GPU temperature in S0.
The GPU is enabled in S0, EC should read GPU temperature in this state. BUG=none BRANCH=none TEST=make BOARD=mushu, Test on Mushu and have not see the init GPU fail log in console when state in S5 or G3. Change-Id: I4a7d53e7bdad12ffd23e187bb0f8120e56467138 Signed-off-by: loganliao <Logan_Liao@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2208337 Reviewed-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Tested-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Commit-Queue: Bob Moragues <moragues@chromium.org>
Diffstat (limited to 'driver/temp_sensor')
-rw-r--r--driver/temp_sensor/amd_r19me4070.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/driver/temp_sensor/amd_r19me4070.c b/driver/temp_sensor/amd_r19me4070.c
index 79d5c387d6..ec606604a5 100644
--- a/driver/temp_sensor/amd_r19me4070.c
+++ b/driver/temp_sensor/amd_r19me4070.c
@@ -11,6 +11,7 @@
#include "hooks.h"
#include "i2c.h"
#include "amd_r19me4070.h"
+#include "power.h"
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
@@ -41,7 +42,6 @@ static void gpu_init_temp_sensor(void)
}
CPRINTS("init GPU fail");
}
-DECLARE_HOOK(HOOK_INIT, gpu_init_temp_sensor, HOOK_PRIO_INIT_I2C + 1);
/* INIT GPU first before read the GPU's die tmeperature. */
int get_temp_R19ME4070(int idx, int *temp_ptr)
@@ -49,6 +49,12 @@ int get_temp_R19ME4070(int idx, int *temp_ptr)
uint8_t reg[5];
int rv;
+ /*
+ * 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)
+ return EC_ERROR_BUSY;
/* if no INIT GPU, must init it first and wait 1 sec. */
if (!initialized) {
gpu_init_temp_sensor();