summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Parent <fabien.parent@linaro.org>2022-10-27 13:19:23 +0200
committerFabien Parent <fabien.parent@linaro.org>2022-10-30 12:13:08 +0100
commit76dff2a7f7978a585e2f02c413bd76efbb2d754e (patch)
tree00dd743dafaf1d4488e631ddaf1fd5d998703434
parent9d6e43c6919b7f386d25e503032f07a8b6f65586 (diff)
drm/msm/a4xx: implement gpu_busy to get devfreq support
The .gpu_busy callback needs to be implemented in order for devfreq to be supported and registered. void msm_devfreq_init(struct msm_gpu *gpu) { /* We need target support to do devfreq */ if (!gpu->funcs->gpu_busy) return; This commit implement the gpu_busy callback. This allows to save power by not running at the highest OPP all the time when the GPU is on. Signed-off-by: Fabien Parent <fabien.parent@linaro.org>
-rw-r--r--drivers/gpu/drm/msm/adreno/a4xx_gpu.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
index 7cb8d9849c07..ec35ec3fd490 100644
--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
@@ -612,6 +612,17 @@ static int a4xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value)
return 0;
}
+static u64 a4xx_gpu_busy(struct msm_gpu *gpu, unsigned long *out_sample_rate)
+{
+ u64 busy_cycles;
+
+ busy_cycles = gpu_read64(gpu, REG_A4XX_RBBM_PERFCTR_PWR_1_LO,
+ REG_A4XX_RBBM_PERFCTR_PWR_1_HI);
+ *out_sample_rate = clk_get_rate(gpu->core_clk);
+
+ return busy_cycles;
+}
+
static u32 a4xx_get_rptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring)
{
ring->memptrs->rptr = gpu_read(gpu, REG_A4XX_CP_RB_RPTR);
@@ -633,6 +644,7 @@ static const struct adreno_gpu_funcs funcs = {
#if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP)
.show = adreno_show,
#endif
+ .gpu_busy = a4xx_gpu_busy,
.gpu_state_get = a4xx_gpu_state_get,
.gpu_state_put = adreno_gpu_state_put,
.create_address_space = adreno_iommu_create_address_space,