summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_scale.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_scale.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
index 7efd07bf..c3affe83 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * gk20a clock scaling profile 2 * gk20a clock scaling profile
3 * 3 *
4 * Copyright (c) 2013-2014, NVIDIA Corporation. All rights reserved. 4 * Copyright (c) 2013-2015, NVIDIA Corporation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -60,6 +60,9 @@ static int gk20a_scale_qos_notify(struct notifier_block *nb,
60 if (g->devfreq) 60 if (g->devfreq)
61 freq = max(g->devfreq->previous_freq, freq); 61 freq = max(g->devfreq->previous_freq, freq);
62 62
63 /* Update gpu load because we may scale the emc target
64 * if the gpu load changed. */
65 gk20a_pmu_load_update(g);
63 platform->postscale(profile->pdev, freq); 66 platform->postscale(profile->pdev, freq);
64 67
65 return NOTIFY_OK; 68 return NOTIFY_OK;
@@ -107,15 +110,18 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq,
107 struct gk20a_scale_profile *profile = g->scale_profile; 110 struct gk20a_scale_profile *profile = g->scale_profile;
108 unsigned long rounded_rate = gk20a_clk_round_rate(g, *freq); 111 unsigned long rounded_rate = gk20a_clk_round_rate(g, *freq);
109 112
110 if (gk20a_clk_get_rate(g) == rounded_rate) { 113 if (gk20a_clk_get_rate(g) == rounded_rate)
111 *freq = rounded_rate; 114 *freq = rounded_rate;
112 return 0; 115 else {
116 gk20a_clk_set_rate(g, rounded_rate);
117 *freq = gk20a_clk_get_rate(g);
113 } 118 }
114 119
115 gk20a_clk_set_rate(g, rounded_rate); 120 /* postscale will only scale emc (dram clock) if evaluating
121 * gk20a_tegra_get_emc_rate() produces a new or different emc
122 * target because the load or_and gpufreq has changed */
116 if (platform->postscale) 123 if (platform->postscale)
117 platform->postscale(profile->pdev, rounded_rate); 124 platform->postscale(profile->pdev, rounded_rate);
118 *freq = gk20a_clk_get_rate(g);
119 125
120 return 0; 126 return 0;
121} 127}