drm/amd/display: Check lid state to determine fast boot optimization.

For legacy enable boot up with lid closed, eDP information couldn't be
read correctly via SBIOS_SCRATCH_3 results in eDP cannot be light up
properly when open lid.
Check lid state instead can resolve the issue.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Eric Yang <eric.yang2@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Yongqiang Sun 2018-04-04 17:27:18 -04:00 committed by Alex Deucher
parent d0f6f1c031
commit 339cc82ae6
2 changed files with 17 additions and 8 deletions

View File

@ -92,6 +92,7 @@ struct dc_stream_state {
int phy_pix_clk; int phy_pix_clk;
enum signal_type signal; enum signal_type signal;
bool dpms_off; bool dpms_off;
bool lid_state_closed;
struct dc_stream_status status; struct dc_stream_status status;

View File

@ -1471,6 +1471,17 @@ static void disable_vga_and_power_gate_all_controllers(
} }
} }
static bool is_eDP_lid_closed(struct dc_state *context)
{
int i;
for (i = 0; i < context->stream_count; i++) {
if (context->streams[i]->signal == SIGNAL_TYPE_EDP)
return context->streams[i]->lid_state_closed;
}
return false;
}
static struct dc_link *get_link_for_edp_not_in_use( static struct dc_link *get_link_for_edp_not_in_use(
struct dc *dc, struct dc *dc,
struct dc_state *context) struct dc_state *context)
@ -1505,20 +1516,17 @@ static struct dc_link *get_link_for_edp_not_in_use(
*/ */
void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context) void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
{ {
struct dc_bios *dcb = dc->ctx->dc_bios; /* check eDP lid state:
* If lid is open, vbios already light up eDP, so we can leverage vbios and skip eDP
/* vbios already light up eDP, so we can leverage vbios and skip eDP
* programming * programming
*/ */
bool can_eDP_fast_boot_optimize = bool lid_state_closed = is_eDP_lid_closed(context);
(dcb->funcs->get_vga_enabled_displays(dc->ctx->dc_bios) == ATOM_DISPLAY_LCD1_ACTIVE);
/* if OS doesn't light up eDP and eDP link is available, we want to disable */
struct dc_link *edp_link_to_turnoff = NULL; struct dc_link *edp_link_to_turnoff = NULL;
if (can_eDP_fast_boot_optimize) { if (!lid_state_closed) {
edp_link_to_turnoff = get_link_for_edp_not_in_use(dc, context); edp_link_to_turnoff = get_link_for_edp_not_in_use(dc, context);
/* if OS doesn't light up eDP and eDP link is available, we want to disable */
if (!edp_link_to_turnoff) if (!edp_link_to_turnoff)
dc->apply_edp_fast_boot_optimization = true; dc->apply_edp_fast_boot_optimization = true;
} }