diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2011-02-01 16:12:34 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-02-02 11:40:31 +1000 |
commit | 20d391d72519527d2266a0166490118b40ff998d (patch) | |
tree | 7e1c3cd7eeff2e3d3ebb2cb313dcd4199340d141 /drivers/gpu/drm/radeon/r600.c | |
parent | e98ce0d7cfa6ee0650a63d45558a5121383995d9 (diff) |
drm/radeon/kms: rv6xx+ thermal sensor fixes
Some fixes to the thermal sensor code:
- handle negative numbers
- properly handle temp calculation on different asics
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r600.c')
-rw-r--r-- | drivers/gpu/drm/radeon/r600.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 1e10e3e2ba2..650672a0f5a 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -97,12 +97,16 @@ void r600_irq_disable(struct radeon_device *rdev); static void r600_pcie_gen2_enable(struct radeon_device *rdev); /* get temperature in millidegrees */ -u32 rv6xx_get_temp(struct radeon_device *rdev) +int rv6xx_get_temp(struct radeon_device *rdev) { u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> ASIC_T_SHIFT; + int actual_temp = temp & 0xff; - return temp * 1000; + if (temp & 0x100) + actual_temp -= 256; + + return actual_temp * 1000; } void r600_pm_get_dynpm_state(struct radeon_device *rdev) |