int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle) { struct pp_hwmgr *hwmgr; if ((handle == NULL) || (pp_init == NULL)) return -EINVAL; hwmgr = kzalloc(sizeof(struct pp_hwmgr), GFP_KERNEL); if (hwmgr == NULL) return -ENOMEM; handle->hwmgr = hwmgr; hwmgr->smumgr = handle->smu_mgr; hwmgr->device = pp_init->device; hwmgr->chip_family = pp_init->chip_family; hwmgr->chip_id = pp_init->chip_id; hwmgr->hw_revision = pp_init->rev_id; hwmgr->usec_timeout = AMD_MAX_USEC_TIMEOUT; hwmgr->power_source = PP_PowerSource_AC; switch (hwmgr->chip_family) { case AMD_FAMILY_CZ: cz_hwmgr_init(hwmgr); break; case AMD_FAMILY_VI: switch (hwmgr->chip_id) { case CHIP_TONGA: tonga_hwmgr_init(hwmgr); break; case CHIP_FIJI: fiji_hwmgr_init(hwmgr); break; default: return -EINVAL; } break; default: return -EINVAL; } phm_init_dynamic_caps(hwmgr); return 0; }
int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle) { struct pp_hwmgr *hwmgr; if ((handle == NULL) || (pp_init == NULL)) return -EINVAL; hwmgr = kzalloc(sizeof(struct pp_hwmgr), GFP_KERNEL); if (hwmgr == NULL) return -ENOMEM; handle->hwmgr = hwmgr; hwmgr->smumgr = handle->smu_mgr; hwmgr->device = pp_init->device; hwmgr->chip_family = pp_init->chip_family; hwmgr->chip_id = pp_init->chip_id; hwmgr->usec_timeout = AMD_MAX_USEC_TIMEOUT; hwmgr->power_source = PP_PowerSource_AC; hwmgr->pp_table_version = PP_TABLE_V1; hwmgr_init_default_caps(hwmgr); hwmgr_set_user_specify_caps(hwmgr); switch (hwmgr->chip_family) { case AMDGPU_FAMILY_CZ: cz_hwmgr_init(hwmgr); break; case AMDGPU_FAMILY_VI: switch (hwmgr->chip_id) { case CHIP_TOPAZ: topaz_set_asic_special_caps(hwmgr); hwmgr->feature_mask &= ~(PP_SMC_VOLTAGE_CONTROL_MASK | PP_VBI_TIME_SUPPORT_MASK | PP_ENABLE_GFX_CG_THRU_SMU); hwmgr->pp_table_version = PP_TABLE_V0; break; case CHIP_TONGA: tonga_set_asic_special_caps(hwmgr); hwmgr->feature_mask &= ~(PP_SMC_VOLTAGE_CONTROL_MASK | PP_VBI_TIME_SUPPORT_MASK); break; case CHIP_FIJI: fiji_set_asic_special_caps(hwmgr); hwmgr->feature_mask &= ~(PP_SMC_VOLTAGE_CONTROL_MASK | PP_VBI_TIME_SUPPORT_MASK | PP_ENABLE_GFX_CG_THRU_SMU); break; case CHIP_POLARIS11: case CHIP_POLARIS10: polaris_set_asic_special_caps(hwmgr); hwmgr->feature_mask &= ~(PP_UVD_HANDSHAKE_MASK); break; default: return -EINVAL; } smu7_hwmgr_init(hwmgr); break; default: return -EINVAL; } return 0; }