summaryrefslogtreecommitdiff
path: root/drivers/gpu/arm
diff options
context:
space:
mode:
authorFinley Xiao <finley.xiao@rock-chips.com>2018-06-29 15:49:36 +0800
committerTao Huang <huangtao@rock-chips.com>2018-07-06 19:42:07 +0800
commit21d81d9c9c799b1ce3402fedc7a516d58455d9b7 (patch)
tree1dc468d5a782fc14b88c98f64b4c01a22b278f8d /drivers/gpu/arm
parente4d2ea0c5587f0345ef8e2ec05936ed7297d30fb (diff)
MALI: midgard: Add wide-temperature control
Change-Id: Ibf1c6ebd91d2e793fa8efe0383df346dd8c67b45 Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Diffstat (limited to 'drivers/gpu/arm')
-rw-r--r--drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c16
-rw-r--r--drivers/gpu/arm/midgard/mali_kbase_defs.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c b/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
index 0127d2a1d66f..1495f06cd9b9 100644
--- a/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
+++ b/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
@@ -45,6 +45,13 @@
#define dev_pm_opp_find_freq_ceil opp_find_freq_ceil
#define dev_pm_opp_find_freq_floor opp_find_freq_floor
#endif /* Linux >= 3.13 */
+#include <soc/rockchip/rockchip_opp_select.h>
+
+static struct thermal_opp_device_data gpu_devdata = {
+ .type = THERMAL_OPP_TPYE_DEV,
+ .low_temp_adjust = rockchip_dev_low_temp_adjust,
+ .high_temp_adjust = rockchip_dev_high_temp_adjust,
+};
/**
* opp_translate - Translate nominal OPP frequency from devicetree into real
@@ -378,6 +385,14 @@ int kbase_devfreq_init(struct kbase_device *kbdev)
devfreq_recommended_opp(kbdev->dev, &opp_rate, 0);
rcu_read_unlock();
kbdev->devfreq->last_status.current_frequency = opp_rate;
+
+ gpu_devdata.data = kbdev->devfreq;
+ kbdev->opp_info = rockchip_register_thermal_notifier(kbdev->dev,
+ &gpu_devdata);
+ if (IS_ERR(kbdev->opp_info)) {
+ dev_dbg(kbdev->dev, "without thermal notifier\n");
+ kbdev->opp_info = NULL;
+ }
#ifdef CONFIG_DEVFREQ_THERMAL
err = kbase_ipa_init(kbdev);
if (err) {
@@ -420,6 +435,7 @@ void kbase_devfreq_term(struct kbase_device *kbdev)
dev_dbg(kbdev->dev, "Term Mali devfreq\n");
+ rockchip_unregister_thermal_notifier(kbdev->opp_info);
#ifdef CONFIG_DEVFREQ_THERMAL
if (kbdev->devfreq_cooling)
devfreq_cooling_unregister(kbdev->devfreq_cooling);
diff --git a/drivers/gpu/arm/midgard/mali_kbase_defs.h b/drivers/gpu/arm/midgard/mali_kbase_defs.h
index 91f159b38413..9526dd9e1a20 100644
--- a/drivers/gpu/arm/midgard/mali_kbase_defs.h
+++ b/drivers/gpu/arm/midgard/mali_kbase_defs.h
@@ -1096,6 +1096,7 @@ struct kbase_device {
u64 current_core_mask;
struct kbase_devfreq_opp *opp_table;
int num_opps;
+ struct thermal_opp_info *opp_info;
#ifdef CONFIG_DEVFREQ_THERMAL
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
struct devfreq_cooling_device *devfreq_cooling;