aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Crouse <jcrouse@codeaurora.org>2017-03-07 12:02:54 -0500
committerRob Clark <robdclark@gmail.com>2017-04-08 06:59:37 -0400
commitbf5af4ae875d8803db98d38ed988c2ec4c941a00 (patch)
tree270c6d656181487d442b0c5f83372c5b8a149ea3
parente3689e470fa0d9ebaa9d13d069e8d73c8d82a11d (diff)
drm/msm: Hard code the GPU "slow frequency"
Some A3XX and A4XX GPU targets required that the GPU clock be programmed to a non zero value when it was disabled so 27Mhz was chosen as the "invalid" frequency. Even though newer targets do not have the same clock restrictions we still write 27Mhz on clock disable and expect the clock subsystem to round down to zero. For unknown reasons even though the slow clock speed is always 27Mhz and it isn't actually a functional level the legacy device tree frequency tables always defined it and then did gymnastics to work around it. Instead of playing the same silly games just hard code the "slow" clock speed in the code as 27MHz and save ourselves a bit of infrastructure. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/adreno/adreno_device.c5
-rw-r--r--drivers/gpu/drm/msm/adreno/adreno_gpu.c5
-rw-r--r--drivers/gpu/drm/msm/adreno/adreno_gpu.h2
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.c8
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.h2
5 files changed, 11 insertions, 11 deletions
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index bc170b7d5546..9cae68bed0d6 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -2,7 +2,7 @@
2 * Copyright (C) 2013-2014 Red Hat 2 * Copyright (C) 2013-2014 Red Hat
3 * Author: Rob Clark <robdclark@gmail.com> 3 * Author: Rob Clark <robdclark@gmail.com>
4 * 4 *
5 * Copyright (c) 2014 The Linux Foundation. All rights reserved. 5 * Copyright (c) 2014,2017 The Linux Foundation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by 8 * under the terms of the GNU General Public License version 2 as published by
@@ -231,7 +231,6 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
231 231
232 /* find clock rates: */ 232 /* find clock rates: */
233 config.fast_rate = 0; 233 config.fast_rate = 0;
234 config.slow_rate = ~0;
235 for_each_child_of_node(node, child) { 234 for_each_child_of_node(node, child) {
236 if (of_device_is_compatible(child, "qcom,gpu-pwrlevels")) { 235 if (of_device_is_compatible(child, "qcom,gpu-pwrlevels")) {
237 struct device_node *pwrlvl; 236 struct device_node *pwrlvl;
@@ -242,7 +241,6 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
242 return ret; 241 return ret;
243 } 242 }
244 config.fast_rate = max(config.fast_rate, val); 243 config.fast_rate = max(config.fast_rate, val);
245 config.slow_rate = min(config.slow_rate, val);
246 } 244 }
247 } 245 }
248 } 246 }
@@ -251,7 +249,6 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
251 dev_warn(dev, "could not find clk rates\n"); 249 dev_warn(dev, "could not find clk rates\n");
252 /* This is a safe low speed for all devices: */ 250 /* This is a safe low speed for all devices: */
253 config.fast_rate = 200000000; 251 config.fast_rate = 200000000;
254 config.slow_rate = 27000000;
255 } 252 }
256 253
257 dev->platform_data = &config; 254 dev->platform_data = &config;
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 4cac22633ce4..5b63fc649dcc 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -352,14 +352,13 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
352 adreno_gpu->rev = config->rev; 352 adreno_gpu->rev = config->rev;
353 353
354 gpu->fast_rate = config->fast_rate; 354 gpu->fast_rate = config->fast_rate;
355 gpu->slow_rate = config->slow_rate;
356 gpu->bus_freq = config->bus_freq; 355 gpu->bus_freq = config->bus_freq;
357#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING 356#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING
358 gpu->bus_scale_table = config->bus_scale_table; 357 gpu->bus_scale_table = config->bus_scale_table;
359#endif 358#endif
360 359
361 DBG("fast_rate=%u, slow_rate=%u, bus_freq=%u", 360 DBG("fast_rate=%u, slow_rate=27000000, bus_freq=%u",
362 gpu->fast_rate, gpu->slow_rate, gpu->bus_freq); 361 gpu->fast_rate, gpu->bus_freq);
363 362
364 ret = msm_gpu_init(drm, pdev, &adreno_gpu->base, &funcs->base, 363 ret = msm_gpu_init(drm, pdev, &adreno_gpu->base, &funcs->base,
365 adreno_gpu->info->name, "kgsl_3d0_reg_memory", "kgsl_3d0_irq", 364 adreno_gpu->info->name, "kgsl_3d0_reg_memory", "kgsl_3d0_irq",
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index 42e444a67630..fb4831f9f80b 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -123,7 +123,7 @@ struct adreno_gpu {
123/* platform config data (ie. from DT, or pdata) */ 123/* platform config data (ie. from DT, or pdata) */
124struct adreno_platform_config { 124struct adreno_platform_config {
125 struct adreno_rev rev; 125 struct adreno_rev rev;
126 uint32_t fast_rate, slow_rate, bus_freq; 126 uint32_t fast_rate, bus_freq;
127#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING 127#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING
128 struct msm_bus_scale_pdata *bus_scale_table; 128 struct msm_bus_scale_pdata *bus_scale_table;
129#endif 129#endif
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 937f1a0c5d3c..f8ee1489e691 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -123,8 +123,12 @@ static int disable_clk(struct msm_gpu *gpu)
123 if (gpu->grp_clks[i]) 123 if (gpu->grp_clks[i])
124 clk_unprepare(gpu->grp_clks[i]); 124 clk_unprepare(gpu->grp_clks[i]);
125 125
126 if (gpu->grp_clks[0] && gpu->slow_rate) 126 /*
127 clk_set_rate(gpu->grp_clks[0], gpu->slow_rate); 127 * Set the clock to a deliberately low rate. On older targets the clock
128 * speed had to be non zero to avoid problems. On newer targets this
129 * will be rounded down to zero anyway so it all works out.
130 */
131 clk_set_rate(gpu->grp_clks[0], 27000000);
128 132
129 if (gpu->grp_clks[2]) 133 if (gpu->grp_clks[2])
130 clk_set_rate(gpu->grp_clks[2], 0); 134 clk_set_rate(gpu->grp_clks[2], 0);
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 72dba973aabf..44f0c34ee5e4 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -104,7 +104,7 @@ struct msm_gpu {
104 /* Power Control: */ 104 /* Power Control: */
105 struct regulator *gpu_reg, *gpu_cx; 105 struct regulator *gpu_reg, *gpu_cx;
106 struct clk *ebi1_clk, *grp_clks[6]; 106 struct clk *ebi1_clk, *grp_clks[6];
107 uint32_t fast_rate, slow_rate, bus_freq; 107 uint32_t fast_rate, bus_freq;
108 108
109#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING 109#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING
110 struct msm_bus_scale_pdata *bus_scale_table; 110 struct msm_bus_scale_pdata *bus_scale_table;