aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2015-07-14 16:16:29 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-07-23 15:09:27 -0400
commitf2d52cd4db08db06200176cfebead9778878d4fc (patch)
tree88857dca42c40e54f1be76d69ae9dde244910c5e
parentfa92754e9c47cf3e5607c0865f4cf59d090cda37 (diff)
drm/amdgpu/cz: implement voltage validation properly
CZ uses a different set of registers compared to previous asics and supports separate NB and GFX planes. Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cz_dpm.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
index 1a2d419cbf16..1316d540ec85 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
@@ -494,6 +494,13 @@ static void cz_dpm_fini(struct amdgpu_device *adev)
494 amdgpu_free_extended_power_table(adev); 494 amdgpu_free_extended_power_table(adev);
495} 495}
496 496
497#define ixSMUSVI_NB_CURRENTVID 0xD8230044
498#define CURRENT_NB_VID_MASK 0xff000000
499#define CURRENT_NB_VID__SHIFT 24
500#define ixSMUSVI_GFX_CURRENTVID 0xD8230048
501#define CURRENT_GFX_VID_MASK 0xff000000
502#define CURRENT_GFX_VID__SHIFT 24
503
497static void 504static void
498cz_dpm_debugfs_print_current_performance_level(struct amdgpu_device *adev, 505cz_dpm_debugfs_print_current_performance_level(struct amdgpu_device *adev,
499 struct seq_file *m) 506 struct seq_file *m)
@@ -505,18 +512,20 @@ cz_dpm_debugfs_print_current_performance_level(struct amdgpu_device *adev,
505 TARGET_AND_CURRENT_PROFILE_INDEX__CURR_SCLK_INDEX_MASK) >> 512 TARGET_AND_CURRENT_PROFILE_INDEX__CURR_SCLK_INDEX_MASK) >>
506 TARGET_AND_CURRENT_PROFILE_INDEX__CURR_SCLK_INDEX__SHIFT; 513 TARGET_AND_CURRENT_PROFILE_INDEX__CURR_SCLK_INDEX__SHIFT;
507 u32 sclk, tmp; 514 u32 sclk, tmp;
508 u16 vddc; 515 u16 vddnb, vddgfx;
509 516
510 if (current_index >= NUM_SCLK_LEVELS) { 517 if (current_index >= NUM_SCLK_LEVELS) {
511 seq_printf(m, "invalid dpm profile %d\n", current_index); 518 seq_printf(m, "invalid dpm profile %d\n", current_index);
512 } else { 519 } else {
513 sclk = table->entries[current_index].clk; 520 sclk = table->entries[current_index].clk;
514 tmp = (RREG32_SMC(ixSMU_VOLTAGE_STATUS) & 521 tmp = (RREG32_SMC(ixSMUSVI_NB_CURRENTVID) &
515 SMU_VOLTAGE_STATUS__SMU_VOLTAGE_CURRENT_LEVEL_MASK) >> 522 CURRENT_NB_VID_MASK) >> CURRENT_NB_VID__SHIFT;
516 SMU_VOLTAGE_STATUS__SMU_VOLTAGE_CURRENT_LEVEL__SHIFT; 523 vddnb = cz_convert_8bit_index_to_voltage(adev, (u16)tmp);
517 vddc = cz_convert_8bit_index_to_voltage(adev, (u16)tmp); 524 tmp = (RREG32_SMC(ixSMUSVI_GFX_CURRENTVID) &
518 seq_printf(m, "power level %d sclk: %u vddc: %u\n", 525 CURRENT_GFX_VID_MASK) >> CURRENT_GFX_VID__SHIFT;
519 current_index, sclk, vddc); 526 vddgfx = cz_convert_8bit_index_to_voltage(adev, (u16)tmp);
527 seq_printf(m, "power level %d sclk: %u vddnb: %u vddgfx: %u\n",
528 current_index, sclk, vddnb, vddgfx);
520 } 529 }
521} 530}
522 531