diff options
author | David Chao <davidchao@google.com> | 2021-08-03 16:47:42 +0800 |
---|---|---|
committer | Wei Wang <wvw@google.com> | 2021-08-09 18:31:26 +0000 |
commit | f3671dbacc743e84c5d35f1c3b35945b4c654a51 (patch) | |
tree | d10193963ab220ba0bbc16da94df152468ccc23a | |
parent | 2d0d4e612e61743598241837bbc7912bc8b94474 (diff) | |
download | abrolhos-f3671dbacc743e84c5d35f1c3b35945b4c654a51.tar.gz |
edgetpu: thermal: tmu: add tpu pause/resume feature
Add tpu pause/resume feature
Bug: 194307914
Test: boot to home and tpu pause/resume worked properly
Change-Id: I737dc6d10cb8f1300459e72045d6b47788e3ee2c
Signed-off-by: David Chao <davidchao@google.com>
-rw-r--r-- | drivers/edgetpu/abrolhos-thermal.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/edgetpu/abrolhos-thermal.c b/drivers/edgetpu/abrolhos-thermal.c index 6e7141f..82a8a5a 100644 --- a/drivers/edgetpu/abrolhos-thermal.c +++ b/drivers/edgetpu/abrolhos-thermal.c @@ -16,6 +16,7 @@ #include <linux/slab.h> #include <linux/thermal.h> #include <linux/version.h> +#include <soc/google/gs101_tmu.h> #include "abrolhos-platform.h" #include "abrolhos-pm.h" @@ -323,6 +324,21 @@ static ssize_t user_vote_store(struct device *dev, struct device_attribute *attr static DEVICE_ATTR_RW(user_vote); +static int tpu_pause_callback(enum thermal_pause_state action, void *dev) +{ + int ret = -EINVAL; + + if (!dev) + return ret; + + if (action == THERMAL_SUSPEND) + ret = edgetpu_thermal_suspend(dev); + else if (action == THERMAL_RESUME) + ret = edgetpu_thermal_resume(dev); + + return ret; +} + static int tpu_thermal_cooling_register(struct edgetpu_thermal *thermal, char *type) { @@ -369,6 +385,8 @@ static int tpu_thermal_init(struct edgetpu_thermal *thermal, struct device *dev) return err; } + register_tpu_thermal_pause_cb(tpu_pause_callback, dev); + return 0; } @@ -413,7 +431,6 @@ int edgetpu_thermal_suspend(struct device *dev) mutex_unlock(&cooling->lock); return ret; } -EXPORT_SYMBOL_GPL(edgetpu_thermal_suspend); int edgetpu_thermal_resume(struct device *dev) { @@ -435,4 +452,3 @@ int edgetpu_thermal_resume(struct device *dev) mutex_unlock(&cooling->lock); return ret; } -EXPORT_SYMBOL_GPL(edgetpu_thermal_resume); |