* [PATCH] drm/radeon/kms: fix thermal sensor reading on juniper
@ 2011-05-25 22:45 Alex Deucher
2011-05-26 15:43 ` Roland Scheidegger
0 siblings, 1 reply; 3+ messages in thread
From: Alex Deucher @ 2011-05-25 22:45 UTC (permalink / raw)
To: airlied, dri-devel
Uses a different method than other evergreen asics.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
---
drivers/gpu/drm/radeon/evergreen.c | 48 ++++++++++++++++++++++++-----------
drivers/gpu/drm/radeon/evergreend.h | 8 +++++-
2 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 7c37638..5f0c345 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -88,21 +88,39 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)
/* get temperature in millidegrees */
int evergreen_get_temp(struct radeon_device *rdev)
{
- u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >>
- ASIC_T_SHIFT;
- u32 actual_temp = 0;
-
- if (temp & 0x400)
- actual_temp = -256;
- else if (temp & 0x200)
- actual_temp = 255;
- else if (temp & 0x100) {
- actual_temp = temp & 0x1ff;
- actual_temp |= ~0x1ff;
- } else
- actual_temp = temp & 0xff;
+ u32 temp, toffset, actual_temp = 0;
+
+ if (rdev->family == CHIP_JUNIPER) {
+ toffset = (RREG32(CG_THERMAL_CTRL) & TOFFSET_MASK) >>
+ TOFFSET_SHIFT;
+ temp = (RREG32(CG_TS0_STATUS) & TS0_ADC_DOUT_MASK) >>
+ TS0_ADC_DOUT_SHIFT;
+
+ if (toffset & 0x100)
+ actual_temp = temp / 2 - (0x200 - toffset);
+ else
+ actual_temp = temp / 2 + toffset;
+
+ actual_temp = actual_temp * 1000;
+
+ } else {
+ temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >>
+ ASIC_T_SHIFT;
+
+ if (temp & 0x400)
+ actual_temp = -256;
+ else if (temp & 0x200)
+ actual_temp = 255;
+ else if (temp & 0x100) {
+ actual_temp = temp & 0x1ff;
+ actual_temp |= ~0x1ff;
+ } else
+ actual_temp = temp & 0xff;
+
+ actual_temp = (actual_temp * 1000) / 2;
+ }
- return (actual_temp * 1000) / 2;
+ return actual_temp;
}
int sumo_get_temp(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index f37e91e..1636e34 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -168,10 +168,16 @@
#define SE_DB_BUSY (1 << 30)
#define SE_CB_BUSY (1 << 31)
/* evergreen */
+#define CG_THERMAL_CTRL 0x72c
+#define TOFFSET_MASK 0x00003FE0
+#define TOFFSET_SHIFT 5
#define CG_MULT_THERMAL_STATUS 0x740
#define ASIC_T(x) ((x) << 16)
-#define ASIC_T_MASK 0x7FF0000
+#define ASIC_T_MASK 0x07FF0000
#define ASIC_T_SHIFT 16
+#define CG_TS0_STATUS 0x760
+#define TS0_ADC_DOUT_MASK 0x000003FF
+#define TS0_ADC_DOUT_SHIFT 0
/* APU */
#define CG_THERMAL_STATUS 0x678
--
1.7.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/radeon/kms: fix thermal sensor reading on juniper
2011-05-25 22:45 [PATCH] drm/radeon/kms: fix thermal sensor reading on juniper Alex Deucher
@ 2011-05-26 15:43 ` Roland Scheidegger
2011-05-26 16:03 ` Alex Deucher
0 siblings, 1 reply; 3+ messages in thread
From: Roland Scheidegger @ 2011-05-26 15:43 UTC (permalink / raw)
To: Alex Deucher; +Cc: dri-devel
Am 26.05.2011 00:45, schrieb Alex Deucher:
> Uses a different method than other evergreen asics.
Strange the temps displayed always seemed to make sense here even with
the wrong method :-).
Roland
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/radeon/kms: fix thermal sensor reading on juniper
2011-05-26 15:43 ` Roland Scheidegger
@ 2011-05-26 16:03 ` Alex Deucher
0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2011-05-26 16:03 UTC (permalink / raw)
To: Roland Scheidegger; +Cc: dri-devel
On Thu, May 26, 2011 at 11:43 AM, Roland Scheidegger
<rscheidegger_lists@hispeed.ch> wrote:
> Am 26.05.2011 00:45, schrieb Alex Deucher:
>> Uses a different method than other evergreen asics.
>
> Strange the temps displayed always seemed to make sense here even with
> the wrong method :-).
Yeah, I got the same results from both, so it must just be some very
specific cases or boards where it's problematic.
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-26 16:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 22:45 [PATCH] drm/radeon/kms: fix thermal sensor reading on juniper Alex Deucher
2011-05-26 15:43 ` Roland Scheidegger
2011-05-26 16:03 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.