diff options
author | Kevin Wang <Kevin1.Wang@amd.com> | 2019-01-10 12:33:23 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-03-19 15:03:57 -0500 |
commit | dc8e3a0c8efbaab9b4bc7b924463a56ea33d818c (patch) | |
tree | 12138f94c01d2d6822399803ac03aefc06419fdb /drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | |
parent | dbe6a97024a6eeadf7912383e05118ff98883d2d (diff) |
drm/amd/powerplay: implement is_support_sw_smu function for new smu
add this helper to check new sw-smu support.
Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/amdgpu_smu.c')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c index 56095a400731..f35c2177d13d 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c @@ -65,6 +65,17 @@ int smu_update_table(struct smu_context *smu, uint32_t table_id, return ret; } +bool is_support_sw_smu(struct amdgpu_device *adev) +{ + if (amdgpu_dpm != 1) + return false; + + if (adev->asic_type >= CHIP_VEGA20) + return true; + + return false; +} + int smu_feature_init_dpm(struct smu_context *smu) { struct smu_feature *feature = &smu->smu_feature; @@ -222,7 +233,7 @@ static int smu_sw_init(void *handle) struct smu_context *smu = &adev->smu; int ret; - if (adev->asic_type < CHIP_VEGA20) + if (!is_support_sw_smu(adev)) return -EINVAL; smu->pool_size = adev->pm.smu_prv_buffer_size; @@ -252,7 +263,7 @@ static int smu_sw_fini(void *handle) struct smu_context *smu = &adev->smu; int ret; - if (adev->asic_type < CHIP_VEGA20) + if (!is_support_sw_smu(adev)) return -EINVAL; ret = smu_smc_table_sw_fini(smu); @@ -517,7 +528,7 @@ static int smu_hw_init(void *handle) struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct smu_context *smu = &adev->smu; - if (adev->asic_type < CHIP_VEGA20) + if (!is_support_sw_smu(adev)) return -EINVAL; if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) { @@ -576,7 +587,7 @@ static int smu_hw_fini(void *handle) struct smu_table_context *table_context = &smu->smu_table; int ret = 0; - if (adev->asic_type < CHIP_VEGA20) + if (!is_support_sw_smu(adev)) return -EINVAL; if (!table_context->driver_pptable) @@ -603,7 +614,7 @@ static int smu_suspend(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; - if (adev->asic_type < CHIP_VEGA20) + if (!is_support_sw_smu(adev)) return -EINVAL; return 0; @@ -615,7 +626,7 @@ static int smu_resume(void *handle) struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct smu_context *smu = &adev->smu; - if (adev->asic_type < CHIP_VEGA20) + if (!is_support_sw_smu(adev)) return -EINVAL; pr_info("SMU is resuming...\n"); |