Commit 66ba1afd authored by Rex Zhu's avatar Rex Zhu Committed by Alex Deucher

drm/amdgpu: save number of vce states in dpm struct.

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0d8de7ca
...@@ -553,9 +553,10 @@ int amdgpu_parse_extended_power_table(struct amdgpu_device *adev) ...@@ -553,9 +553,10 @@ int amdgpu_parse_extended_power_table(struct amdgpu_device *adev)
entry = (ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record *) entry = (ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record *)
((u8 *)entry + sizeof(ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record)); ((u8 *)entry + sizeof(ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record));
} }
for (i = 0; i < states->numEntries; i++) { adev->pm.dpm.num_of_vce_states =
if (i >= AMD_MAX_VCE_LEVELS) states->numEntries > AMD_MAX_VCE_LEVELS ?
break; AMD_MAX_VCE_LEVELS : states->numEntries;
for (i = 0; i < adev->pm.dpm.num_of_vce_states; i++) {
vce_clk = (VCEClockInfo *) vce_clk = (VCEClockInfo *)
((u8 *)&array->entries[0] + ((u8 *)&array->entries[0] +
(state_entry->ucVCEClockInfoIndex * sizeof(VCEClockInfo))); (state_entry->ucVCEClockInfoIndex * sizeof(VCEClockInfo)));
......
...@@ -387,6 +387,7 @@ struct amdgpu_dpm { ...@@ -387,6 +387,7 @@ struct amdgpu_dpm {
/* default uvd power state */ /* default uvd power state */
struct amdgpu_ps *uvd_ps; struct amdgpu_ps *uvd_ps;
/* vce requirements */ /* vce requirements */
u32 num_of_vce_states;
struct amd_vce_state vce_states[AMD_MAX_VCE_LEVELS]; struct amd_vce_state vce_states[AMD_MAX_VCE_LEVELS];
enum amd_vce_level vce_level; enum amd_vce_level vce_level;
enum amd_pm_state_type state; enum amd_pm_state_type state;
......
...@@ -5689,7 +5689,7 @@ static int ci_parse_power_table(struct amdgpu_device *adev) ...@@ -5689,7 +5689,7 @@ static int ci_parse_power_table(struct amdgpu_device *adev)
adev->pm.dpm.num_ps = state_array->ucNumEntries; adev->pm.dpm.num_ps = state_array->ucNumEntries;
/* fill in the vce power states */ /* fill in the vce power states */
for (i = 0; i < AMD_MAX_VCE_LEVELS; i++) { for (i = 0; i < adev->pm.dpm.num_of_vce_states; i++) {
u32 sclk, mclk; u32 sclk, mclk;
clock_array_index = adev->pm.dpm.vce_states[i].clk_idx; clock_array_index = adev->pm.dpm.vce_states[i].clk_idx;
clock_info = (union pplib_clock_info *) clock_info = (union pplib_clock_info *)
......
...@@ -2796,7 +2796,7 @@ static int kv_parse_power_table(struct amdgpu_device *adev) ...@@ -2796,7 +2796,7 @@ static int kv_parse_power_table(struct amdgpu_device *adev)
adev->pm.dpm.num_ps = state_array->ucNumEntries; adev->pm.dpm.num_ps = state_array->ucNumEntries;
/* fill in the vce power states */ /* fill in the vce power states */
for (i = 0; i < AMD_MAX_VCE_LEVELS; i++) { for (i = 0; i < adev->pm.dpm.num_of_vce_states; i++) {
u32 sclk; u32 sclk;
clock_array_index = adev->pm.dpm.vce_states[i].clk_idx; clock_array_index = adev->pm.dpm.vce_states[i].clk_idx;
clock_info = (union pplib_clock_info *) clock_info = (union pplib_clock_info *)
......
...@@ -7320,7 +7320,7 @@ static int si_parse_power_table(struct amdgpu_device *adev) ...@@ -7320,7 +7320,7 @@ static int si_parse_power_table(struct amdgpu_device *adev)
adev->pm.dpm.num_ps = state_array->ucNumEntries; adev->pm.dpm.num_ps = state_array->ucNumEntries;
/* fill in the vce power states */ /* fill in the vce power states */
for (i = 0; i < AMD_MAX_VCE_LEVELS; i++) { for (i = 0; i < adev->pm.dpm.num_of_vce_states; i++) {
u32 sclk, mclk; u32 sclk, mclk;
clock_array_index = adev->pm.dpm.vce_states[i].clk_idx; clock_array_index = adev->pm.dpm.vce_states[i].clk_idx;
clock_info = (union pplib_clock_info *) clock_info = (union pplib_clock_info *)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment