hdmirx: add pddq selection interface when suspend/resume
authorHang Cheng <hang.cheng@amlogic.com>
Fri, 13 Apr 2018 08:19:53 +0000 (16:19 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 23 Apr 2018 09:38:11 +0000 (02:38 -0700)
PD#164216: hdmirx: add pddq selection interface when suspend/resume

when suspend, set pddq down by default, use another Rxsense pulse
during resume to recovery MTK box from hdcp2.2 transaction

Change-Id: Icc574847105a00c5d441fdd589b928eaaf2acf05
Signed-off-by: Hang Cheng <hang.cheng@amlogic.com>
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c

index 29ffcf2..22b2a53 100644 (file)
@@ -120,8 +120,19 @@ int en_4k_2_2k;
 int en_4k_timing = 1;
 bool hdmi_cec_en;
 int skip_frame_cnt = 1;
-
-
+/* suspend_pddq_sel:
+ * 0: keep phy on when suspend(don't need phy init when
+ *   resume), it doesn't work now because phy VDDIO_3.3V
+ *   will power off when suspend, and tmds clk will be low;
+ * 1&2: when CEC off there's no SDA low issue for MTK box,
+ *   these workaround are not needed
+ * 1: disable phy when suspend, set rxsense 1 and 0 when resume to
+ *   release DDC from hdcp2.2 for MTK box, as LG 49UB8800-CE does
+ * 2: disable phy when suspend, set rxsense 1 and 0 when suspend
+ *   to release DDC from hdcp2.2 for MTK xiaomi box
+ * other value: keep previous logic
+ */
+int suspend_pddq_sel = 1;
 
 struct reg_map reg_maps[MAP_ADDR_MODULE_NUM];
 
@@ -1890,8 +1901,22 @@ static int hdmirx_suspend(struct platform_device *pdev, pm_message_t state)
        if (!hdmi_cec_en)
                rx_force_hpd_cfg(0);
 
-       /* phy powerdown */
-       hdmirx_phy_pddq(1);
+       if (suspend_pddq_sel == 0)
+               rx_pr("don't set phy pddq down\n");
+       else {
+               /* there's no SDA low issue on MTK box when CEC off */
+               if (hdmi_cec_en != 0) {
+                       if (suspend_pddq_sel == 2) {
+                               /* set rxsense pulse */
+                               mdelay(10);
+                               hdmirx_phy_pddq(1);
+                               mdelay(10);
+                               hdmirx_phy_pddq(0);
+                       }
+               }
+               /* phy powerdown */
+               hdmirx_phy_pddq(1);
+       }
        if (hdcp22_on)
                hdcp22_suspend();
        rx_pr("[hdmirx]: suspend success\n");
@@ -1903,6 +1928,18 @@ static int hdmirx_resume(struct platform_device *pdev)
        struct hdmirx_dev_s *hdevp;
 
        hdevp = platform_get_drvdata(pdev);
+       if (hdmi_cec_en != 0) {
+               if (suspend_pddq_sel == 1) {
+                       /* set rxsense pulse, if delay time between
+                        * rxsense pulse and phy_int shottern than
+                        * 50ms, SDA may be pulled low 800ms on MTK box
+                        */
+                       hdmirx_phy_pddq(0);
+                       mdelay(10);
+                       hdmirx_phy_pddq(1);
+                       mdelay(50);
+               }
+       }
        hdmirx_phy_init();
        add_timer(&hdevp->timer);
        if (hdcp22_on)
index 736e5d1..a3e114b 100644 (file)
@@ -34,7 +34,7 @@
 //#include "hdmi_rx_edid.h"
 
 
-#define RX_VER0 "ver.2018-04-11"
+#define RX_VER0 "ver.2018-04-13"
 /*
  *
  *
@@ -424,6 +424,7 @@ extern int skip_frame_cnt;
 extern bool hdcp_enable;
 extern int log_level;
 extern int sm_pause;
+extern int suspend_pddq_sel;
 extern int rx_set_global_variable(const char *buf, int size);
 extern void rx_get_global_variable(const char *buf);
 extern int rx_pr(const char *fmt, ...);
index ba138ba..8dca28c 100644 (file)
@@ -1506,6 +1506,8 @@ int rx_set_global_variable(const char *buf, int size)
        if (set_pr_var(tmpbuf, sig_unstable_reset_hpd_max, value, &index, ret))
                return pr_var(sig_unstable_reset_hpd_max, index);
        #endif
+       if (set_pr_var(tmpbuf, suspend_pddq_sel, value, &index, ret))
+               return pr_var(suspend_pddq_sel, index);
        return 0;
 }
 
@@ -1602,6 +1604,7 @@ void rx_get_global_variable(const char *buf)
        pr_var(enable_hpd_reset, i++);
        pr_var(sig_unstable_reset_hpd_max, i++);
        #endif
+       pr_var(suspend_pddq_sel, i++);
 }
 
 void skip_frame(void)