Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7982128c authored by Alex Deucher's avatar Alex Deucher
Browse files

drm/radeon/dpm: add debugfs support for SI



This allows you to look at the current DPM state via
debugfs.

Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent bdf0c4f0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2282,6 +2282,7 @@ static struct radeon_asic si_asic = {
		.get_sclk = &ni_dpm_get_sclk,
		.get_mclk = &ni_dpm_get_mclk,
		.print_power_state = &ni_dpm_print_power_state,
		.debugfs_print_current_performance_level = &si_dpm_debugfs_print_current_performance_level,
	},
	.pflip = {
		.pre_page_flip = &evergreen_pre_page_flip,
+2 −0
Original line number Diff line number Diff line
@@ -677,6 +677,8 @@ int si_dpm_set_power_state(struct radeon_device *rdev);
void si_dpm_post_set_power_state(struct radeon_device *rdev);
void si_dpm_fini(struct radeon_device *rdev);
void si_dpm_display_configuration_changed(struct radeon_device *rdev);
void si_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
						    struct seq_file *m);

/* DCE8 - CIK */
void dce8_bandwidth_update(struct radeon_device *rdev);
+19 −0
Original line number Diff line number Diff line
@@ -6385,3 +6385,22 @@ void si_dpm_fini(struct radeon_device *rdev)
	r600_free_extended_power_table(rdev);
}

void si_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
						    struct seq_file *m)
{
	struct radeon_ps *rps = rdev->pm.dpm.current_ps;
	struct ni_ps *ps = ni_get_ps(rps);
	struct rv7xx_pl *pl;
	u32 current_index =
		(RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_STATE_INDEX_MASK) >>
		CURRENT_STATE_INDEX_SHIFT;

	if (current_index >= ps->performance_level_count) {
		seq_printf(m, "invalid dpm profile %d\n", current_index);
	} else {
		pl = &ps->performance_levels[current_index];
		seq_printf(m, "uvd    vclk: %d dclk: %d\n", rps->vclk, rps->dclk);
		seq_printf(m, "power level %d    sclk: %u mclk: %u vddc: %u vddci: %u pcie gen: %u\n",
			   current_index, pl->sclk, pl->mclk, pl->vddc, pl->vddci, pl->pcie_gen + 1);
	}
}
+4 −0
Original line number Diff line number Diff line
@@ -220,6 +220,10 @@
#       define GFX_CLK_OFF_ACPI_D3                        (1 << 13)
#       define DYN_LIGHT_SLEEP_EN                         (1 << 14)

#define TARGET_AND_CURRENT_PROFILE_INDEX                  0x798
#       define CURRENT_STATE_INDEX_MASK                   (0xf << 4)
#       define CURRENT_STATE_INDEX_SHIFT                  4

#define CG_FTV                                            0x7bc

#define CG_FFCT_0                                         0x7c0