From f23af31d600bd0e83533c701b0caa6b8d040c611 Mon Sep 17 00:00:00 2001 From: Hang Cheng Date: Fri, 13 Apr 2018 16:19:53 +0800 Subject: [PATCH] hdmirx: add pddq selection interface when suspend/resume 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 --- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c | 45 ++++++++++++++++++++-- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h | 3 +- .../media/vin/tvin/hdmirx/hdmi_rx_wrapper.c | 3 ++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c index 29ffcf2..22b2a53 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c @@ -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) diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h index 736e5d1..a3e114b 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h @@ -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, ...); diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c index ba138ba..8dca28c 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -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) -- 2.7.4