Commit 3addbde2 authored by Jake Wang's avatar Jake Wang Committed by Alex Deucher

drm/amd/display: Fixed hardware power down bypass during headless boot

[Why]
During headless boot, DIG may be on which causes HW/SW discrepancies.
To avoid this we power down hardware on boot if DIG is turned on. With
introduction of multiple eDP, hardware power down is being bypassed
under certain conditions.

[How]
Fixed hardware power down bypass, and ensured hardware will power down
if DIG is on and seamless boot is not enabled.
Reviewed-by: default avatarNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarJake Wang <haonan.wang2@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d93d5356
...@@ -1502,16 +1502,15 @@ void dcn10_init_hw(struct dc *dc) ...@@ -1502,16 +1502,15 @@ void dcn10_init_hw(struct dc *dc)
void dcn10_power_down_on_boot(struct dc *dc) void dcn10_power_down_on_boot(struct dc *dc)
{ {
struct dc_link *edp_links[MAX_NUM_EDP]; struct dc_link *edp_links[MAX_NUM_EDP];
struct dc_link *edp_link; struct dc_link *edp_link = NULL;
int edp_num; int edp_num;
int i = 0; int i = 0;
get_edp_links(dc, edp_links, &edp_num); get_edp_links(dc, edp_links, &edp_num);
if (edp_num)
edp_link = edp_links[0];
if (edp_num) { if (edp_link && edp_link->link_enc->funcs->is_dig_enabled &&
for (i = 0; i < edp_num; i++) {
edp_link = edp_links[i];
if (edp_link->link_enc->funcs->is_dig_enabled &&
edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) && edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
dc->hwseq->funcs.edp_backlight_control && dc->hwseq->funcs.edp_backlight_control &&
dc->hwss.power_down && dc->hwss.power_down &&
...@@ -1519,8 +1518,6 @@ void dcn10_power_down_on_boot(struct dc *dc) ...@@ -1519,8 +1518,6 @@ void dcn10_power_down_on_boot(struct dc *dc)
dc->hwseq->funcs.edp_backlight_control(edp_link, false); dc->hwseq->funcs.edp_backlight_control(edp_link, false);
dc->hwss.power_down(dc); dc->hwss.power_down(dc);
dc->hwss.edp_power_control(edp_link, false); dc->hwss.edp_power_control(edp_link, false);
}
}
} else { } else {
for (i = 0; i < dc->link_count; i++) { for (i = 0; i < dc->link_count; i++) {
struct dc_link *link = dc->links[i]; struct dc_link *link = dc->links[i];
......
...@@ -580,13 +580,12 @@ void dcn30_init_hw(struct dc *dc) ...@@ -580,13 +580,12 @@ void dcn30_init_hw(struct dc *dc)
*/ */
if (dc->config.power_down_display_on_boot) { if (dc->config.power_down_display_on_boot) {
struct dc_link *edp_links[MAX_NUM_EDP]; struct dc_link *edp_links[MAX_NUM_EDP];
struct dc_link *edp_link; struct dc_link *edp_link = NULL;
get_edp_links(dc, edp_links, &edp_num); get_edp_links(dc, edp_links, &edp_num);
if (edp_num) { if (edp_num)
for (i = 0; i < edp_num; i++) { edp_link = edp_links[0];
edp_link = edp_links[i]; if (edp_link && edp_link->link_enc->funcs->is_dig_enabled &&
if (edp_link->link_enc->funcs->is_dig_enabled &&
edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) && edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
dc->hwss.edp_backlight_control && dc->hwss.edp_backlight_control &&
dc->hwss.power_down && dc->hwss.power_down &&
...@@ -594,8 +593,6 @@ void dcn30_init_hw(struct dc *dc) ...@@ -594,8 +593,6 @@ void dcn30_init_hw(struct dc *dc)
dc->hwss.edp_backlight_control(edp_link, false); dc->hwss.edp_backlight_control(edp_link, false);
dc->hwss.power_down(dc); dc->hwss.power_down(dc);
dc->hwss.edp_power_control(edp_link, false); dc->hwss.edp_power_control(edp_link, false);
}
}
} else { } else {
for (i = 0; i < dc->link_count; i++) { for (i = 0; i < dc->link_count; i++) {
struct dc_link *link = dc->links[i]; struct dc_link *link = dc->links[i];
......
...@@ -226,6 +226,7 @@ void dcn31_init_hw(struct dc *dc) ...@@ -226,6 +226,7 @@ void dcn31_init_hw(struct dc *dc)
if (dc->config.power_down_display_on_boot) { if (dc->config.power_down_display_on_boot) {
struct dc_link *edp_links[MAX_NUM_EDP]; struct dc_link *edp_links[MAX_NUM_EDP];
struct dc_link *edp_link; struct dc_link *edp_link;
bool power_down = false;
get_edp_links(dc, edp_links, &edp_num); get_edp_links(dc, edp_links, &edp_num);
if (edp_num) { if (edp_num) {
...@@ -239,9 +240,11 @@ void dcn31_init_hw(struct dc *dc) ...@@ -239,9 +240,11 @@ void dcn31_init_hw(struct dc *dc)
dc->hwss.edp_backlight_control(edp_link, false); dc->hwss.edp_backlight_control(edp_link, false);
dc->hwss.power_down(dc); dc->hwss.power_down(dc);
dc->hwss.edp_power_control(edp_link, false); dc->hwss.edp_power_control(edp_link, false);
power_down = true;
} }
} }
} else { }
if (!power_down) {
for (i = 0; i < dc->link_count; i++) { for (i = 0; i < dc->link_count; i++) {
struct dc_link *link = dc->links[i]; struct dc_link *link = dc->links[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment