Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/radeon/ni: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+40
+36
drivers/gpu/drm/radeon/ni_dpm.c
··· 4319 4319 } 4320 4320 } 4321 4321 4322 + u32 ni_dpm_get_current_sclk(struct radeon_device *rdev) 4323 + { 4324 + struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 4325 + struct radeon_ps *rps = &eg_pi->current_rps; 4326 + struct ni_ps *ps = ni_get_ps(rps); 4327 + struct rv7xx_pl *pl; 4328 + u32 current_index = 4329 + (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_STATE_INDEX_MASK) >> 4330 + CURRENT_STATE_INDEX_SHIFT; 4331 + 4332 + if (current_index >= ps->performance_level_count) { 4333 + return 0; 4334 + } else { 4335 + pl = &ps->performance_levels[current_index]; 4336 + return pl->sclk; 4337 + } 4338 + } 4339 + 4340 + u32 ni_dpm_get_current_mclk(struct radeon_device *rdev) 4341 + { 4342 + struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 4343 + struct radeon_ps *rps = &eg_pi->current_rps; 4344 + struct ni_ps *ps = ni_get_ps(rps); 4345 + struct rv7xx_pl *pl; 4346 + u32 current_index = 4347 + (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_STATE_INDEX_MASK) >> 4348 + CURRENT_STATE_INDEX_SHIFT; 4349 + 4350 + if (current_index >= ps->performance_level_count) { 4351 + return 0; 4352 + } else { 4353 + pl = &ps->performance_levels[current_index]; 4354 + return pl->mclk; 4355 + } 4356 + } 4357 + 4322 4358 u32 ni_dpm_get_sclk(struct radeon_device *rdev, bool low) 4323 4359 { 4324 4360 struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
+2
drivers/gpu/drm/radeon/radeon_asic.c
··· 1727 1727 .debugfs_print_current_performance_level = &ni_dpm_debugfs_print_current_performance_level, 1728 1728 .force_performance_level = &ni_dpm_force_performance_level, 1729 1729 .vblank_too_short = &ni_dpm_vblank_too_short, 1730 + .get_current_sclk = &ni_dpm_get_current_sclk, 1731 + .get_current_mclk = &ni_dpm_get_current_mclk, 1730 1732 }, 1731 1733 .pflip = { 1732 1734 .page_flip = &evergreen_page_flip,
+2
drivers/gpu/drm/radeon/radeon_asic.h
··· 663 663 int ni_dpm_force_performance_level(struct radeon_device *rdev, 664 664 enum radeon_dpm_forced_level level); 665 665 bool ni_dpm_vblank_too_short(struct radeon_device *rdev); 666 + u32 ni_dpm_get_current_sclk(struct radeon_device *rdev); 667 + u32 ni_dpm_get_current_mclk(struct radeon_device *rdev); 666 668 int trinity_dpm_init(struct radeon_device *rdev); 667 669 int trinity_dpm_enable(struct radeon_device *rdev); 668 670 int trinity_dpm_late_enable(struct radeon_device *rdev);