summaryrefslogtreecommitdiff
path: root/src/soc/rockchip/rk3288/display.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/rockchip/rk3288/display.c')
-rw-r--r--src/soc/rockchip/rk3288/display.c54
1 files changed, 35 insertions, 19 deletions
diff --git a/src/soc/rockchip/rk3288/display.c b/src/soc/rockchip/rk3288/display.c
index 192580b534..ab297a21d1 100644
--- a/src/soc/rockchip/rk3288/display.c
+++ b/src/soc/rockchip/rk3288/display.c
@@ -46,6 +46,7 @@ void rk_display_init(device_t dev, u32 lcdbase,
struct soc_rockchip_rk3288_config *conf = dev->chip_info;
uint32_t lower = ALIGN_DOWN(lcdbase, MiB);
uint32_t upper = ALIGN_UP(lcdbase + fb_size, MiB);
+ enum vop_modes detected_mode = VOP_MODE_UNKNOWN;
printk(BIOS_SPEW, "LCD framebuffer @%p\n", (void *)(lcdbase));
memset((void *)lcdbase, 0, fb_size); /* clear the framebuffer */
@@ -53,26 +54,41 @@ void rk_display_init(device_t dev, u32 lcdbase,
mmu_config_range(lower / MiB, (upper - lower) / MiB, DCACHE_OFF);
switch (conf->vop_mode) {
- case HDMI_MODE:
+ case VOP_MODE_AUTO_DETECT:
+ /* try EDP first, then HDMI */
+ case VOP_MODE_EDP:
+ printk(BIOS_DEBUG, "Attempting to setup EDP display.\n");
+ rkclk_configure_edp();
+ rkclk_configure_vop_aclk(conf->vop_id, 192 * MHz);
+ rk_edp_init(conf->vop_id);
+
+ if (rk_edp_get_edid(&edid) == 0) {
+ detected_mode = VOP_MODE_EDP;
+ break;
+ } else {
+ printk(BIOS_WARNING, "Cannot get EDID from EDP.\n");
+ if (conf->vop_mode == VOP_MODE_EDP)
+ return;
+ }
+ /* fall thru */
+ case VOP_MODE_HDMI:
+ printk(BIOS_DEBUG, "Attempting to setup HDMI display.\n");
rkclk_configure_hdmi();
rkclk_configure_vop_aclk(conf->vop_id, 384 * MHz);
rk_hdmi_init(conf->vop_id);
- if (rk_hdmi_get_edid(&edid)) {
- printk(BIOS_WARNING, "can not get edid\n");
- return;
- }
- break;
- case EDP_MODE:
- default:
- rkclk_configure_edp();
- rkclk_configure_vop_aclk(conf->vop_id, 192 * MHz);
- rk_edp_init(conf->vop_id);
- if (rk_edp_get_edid(&edid)) {
- printk(BIOS_WARNING, "can not get edid\n");
- return;
+ if (rk_hdmi_get_edid(&edid) == 0) {
+ detected_mode = VOP_MODE_HDMI;
+ break;
+ } else {
+ printk(BIOS_WARNING, "Cannot get EDID from HDMI.\n");
+ if (conf->vop_mode == VOP_MODE_HDMI)
+ return;
}
- break;
+ /* fall thru */
+ default:
+ printk(BIOS_WARNING, "Cannot read any edid info, aborting.\n");
+ return;
}
if (rkclk_configure_vop_dclk(conf->vop_id, edid.pixel_clock * KHz)) {
@@ -84,12 +100,12 @@ void rk_display_init(device_t dev, u32 lcdbase,
edid.bytes_per_line = edid.ha * conf->framebuffer_bits_per_pixel / 8;
edid.x_resolution = edid.ha;
edid.y_resolution = edid.va;
- rkvop_mode_set(conf->vop_id, &edid, conf->vop_mode);
+ rkvop_mode_set(conf->vop_id, &edid, detected_mode);
rkvop_enable(conf->vop_id, lcdbase, &edid);
- switch (conf->vop_mode) {
- case HDMI_MODE:
+ switch (detected_mode) {
+ case VOP_MODE_HDMI:
if (rk_hdmi_enable(&edid)) {
printk(BIOS_WARNING, "hdmi enable err\n");
return;
@@ -103,7 +119,7 @@ void rk_display_init(device_t dev, u32 lcdbase,
mdelay(2000);
break;
- case EDP_MODE:
+ case VOP_MODE_EDP:
default:
if (rk_edp_enable()) {
printk(BIOS_WARNING, "edp enable err\n");