From: Yongqiang Sun Date: Mon, 18 Dec 2017 21:59:44 +0000 (-0500) Subject: drm/amd/display: disable eDP backlight for extend monitor only reboot use case. X-Git-Tag: v4.19~1144^2~30^2~313 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91178796ba171ebcc77bc384ff0a9afbeaf6b4d0;p=platform%2Fkernel%2Flinux-rpi3.git drm/amd/display: disable eDP backlight for extend monitor only reboot use case. Signed-off-by: Yongqiang Sun Reviewed-by: Tony Cheng Acked-by: Harry Wentland Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 7938c17..36b761a 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -649,7 +649,31 @@ bool dc_enable_stereo( return ret; } +static void disable_eDP_not_in_use(struct dc *dc, struct dc_state *context) +{ + int i; + struct dc_link *link = NULL; + /* check if eDP panel is suppose to be set mode, if yes, no need to disable */ + for (i = 0; i < context->stream_count; i++) { + if (context->streams[i]->signal == SIGNAL_TYPE_EDP) + return; + } + + /* check if there is an eDP panel not in use */ + for (i = 0; i < dc->link_count; i++) { + if (dc->links[i]->local_sink && + dc->links[i]->local_sink->sink_signal == SIGNAL_TYPE_EDP) { + link = dc->links[i]; + break; + } + } + + if (link) { + dc->hwss.edp_backlight_control(link, false); + dc->hwss.edp_power_control(link, false); + } +} /* * Applies given context to HW and copy it into current context. * It's up to the user to release the src context afterwards. @@ -667,8 +691,10 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c for (i = 0; i < context->stream_count; i++) dc_streams[i] = context->streams[i]; - if (!dcb->funcs->is_accelerated_mode(dcb)) + if (!dcb->funcs->is_accelerated_mode(dcb)) { dc->hwss.enable_accelerated_mode(dc); + disable_eDP_not_in_use(dc, context); + } /* re-program planes for existing stream, in case we need to * free up plane resource for later use