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 f2a1717aede4..529af126b508 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c @@ -1024,18 +1024,18 @@ static long hdmirx_ioctl(struct file *file, unsigned int cmd, } case HDMI_IOC_HDCP_ON: hdcp_enable = 1; - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 4); /*fsm_restart();*/ break; case HDMI_IOC_HDCP_OFF: hdcp_enable = 0; - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 4); hdmirx_hw_config(); /*fsm_restart();*/ break; case HDMI_IOC_EDID_UPDATE: if (rx.open_fg) { - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 4); edid_update_flag = 1; } #if 0 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 6587a216bd59..306b2874d397 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.2019-09-02" +#define RX_VER0 "ver.2019-09-26" /* * * diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c index e82ff0d866bd..ef8c0d6355b5 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c @@ -1602,9 +1602,13 @@ if (log_level & LOG_EN) return 0; } -void rx_set_cur_hpd(uint8_t val) +/* add param to differentiate repeater/main state machine/etc + * 0: main loop; 2: workaround; 3: repeater flow; 4: special use + */ +void rx_set_cur_hpd(u8 val, u8 func) { -rx_set_port_hpd(rx.port, val); + rx_pr("func-%d to", func); + rx_set_port_hpd(rx.port, val); } /* @@ -1717,16 +1721,7 @@ void rx_esm_tmdsclk_en(bool en) */ void hdcp22_clk_en(bool en) { -if (en) { - wr_reg_hhi(HHI_HDCP22_CLK_CNTL, - (rd_reg_hhi(HHI_HDCP22_CLK_CNTL) & 0xffff0000) | - /* [10: 9] fclk_div7=2000/7=285.71 MHz */ - ((0 << 9) | - /* [ 8] clk_en. Enable gated clock */ - (1 << 8) | - /* [ 6: 0] Divide by 1. = 285.71/1 = 285.71 MHz */ - (0 << 0))); - + if (en) { wr_reg_hhi(HHI_HDCP22_CLK_CNTL, (rd_reg_hhi(HHI_HDCP22_CLK_CNTL) & 0xffff0000) | /* [10: 9] fclk_div7=2000/7=285.71 MHz */ @@ -2365,7 +2360,7 @@ void hdmirx_load_firm_reset(int type) rx.firm_change = 1; msleep(20); /*External_Mute(1);rx_aud_pll_ctl(0);*/ - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 4); /*type 2 only pull down hpd*/ if (type == 2) { downstream_hpd_flag = 0; @@ -3038,7 +3033,7 @@ void rx_debug_load22key(void) if (ret) { rx_pr("load 2.2 key\n"); sm_pause = 1; - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 4); hdcp22_on = 1; hdcp22_kill_esm = 1; while (wait_kill_done_cnt++ < 10) { @@ -3064,7 +3059,7 @@ void rx_debug_load22key(void) hdmi_rx_top_edid_update(); hpd_to_esm = 1; /* mdelay(900); */ - rx_set_cur_hpd(1); + rx_set_cur_hpd(1, 4); sm_pause = 0; } } diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h index 447d353228a6..18c7047c5ff9 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h @@ -1213,7 +1213,7 @@ extern unsigned int rx_hdcp22_rd_reg_bits(unsigned int addr, unsigned int mask); extern int rx_get_aud_pll_err_sts(void); extern void rx_force_hpd_cfg(uint8_t hpd_level); extern int rx_set_port_hpd(uint8_t port_id, bool val); -extern void rx_set_cur_hpd(uint8_t val); +void rx_set_cur_hpd(u8 val, u8 func); extern unsigned int rx_get_hdmi5v_sts(void); extern unsigned int rx_get_hpd_sts(void); diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c index 9e7e8da65bf7..d08e72387830 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c @@ -101,7 +101,8 @@ void rx_check_repeat(void) if (rx.hdcp.repeat != repeat_plug) { /*pull down hpd if downstream plug low*/ - rx_set_cur_hpd(0); + /* rx_set_cur_hpd(0, 3); */ + rx_send_hpd_pulse(); rx_pr("firm_change:%d,repeat_plug:%d,repeat:%d\n", rx.firm_change, repeat_plug, rx.hdcp.repeat); rx_set_repeat_signal(repeat_plug); @@ -113,7 +114,7 @@ void rx_check_repeat(void) memset(&receive_edid, 0, sizeof(receive_edid)); up_phy_addr = 0; /*new_edid = true;*/ - /* rx_set_cur_hpd(1); */ + /* rx_set_cur_hpd(1, 3); */ /*rx.firm_change = 0;*/ rx_pr("1firm_change:%d,repeat_plug:%d,repeat:%d\n", rx.firm_change, repeat_plug, rx.hdcp.repeat); 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 04c89a33f7c9..b18748d91e6d 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -1905,7 +1905,7 @@ void hdmirx_open_port(enum tvin_port_e port) } if (rx.state > FSM_HPD_LOW) rx.state = FSM_HPD_LOW; - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 0); /* need reset the whole module when switch port */ wait_ddc_idle(); hdmi_rx_top_edid_update(); @@ -2129,7 +2129,7 @@ void rx_main_state_machine(void) fsm_restart(); break; case FSM_HPD_LOW: - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 0); set_scdc_cfg(1, 0); rx.state = FSM_INIT; break; @@ -2150,7 +2150,7 @@ void rx_main_state_machine(void) downstream_hpd_flag = 0; edid_update_flag = 0; pre_port = rx.port; - rx_set_cur_hpd(1); + rx_set_cur_hpd(1, 0); rx.phy.cable_clk = 0; rx.phy.cablesel = 0; set_scdc_cfg(0, 1); @@ -2219,7 +2219,7 @@ void rx_main_state_machine(void) } else rx.err_rec_mode = ERR_REC_HPD_RST; } else if (rx.err_rec_mode == ERR_REC_HPD_RST) { - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 2); rx.phy.cable_clk = 0; rx.state = FSM_INIT; rx.err_rec_mode = ERR_REC_EQ_RETRY; @@ -2313,7 +2313,7 @@ void rx_main_state_machine(void) rx.err_rec_mode = ERR_REC_HPD_RST; rx_set_eq_run_state(E_EQ_START); } else if (rx.err_rec_mode == ERR_REC_HPD_RST) { - rx_set_cur_hpd(0); + rx_set_cur_hpd(0, 2); rx.phy.cable_clk = 0; rx.state = FSM_INIT; rx.err_rec_mode = ERR_REC_EQ_RETRY; @@ -2829,7 +2829,7 @@ int hdmirx_debug(const char *buf, int size) if (strncmp(tmpbuf, "help", 4) == 0) { rx_debug_help(); } else if (strncmp(tmpbuf, "hpd", 3) == 0) - rx_set_cur_hpd(tmpbuf[3] == '0' ? 0 : 1); + rx_set_cur_hpd((tmpbuf[3] == '0' ? 0 : 1), 4); else if (strncmp(tmpbuf, "cable_status", 12) == 0) { size = hdmirx_rd_top(TOP_HPD_PWR5V) >> 20; rx_pr("cable_status = %x\n", size); @@ -2970,7 +2970,7 @@ int hdmirx_debug(const char *buf, int size) void rx_dw_edid_monitor(void) { - if (!hdmi_cec_en) + if ((!hdmi_cec_en) || (hdmirx_repeat_support())) return; if (tx_hpd_event == E_RCV) { if (rx.open_fg)