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

drm/amd/display: Register DMUB service with DC

[Why]
DC can utilize the DMUB server to send commands to the DMUB but it's
the DM responsibility to pass it the service to use.

[How]
Create the dc_dmub_srv after we finish initializing the dmub_srv.
Cleanup the dc_dmub_srv before destroying the dmub_srv or dc.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Nicholas Kazlauskas and committed by
Alex Deucher
9a71c7d3 3a1627b0

+12
+12
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 34 34 #include "dmub/inc/dmub_srv.h" 35 35 #include "dc/inc/hw/dmcu.h" 36 36 #include "dc/inc/hw/abm.h" 37 + #include "dc/dc_dmub_srv.h" 37 38 #endif 38 39 39 40 #include "vid.h" ··· 804 803 abm->dmcu_is_running = dmcu->funcs->is_dmcu_initialized(dmcu); 805 804 } 806 805 806 + adev->dm.dc->ctx->dmub_srv = dc_dmub_srv_create(adev->dm.dc, dmub_srv); 807 + if (!adev->dm.dc->ctx->dmub_srv) { 808 + DRM_ERROR("Couldn't allocate DC DMUB server!\n"); 809 + return -ENOMEM; 810 + } 811 + 807 812 DRM_INFO("DMUB hardware initialized: version=0x%08X\n", 808 813 adev->dm.dmcub_fw_version); 809 814 ··· 983 976 dc_deinit_callbacks(adev->dm.dc); 984 977 #endif 985 978 #ifdef CONFIG_DRM_AMD_DC_DMUB 979 + if (adev->dm.dc->ctx->dmub_srv) { 980 + dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv); 981 + adev->dm.dc->ctx->dmub_srv = NULL; 982 + } 983 + 986 984 if (adev->dm.dmub_bo) 987 985 amdgpu_bo_free_kernel(&adev->dm.dmub_bo, 988 986 &adev->dm.dmub_bo_gpu_addr,