aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2013-11-15 09:03:15 -0500
committerRob Clark <robdclark@gmail.com>2014-01-09 14:38:58 -0500
commitbf2b33afb9ea1d9609767c70562610a686bdfbd7 (patch)
treea7b9f940bc3f0ce318cdc67bf6795555015307c0
parent3b57f23b1ccaec1c34fb3d4e781fc8e1f72ad61e (diff)
drm/msm: fix bus scaling
This got a bit broken with original patches when re-arranging things to move dependencies on mach-msm inside #ifndef OF. Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/adreno/a3xx_gpu.c11
-rw-r--r--drivers/gpu/drm/msm/adreno/adreno_gpu.h3
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.c20
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.h4
4 files changed, 23 insertions, 15 deletions
diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
index 035bd13dc8bd..d9e72a60080c 100644
--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
@@ -414,6 +414,9 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
414 gpu->fast_rate = config->fast_rate; 414 gpu->fast_rate = config->fast_rate;
415 gpu->slow_rate = config->slow_rate; 415 gpu->slow_rate = config->slow_rate;
416 gpu->bus_freq = config->bus_freq; 416 gpu->bus_freq = config->bus_freq;
417#ifdef CONFIG_MSM_BUS_SCALING
418 gpu->bus_scale_table = config->bus_scale_table;
419#endif
417 420
418 DBG("fast_rate=%u, slow_rate=%u, bus_freq=%u", 421 DBG("fast_rate=%u, slow_rate=%u, bus_freq=%u",
419 gpu->fast_rate, gpu->slow_rate, gpu->bus_freq); 422 gpu->fast_rate, gpu->slow_rate, gpu->bus_freq);
@@ -436,12 +439,17 @@ fail:
436 * The a3xx device: 439 * The a3xx device:
437 */ 440 */
438 441
442#if defined(CONFIG_MSM_BUS_SCALING) && !defined(CONFIG_OF)
443# include <mach/kgsl.h>
444#endif
445
439static int a3xx_probe(struct platform_device *pdev) 446static int a3xx_probe(struct platform_device *pdev)
440{ 447{
441 static struct adreno_platform_config config = {}; 448 static struct adreno_platform_config config = {};
442#ifdef CONFIG_OF 449#ifdef CONFIG_OF
443 /* TODO */ 450 /* TODO */
444#else 451#else
452 struct kgsl_device_platform_data *pdata = pdev->dev.platform_data;
445 uint32_t version = socinfo_get_version(); 453 uint32_t version = socinfo_get_version();
446 if (cpu_is_apq8064ab()) { 454 if (cpu_is_apq8064ab()) {
447 config.fast_rate = 450000000; 455 config.fast_rate = 450000000;
@@ -473,6 +481,9 @@ static int a3xx_probe(struct platform_device *pdev)
473 config.rev = ADRENO_REV(3, 0, 5, 0); 481 config.rev = ADRENO_REV(3, 0, 5, 0);
474 482
475 } 483 }
484# ifdef CONFIG_MSM_BUS_SCALING
485 config.bus_scale_table = pdata->bus_scale_table;
486# endif
476#endif 487#endif
477 pdev->dev.platform_data = &config; 488 pdev->dev.platform_data = &config;
478 a3xx_pdev = pdev; 489 a3xx_pdev = pdev;
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index f73abfba7c22..451b741fbd12 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -70,6 +70,9 @@ struct adreno_gpu {
70struct adreno_platform_config { 70struct adreno_platform_config {
71 struct adreno_rev rev; 71 struct adreno_rev rev;
72 uint32_t fast_rate, slow_rate, bus_freq; 72 uint32_t fast_rate, slow_rate, bus_freq;
73#ifdef CONFIG_MSM_BUS_SCALING
74 struct msm_bus_scale_pdata *bus_scale_table;
75#endif
73}; 76};
74 77
75#define ADRENO_IDLE_TIMEOUT (20 * 1000) 78#define ADRENO_IDLE_TIMEOUT (20 * 1000)
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 4583d61556f5..71f105f0d897 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -25,20 +25,10 @@
25 25
26#ifdef CONFIG_MSM_BUS_SCALING 26#ifdef CONFIG_MSM_BUS_SCALING
27#include <mach/board.h> 27#include <mach/board.h>
28#include <mach/kgsl.h> 28static void bs_init(struct msm_gpu *gpu)
29static void bs_init(struct msm_gpu *gpu, struct platform_device *pdev)
30{ 29{
31 struct drm_device *dev = gpu->dev; 30 if (gpu->bus_scale_table) {
32 struct kgsl_device_platform_data *pdata; 31 gpu->bsc = msm_bus_scale_register_client(gpu->bus_scale_table);
33
34 if (!pdev) {
35 dev_err(dev->dev, "could not find dtv pdata\n");
36 return;
37 }
38
39 pdata = pdev->dev.platform_data;
40 if (pdata->bus_scale_table) {
41 gpu->bsc = msm_bus_scale_register_client(pdata->bus_scale_table);
42 DBG("bus scale client: %08x", gpu->bsc); 32 DBG("bus scale client: %08x", gpu->bsc);
43 } 33 }
44} 34}
@@ -59,7 +49,7 @@ static void bs_set(struct msm_gpu *gpu, int idx)
59 } 49 }
60} 50}
61#else 51#else
62static void bs_init(struct msm_gpu *gpu, struct platform_device *pdev) {} 52static void bs_init(struct msm_gpu *gpu) {}
63static void bs_fini(struct msm_gpu *gpu) {} 53static void bs_fini(struct msm_gpu *gpu) {}
64static void bs_set(struct msm_gpu *gpu, int idx) {} 54static void bs_set(struct msm_gpu *gpu, int idx) {}
65#endif 55#endif
@@ -452,7 +442,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
452 goto fail; 442 goto fail;
453 } 443 }
454 444
455 bs_init(gpu, pdev); 445 bs_init(gpu);
456 446
457 return 0; 447 return 0;
458 448
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 8cd829e520bb..08d08420cbcc 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -85,7 +85,11 @@ struct msm_gpu {
85 struct regulator *gpu_reg, *gpu_cx; 85 struct regulator *gpu_reg, *gpu_cx;
86 struct clk *ebi1_clk, *grp_clks[5]; 86 struct clk *ebi1_clk, *grp_clks[5];
87 uint32_t fast_rate, slow_rate, bus_freq; 87 uint32_t fast_rate, slow_rate, bus_freq;
88
89#ifdef CONFIG_MSM_BUS_SCALING
90 struct msm_bus_scale_pdata *bus_scale_table;
88 uint32_t bsc; 91 uint32_t bsc;
92#endif
89 93
90 /* Hang Detction: */ 94 /* Hang Detction: */
91#define DRM_MSM_HANGCHECK_PERIOD 500 /* in ms */ 95#define DRM_MSM_HANGCHECK_PERIOD 500 /* in ms */