summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_pm.c
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@ensi-bourges.fr>2011-11-03 00:03:06 +0100
committerBen Skeggs <bskeggs@redhat.com>2012-03-13 17:06:19 +1000
commitb0103747094b62231fc951dfaca4897f67670874 (patch)
tree64f310267a466acbf20c11336ad64cb2e9c7c3fc /drivers/gpu/drm/nouveau/nouveau_pm.c
parentb1aa5531cc74ea023ad35e9cf5872112a15b4f70 (diff)
drm/nouveau/pm: improve the reclocking logs' readability
Signed-off-by: Martin Peres <martin.peres@labri.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_pm.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 5ee5ca6166a..08c563dfa28 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -147,9 +147,13 @@ nouveau_pm_perflvl_set(struct drm_device *dev, struct nouveau_pm_level *perflvl)
return ret;
state = pm->clocks_pre(dev, perflvl);
- if (IS_ERR(state))
- return PTR_ERR(state);
- pm->clocks_set(dev, state);
+ if (IS_ERR(state)) {
+ ret = PTR_ERR(state);
+ goto error;
+ }
+ ret = pm->clocks_set(dev, state);
+ if (ret)
+ goto error;
ret = nouveau_pm_perflvl_aux(dev, perflvl, perflvl, pm->cur);
if (ret)
@@ -157,6 +161,11 @@ nouveau_pm_perflvl_set(struct drm_device *dev, struct nouveau_pm_level *perflvl)
pm->cur = perflvl;
return 0;
+
+error:
+ /* restore the fan speed and voltage before leaving */
+ nouveau_pm_perflvl_aux(dev, perflvl, perflvl, pm->cur);
+ return ret;
}
static int
@@ -165,6 +174,8 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
struct nouveau_pm_level *perflvl = NULL;
+ u64 start_time;
+ int ret = 0;
long pl;
/* safety precaution, for now */
@@ -189,8 +200,17 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
return -EINVAL;
}
- NV_INFO(dev, "setting performance level: %s\n", profile);
- return nouveau_pm_perflvl_set(dev, perflvl);
+ NV_INFO(dev, "setting performance level: %s", profile);
+ start_time = nv04_timer_read(dev);
+ ret = nouveau_pm_perflvl_set(dev, perflvl);
+ if (!ret) {
+ NV_INFO(dev, "> reclocking took %lluns\n\n",
+ (nv04_timer_read(dev) - start_time));
+ } else {
+ NV_INFO(dev, "> reclocking failed\n\n");
+ }
+
+ return ret;
}
static int