[coreboot-gerrit] New patch to review for coreboot: rockchip/rk3399: display: Update edp initialization retry
Martin Roth (martinroth@google.com)
gerrit at coreboot.org
Tue Nov 29 19:16:08 CET 2016
Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17642
-gerrit
commit 375705943d1024ea6a548ee1cfd62ff2ac8ae2a2
Author: Martin Roth <martinroth at google.com>
Date: Tue Nov 29 10:50:52 2016 -0700
rockchip/rk3399: display: Update edp initialization retry
Follow on patch to clean up the previous retry code.
Previous patches:
coreboot commit 079b5c65
(rockchip/rk3399: display: Retry edp initialization if it fails
cros commit 28c57a6e
(rockchip/rk3399: display: retry edp initialization if edp initial fail)
- Get rid of the gotos that jump to the retry code from two separate
locations in the switch statement, then return to just one.
- Break the retry code out into a separate function that also
prints the error messages.
- Create a #define for the Max number of retries, since it's used
in multiple locations.
BRANCH=gru
BUG=chrome-os-partner:60150
TEST=Rebuild Kevin and Gru
Change-Id: I3b6cf572073e4dcac83da09621bafde179af2613
Signed-off-by: Martin Roth <martinroth at google.com>
---
src/soc/rockchip/rk3399/display.c | 56 ++++++++++++++++++++++++---------------
1 file changed, 34 insertions(+), 22 deletions(-)
diff --git a/src/soc/rockchip/rk3399/display.c b/src/soc/rockchip/rk3399/display.c
index 4261b26..c2f83cb 100644
--- a/src/soc/rockchip/rk3399/display.c
+++ b/src/soc/rockchip/rk3399/display.c
@@ -36,6 +36,25 @@
#include "chip.h"
+#define MAX_EDP_RETRIES 3
+
+static int reset_edp(int retry_count)
+{
+ if (retry_count == MAX_EDP_RETRIES) {
+ printk(BIOS_WARNING, "Warning: epd initialization failed.\n");
+ return 1;
+ }
+
+ /* 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));
+ printk(BIOS_WARNING, "Retrying epd initialization.\n");
+ return 0;
+}
+
void rk_display_init(device_t dev)
{
struct edid edid;
@@ -64,15 +83,17 @@ void rk_display_init(device_t dev)
*/
write32(&rk3399_grf->soc_con25, RK_SETBITS(1 << 11));
-retry_edp:
- rk_edp_init();
- if (rk_edp_get_edid(&edid) == 0) {
- detected_mode = VOP_MODE_EDP;
- break;
+ while (retry_count++ < MAX_EDP_RETRIES) {
+ rk_edp_init();
+ if (rk_edp_get_edid(&edid) != 0) {
+ detected_mode = VOP_MODE_EDP;
+ break;
+ }
+ if (reset_edp(retry_count))
+ return;
}
- goto edp_error;
+ return;
- /* fall thru */
case VOP_MODE_HDMI:
printk(BIOS_WARNING, "HDMI display is NOT supported yet.\n");
return;
@@ -100,24 +121,15 @@ retry_edp:
case VOP_MODE_EDP:
default:
/* will enable edp in depthcharge */
- if (rk_edp_prepare())
- goto edp_error;
+ while (retry_count++ < MAX_EDP_RETRIES) {
+ if (rk_edp_prepare() == 0)
+ break;
+ if (reset_edp(retry_count))
+ return;
+ }
mainboard_power_on_backlight();
break;
}
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");
}
More information about the coreboot-gerrit
mailing list