drm/radeon: add support for thermal sensor on tn
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Dec 2012 16:57:36 +0000 (11:57 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jun 2013 14:49:17 +0000 (10:49 -0400)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/ni.c
drivers/gpu/drm/radeon/nid.h
drivers/gpu/drm/radeon/radeon_asic.c
drivers/gpu/drm/radeon/radeon_asic.h

index 84583302b08162058d3ce0c2bfed31ddf1b2b44e..f88946160854c4775f59d9069654edd23680f7c2 100644 (file)
@@ -692,6 +692,14 @@ out:
        return err;
 }
 
+int tn_get_temp(struct radeon_device *rdev)
+{
+       u32 temp = RREG32_SMC(TN_CURRENT_GNB_TEMP) & 0x7ff;
+       int actual_temp = (temp / 8) - 49;
+
+       return actual_temp * 1000;
+}
+
 /*
  * Core functions
  */
index e226faf16fea807f72fba17b7a7e4febc1bbe1ae..7b8da52147294d46a3ffe6cb94a488c650df7d7e 100644 (file)
 #       define CACHE_FLUSH_AND_INV_EVENT_TS                     (0x14 << 0)
 #       define CACHE_FLUSH_AND_INV_EVENT                        (0x16 << 0)
 
+/* TN SMU registers */
+#define        TN_CURRENT_GNB_TEMP                             0x1F390
+
 /*
  * UVD
  */
index 9f5426388cf7dd70992811e75500f5b4af215064..0a39680ed166b6537946fb7f0820f42e5c0c2d46 100644 (file)
@@ -1897,6 +1897,7 @@ static struct radeon_asic trinity_asic = {
                .set_pcie_lanes = NULL,
                .set_clock_gating = NULL,
                .set_uvd_clocks = &sumo_set_uvd_clocks,
+               .get_temperature = &tn_get_temp,
        },
        .pflip = {
                .pre_page_flip = &evergreen_pre_page_flip,
index 74f04a8c7db446897c2238e1a0ee42730cc5bfb9..0879f3be8cbc9eed0a95174954fabc4dff01b468 100644 (file)
@@ -492,6 +492,7 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable);
 void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode);
 int evergreen_get_temp(struct radeon_device *rdev);
 int sumo_get_temp(struct radeon_device *rdev);
+int tn_get_temp(struct radeon_device *rdev);
 
 /*
  * cayman