Commit 04f3c88f authored by Wyatt Wood's avatar Wyatt Wood Committed by Alex Deucher
Browse files

drm/amd/display: Retry getting PSR state if command times out



[Why]
GPINT command to get PSR state from FW times out.

[How]
Add retry to get valid PSR state.

Signed-off-by: default avatarWyatt Wood <wyatt.wood@amd.com>
Reviewed-by: default avatarAnthony Koo <Anthony.Koo@amd.com>
Acked-by: default avatarQingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 719a9b33
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -687,7 +687,8 @@ enum dc_psr_state {
	PSR_STATE5,
	PSR_STATE5a,
	PSR_STATE5b,
	PSR_STATE5c
	PSR_STATE5c,
	PSR_STATE_INVALID = 0xFF
};

struct psr_config {
+18 −11
Original line number Diff line number Diff line
@@ -80,9 +80,11 @@ static enum dc_psr_state convert_psr_state(uint32_t raw_state)
static void dmub_psr_get_state(struct dmub_psr *dmub, enum dc_psr_state *state)
{
	struct dmub_srv *srv = dmub->ctx->dmub_srv->dmub;
	uint32_t raw_state;
	uint32_t raw_state = 0;
	uint32_t retry_count = 0;
	enum dmub_status status;

	do {
		// Send gpint command and wait for ack
		status = dmub_srv_send_gpint_command(srv, DMUB_GPINT__GET_PSR_STATE, 0, 30);

@@ -92,7 +94,12 @@ static void dmub_psr_get_state(struct dmub_psr *dmub, enum dc_psr_state *state)
			*state = convert_psr_state(raw_state);
		} else
			// Return invalid state when GPINT times out
		*state = 0xFF;
			*state = PSR_STATE_INVALID;

		// Assert if max retry hit
		if (retry_count >= 1000)
			ASSERT(0);
	} while (++retry_count <= 1000 && *state == PSR_STATE_INVALID);
}

/*