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.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
index 160776bc..df4e4996 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
@@ -28,8 +28,8 @@
28 28
29#include "gk20a.h" 29#include "gk20a.h"
30#include "platform_gk20a.h" 30#include "platform_gk20a.h"
31#include "clk_gk20a.h"
32#include "gk20a_scale.h" 31#include "gk20a_scale.h"
32#include "common/linux/os_linux.h"
33 33
34/* 34/*
35 * gk20a_scale_qos_notify() 35 * gk20a_scale_qos_notify()
@@ -46,7 +46,8 @@ int gk20a_scale_qos_notify(struct notifier_block *nb,
46 container_of(nb, struct gk20a_scale_profile, 46 container_of(nb, struct gk20a_scale_profile,
47 qos_notify_block); 47 qos_notify_block);
48 struct gk20a *g = get_gk20a(profile->dev); 48 struct gk20a *g = get_gk20a(profile->dev);
49 struct devfreq *devfreq = g->devfreq; 49 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
50 struct devfreq *devfreq = l->devfreq;
50 51
51 if (!devfreq) 52 if (!devfreq)
52 return NOTIFY_OK; 53 return NOTIFY_OK;
@@ -79,6 +80,7 @@ int gk20a_scale_qos_notify(struct notifier_block *nb,
79 qos_notify_block); 80 qos_notify_block);
80 struct gk20a_platform *platform = dev_get_drvdata(profile->dev); 81 struct gk20a_platform *platform = dev_get_drvdata(profile->dev);
81 struct gk20a *g = get_gk20a(profile->dev); 82 struct gk20a *g = get_gk20a(profile->dev);
83 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
82 unsigned long freq; 84 unsigned long freq;
83 85
84 if (!platform->postscale) 86 if (!platform->postscale)
@@ -88,8 +90,8 @@ int gk20a_scale_qos_notify(struct notifier_block *nb,
88 * has higher demand than qos */ 90 * has higher demand than qos */
89 freq = platform->clk_round_rate(profile->dev, 91 freq = platform->clk_round_rate(profile->dev,
90 (u32)pm_qos_read_min_bound(PM_QOS_GPU_FREQ_BOUNDS)); 92 (u32)pm_qos_read_min_bound(PM_QOS_GPU_FREQ_BOUNDS));
91 if (g->devfreq) 93 if (l->devfreq)
92 freq = max(g->devfreq->previous_freq, freq); 94 freq = max(l->devfreq->previous_freq, freq);
93 95
94 /* Update gpu load because we may scale the emc target 96 /* Update gpu load because we may scale the emc target
95 * if the gpu load changed. */ 97 * if the gpu load changed. */
@@ -138,8 +140,9 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq,
138{ 140{
139 struct gk20a_platform *platform = dev_get_drvdata(dev); 141 struct gk20a_platform *platform = dev_get_drvdata(dev);
140 struct gk20a *g = platform->g; 142 struct gk20a *g = platform->g;
143 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
141 struct gk20a_scale_profile *profile = g->scale_profile; 144 struct gk20a_scale_profile *profile = g->scale_profile;
142 struct devfreq *devfreq = g->devfreq; 145 struct devfreq *devfreq = l->devfreq;
143 unsigned long local_freq = *freq; 146 unsigned long local_freq = *freq;
144 unsigned long rounded_rate; 147 unsigned long rounded_rate;
145 unsigned long min_freq = 0, max_freq = 0; 148 unsigned long min_freq = 0, max_freq = 0;
@@ -236,7 +239,8 @@ static void update_load_estimate_gpmu(struct device *dev)
236void gk20a_scale_suspend(struct device *dev) 239void gk20a_scale_suspend(struct device *dev)
237{ 240{
238 struct gk20a *g = get_gk20a(dev); 241 struct gk20a *g = get_gk20a(dev);
239 struct devfreq *devfreq = g->devfreq; 242 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
243 struct devfreq *devfreq = l->devfreq;
240 244
241 if (!devfreq) 245 if (!devfreq)
242 return; 246 return;
@@ -253,7 +257,8 @@ void gk20a_scale_suspend(struct device *dev)
253void gk20a_scale_resume(struct device *dev) 257void gk20a_scale_resume(struct device *dev)
254{ 258{
255 struct gk20a *g = get_gk20a(dev); 259 struct gk20a *g = get_gk20a(dev);
256 struct devfreq *devfreq = g->devfreq; 260 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
261 struct devfreq *devfreq = l->devfreq;
257 262
258 if (!devfreq) 263 if (!devfreq)
259 return; 264 return;
@@ -272,8 +277,9 @@ void gk20a_scale_resume(struct device *dev)
272static void gk20a_scale_notify(struct device *dev, bool busy) 277static void gk20a_scale_notify(struct device *dev, bool busy)
273{ 278{
274 struct gk20a *g = get_gk20a(dev); 279 struct gk20a *g = get_gk20a(dev);
280 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
275 struct gk20a_scale_profile *profile = g->scale_profile; 281 struct gk20a_scale_profile *profile = g->scale_profile;
276 struct devfreq *devfreq = g->devfreq; 282 struct devfreq *devfreq = l->devfreq;
277 283
278 /* Is the device profile initialised? */ 284 /* Is the device profile initialised? */
279 if (!(profile && devfreq)) 285 if (!(profile && devfreq))
@@ -355,6 +361,7 @@ void gk20a_scale_init(struct device *dev)
355{ 361{
356 struct gk20a_platform *platform = dev_get_drvdata(dev); 362 struct gk20a_platform *platform = dev_get_drvdata(dev);
357 struct gk20a *g = platform->g; 363 struct gk20a *g = platform->g;
364 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
358 struct gk20a_scale_profile *profile; 365 struct gk20a_scale_profile *profile;
359 int err; 366 int err;
360 367
@@ -398,7 +405,7 @@ void gk20a_scale_init(struct device *dev)
398 if (IS_ERR(devfreq)) 405 if (IS_ERR(devfreq))
399 devfreq = NULL; 406 devfreq = NULL;
400 407
401 g->devfreq = devfreq; 408 l->devfreq = devfreq;
402 } 409 }
403 410
404 /* Should we register QoS callback for this device? */ 411 /* Should we register QoS callback for this device? */
@@ -422,6 +429,7 @@ void gk20a_scale_exit(struct device *dev)
422{ 429{
423 struct gk20a_platform *platform = dev_get_drvdata(dev); 430 struct gk20a_platform *platform = dev_get_drvdata(dev);
424 struct gk20a *g = platform->g; 431 struct gk20a *g = platform->g;
432 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
425 int err; 433 int err;
426 434
427 if (platform->qos_notify) { 435 if (platform->qos_notify) {
@@ -432,8 +440,8 @@ void gk20a_scale_exit(struct device *dev)
432 } 440 }
433 441
434 if (platform->devfreq_governor) { 442 if (platform->devfreq_governor) {
435 err = devfreq_remove_device(g->devfreq); 443 err = devfreq_remove_device(l->devfreq);
436 g->devfreq = NULL; 444 l->devfreq = NULL;
437 } 445 }
438 446
439 nvgpu_kfree(g, g->scale_profile); 447 nvgpu_kfree(g, g->scale_profile);