summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Courbot2016-02-12 06:05:01 +0100
committerBen Skeggs2016-03-14 01:13:51 +0100
commitd865f3c52de7c148d53ac9028659e6eafd833241 (patch)
tree58952dcf1562e16d05ddb424a72becc7aa68a326
parentdrm/nouveau/clk/gk20a: convert parameters to Khz (diff)
downloadkernel-qcow2-linux-d865f3c52de7c148d53ac9028659e6eafd833241.tar.gz
kernel-qcow2-linux-d865f3c52de7c148d53ac9028659e6eafd833241.tar.xz
kernel-qcow2-linux-d865f3c52de7c148d53ac9028659e6eafd833241.zip
drm/nouveau/clk/gk20a: reorganize variables in gk20a_pllg_calc_mnp()
Move some variables declarations to the scope where they are actually used to make the code easier to follow. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
index eaf7939c6a51..0c2b078914c5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
@@ -153,11 +153,9 @@ gk20a_pllg_calc_mnp(struct gk20a_clk *clk, unsigned long rate)
u32 target_clk_f, ref_clk_f, target_freq;
u32 min_vco_f, max_vco_f;
u32 low_pl, high_pl, best_pl;
- u32 target_vco_f, vco_f;
+ u32 target_vco_f;
u32 best_m, best_n;
- u32 u_f;
- u32 m, n, n2;
- u32 delta, lwv, best_delta = ~0;
+ u32 best_delta = ~0;
u32 pl;
target_clk_f = rate * 2 / KHZ;
@@ -202,8 +200,12 @@ gk20a_pllg_calc_mnp(struct gk20a_clk *clk, unsigned long rate)
/* Select lowest possible VCO */
for (pl = low_pl; pl <= high_pl; pl++) {
+ u32 m, n, n2;
+
target_vco_f = target_clk_f * pl_to_div[pl];
for (m = clk->params->min_m; m <= clk->params->max_m; m++) {
+ u32 u_f, vco_f;
+
u_f = ref_clk_f / m;
if (u_f < clk->params->min_u)
@@ -226,6 +228,8 @@ gk20a_pllg_calc_mnp(struct gk20a_clk *clk, unsigned long rate)
vco_f = ref_clk_f * n / m;
if (vco_f >= min_vco_f && vco_f <= max_vco_f) {
+ u32 delta, lwv;
+
lwv = (vco_f + (pl_to_div[pl] / 2))
/ pl_to_div[pl];
delta = abs(lwv - target_clk_f);