Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5a70edb authored by Felix Xiong's avatar Felix Xiong Committed by Sharat Masetty
Browse files

drm/msm: Register GPU devfreq to allow thermal mitigation



To allow thermal framework to scale the GPU frequency to mitigate
the GPU temperature. Register GPU as a devfreq based cooling device.

Change-Id: I01176ef96a69f1aa90d30f14f5c9d940e97cc188
Signed-off-by: default avatarFelix Xiong <xayang@codeaurora.org>
Signed-off-by: default avatarVenkateswara Rao Tadikonda <vtadik@codeaurora.org>
Signed-off-by: default avatarSharat Masetty <smasetty@codeaurora.org>
parent bb69facb
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
 */

#include <linux/devfreq.h>
#include <linux/devfreq_cooling.h>
#include "msm_gpu.h"
#include "msm_gem.h"
#include "msm_mmu.h"
@@ -133,6 +134,15 @@ static void msm_devfreq_init(struct msm_gpu *gpu)
	if (IS_ERR(gpu->devfreq.devfreq)) {
		dev_err(dev, "Couldn't initialize GPU devfreq\n");
		gpu->devfreq.devfreq = NULL;
		return;
	}

	gpu->devfreq.cooling_dev = of_devfreq_cooling_register(
		dev->of_node, gpu->devfreq.devfreq);

	if (IS_ERR(gpu->devfreq.cooling_dev)) {
		dev_err(dev, "Couldn't register GPU devfreq cooling device\n");
		gpu->devfreq.cooling_dev = NULL;
	}
}

@@ -1117,8 +1127,10 @@ void msm_gpu_cleanup(struct msm_gpu *gpu)

	WARN_ON(!list_empty(&gpu->active_list));

	if (gpu->devfreq.devfreq)
	if (gpu->devfreq.devfreq) {
		devfreq_cooling_unregister(gpu->devfreq.cooling_dev);
		devfreq_remove_device(gpu->devfreq.devfreq);
	}

	if (gpu->irq >= 0) {
		disable_irq(gpu->irq);
+1 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ struct msm_gpu {
		struct devfreq *devfreq;
		u64 busy_cycles;
		ktime_t time;
		struct thermal_cooling_device *cooling_dev;
	} devfreq;
};