diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-08-15 16:13:34 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-12-21 19:01:11 +1000 |
commit | 3f8e11e4b606a050007cd1020d59e7b74c68d088 (patch) | |
tree | 4d550be304e3229af2228bcd9469f34057395dbb /drivers/gpu/drm/nouveau/nv50_pm.c | |
parent | 11b7d895216f7f954c6cfa0c23b76dccb7a890c1 (diff) | |
download | blackbird-op-linux-3f8e11e4b606a050007cd1020d59e7b74c68d088.tar.gz blackbird-op-linux-3f8e11e4b606a050007cd1020d59e7b74c68d088.zip |
drm/nv50/pm: mostly nailed down fan pwm frequency selection
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_pm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_pm.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c index 713c718206e3..0cbf538b6e85 100644 --- a/drivers/gpu/drm/nouveau/nv50_pm.c +++ b/drivers/gpu/drm/nouveau/nv50_pm.c @@ -201,6 +201,8 @@ nv50_pm_fanspeed_get(struct drm_device *dev) int nv50_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; struct pwm_info pwm; u32 divs, duty; int ret; @@ -209,12 +211,20 @@ nv50_pm_fanspeed_set(struct drm_device *dev, int percent) if (ret) return ret; - divs = nv_rd32(dev, 0x00e114 + (pwm.id * 8)); + divs = pm->pwm_divisor; + if (pm->fan.pwm_freq) { + /*XXX: PNVIO clock more than likely... */ + divs = 1350000 / pm->fan.pwm_freq; + if (dev_priv->chipset < 0xa3) + divs /= 4; + } + duty = ((divs * percent) + 99) / 100; if (pwm.invert) duty = divs - duty; nv_mask(dev, pwm.ctrl, 0x00010001 << pwm.line, 0x00000001 << pwm.line); + nv_wr32(dev, 0x00e114 + (pwm.id * 8), divs); nv_wr32(dev, 0x00e118 + (pwm.id * 8), 0x80000000 | duty); return 0; } |