Skip to content

Commit 0fc7d79

Browse files
Bhawanpreet Lakhaalexdeucher
authored andcommitted
drm/amd/display: Handle Replay related hpd irq
Handle replay related hpd irqs Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent d34fecc commit 0fc7d79

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,68 @@ static bool handle_hpd_irq_psr_sink(struct dc_link *link)
182182
return false;
183183
}
184184

185+
static bool handle_hpd_irq_replay_sink(struct dc_link *link)
186+
{
187+
union dpcd_replay_configuration replay_configuration;
188+
/*AMD Replay version reuse DP_PSR_ERROR_STATUS for REPLAY_ERROR status.*/
189+
union psr_error_status replay_error_status;
190+
191+
if (!link->replay_settings.replay_feature_enabled)
192+
return false;
193+
194+
dm_helpers_dp_read_dpcd(
195+
link->ctx,
196+
link,
197+
DP_SINK_PR_REPLAY_STATUS,
198+
&replay_configuration.raw,
199+
sizeof(replay_configuration.raw));
200+
201+
dm_helpers_dp_read_dpcd(
202+
link->ctx,
203+
link,
204+
DP_PSR_ERROR_STATUS,
205+
&replay_error_status.raw,
206+
sizeof(replay_error_status.raw));
207+
208+
link->replay_settings.config.replay_error_status.bits.LINK_CRC_ERROR =
209+
replay_error_status.bits.LINK_CRC_ERROR;
210+
link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR =
211+
replay_configuration.bits.DESYNC_ERROR_STATUS;
212+
link->replay_settings.config.replay_error_status.bits.STATE_TRANSITION_ERROR =
213+
replay_configuration.bits.STATE_TRANSITION_ERROR_STATUS;
214+
215+
if (link->replay_settings.config.replay_error_status.bits.LINK_CRC_ERROR ||
216+
link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR ||
217+
link->replay_settings.config.replay_error_status.bits.STATE_TRANSITION_ERROR) {
218+
bool allow_active;
219+
220+
/* Acknowledge and clear configuration bits */
221+
dm_helpers_dp_write_dpcd(
222+
link->ctx,
223+
link,
224+
DP_SINK_PR_REPLAY_STATUS,
225+
&replay_configuration.raw,
226+
sizeof(replay_configuration.raw));
227+
228+
/* Acknowledge and clear error bits */
229+
dm_helpers_dp_write_dpcd(
230+
link->ctx,
231+
link,
232+
DP_PSR_ERROR_STATUS,/*DpcdAddress_REPLAY_Error_Status*/
233+
&replay_error_status.raw,
234+
sizeof(replay_error_status.raw));
235+
236+
/* Replay error, disable and re-enable Replay */
237+
if (link->replay_settings.replay_allow_active) {
238+
allow_active = false;
239+
edp_set_replay_allow_active(link, &allow_active, true, false, NULL);
240+
allow_active = true;
241+
edp_set_replay_allow_active(link, &allow_active, true, false, NULL);
242+
}
243+
}
244+
return true;
245+
}
246+
185247
void dp_handle_link_loss(struct dc_link *link)
186248
{
187249
struct pipe_ctx *pipes[MAX_PIPES];
@@ -360,6 +422,10 @@ bool dp_handle_hpd_rx_irq(struct dc_link *link,
360422
/* PSR-related error was detected and handled */
361423
return true;
362424

425+
if (handle_hpd_irq_replay_sink(link))
426+
/* Replay-related error was detected and handled */
427+
return true;
428+
363429
/* If PSR-related error handled, Main link may be off,
364430
* so do not handle as a normal sink status change interrupt.
365431
*/

0 commit comments

Comments
 (0)