From: Huang Rui Date: Wed, 14 Dec 2016 08:26:54 +0000 (+0800) Subject: drm/amd/powerplay: add callbacks to move smc firmware request into sw_init phase X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=167112bff8a753f0b1e5f649a3dfb48246bc6afe;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/amd/powerplay: add callbacks to move smc firmware request into sw_init phase Signed-off-by: Huang Rui Acked-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index c81cf1412728..cc7219084fad 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c @@ -76,9 +76,18 @@ static int pp_sw_init(void *handle) if (ret) goto err1; + if (hwmgr->hwmgr_func->request_firmware) { + ret = hwmgr->hwmgr_func->request_firmware(hwmgr); + if (ret) + goto err2; + } + pr_info("amdgpu: powerplay initialized\n"); return 0; +err2: + if (hwmgr->hwmgr_func->backend_fini) + hwmgr->hwmgr_func->backend_fini(hwmgr); err1: if (hwmgr->pptable_func->pptable_fini) hwmgr->pptable_func->pptable_fini(hwmgr); @@ -101,6 +110,9 @@ static int pp_sw_fini(void *handle) PP_CHECK_HW(hwmgr); + if (hwmgr->hwmgr_func->release_firmware) + ret = hwmgr->hwmgr_func->release_firmware(hwmgr); + if (hwmgr->hwmgr_func->backend_fini != NULL) ret = hwmgr->hwmgr_func->backend_fini(hwmgr); diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h index 6cdb7cbf515e..3b7450ee7163 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h @@ -358,6 +358,8 @@ struct pp_hwmgr_func { int (*get_mclk_od)(struct pp_hwmgr *hwmgr); int (*set_mclk_od)(struct pp_hwmgr *hwmgr, uint32_t value); int (*read_sensor)(struct pp_hwmgr *hwmgr, int idx, int32_t *value); + int (*request_firmware)(struct pp_hwmgr *hwmgr); + int (*release_firmware)(struct pp_hwmgr *hwmgr); }; struct pp_table_func {