aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Crouse <jcrouse@codeaurora.org>2016-11-28 14:28:31 -0500
committerRob Clark <robdclark@gmail.com>2016-11-28 15:14:13 -0500
commit89d777a572459d6ea726b609838beaef0c1b94a7 (patch)
tree9cae8205ec1fc321aa3a61736bf1d9dc486b9bbb
parent05b9401bee13da14ea3d0b17eda6f0f89f6d455e (diff)
drm/msm: Remove 'src_clk' from adreno configuration
The adreno code inherited a silly workaround from downstream from the bad old days before decent clock control. grp_clk[0] (named 'src_clk') doesn't actually exist - it was used as a proxy for whatever the core clock actually was (usually 'core_clk'). All targets should be able to correctly request 'core_clk' and get the right thing back so zap the anachronism and directly use grp_clk[0] to control the clock rate. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.c36
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.h2
2 files changed, 14 insertions, 24 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 1277088426a7..3d6e3b7a13e2 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -91,21 +91,16 @@ static int disable_pwrrail(struct msm_gpu *gpu)
91 91
92static int enable_clk(struct msm_gpu *gpu) 92static int enable_clk(struct msm_gpu *gpu)
93{ 93{
94 struct clk *rate_clk = NULL;
95 int i; 94 int i;
96 95
97 /* NOTE: kgsl_pwrctrl_clk() ignores grp_clks[0].. */ 96 if (gpu->grp_clks[0] && gpu->fast_rate)
98 for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i > 0; i--) { 97 clk_set_rate(gpu->grp_clks[0], gpu->fast_rate);
99 if (gpu->grp_clks[i]) {
100 clk_prepare(gpu->grp_clks[i]);
101 rate_clk = gpu->grp_clks[i];
102 }
103 }
104 98
105 if (rate_clk && gpu->fast_rate) 99 for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i >= 0; i--)
106 clk_set_rate(rate_clk, gpu->fast_rate); 100 if (gpu->grp_clks[i])
101 clk_prepare(gpu->grp_clks[i]);
107 102
108 for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i > 0; i--) 103 for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i >= 0; i--)
109 if (gpu->grp_clks[i]) 104 if (gpu->grp_clks[i])
110 clk_enable(gpu->grp_clks[i]); 105 clk_enable(gpu->grp_clks[i]);
111 106
@@ -114,24 +109,19 @@ static int enable_clk(struct msm_gpu *gpu)
114 109
115static int disable_clk(struct msm_gpu *gpu) 110static int disable_clk(struct msm_gpu *gpu)
116{ 111{
117 struct clk *rate_clk = NULL;
118 int i; 112 int i;
119 113
120 /* NOTE: kgsl_pwrctrl_clk() ignores grp_clks[0].. */ 114 for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i >= 0; i--)
121 for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i > 0; i--) { 115 if (gpu->grp_clks[i])
122 if (gpu->grp_clks[i]) {
123 clk_disable(gpu->grp_clks[i]); 116 clk_disable(gpu->grp_clks[i]);
124 rate_clk = gpu->grp_clks[i];
125 }
126 }
127 117
128 if (rate_clk && gpu->slow_rate) 118 for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i >= 0; i--)
129 clk_set_rate(rate_clk, gpu->slow_rate);
130
131 for (i = ARRAY_SIZE(gpu->grp_clks) - 1; i > 0; i--)
132 if (gpu->grp_clks[i]) 119 if (gpu->grp_clks[i])
133 clk_unprepare(gpu->grp_clks[i]); 120 clk_unprepare(gpu->grp_clks[i]);
134 121
122 if (gpu->grp_clks[0] && gpu->slow_rate)
123 clk_set_rate(gpu->grp_clks[0], gpu->slow_rate);
124
135 return 0; 125 return 0;
136} 126}
137 127
@@ -563,7 +553,7 @@ static irqreturn_t irq_handler(int irq, void *data)
563} 553}
564 554
565static const char *clk_names[] = { 555static const char *clk_names[] = {
566 "src_clk", "core_clk", "iface_clk", "mem_clk", "mem_iface_clk", 556 "core_clk", "iface_clk", "mem_clk", "mem_iface_clk",
567 "alt_mem_iface_clk", 557 "alt_mem_iface_clk",
568}; 558};
569 559
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index c4c39d3272c7..10252d07bb14 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -103,7 +103,7 @@ struct msm_gpu {
103 103
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[5];
107 uint32_t fast_rate, slow_rate, bus_freq; 107 uint32_t fast_rate, slow_rate, bus_freq;
108 108
109#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING 109#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING