diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2011-02-01 16:12:34 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-02-01 20:40:31 -0500 |
commit | 20d391d72519527d2266a0166490118b40ff998d (patch) | |
tree | 7e1c3cd7eeff2e3d3ebb2cb313dcd4199340d141 /drivers/gpu/drm/radeon/rv770.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/rv770.c')
-rw-r--r-- | drivers/gpu/drm/radeon/rv770.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 491dc9000655..2211a323db41 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -78,18 +78,23 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* get temperature in millidegrees */ | 80 | /* get temperature in millidegrees */ |
81 | u32 rv770_get_temp(struct radeon_device *rdev) | 81 | int rv770_get_temp(struct radeon_device *rdev) |
82 | { | 82 | { |
83 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> | 83 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> |
84 | ASIC_T_SHIFT; | 84 | ASIC_T_SHIFT; |
85 | u32 actual_temp = 0; | 85 | int actual_temp; |
86 | 86 | ||
87 | if ((temp >> 9) & 1) | 87 | if (temp & 0x400) |
88 | actual_temp = 0; | 88 | actual_temp = -256; |
89 | else | 89 | else if (temp & 0x200) |
90 | actual_temp = (temp >> 1) & 0xff; | 90 | actual_temp = 255; |
91 | 91 | else if (temp & 0x100) { | |
92 | return actual_temp * 1000; | 92 | actual_temp = temp & 0x1ff; |
93 | actual_temp |= ~0x1ff; | ||
94 | } else | ||
95 | actual_temp = temp & 0xff; | ||
96 | |||
97 | return (actual_temp * 1000) / 2; | ||
93 | } | 98 | } |
94 | 99 | ||
95 | void rv770_pm_misc(struct radeon_device *rdev) | 100 | void rv770_pm_misc(struct radeon_device *rdev) |