diff options
| author | Alvin Lee <[email protected]> | 2021-11-04 16:52:15 -0400 | 
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2021-11-17 16:58:11 -0500 | 
| commit | d493a0244fce12de22a220468e6628bb008a0e58 (patch) | |
| tree | 3948f3d9617d28e699222740935bf8902a155106 /drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c | |
| parent | 7a47c8820a1d97e6cb5bcef6b65529f1389b0e13 (diff) | |
drm/amd/display: Wait for ACK for INBOX0 HW Lock
[Why]
In DC we want to wait for the INBOX0 HW Lock command to ACK before
continuing. This is to ensure that the lock has been successfully
acquired before programming HW in DC.
[How]
Add interfaces to send messages on INBOX0, poll for their completation
and clear the ack.
Reviewed-by: Nicholas Kazlauskas <[email protected]>
Acked-by: Anson Jacob <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alvin Lee <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c')
| -rw-r--r-- | drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c | 35 | 
1 files changed, 35 insertions, 0 deletions
| diff --git a/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c b/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c index 4a2cb0cdb0ba..56a03328e8e6 100644 --- a/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +++ b/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c @@ -842,3 +842,38 @@ bool dmub_srv_should_detect(struct dmub_srv *dmub)  	return dmub->hw_funcs.should_detect(dmub);  } + +enum dmub_status dmub_srv_clear_inbox0_ack(struct dmub_srv *dmub) +{ +	if (!dmub->hw_init || dmub->hw_funcs.clear_inbox0_ack_register) +		return DMUB_STATUS_INVALID; + +	dmub->hw_funcs.clear_inbox0_ack_register(dmub); +	return DMUB_STATUS_OK; +} + +enum dmub_status dmub_srv_wait_for_inbox0_ack(struct dmub_srv *dmub, uint32_t timeout_us) +{ +	uint32_t i = 0; +	uint32_t ack = 0; + +	if (!dmub->hw_init || !dmub->hw_funcs.read_inbox0_ack_register) +		return DMUB_STATUS_INVALID; + +	for (i = 0; i <= timeout_us; i++) { +		ack = dmub->hw_funcs.read_inbox0_ack_register(dmub); +		if (ack) +			return DMUB_STATUS_OK; +	} +	return DMUB_STATUS_TIMEOUT; +} + +enum dmub_status dmub_srv_send_inbox0_cmd(struct dmub_srv *dmub, +		union dmub_inbox0_data_register data) +{ +	if (!dmub->hw_init || dmub->hw_funcs.send_inbox0_cmd) +		return DMUB_STATUS_INVALID; + +	dmub->hw_funcs.send_inbox0_cmd(dmub, data); +	return DMUB_STATUS_OK; +} |