author | Lei Yang <lei.yang@amlogic.com> | 2019-03-21 02:53:03 (GMT) |
---|---|---|
committer | Lei Yang <lei.yang@amlogic.com> | 2019-05-07 08:01:43 (GMT) |
commit | a70b6f47c834258402fa6052c4b87fc950ebcd60 (patch) | |
tree | 30deca3d771e22d41bdf278572e08c2c2c39b7a2 | |
parent | bd011bb30410c2194da85b12440ff741ea42a697 (diff) | |
download | common-a70b6f47c834258402fa6052c4b87fc950ebcd60.zip common-a70b6f47c834258402fa6052c4b87fc950ebcd60.tar.gz common-a70b6f47c834258402fa6052c4b87fc950ebcd60.tar.bz2 |
hdmirx: add edid real time update when tx_hpd event received [1/1]
PD#OTT-2522
Problem:
physical addr is wrong when tx re-plug
Solution:
do hpd reset when tx hpd event is received
Partly pick from http://scgit.amlogic.com:8080/#/c/63682/
Verify:
962X2
Change-Id: I2a5f878db5112152a60d6adf563e5d9f2539aaa5
Signed-off-by: Yang Lei <lei.yang@amlogic.com>
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
Signed-off-by: Lei Yang <lei.yang@amlogic.com>
9 files changed, 82 insertions, 51 deletions
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 eae4f61..1be9285 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h @@ -46,7 +46,7 @@ * * */ -#define RX_VER2 "ver.2018/11/22" +#define RX_VER2 "ver.2019/03/22" /*print type*/ #define LOG_EN 0x01 @@ -57,6 +57,7 @@ #define EQ_LOG 0x20 #define REG_LOG 0x40 #define ERR_LOG 0x80 +#define EDID_LOG 0x100 #define VSI_LOG 0x800 /* 50ms timer for hdmirx main loop (HDMI_STATE_CHECK_FREQ is 20) */ diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c index f689ee3..a7774e5 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c @@ -1121,7 +1121,8 @@ unsigned char get_atmos_offset(unsigned char *p_edid) do { tag_data = p_edid[tag_offset]; if ((tag_data & 0xE0) == 0x20) { - rx_pr("audio_\n"); + if (log_level & EDID_LOG) + rx_pr("audio_"); aud_length = tag_data & 0x1F; break; } @@ -1148,7 +1149,8 @@ unsigned char rx_edid_update_atmos(unsigned char *p_edid) p_edid[offset] = 1; else p_edid[offset] = 0; - rx_pr("offset = %d\n", offset); + if (log_level & EDID_LOG) + rx_pr("offset = %d\n", offset); } return 0; } @@ -1841,11 +1843,11 @@ static void get_edid_vsdb(unsigned char *buff, unsigned char start, } /* 3d_multi_present: hdmi1.4 spec page155: * 0: neither structure or mask present, - * 1: only 3D_Structure_ALL_15¡0 is present + * 1: only 3D_Structure_ALL_15¡Â0 is present * and assigns 3D formats to all of the * VICs listed in the first 16 entries * in the EDID - * 2: 3D_Structure_ALL_15¡0 and 3D_MASK_15¡0 + * 2: 3D_Structure_ALL_15¡Â0 and 3D_MASK_15¡Â0 * are present and assign 3D formats to * some of the VICs listed in the first * 16 entries in the EDID. @@ -2417,7 +2419,7 @@ void rx_edid_parse_print(struct edid_info_s *edid_info) /* Where a bit is set (=1), for the corresponding * VIC within the first 16 entries in the EDID, * the Sink indicates 3D support as designate - * by the 3D_Structure_ALL_15¡0 field. + * by the 3D_Structure_ALL_15¡Â0 field. */ rx_pr("General 3D format, on the SVDs below:\n"); for (i = 0; i < 16; i++) { @@ -2669,3 +2671,16 @@ int rx_set_hdr_lumi(unsigned char *data, int len) } EXPORT_SYMBOL(rx_set_hdr_lumi); +void rx_edid_physical_addr(int a, int b, int c, int d) +{ + tx_hpd_event = E_RCV; + up_phy_addr = ((d & 0xf) << 12) | + ((c & 0xf) << 8) | + ((b & 0xf) << 4) | + ((a & 0xf) << 0); + + if (log_level & EDID_LOG) + rx_pr("\nup_phy_addr = %x\n", up_phy_addr); +} +EXPORT_SYMBOL(rx_edid_physical_addr); + diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h index 134f700..9a3d43f 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h @@ -434,6 +434,12 @@ struct edid_data_s { unsigned int checksum; }; +enum tx_hpd_event_e { + E_IDLE = 0, + E_EXE = 1, + E_RCV = 2, +}; + enum hdmi_vic_e { /* Refer to CEA 861-D */ HDMI_UNKNOWN = 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 b906ad2..5166dd3 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h @@ -19,6 +19,8 @@ #define __HDMI_RX_HW_H__ +#define K_TEST_CHK_ERR_CNT + /** * Bit field mask * @param m width 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 b77f77c..88a2c6c 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c @@ -47,7 +47,7 @@ static unsigned char receive_edid[MAX_RECEIVE_EDID]; int receive_edid_len = MAX_RECEIVE_EDID; MODULE_PARM_DESC(receive_edid, "\n receive_edid\n"); module_param_array(receive_edid, byte, &receive_edid_len, 0664); -bool new_edid; +int tx_hpd_event; /*original bksv from device*/ static unsigned char receive_hdcp[MAX_KSV_LIST_SIZE]; int hdcp_array_len = MAX_KSV_LIST_SIZE; @@ -103,23 +103,6 @@ bool hdmirx_is_key_write(void) void rx_check_repeat(void) { if (!hdmirx_repeat_support()) { - if (rx.hdcp.repeat != repeat_plug) { - rx.hdcp.repeat = repeat_plug; - if (!repeat_plug) { - memset(&receive_edid, 0, sizeof(receive_edid)); - up_phy_addr = 0; - new_edid = true; - } - if (rx.open_fg) - rx_set_cur_hpd(0); - } - - if (new_edid) { - hdmi_rx_top_edid_update(); - if (rx.open_fg) - rx_send_hpd_pulse(); - new_edid = 0; - } return; } @@ -131,16 +114,16 @@ void rx_check_repeat(void) rx.hdcp.dev_exceed = 0; rx.hdcp.cascade_exceed = 0; memset(&receive_hdcp, 0, sizeof(receive_hdcp)); - new_edid = true; + tx_hpd_event = true; memset(&receive_edid, 0, sizeof(receive_edid)); rx_send_hpd_pulse(); } } - if (new_edid) { + if (tx_hpd_event) { /*check downstream plug when new plug occur*/ /*check receive change*/ hdmi_rx_top_edid_update(); - new_edid = false; + tx_hpd_event = false; rx_send_hpd_pulse(); } if (repeat_plug) { @@ -215,7 +198,7 @@ int rx_set_receiver_edid(unsigned char *data, int len) memset(receive_edid, 0, sizeof(receive_edid)); if ((len > 0) && (*data != 0)) memcpy(receive_edid, data, len); - new_edid = true; + tx_hpd_event = 2; return true; } EXPORT_SYMBOL(rx_set_receiver_edid); @@ -355,14 +338,3 @@ void rx_repeat_hdcp_ver(int version) } EXPORT_SYMBOL(rx_repeat_hdcp_ver); -void rx_edid_physical_addr(int a, int b, int c, int d) -{ - if (!hdmirx_repeat_support()) { - up_phy_addr = ((d & 0xf) << 12) | ((c & 0xf) << 8) | ((b & - 0xf) << 4) | (a & 0xf); - new_edid = true; - } -} -EXPORT_SYMBOL(rx_edid_physical_addr); - - diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.h index 82340b4..58c784f 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.h @@ -46,7 +46,7 @@ enum repeater_state_e { }; extern int receive_edid_len; -extern bool new_edid; +extern int tx_hpd_event; extern int hdcp_array_len; extern int hdcp_len; extern int hdcp_repeat_depth; 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 923ee51..e5904e3 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -190,6 +190,7 @@ static int edid_update_delay = 150; int skip_frame_cnt = 1; static bool hdcp22_reauth_enable; unsigned int edid_update_flag; +unsigned int downstream_hpd_flag; static bool hdcp22_stop_auth_enable; static bool hdcp22_esm_reset2_enable; int sm_pause; @@ -1177,6 +1178,20 @@ void rx_dwc_reset(void) hdmirx_packet_fifo_rst(); } +bool rx_hpd_keep_low(void) +{ + bool ret = false; + + if (downstream_hpd_flag) { + if (hpd_wait_cnt <= hpd_wait_max*5) + ret = true; + } else { + if (hpd_wait_cnt <= hpd_wait_max) + ret = true; + } + return ret; +} + int rx_get_cur_hpd_sts(void) { int tmp; @@ -1554,8 +1569,8 @@ int rx_set_global_variable(const char *buf, int size) return pr_var(wait_no_sig_max, index); if (set_pr_var(tmpbuf, receive_edid_len, value, &index, ret)) return pr_var(receive_edid_len, index); - if (set_pr_var(tmpbuf, new_edid, value, &index, ret)) - return pr_var(new_edid, index); + if (set_pr_var(tmpbuf, tx_hpd_event, value, &index, ret)) + return pr_var(tx_hpd_event, index); if (set_pr_var(tmpbuf, hdcp_array_len, value, &index, ret)) return pr_var(hdcp_array_len, index); if (set_pr_var(tmpbuf, hdcp_len, value, &index, ret)) @@ -1717,7 +1732,7 @@ void rx_get_global_variable(const char *buf) pr_var(clk_stable_max, i++); pr_var(wait_no_sig_max, i++); pr_var(receive_edid_len, i++); - pr_var(new_edid, i++); + pr_var(tx_hpd_event, i++); pr_var(hdcp_array_len, i++); pr_var(hdcp_len, i++); pr_var(hdcp_repeat_depth, i++); @@ -2009,7 +2024,6 @@ void rx_main_state_machine(void) if (hpd_wait_cnt <= hpd_wait_max) break; } - hpd_wait_cnt = 0; clk_unstable_cnt = 0; esd_phy_rst_cnt = 0; pre_port = rx.port; @@ -2084,7 +2098,7 @@ void rx_main_state_machine(void) rx.err_rec_mode = ERR_REC_HPD_RST; } else if (rx.err_rec_mode == ERR_REC_HPD_RST) { rx_set_cur_hpd(0); - rx.state = FSM_HPD_HIGH; + rx.state = FSM_INIT; rx.err_rec_mode = ERR_REC_END; } else { rx.state = FSM_WAIT_CLK_STABLE; @@ -2169,7 +2183,7 @@ void rx_main_state_machine(void) hdmirx_hw_config(); hdmi_rx_top_edid_update(); rx_set_eq_run_state(E_EQ_START); - rx.state = FSM_HPD_HIGH; + rx.state = FSM_INIT; if (hdcp22_on && (rx.hdcp.hdcp_version != HDCP_VER_14)) { if (esm_recovery_mode == @@ -2182,7 +2196,7 @@ void rx_main_state_machine(void) rx_set_eq_run_state(E_EQ_START); } else if (rx.err_rec_mode == ERR_REC_HPD_RST) { rx_set_cur_hpd(0); - rx.state = FSM_HPD_HIGH; + rx.state = FSM_INIT; rx.err_rec_mode = ERR_REC_END; } else rx.err_code = ERR_DE_UNSTABLE; @@ -2498,7 +2512,7 @@ void rx_main_state_machine(void) sig_unstable_reset_hpd_cnt++; if (sig_unstable_reset_hpd_cnt >= sig_unstable_reset_hpd_max) { - rx.state = FSM_HPD_HIGH; + rx.state = FSM_INIT; rx_set_cur_hpd(0); sig_unstable_reset_hpd_cnt = 0; rx_pr( @@ -2989,12 +3003,34 @@ int hdmirx_debug(const char *buf, int size) return 0; } +void rx_dw_edid_monitor(void) +{ + if (!hdmi_cec_en) + return; + if (tx_hpd_event == E_RCV) { + if (rx.open_fg) + fsm_restart(); + rx_set_port_hpd(ALL_PORTS, 0); + hdmi_rx_top_edid_update(); + hpd_wait_cnt = 0; + tx_hpd_event = E_EXE; + } else if (tx_hpd_event == E_EXE) { + if (!rx.open_fg) + hpd_wait_cnt++; + if (!rx_hpd_keep_low()) { + rx_set_port_hpd(ALL_PORTS, 1); + tx_hpd_event = E_IDLE; + } + } +} + void hdmirx_timer_handler(unsigned long arg) { struct hdmirx_dev_s *devp = (struct hdmirx_dev_s *)arg; rx_5v_monitor(); rx_check_repeat(); + rx_dw_edid_monitor(); if (rx.open_fg) { if (!sm_pause) rx_main_state_machine(); diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c index b2447c9..6bcd7b9 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c @@ -1158,8 +1158,7 @@ int Edid_ParsingCEADataBlockCollection(struct hdmitx_dev *hdmitx_device, case AUDIO_TAG: len = (Data & 0x1f) + 1; - if (hdmitx_device->basic_audio) - rx_set_receiver_edid(&buff[AddrTag], len); + rx_set_receiver_edid(&buff[AddrTag], len); for (pos = 0, i = 0; i < len; i++) pos += sprintf(rptx_edid_buf+pos, "%02x", buff[AddrTag + i]); diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c index 3467cd6..1b8a430 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c @@ -3017,7 +3017,7 @@ static void hdmitx_get_edid(struct hdmitx_dev *hdev) hdev->HWOp.CntlDDC(hdev, DDC_EDID_READ_DATA, 0); hdev->HWOp.CntlDDC(hdev, DDC_EDID_GET_DATA, 1); } - hdmitx_edid_clear(hdev); + /* hdmitx_edid_clear(hdev); */ hdmitx_edid_parse(hdev); hdmitx_edid_buf_compare_print(hdev); mutex_unlock(&getedid_mutex); |