hdmirx: add new atmos edid handle method
authoryicheng shen <yicheng.shen@amlogic.com>
Fri, 11 May 2018 03:23:12 +0000 (11:23 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Tue, 15 May 2018 11:52:43 +0000 (04:52 -0700)
PD#164867: hdmirx: add new atmos edid handle method

Change-Id: I03865be263d195b3b38bf782bd52b992e2084c71
Signed-off-by: yicheng shen <yicheng.shen@amlogic.com>
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c

index f721162..4b15126 100644 (file)
@@ -34,7 +34,7 @@
 //#include "hdmi_rx_edid.h"
 
 
-#define RX_VER0 "ver.2018-04-24"
+#define RX_VER0 "ver.2018-05-11"
 /*
  *
  *
index e49766a..02cdd51 100644 (file)
@@ -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,
index 728f135..104dc79 100644 (file)
@@ -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);
index 3d52587..4d26b7f 100644 (file)
@@ -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++);
 }