summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv40_pm.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-07-28 10:40:48 +1000
committerBen Skeggs <bskeggs@redhat.com>2011-12-21 19:01:09 +1000
commit9232969e19ae7251a93ab72e405cf71e5109ec05 (patch)
tree5393c4c6fa317e5ea229c1a9eb69e7c6847753f6 /drivers/gpu/drm/nouveau/nv40_pm.c
parent0c101461e267850925218d6a6872c379f2498b16 (diff)
downloadtalos-obmc-linux-9232969e19ae7251a93ab72e405cf71e5109ec05.tar.gz
talos-obmc-linux-9232969e19ae7251a93ab72e405cf71e5109ec05.zip
drm/nv40/pm: implement first type of pwm fanspeed funcs
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv40_pm.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv40_pm.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nv40_pm.c b/drivers/gpu/drm/nouveau/nv40_pm.c
index e676b0d53478..c969bcbab547 100644
--- a/drivers/gpu/drm/nouveau/nv40_pm.c
+++ b/drivers/gpu/drm/nouveau/nv40_pm.c
@@ -346,3 +346,29 @@ resume:
kfree(info);
}
+
+int
+nv40_pm_fanspeed_get(struct drm_device *dev)
+{
+ u32 reg = nv_rd32(dev, 0x0010f0);
+ if (reg & 0x80000000) {
+ u32 duty = (reg & 0x7fff0000) >> 16;
+ u32 divs = (reg & 0x00007fff);
+ if (divs && divs >= duty)
+ return ((divs - duty) * 100) / divs;
+ }
+
+ return 100;
+}
+
+int
+nv40_pm_fanspeed_set(struct drm_device *dev, int percent)
+{
+ struct drm_nouveau_private *dev_priv = dev->dev_private;
+ struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
+ u32 divs = pm->pwm_divisor;
+ u32 duty = ((100 - percent) * divs) / 100;
+
+ nv_wr32(dev, 0x0010f0, 0x80000000 | (duty << 16) | divs);
+ return 0;
+}
OpenPOWER on IntegriCloud