rockchip/rk3399: display: Retry edp initialization if it fails

We found that sometimes the edp doesn't get the edid or that video
config fails on kevin after a reboot. Now we will retry 3 times to
initialize it if there are errors.

BRANCH=gru
BUG=chrome-os-partner:60150
TEST=reboot kevin, the edp initialization error is no longer seen.

Change-Id: I96e20e526294fbc856fbdffcbd63accdc7371ef6
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 28c57a6e5b89c7b3a96204ec19a080067460544a
Original-Change-Id: I1382cdf4119fc4eeae5c2b36485030e3a38c2d91
Original-Signed-off-by: Lin Huang <hl@rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/412622
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/17626
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Lin Huang 2016-11-21 17:35:20 +08:00 committed by Martin Roth
parent 9f470b1930
commit 079b5c65c3
1 changed files with 19 additions and 8 deletions

View File

@ -41,6 +41,7 @@ void rk_display_init(device_t dev)
struct edid edid; struct edid edid;
struct soc_rockchip_rk3399_config *conf = dev->chip_info; struct soc_rockchip_rk3399_config *conf = dev->chip_info;
enum vop_modes detected_mode = VOP_MODE_UNKNOWN; enum vop_modes detected_mode = VOP_MODE_UNKNOWN;
int retry_count = 0;
/* let's use vop0 in rk3399 */ /* let's use vop0 in rk3399 */
uint32_t vop_id = 0; uint32_t vop_id = 0;
@ -63,15 +64,14 @@ void rk_display_init(device_t dev)
*/ */
write32(&rk3399_grf->soc_con25, RK_SETBITS(1 << 11)); write32(&rk3399_grf->soc_con25, RK_SETBITS(1 << 11));
retry_edp:
rk_edp_init(); rk_edp_init();
if (rk_edp_get_edid(&edid) == 0) { if (rk_edp_get_edid(&edid) == 0) {
detected_mode = VOP_MODE_EDP; detected_mode = VOP_MODE_EDP;
break; break;
} }
printk(BIOS_WARNING, "Cannot get EDID from EDP.\n"); goto edp_error;
if (conf->vop_mode == VOP_MODE_EDP)
return;
/* fall thru */ /* fall thru */
case VOP_MODE_HDMI: case VOP_MODE_HDMI:
printk(BIOS_WARNING, "HDMI display is NOT supported yet.\n"); printk(BIOS_WARNING, "HDMI display is NOT supported yet.\n");
@ -100,13 +100,24 @@ void rk_display_init(device_t dev)
case VOP_MODE_EDP: case VOP_MODE_EDP:
default: default:
/* will enable edp in depthcharge */ /* will enable edp in depthcharge */
if (rk_edp_prepare()) { if (rk_edp_prepare())
printk(BIOS_WARNING, "edp prepare error\n"); goto edp_error;
return;
}
mainboard_power_on_backlight(); mainboard_power_on_backlight();
break; break;
} }
set_vbe_mode_info_valid(&edid, (uintptr_t)0); set_vbe_mode_info_valid(&edid, (uintptr_t)0);
return;
edp_error:
if (retry_count++ < 3) {
/* rst edp */
write32(&cru_ptr->softrst_con[17],
RK_SETBITS(1 << 12 | 1 << 13));
udelay(1);
write32(&cru_ptr->softrst_con[17],
RK_CLRBITS(1 << 12 | 1 << 13));
goto retry_edp;
}
printk(BIOS_WARNING, "epd initial error\n");
} }