hdmirp: enable CEC physical address passing for non-repeater mode [1/4]
authorZongdong Jiao <zongdong.jiao@amlogic.com>
Mon, 29 Apr 2019 07:16:21 +0000 (15:16 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Thu, 16 May 2019 06:46:15 +0000 (23:46 -0700)
PD#SWPL-6988

Problem:
Lack CEC physical address passing

Solution:
Pass CEC address from Tx to Rx in kernel

Verify:
T962X3

Change-Id: I67952d040478c0068e3f0ed777ecf40410a7767d
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
Signed-off-by: Lei Yang <lei.yang@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_repeater.c
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.h
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c
drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c

index 6bae781..be4d203 100644 (file)
@@ -34,7 +34,7 @@
 #include "hdmi_rx_edid.h"
 
 
-#define RX_VER0 "ver.2019-05-01"
+#define RX_VER0 "ver.2019-05-07"
 /*
  *
  *
index 7c24d11..dad96ab 100644 (file)
@@ -2716,3 +2716,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);
+
index 134f700..9a3d43f 100644 (file)
@@ -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,
index e3a1e3d..155d5ca 100644 (file)
@@ -47,6 +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);
+int tx_hpd_event;
 int edid_len;
 MODULE_PARM_DESC(edid_len, "\n edid_len\n");
 module_param(edid_len, int, 0664);
@@ -370,9 +371,3 @@ void rx_repeat_hpd_state(bool plug)
 }
 EXPORT_SYMBOL(rx_repeat_hpd_state);
 
-void rx_edid_physical_addr(int a, int b, int c, int d)
-{
-}
-EXPORT_SYMBOL(rx_edid_physical_addr);
-
-
index da190fb..7426848 100644 (file)
@@ -63,6 +63,7 @@ struct hdcp_hw_info_s {
 };
 
 extern int receive_edid_len;
+extern int tx_hpd_event;
 extern bool new_edid;
 extern int hdcp_array_len;
 extern int hdcp_len;
index d8c5841..658e756 100644 (file)
@@ -2212,7 +2212,7 @@ void rx_main_state_machine(void)
                        } else if (rx.err_rec_mode == ERR_REC_HPD_RST) {
                                rx_set_cur_hpd(0);
                                rx.phy.cable_clk = 0;
-                               rx.state = FSM_HPD_HIGH;
+                               rx.state = FSM_INIT;
                                rx.err_rec_mode = ERR_REC_EQ_RETRY;
                        }
                        rx_set_eq_run_state(E_EQ_START);
@@ -2306,7 +2306,7 @@ void rx_main_state_machine(void)
                        } else if (rx.err_rec_mode == ERR_REC_HPD_RST) {
                                rx_set_cur_hpd(0);
                                rx.phy.cable_clk = 0;
-                               rx.state = FSM_HPD_HIGH;
+                               rx.state = FSM_INIT;
                                rx.err_rec_mode = ERR_REC_EQ_RETRY;
                        }
                }
@@ -2935,12 +2935,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) {
                rx_nosig_monitor();
                if (!hdmirx_repeat_support() || !rx.firm_change) {
index 48ba723..02b7654 100644 (file)
@@ -383,16 +383,14 @@ int Edid_Parse_check_HDMI_VSDB(struct hdmitx_dev *hdev,
        }
 
        set_vsdb_phy_addr(hdev, &info->vsdb_phy_addr, &buff[BlockAddr]);
-       if (hdev->repeater_tx) {
-               if ((check_fbc_special(&hdev->EDID_buf[0])) ||
-                   (check_fbc_special(&hdev->EDID_buf1[0])))
-                       rx_edid_physical_addr(0, 0, 0, 0);
-               else
-                       rx_edid_physical_addr(info->vsdb_phy_addr.a,
-                               info->vsdb_phy_addr.b,
-                               info->vsdb_phy_addr.c,
-                               info->vsdb_phy_addr.d);
-       }
+       if ((check_fbc_special(&hdev->EDID_buf[0])) ||
+           (check_fbc_special(&hdev->EDID_buf1[0])))
+               rx_edid_physical_addr(0, 0, 0, 0);
+       else
+               rx_edid_physical_addr(info->vsdb_phy_addr.a,
+                       info->vsdb_phy_addr.b,
+                       info->vsdb_phy_addr.c,
+                       info->vsdb_phy_addr.d);
 
        if (temp_addr >= VSpecificBoundary)
                ret = -1;