From 703c39d2c2d207c035125ccfb0f9f61ca3e00499 Mon Sep 17 00:00:00 2001 From: Zongdong Jiao Date: Mon, 29 Apr 2019 15:16:21 +0800 Subject: [PATCH] hdmirp: enable CEC physical address passing for non-repeater mode [1/4] 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 Signed-off-by: Lei Yang --- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h | 2 +- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c | 13 +++++++++++ .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.h | 6 +++++ .../media/vin/tvin/hdmirx/hdmi_rx_repeater.c | 7 +----- .../media/vin/tvin/hdmirx/hdmi_rx_repeater.h | 1 + .../media/vin/tvin/hdmirx/hdmi_rx_wrapper.c | 26 ++++++++++++++++++++-- .../media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c | 18 +++++++-------- 7 files changed, 54 insertions(+), 19 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 6bae781..be4d203 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.2019-05-01" +#define RX_VER0 "ver.2019-05-07" /* * * 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 7c24d11..dad96ab 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c @@ -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); + 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_repeater.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c index e3a1e3d76..155d5ca 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c @@ -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); - - 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 da190fb..7426848 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.h @@ -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; 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 d8c5841..658e756 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -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) { 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 48ba723..02b7654 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 @@ -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; -- 2.7.4