summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
diff options
context:
space:
mode:
authorAnders Kugler <akugler@nvidia.com>2015-02-03 21:54:16 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-04-04 22:00:15 -0400
commitf7d7b601ed7e4f592c9ce82708e69b16f1c28eec (patch)
tree7fc867dc74f394fd60304c2f1c932f609c198cf5 /drivers/gpu/nvgpu/gk20a/gk20a_scale.c
parentf45d33e5f2b1e36363f32bbbeeeba462486cc6cd (diff)
gpu: nvgpu: 3d.emc frequency scaling
o QoS notifier Refresh the gpu load query because we may update the emc target if gpu load changed. o tegra_postscale() Scaling the emc clock to a new target may be necessary if the gpu load changed at low gpu frequencies. Bug 1591643 Change-Id: Ibc6f73c02eaf6cedb7f0f579d5f4d90c735d354a Signed-off-by: Anders Kugler <akugler@nvidia.com> Reviewed-on: http://git-master/r/680929 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
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}