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 f7211629afd5..4b15126bf2cd 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-24" +#define RX_VER0 "ver.2018-05-11" /* * * 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 e49766a85d8e..02cdd51565bc 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c @@ -36,7 +36,7 @@ #include "hdmi_rx_hw.h" static unsigned char edid_temp[EDID_SIZE]; -static char edid_buf[MAX_EDID_BUF_SIZE]; +static char edid_buf[MAX_EDID_BUF_SIZE] = {0x0}; static int edid_size; struct edid_data_s tmp_edid_data; int arc_port_id; @@ -52,6 +52,13 @@ bool new_hdr_lum; MODULE_PARM_DESC(new_hdr_lum, "\n new_hdr_lum\n"); module_param(new_hdr_lum, bool, 0664); +/* + * 1:reset hpd after atmos edid update + * 0:not reset hpd after atmos edid update + */ +bool atmos_edid_update_hpd_en = 1; + + /* hdmi1.4 edid */ static unsigned char edid_14[] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, @@ -375,24 +382,26 @@ unsigned char *edid_list[] = { unsigned char rx_get_edid_index(void) { - if (edid_mode == 0) { - if ((edid_buf[0] == 'E') && - (edid_buf[1] == 'D') && - (edid_buf[2] == 'I') && - (edid_buf[3] == 'D')) { - rx_pr("edid: use Top edid\n"); - return EDID_LIST_BUFF; - } else - return EDID_LIST_14; - } else if (edid_mode < EDID_LIST_NUM) + if ((edid_mode < EDID_LIST_NUM) && + (edid_mode > EDID_LIST_TOP)) return edid_mode; - else - return EDID_LIST_14; + else { + if ((edid_mode == 0) && + edid_size > 4 && + edid_buf[0] == 'E' && + edid_buf[1] == 'D' && + edid_buf[2] == 'I' && + edid_buf[3] == 'D') { + rx_pr("edid: use Top edid\n"); + return EDID_LIST_TOP; + } + return EDID_LIST_NULL; + } } unsigned char *rx_get_edid_buffer(unsigned char index) { - if (index == EDID_LIST_BUFF) + if (index == EDID_LIST_TOP) return edid_list[index] + 4; else return edid_list[index]; @@ -400,8 +409,10 @@ unsigned char *rx_get_edid_buffer(unsigned char index) unsigned int rx_get_edid_size(unsigned char index) { - if (index == EDID_LIST_BUFF) + if (index == EDID_LIST_TOP) return edid_size - 4; + else if (index == EDID_LIST_NULL) + return edid_size; else return EDID_SIZE; } @@ -696,9 +707,10 @@ unsigned char rx_parse_arc_aud_type(const unsigned char *buff) ((aud_data & 0xff) == 1)) { if (!need_support_atmos_bit) { need_support_atmos_bit = true; + hdmi_rx_top_edid_update(); if (rx.open_fg) { - hdmi_rx_top_edid_update(); - rx_send_hpd_pulse(); + if (atmos_edid_update_hpd_en) + rx_send_hpd_pulse(); rx_pr("*update edid-atmos*\n"); } else pre_port = 0xff; @@ -706,9 +718,10 @@ unsigned char rx_parse_arc_aud_type(const unsigned char *buff) } else { if (need_support_atmos_bit) { need_support_atmos_bit = false; + hdmi_rx_top_edid_update(); if (rx.open_fg) { - hdmi_rx_top_edid_update(); - rx_send_hpd_pulse(); + if (atmos_edid_update_hpd_en) + rx_send_hpd_pulse(); rx_pr("*update edid-no atmos*\n"); } else pre_port = 0xff; @@ -718,6 +731,30 @@ unsigned char rx_parse_arc_aud_type(const unsigned char *buff) return 0; } +/* + * audio parse the atmos info and inform hdmirx via a flag + */ +void rx_set_atmos_flag(bool en) +{ + if (need_support_atmos_bit != en) { + need_support_atmos_bit = en; + hdmi_rx_top_edid_update(); + if (rx.open_fg) { + if (atmos_edid_update_hpd_en) + rx_send_hpd_pulse(); + rx_pr("*update edid-atmos*\n"); + } else + pre_port = 0xff; + } +} +EXPORT_SYMBOL(rx_set_atmos_flag); + +bool rx_get_atmos_flag(void) +{ + return need_support_atmos_bit; +} +EXPORT_SYMBOL(rx_get_atmos_flag); + unsigned char get_atmos_offset(unsigned char *p_edid) { unsigned char max_offset = 0; @@ -755,7 +792,10 @@ unsigned char rx_edid_update_atmos(unsigned char *p_edid) if (offset == 0) rx_pr("can not find atmos info\n"); else { - p_edid[offset] = 1; + if (need_support_atmos_bit) + p_edid[offset] = 1; + else + p_edid[offset] = 0; rx_pr("offset = %d\n", offset); } return 0; @@ -783,8 +823,8 @@ unsigned int hdmi_rx_top_edid_update(void) rx_get_edid_size(edid_index)); } - if (need_support_atmos_bit) - rx_edid_update_atmos(pedid_data); + /* if (need_support_atmos_bit) */ + rx_edid_update_atmos(pedid_data); /* caculate physical address and checksum */ sts = rx_edid_cal_phy_addr(brepeat, 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 728f135b4335..104dc79dd83c 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h @@ -113,13 +113,14 @@ struct edid_hdr_block_t { }; enum edid_list_e { - EDID_LIST_BUFF, + EDID_LIST_TOP, EDID_LIST_14, EDID_LIST_14_AUD, EDID_LIST_14_420C, EDID_LIST_14_420VD, EDID_LIST_20, - EDID_LIST_NUM + EDID_LIST_NUM, + EDID_LIST_NULL }; struct detailed_timing_desc { @@ -534,6 +535,7 @@ enum hdmi_vic_e { extern int edid_mode; extern int port_map; extern bool new_hdr_lum; +extern bool atmos_edid_update_hpd_en; int rx_set_hdr_lumi(unsigned char *data, int len); void rx_edid_physical_addr(int a, int b, int c, int d); unsigned char rx_parse_arc_aud_type(const unsigned char *buff); 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 3d52587af159..4d26b7fdee95 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -1502,6 +1502,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, atmos_edid_update_hpd_en, value, &index, ret)) + return pr_var(atmos_edid_update_hpd_en, index); if (set_pr_var(tmpbuf, suspend_pddq_sel, value, &index, ret)) return pr_var(suspend_pddq_sel, index); if (set_pr_var(tmpbuf, aud_ch_map, value, &index, ret)) @@ -1601,6 +1603,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(atmos_edid_update_hpd_en, i++); pr_var(suspend_pddq_sel, i++); pr_var(aud_ch_map, i++); }