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

drm/radeon/btc: 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>

+50
+46
drivers/gpu/drm/radeon/btc_dpm.c
··· 2761 2761 } 2762 2762 } 2763 2763 2764 + u32 btc_dpm_get_current_sclk(struct radeon_device *rdev) 2765 + { 2766 + struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 2767 + struct radeon_ps *rps = &eg_pi->current_rps; 2768 + struct rv7xx_ps *ps = rv770_get_ps(rps); 2769 + struct rv7xx_pl *pl; 2770 + u32 current_index = 2771 + (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_PROFILE_INDEX_MASK) >> 2772 + CURRENT_PROFILE_INDEX_SHIFT; 2773 + 2774 + if (current_index > 2) { 2775 + return 0; 2776 + } else { 2777 + if (current_index == 0) 2778 + pl = &ps->low; 2779 + else if (current_index == 1) 2780 + pl = &ps->medium; 2781 + else /* current_index == 2 */ 2782 + pl = &ps->high; 2783 + return pl->sclk; 2784 + } 2785 + } 2786 + 2787 + u32 btc_dpm_get_current_mclk(struct radeon_device *rdev) 2788 + { 2789 + struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 2790 + struct radeon_ps *rps = &eg_pi->current_rps; 2791 + struct rv7xx_ps *ps = rv770_get_ps(rps); 2792 + struct rv7xx_pl *pl; 2793 + u32 current_index = 2794 + (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_PROFILE_INDEX_MASK) >> 2795 + CURRENT_PROFILE_INDEX_SHIFT; 2796 + 2797 + if (current_index > 2) { 2798 + return 0; 2799 + } else { 2800 + if (current_index == 0) 2801 + pl = &ps->low; 2802 + else if (current_index == 1) 2803 + pl = &ps->medium; 2804 + else /* current_index == 2 */ 2805 + pl = &ps->high; 2806 + return pl->mclk; 2807 + } 2808 + } 2809 + 2764 2810 u32 btc_dpm_get_sclk(struct radeon_device *rdev, bool low) 2765 2811 { 2766 2812 struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
+2
drivers/gpu/drm/radeon/radeon_asic.c
··· 1580 1580 .debugfs_print_current_performance_level = &btc_dpm_debugfs_print_current_performance_level, 1581 1581 .force_performance_level = &rv770_dpm_force_performance_level, 1582 1582 .vblank_too_short = &btc_dpm_vblank_too_short, 1583 + .get_current_sclk = &btc_dpm_get_current_sclk, 1584 + .get_current_mclk = &btc_dpm_get_current_mclk, 1583 1585 }, 1584 1586 .pflip = { 1585 1587 .page_flip = &evergreen_page_flip,
+2
drivers/gpu/drm/radeon/radeon_asic.h
··· 569 569 bool btc_dpm_vblank_too_short(struct radeon_device *rdev); 570 570 void btc_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, 571 571 struct seq_file *m); 572 + u32 btc_dpm_get_current_sclk(struct radeon_device *rdev); 573 + u32 btc_dpm_get_current_mclk(struct radeon_device *rdev); 572 574 int sumo_dpm_init(struct radeon_device *rdev); 573 575 int sumo_dpm_enable(struct radeon_device *rdev); 574 576 int sumo_dpm_late_enable(struct radeon_device *rdev);