aboutsummaryrefslogtreecommitdiff
path: root/src/soc/rockchip/rk3288/edp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/rockchip/rk3288/edp.c')
-rw-r--r--src/soc/rockchip/rk3288/edp.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/soc/rockchip/rk3288/edp.c b/src/soc/rockchip/rk3288/edp.c
index 7b69ce8d2d..3f27195199 100644
--- a/src/soc/rockchip/rk3288/edp.c
+++ b/src/soc/rockchip/rk3288/edp.c
@@ -938,6 +938,49 @@ static int rk_edp_config_video(struct rk_edp *edp)
return rk_edp_is_video_stream_on(edp);
}
+static void rockchip_edp_force_hpd(struct rk_edp *edp)
+{
+ u32 val;
+
+ val = readl(&edp->regs->sys_ctl_3);
+ val |= (F_HPD | HPD_CTRL);
+ writel(val, &edp->regs->sys_ctl_3);
+}
+
+static int rockchip_edp_get_plug_in_status(struct rk_edp *edp)
+{
+ u32 val;
+
+ val = readl(&edp->regs->sys_ctl_3);
+ if (val & HPD_STATUS)
+ return 1;
+
+ return 0;
+}
+
+/*
+ * support edp HPD function
+ * some hardware version do not support edp hdp,
+ * we use 200ms to try to get the hpd single now,
+ * if we can not get edp hpd single, it will delay 200ms,
+ * also meet the edp power timing request, to compatible
+ * all of the hardware version
+ */
+static void rockchip_edp_wait_hpd(struct rk_edp *edp)
+{
+ struct stopwatch hpd;
+
+ stopwatch_init_msecs_expire(&hpd, 200);
+ do {
+ if (rockchip_edp_get_plug_in_status(edp))
+ return;
+ udelay(100);
+ } while (!stopwatch_expired(&hpd));
+
+ printk(BIOS_DEBUG, "do not get hpd single, force hpd\n");
+ rockchip_edp_force_hpd(edp);
+}
+
int rk_edp_get_edid(struct edid *edid)
{
int i;
@@ -983,6 +1026,8 @@ void rk_edp_init(u32 vop_id)
val = (vop_id == 1) ? RK_SETBITS(1 << 5) : RK_CLRBITS(1 << 5);
writel(val, &rk3288_grf->soc_con6);
+ rockchip_edp_wait_hpd(&rk_edp);
+
rk_edp_init_refclk(&rk_edp);
rk_edp_init_interrupt(&rk_edp);
rk_edp_enable_sw_function(&rk_edp);