From: Gabe Teeger <[email protected]> [Why] Enable PSR and Panel Replay on a DCN4 variant for display power savings. On links without native I2C (no DDC pin), the AUX channel must use aux_hw_inst to avoid NULL pointer access during PSR and Replay setup.
[How] Enable PSR and Replay in the DCN4 variant panel config defaults. Add no_ddc_pin check in dp_setup_panel_replay(), edp_setup_freesync_replay(), and fsft_send_msg_to_fw() to use link->aux_hw_inst when dp_connector_no_native_i2c and no_ddc_pin are set. Reviewed-by: Matthew Stewart <[email protected]> Signed-off-by: Gabe Teeger <[email protected]> Signed-off-by: George Zhang <[email protected]> --- .../display/dc/link/protocols/link_dp_panel_replay.c | 6 +++++- .../dc/link/protocols/link_edp_panel_control.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c index d87f87a02d63..465b9e53d311 100644 --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c @@ -119,7 +119,11 @@ static bool dp_setup_panel_replay(struct dc_link *link, const struct dc_stream_s if (!dp_pr_get_panel_inst(dc, link, &panel_inst)) return false; - replay_context.aux_inst = link->ddc->ddc_pin->hw_info.ddc_channel; + if (dc->config.dp_connector_no_native_i2c && link->no_ddc_pin) { + replay_context.aux_inst = (enum channel_id) link->aux_hw_inst; + } else { + replay_context.aux_inst = link->ddc->ddc_pin->hw_info.ddc_channel; + } replay_context.digbe_inst = link->link_enc->transmitter; replay_context.digfe_inst = link->link_enc->preferred_engine; diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c index 80a372ceaa51..1fda6e226e23 100644 --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c @@ -788,10 +788,11 @@ bool edp_setup_psr(struct dc_link *link, } } - if (dc->config.dp_connector_no_native_i2c && link->no_ddc_pin) + if (dc->config.dp_connector_no_native_i2c && link->no_ddc_pin) { psr_context->channel = (enum channel_id)link->aux_hw_inst; - else + } else { psr_context->channel = link->ddc->ddc_pin->hw_info.ddc_channel; + } psr_context->transmitterId = link->link_enc->transmitter; psr_context->engineId = link->link_enc->preferred_engine; @@ -1024,7 +1025,11 @@ bool edp_setup_freesync_replay(struct dc_link *link, const struct dc_stream_stat if (!dp_pr_get_panel_inst(dc, link, &panel_inst)) return false; - replay_context.aux_inst = link->ddc->ddc_pin->hw_info.ddc_channel; + if (dc->config.dp_connector_no_native_i2c && link->no_ddc_pin) { + replay_context.aux_inst = (enum channel_id) link->aux_hw_inst; + } else { + replay_context.aux_inst = link->ddc->ddc_pin->hw_info.ddc_channel; + } replay_context.digbe_inst = link->link_enc->transmitter; replay_context.digfe_inst = link->link_enc->preferred_engine; -- 2.54.0
