From 6bf27f9a5a1777fe965f0d381296f886085a3c87 Mon Sep 17 00:00:00 2001 From: yicheng shen Date: Mon, 23 Apr 2018 10:50:25 +0800 Subject: [PATCH] hdmirx: add new atmos edid handle method PD#164867: hdmirx: add new atmos edid handle method Change-Id: I4f6fa58ebfe106cedb9f814c92657f08dc6d2aaf Signed-off-by: yicheng shen --- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h | 2 +- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c | 92 +++++++++++++++++----- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h | 3 +- .../media/vin/tvin/hdmirx/hdmi_rx_wrapper.c | 3 + 4 files changed, 78 insertions(+), 22 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 82a571b..8132801 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-04" /* * * 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 e49766a..6b3eb66 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,19 +382,35 @@ 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 == 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_BUFF; */ + /* } else { */ + /* if (edid_mode == 0) */ + /* return EDID_LIST_14; */ + /* else if (edid_mode < EDID_LIST_NUM) */ + /* return edid_mode; */ + /* else */ + /* return EDID_LIST_14; */ + /* } */ + if ((edid_mode < EDID_LIST_NUM) && + (edid_mode > EDID_LIST_BUFF)) 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_BUFF; + } } unsigned char *rx_get_edid_buffer(unsigned char index) @@ -696,9 +719,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 +730,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 +743,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 +804,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 +835,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 728f135..0fd6ca0 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h @@ -17,7 +17,7 @@ #define EDID_SIZE 256 #define EDID_HDR_SIZE 7 -#define MAX_EDID_BUF_SIZE 512 +#define MAX_EDID_BUF_SIZE (256+4) #define MAX_HDR_LUMI 3 /* CEA861F Table 44~46 CEA data block tag code*/ @@ -534,6 +534,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 6c4319d..fb963a9 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -1518,6 +1518,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)) @@ -1618,6 +1620,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++); } -- 2.7.4