diff options
author | Seshendra Gadagottu <sgadagottu@nvidia.com> | 2015-10-13 14:39:43 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2015-11-19 17:31:49 -0500 |
commit | acde16dd16012004efa1edb9dc9813f0c62622e4 (patch) | |
tree | 415603313667448d1325fe610b41d49c564c49c1 /drivers/gpu/nvgpu/gk20a/gk20a_scale.c | |
parent | d3cf5811996388a1d7501da72fff46ee19e5e7c7 (diff) |
gpu: nvgpu: scaling driver update
Update scaling driver to support to differnt
clock frameworks.
Bug 200147662
Reviewed-on: http://git-master/r/816929
(cherry picked from commit cbd4cb575fb2d27870089797ff2a8f22540b87e8)
Change-Id: Ie50304b4a593d74bd43b271005cc9616fdb52a6e
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: http://git-master/r/834748
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_scale.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_scale.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c index c3affe83..0411e2fa 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c | |||
@@ -56,7 +56,8 @@ static int gk20a_scale_qos_notify(struct notifier_block *nb, | |||
56 | 56 | ||
57 | /* get the frequency requirement. if devfreq is enabled, check if it | 57 | /* get the frequency requirement. if devfreq is enabled, check if it |
58 | * has higher demand than qos */ | 58 | * has higher demand than qos */ |
59 | freq = gk20a_clk_round_rate(g, pm_qos_request(platform->qos_id)); | 59 | freq = platform->clk_round_rate(profile->pdev, |
60 | pm_qos_request(platform->qos_id)); | ||
60 | if (g->devfreq) | 61 | if (g->devfreq) |
61 | freq = max(g->devfreq->previous_freq, freq); | 62 | freq = max(g->devfreq->previous_freq, freq); |
62 | 63 | ||
@@ -76,17 +77,13 @@ static int gk20a_scale_qos_notify(struct notifier_block *nb, | |||
76 | 77 | ||
77 | static int gk20a_scale_make_freq_table(struct gk20a_scale_profile *profile) | 78 | static int gk20a_scale_make_freq_table(struct gk20a_scale_profile *profile) |
78 | { | 79 | { |
79 | struct gk20a *g = get_gk20a(profile->pdev); | 80 | struct gk20a_platform *platform = platform_get_drvdata(profile->pdev); |
80 | unsigned long *freqs; | ||
81 | int num_freqs, err; | 81 | int num_freqs, err; |
82 | unsigned long *freqs; | ||
82 | 83 | ||
83 | /* make sure the clock is available */ | 84 | /* get gpu frequency table */ |
84 | if (!gk20a_clk_get(g)) | 85 | err = platform->get_clk_freqs(profile->pdev, &freqs, |
85 | return -ENOSYS; | 86 | &num_freqs); |
86 | |||
87 | /* get gpu dvfs table */ | ||
88 | err = tegra_dvfs_get_freqs(clk_get_parent(g->clk.tegra_clk), | ||
89 | &freqs, &num_freqs); | ||
90 | if (err) | 87 | if (err) |
91 | return -ENOSYS; | 88 | return -ENOSYS; |
92 | 89 | ||
@@ -105,23 +102,23 @@ static int gk20a_scale_make_freq_table(struct gk20a_scale_profile *profile) | |||
105 | static int gk20a_scale_target(struct device *dev, unsigned long *freq, | 102 | static int gk20a_scale_target(struct device *dev, unsigned long *freq, |
106 | u32 flags) | 103 | u32 flags) |
107 | { | 104 | { |
108 | struct gk20a *g = get_gk20a(to_platform_device(dev)); | ||
109 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 105 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
110 | struct gk20a_scale_profile *profile = g->scale_profile; | 106 | struct platform_device *pdev = to_platform_device(dev); |
111 | unsigned long rounded_rate = gk20a_clk_round_rate(g, *freq); | 107 | unsigned long rounded_rate = |
108 | platform->clk_round_rate(pdev, *freq); | ||
112 | 109 | ||
113 | if (gk20a_clk_get_rate(g) == rounded_rate) | 110 | if (platform->clk_get_rate(pdev) == rounded_rate) |
114 | *freq = rounded_rate; | 111 | *freq = rounded_rate; |
115 | else { | 112 | else { |
116 | gk20a_clk_set_rate(g, rounded_rate); | 113 | platform->clk_set_rate(pdev, rounded_rate); |
117 | *freq = gk20a_clk_get_rate(g); | 114 | *freq = platform->clk_get_rate(pdev); |
118 | } | 115 | } |
119 | 116 | ||
120 | /* postscale will only scale emc (dram clock) if evaluating | 117 | /* postscale will only scale emc (dram clock) if evaluating |
121 | * gk20a_tegra_get_emc_rate() produces a new or different emc | 118 | * gk20a_tegra_get_emc_rate() produces a new or different emc |
122 | * target because the load or_and gpufreq has changed */ | 119 | * target because the load or_and gpufreq has changed */ |
123 | if (platform->postscale) | 120 | if (platform->postscale) |
124 | platform->postscale(profile->pdev, rounded_rate); | 121 | platform->postscale(pdev, rounded_rate); |
125 | 122 | ||
126 | return 0; | 123 | return 0; |
127 | } | 124 | } |
@@ -237,9 +234,12 @@ static int gk20a_scale_get_dev_status(struct device *dev, | |||
237 | { | 234 | { |
238 | struct gk20a *g = get_gk20a(to_platform_device(dev)); | 235 | struct gk20a *g = get_gk20a(to_platform_device(dev)); |
239 | struct gk20a_scale_profile *profile = g->scale_profile; | 236 | struct gk20a_scale_profile *profile = g->scale_profile; |
237 | struct platform_device *pdev = to_platform_device(dev); | ||
238 | struct gk20a_platform *platform = platform_get_drvdata(pdev); | ||
240 | 239 | ||
241 | /* Make sure there are correct values for the current frequency */ | 240 | /* Make sure there are correct values for the current frequency */ |
242 | profile->dev_stat.current_frequency = gk20a_clk_get_rate(g); | 241 | profile->dev_stat.current_frequency = |
242 | platform->clk_get_rate(profile->pdev); | ||
243 | 243 | ||
244 | /* Update load estimate */ | 244 | /* Update load estimate */ |
245 | update_load_estimate_gpmu(to_platform_device(dev)); | 245 | update_load_estimate_gpmu(to_platform_device(dev)); |