drm/radeon: add INFO query for current sclk/mclk
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 30 Sep 2014 15:33:30 +0000 (11:33 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 19 Mar 2015 16:26:36 +0000 (12:26 -0400)
Allow the UMDs to query the current sclk/mclk
for profiling, etc.

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 7904887c6cc7cff39e6345d609f61f88b6af1b75..cf7e54e9b0d164eb4d44bb3fc87788228c9c6b85 100644 (file)
@@ -554,6 +554,20 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                else
                        *value = 0;
                break;
+       case RADEON_INFO_CURRENT_GPU_SCLK:
+               /* get sclk in Mhz */
+               if (rdev->pm.dpm_enabled)
+                       *value = radeon_dpm_get_current_sclk(rdev) / 100;
+               else
+                       *value = rdev->pm.current_sclk / 100;
+               break;
+       case RADEON_INFO_CURRENT_GPU_MCLK:
+               /* get mclk in Mhz */
+               if (rdev->pm.dpm_enabled)
+                       *value = radeon_dpm_get_current_mclk(rdev) / 100;
+               else
+                       *value = rdev->pm.current_mclk / 100;
+               break;
        default:
                DRM_DEBUG_KMS("Invalid request %d\n", info->request);
                return -EINVAL;
index 66b1131bb296d970b959ef847afbb389e7dd5f84..de7ee21efea22f6d148652b7f79d2febed5d0f63 100644 (file)
@@ -1035,6 +1035,8 @@ struct drm_radeon_cs {
 #define RADEON_INFO_GTT_USAGE          0x1f
 #define RADEON_INFO_ACTIVE_CU_COUNT    0x20
 #define RADEON_INFO_CURRENT_GPU_TEMP   0x21
+#define RADEON_INFO_CURRENT_GPU_SCLK   0x22
+#define RADEON_INFO_CURRENT_GPU_MCLK   0x23
 
 struct drm_radeon_info {
        uint32_t                request;