drm/radeon: add INFO query for GPU temperature
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 30 Sep 2014 14:04:40 +0000 (10:04 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 19 Mar 2015 16:26:27 +0000 (12:26 -0400)
Useful for profiling.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon_kms.c
include/uapi/drm/radeon_drm.h

index 686411e4e4f6a3620289be34106ae5d38c9f6b93..7904887c6cc7cff39e6345d609f61f88b6af1b75 100644 (file)
@@ -547,6 +547,13 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                else
                        *value = 1;
                break;
+       case RADEON_INFO_CURRENT_GPU_TEMP:
+               /* get temperature in millidegrees C */
+               if (rdev->asic->pm.get_temperature)
+                       *value = radeon_get_temperature(rdev);
+               else
+                       *value = 0;
+               break;
        default:
                DRM_DEBUG_KMS("Invalid request %d\n", info->request);
                return -EINVAL;
index 50d0fb41a3bf32cb2a796f3738adb10d79e3fb6c..66b1131bb296d970b959ef847afbb389e7dd5f84 100644 (file)
@@ -1034,6 +1034,7 @@ struct drm_radeon_cs {
 #define RADEON_INFO_VRAM_USAGE         0x1e
 #define RADEON_INFO_GTT_USAGE          0x1f
 #define RADEON_INFO_ACTIVE_CU_COUNT    0x20
+#define RADEON_INFO_CURRENT_GPU_TEMP   0x21
 
 struct drm_radeon_info {
        uint32_t                request;