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

Commit 954e6bee authored by Rex Zhu's avatar Rex Zhu Committed by Alex Deucher
Browse files

drm/amd/powerplay: implement get_clock_by_type for iceland.

parent 0f12f73c
Loading
Loading
Loading
Loading
+33 −18
Original line number Diff line number Diff line
@@ -4233,18 +4233,26 @@ static int smu7_get_sclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks)
{
	struct phm_ppt_v1_information *table_info =
			(struct phm_ppt_v1_information *)hwmgr->pptable;
	struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table;
	struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table = NULL;
	struct phm_clock_voltage_dependency_table *sclk_table;
	int i;

	if (table_info == NULL)
	if (hwmgr->pp_table_version == PP_TABLE_V1) {
		if (table_info == NULL || table_info->vdd_dep_on_sclk == NULL)
			return -EINVAL;

		dep_sclk_table = table_info->vdd_dep_on_sclk;

		for (i = 0; i < dep_sclk_table->count; i++) {
			clocks->clock[i] = dep_sclk_table->entries[i].clk;
			clocks->count++;
		}
	} else if (hwmgr->pp_table_version == PP_TABLE_V0) {
		sclk_table = hwmgr->dyn_state.vddc_dependency_on_sclk;
		for (i = 0; i < sclk_table->count; i++) {
			clocks->clock[i] = sclk_table->entries[i].clk;
			clocks->count++;
		}
	}

	return 0;
}

@@ -4266,18 +4274,25 @@ static int smu7_get_mclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks)
			(struct phm_ppt_v1_information *)hwmgr->pptable;
	struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table;
	int i;
	struct phm_clock_voltage_dependency_table *mclk_table;

	if (hwmgr->pp_table_version == PP_TABLE_V1) {
		if (table_info == NULL)
			return -EINVAL;

		dep_mclk_table = table_info->vdd_dep_on_mclk;

		for (i = 0; i < dep_mclk_table->count; i++) {
			clocks->clock[i] = dep_mclk_table->entries[i].clk;
			clocks->latency[i] = smu7_get_mem_latency(hwmgr,
						dep_mclk_table->entries[i].clk);
			clocks->count++;
		}
	} else if (hwmgr->pp_table_version == PP_TABLE_V0) {
		mclk_table = hwmgr->dyn_state.vddc_dependency_on_mclk;
		for (i = 0; i < mclk_table->count; i++) {
			clocks->clock[i] = mclk_table->entries[i].clk;
			clocks->count++;
		}
	}
	return 0;
}