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

drm/amd/powerplay: move asic unrelated function to hwmgr.c.

It's generic and used by multiple asics.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rex Zhu and committed by
Alex Deucher
8b41e7a0 2dcbffad

+40 -73
+1 -36
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
··· 3573 3573 return 0; 3574 3574 } 3575 3575 3576 - static void fiji_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr) 3577 - { 3578 - struct phm_ppt_v1_information *table_info = 3579 - (struct phm_ppt_v1_information *)hwmgr->pptable; 3580 - struct phm_clock_voltage_dependency_table *table = 3581 - table_info->vddc_dep_on_dal_pwrl; 3582 - struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table; 3583 - enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level; 3584 - uint32_t req_vddc = 0, req_volt, i; 3585 - 3586 - if (!table && !(dal_power_level >= PP_DAL_POWERLEVEL_ULTRALOW && 3587 - dal_power_level <= PP_DAL_POWERLEVEL_PERFORMANCE)) 3588 - return; 3589 - 3590 - for (i= 0; i < table->count; i++) { 3591 - if (dal_power_level == table->entries[i].clk) { 3592 - req_vddc = table->entries[i].v; 3593 - break; 3594 - } 3595 - } 3596 - 3597 - vddc_table = table_info->vdd_dep_on_sclk; 3598 - for (i= 0; i < vddc_table->count; i++) { 3599 - if (req_vddc <= vddc_table->entries[i].vddc) { 3600 - req_volt = (((uint32_t)vddc_table->entries[i].vddc) * VOLTAGE_SCALE) 3601 - << VDDC_SHIFT; 3602 - smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, 3603 - PPSMC_MSG_VddC_Request, req_volt); 3604 - return; 3605 - } 3606 - } 3607 - printk(KERN_ERR "DAL requested level can not" 3608 - " found a available voltage in VDDC DPM Table \n"); 3609 - } 3610 - 3611 3576 static int fiji_upload_dpmlevel_enable_mask(struct pp_hwmgr *hwmgr) 3612 3577 { 3613 3578 struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend); 3614 3579 3615 - fiji_apply_dal_min_voltage_request(hwmgr); 3580 + phm_apply_dal_min_voltage_request(hwmgr); 3616 3581 3617 3582 if (!data->sclk_dpm_key_disabled) { 3618 3583 if (data->dpm_level_enable_mask.sclk_dpm_enable_mask)
+38
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
··· 30 30 #include "pppcielanes.h" 31 31 #include "pp_debug.h" 32 32 #include "ppatomctrl.h" 33 + #include "ppsmc.h" 34 + 35 + #define VOLTAGE_SCALE 4 33 36 34 37 extern int cz_hwmgr_init(struct pp_hwmgr *hwmgr); 35 38 extern int tonga_hwmgr_init(struct pp_hwmgr *hwmgr); ··· 568 565 level++; 569 566 570 567 return level; 568 + } 569 + 570 + void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr) 571 + { 572 + struct phm_ppt_v1_information *table_info = 573 + (struct phm_ppt_v1_information *)hwmgr->pptable; 574 + struct phm_clock_voltage_dependency_table *table = 575 + table_info->vddc_dep_on_dal_pwrl; 576 + struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table; 577 + enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level; 578 + uint32_t req_vddc = 0, req_volt, i; 579 + 580 + if (!table || table->count <= 0 581 + || dal_power_level < PP_DAL_POWERLEVEL_ULTRALOW 582 + || dal_power_level > PP_DAL_POWERLEVEL_PERFORMANCE) 583 + return; 584 + 585 + for (i = 0; i < table->count; i++) { 586 + if (dal_power_level == table->entries[i].clk) { 587 + req_vddc = table->entries[i].v; 588 + break; 589 + } 590 + } 591 + 592 + vddc_table = table_info->vdd_dep_on_sclk; 593 + for (i = 0; i < vddc_table->count; i++) { 594 + if (req_vddc <= vddc_table->entries[i].vddc) { 595 + req_volt = (((uint32_t)vddc_table->entries[i].vddc) * VOLTAGE_SCALE); 596 + smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, 597 + PPSMC_MSG_VddC_Request, req_volt); 598 + return; 599 + } 600 + } 601 + printk(KERN_ERR "DAL requested level can not" 602 + " found a available voltage in VDDC DPM Table \n"); 571 603 }
-36
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
··· 189 189 return decode_pcie_lane_width(link_width); 190 190 } 191 191 192 - void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr) 193 - { 194 - struct phm_ppt_v1_information *table_info = 195 - (struct phm_ppt_v1_information *)hwmgr->pptable; 196 - struct phm_clock_voltage_dependency_table *table = 197 - table_info->vddc_dep_on_dal_pwrl; 198 - struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table; 199 - enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level; 200 - uint32_t req_vddc = 0, req_volt, i; 201 - 202 - if (!table || table-count <= 0 203 - || dal_power_level < PP_DAL_POWERLEVEL_ULTRALOW 204 - || dal_power_level > PP_DAL_POWERLEVEL_PERFORMANCE) 205 - return; 206 - 207 - for (i = 0; i < table->count; i++) { 208 - if (dal_power_level == table->entries[i].clk) { 209 - req_vddc = table->entries[i].v; 210 - break; 211 - } 212 - } 213 - 214 - vddc_table = table_info->vdd_dep_on_sclk; 215 - for (i = 0; i < vddc_table->count; i++) { 216 - if (req_vddc <= vddc_table->entries[i].vddc) { 217 - req_volt = (((uint32_t)vddc_table->entries[i].vddc) * VOLTAGE_SCALE) 218 - << VDDC_SHIFT; 219 - smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, 220 - PPSMC_MSG_VddC_Request, req_volt); 221 - return; 222 - } 223 - } 224 - printk(KERN_ERR "DAL requested level can not" 225 - " found a available voltage in VDDC DPM Table \n"); 226 - } 227 - 228 192 /** 229 193 * Enable voltage control 230 194 *
+1 -1
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
··· 673 673 extern int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr); 674 674 extern int phm_hwmgr_backend_fini(struct pp_hwmgr *hwmgr); 675 675 extern uint32_t phm_get_lowest_enabled_level(struct pp_hwmgr *hwmgr, uint32_t mask); 676 - 676 + extern void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr); 677 677 678 678 #define PHM_ENTIRE_REGISTER_MASK 0xFFFFFFFFU 679 679