hdmirx: add repeater22 [1/1]
authorLei Yang <lei.yang@amlogic.com>
Tue, 24 Sep 2019 12:37:22 +0000 (20:37 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Fri, 27 Sep 2019 05:28:40 +0000 (22:28 -0700)
PD#SWPL-12503

Problem:
TM2 cannot support repeater22

Solution:
add repreater2.2

Verify:
TM2

Change-Id: Idda626632641939dccab79bf3d958e8f2c462c82
Signed-off-by: Lei Yang <lei.yang@amlogic.com>
12 files changed:
arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts
arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts
arch/arm/boot/dts/amlogic/tm2_t962x3_t312.dts
arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts
arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts
arch/arm64/boot/dts/amlogic/tm2_t962x3_t312.dts
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.c
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_repeater.c
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c

index 628cb1c..985f87a 100644 (file)
                compatible = "amlogic, unifykey";
                status = "okay";
 
-               unifykey-num = <24>;
+               unifykey-num = <21>;
                unifykey-index-0 = <&keysn_0>;
                unifykey-index-1 = <&keysn_1>;
                unifykey-index-2 = <&keysn_2>;
                unifykey-index-18 = <&keysn_18>;
                unifykey-index-19 = <&keysn_19>;
                unifykey-index-20 = <&keysn_20>;
-               unifykey-index-21 = <&keysn_21>;
-               unifykey-index-22 = <&keysn_22>;
-               unifykey-index-23 = <&keysn_23>;
 
                keysn_0: key_0{
                        key-name = "usid";
                        key-device = "secure";
                        key-permit = "read","write","del";
                };
-               keysn_21:key_21{
-                       key-name = "hdcp22_rprx_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_22:key_22{
-                       key-name = "hdcp22_rprp_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_23:key_23{
-                       key-name = "hdcp22_rp_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
        }; /* End unifykey */
 
        amlvideo2_0 {
                        0xff610000 0xa000>;
        };
 
-       amhdmitx: amhdmitx {
-               compatible = "amlogic, amhdmitx";
-               dev_name = "amhdmitx";
-               status = "okay";
-               repeater_tx = <0x0>;
-       };
-
        aocec: aocec {
                compatible = "amlogic, aocec-tm2";
                /*device_name = "aocec";*/
index 03a2c91..78d8627 100644 (file)
                compatible = "amlogic, unifykey";
                status = "okay";
 
-               unifykey-num = <24>;
+               unifykey-num = <21>;
                unifykey-index-0 = <&keysn_0>;
                unifykey-index-1 = <&keysn_1>;
                unifykey-index-2 = <&keysn_2>;
                unifykey-index-18 = <&keysn_18>;
                unifykey-index-19 = <&keysn_19>;
                unifykey-index-20 = <&keysn_20>;
-               unifykey-index-21 = <&keysn_21>;
-               unifykey-index-22 = <&keysn_22>;
-               unifykey-index-23 = <&keysn_23>;
 
                keysn_0: key_0{
                        key-name = "usid";
                        key-device = "secure";
                        key-permit = "read","write","del";
                };
-               keysn_21:key_21{
-                       key-name = "hdcp22_rprx_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_22:key_22{
-                       key-name = "hdcp22_rprp_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_23:key_23{
-                       key-name = "hdcp22_rp_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
        }; /* End unifykey */
 
        hdmirx {
                        0xff610000 0xa000>;
        };
 
-       amhdmitx: amhdmitx {
-               compatible = "amlogic, amhdmitx";
-               dev_name = "amhdmitx";
-               status = "okay";
-               repeater_tx = <0x0>;
-       };
-
        aocec: aocec {
                compatible = "amlogic, aocec-tm2";
                /*device_name = "aocec";*/
index 488b12b..b38f50a 100644 (file)
                compatible = "amlogic, unifykey";
                status = "okay";
 
-               unifykey-num = <24>;
+               unifykey-num = <21>;
                unifykey-index-0 = <&keysn_0>;
                unifykey-index-1 = <&keysn_1>;
                unifykey-index-2 = <&keysn_2>;
                unifykey-index-18 = <&keysn_18>;
                unifykey-index-19 = <&keysn_19>;
                unifykey-index-20 = <&keysn_20>;
-               unifykey-index-21 = <&keysn_21>;
-               unifykey-index-22 = <&keysn_22>;
-               unifykey-index-23 = <&keysn_23>;
 
                keysn_0: key_0{
                        key-name = "usid";
                        key-device = "secure";
                        key-permit = "read","write","del";
                };
-               keysn_21:key_21{
-                       key-name = "hdcp22_rprx_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_22:key_22{
-                       key-name = "hdcp22_rprp_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_23:key_23{
-                       key-name = "hdcp22_rp_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
        }; /* End unifykey */
 
        amlvideo2_0 {
                        0xff610000 0xa000>;
        };
 
-       amhdmitx: amhdmitx {
-               compatible = "amlogic, amhdmitx";
-               dev_name = "amhdmitx";
-               status = "okay";
-               repeater_tx = <0x0>;
-       };
-
        aocec: aocec {
                compatible = "amlogic, aocec-tm2";
                /*device_name = "aocec";*/
index 6b5ca87..717debf 100644 (file)
                compatible = "amlogic, unifykey";
                status = "okay";
 
-               unifykey-num = <24>;
+               unifykey-num = <21>;
                unifykey-index-0 = <&keysn_0>;
                unifykey-index-1 = <&keysn_1>;
                unifykey-index-2 = <&keysn_2>;
                unifykey-index-18 = <&keysn_18>;
                unifykey-index-19 = <&keysn_19>;
                unifykey-index-20 = <&keysn_20>;
-               unifykey-index-21 = <&keysn_21>;
-               unifykey-index-22 = <&keysn_22>;
-               unifykey-index-23 = <&keysn_23>;
 
                keysn_0: key_0{
                        key-name = "usid";
                        key-device = "secure";
                        key-permit = "read","write","del";
                };
-               keysn_21:key_21{
-                       key-name = "hdcp22_rprx_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_22:key_22{
-                       key-name = "hdcp22_rprp_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_23:key_23{
-                       key-name = "hdcp22_rp_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
        }; /* End unifykey */
 
        amlvideo2_0 {
                        0x0 0xff610000 0x0 0xa000>;
        };
 
-       amhdmitx: amhdmitx {
-               compatible = "amlogic, amhdmitx";
-               dev_name = "amhdmitx";
-               status = "okay";
-               repeater_tx = <0x0>;
-       };
-
        aocec: aocec {
                compatible = "amlogic, aocec-tm2";
                /*device_name = "aocec";*/
index 00aae2e..0159322 100644 (file)
                compatible = "amlogic, unifykey";
                status = "okay";
 
-               unifykey-num = <24>;
+               unifykey-num = <21>;
                unifykey-index-0 = <&keysn_0>;
                unifykey-index-1 = <&keysn_1>;
                unifykey-index-2 = <&keysn_2>;
                unifykey-index-18 = <&keysn_18>;
                unifykey-index-19 = <&keysn_19>;
                unifykey-index-20 = <&keysn_20>;
-               unifykey-index-21 = <&keysn_21>;
-               unifykey-index-22 = <&keysn_22>;
-               unifykey-index-23 = <&keysn_23>;
 
                keysn_0: key_0{
                        key-name = "usid";
                        key-device = "secure";
                        key-permit = "read","write","del";
                };
-               keysn_21:key_21{
-                       key-name = "hdcp22_rprx_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_22:key_22{
-                       key-name = "hdcp22_rprp_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_23:key_23{
-                       key-name = "hdcp22_rp_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
        }; /* End unifykey */
 
        hdmirx {
                        0x0 0xff610000 0x0 0xa000>;
        };
 
-       amhdmitx: amhdmitx {
-               compatible = "amlogic, amhdmitx";
-               dev_name = "amhdmitx";
-               status = "okay";
-               repeater_tx = <0x0>;
-       };
-
        aocec: aocec {
                compatible = "amlogic, aocec-tm2";
                /*device_name = "aocec";*/
index f449c2b..dbcd7a3 100644 (file)
                compatible = "amlogic, unifykey";
                status = "okay";
 
-               unifykey-num = <24>;
+               unifykey-num = <21>;
                unifykey-index-0 = <&keysn_0>;
                unifykey-index-1 = <&keysn_1>;
                unifykey-index-2 = <&keysn_2>;
                unifykey-index-18 = <&keysn_18>;
                unifykey-index-19 = <&keysn_19>;
                unifykey-index-20 = <&keysn_20>;
-               unifykey-index-21 = <&keysn_21>;
-               unifykey-index-22 = <&keysn_22>;
-               unifykey-index-23 = <&keysn_23>;
 
                keysn_0: key_0{
                        key-name = "usid";
                        key-device = "secure";
                        key-permit = "read","write","del";
                };
-               keysn_21:key_21{
-                       key-name = "hdcp22_rprx_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_22:key_22{
-                       key-name = "hdcp22_rprp_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_23:key_23{
-                       key-name = "hdcp22_rp_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
        }; /* End unifykey */
 
        amlvideo2_0 {
                        0x0 0xff610000 0x0 0xa000>;
        };
 
-       amhdmitx: amhdmitx {
-               compatible = "amlogic, amhdmitx";
-               dev_name = "amhdmitx";
-               status = "okay";
-               repeater_tx = <0x0>;
-       };
-
        aocec: aocec {
                compatible = "amlogic, aocec-tm2";
                /*device_name = "aocec";*/
index e5e82ef..0140204 100644 (file)
@@ -1024,18 +1024,18 @@ static long hdmirx_ioctl(struct file *file, unsigned int cmd,
        }
        case HDMI_IOC_HDCP_ON:
                hdcp_enable = 1;
-               rx_set_cur_hpd(0);
+               rx_set_cur_hpd(0, 4);
                /*fsm_restart();*/
                break;
        case HDMI_IOC_HDCP_OFF:
                hdcp_enable = 0;
-               rx_set_cur_hpd(0);
+               rx_set_cur_hpd(0, 4);
                hdmirx_hw_config();
                /*fsm_restart();*/
                break;
        case HDMI_IOC_EDID_UPDATE:
                if (rx.open_fg) {
-                       rx_set_cur_hpd(0);
+                       rx_set_cur_hpd(0, 4);
                        edid_update_flag = 1;
                }
                #if 0
index 6b46639..e6a5d60 100644 (file)
@@ -34,7 +34,7 @@
 #include "hdmi_rx_edid.h"
 
 
-#define RX_VER0 "ver.2019-09-02"
+#define RX_VER0 "ver.2019-09-26"
 /*
  *
  *
index d51a9ef..3afba29 100644 (file)
@@ -1602,8 +1602,12 @@ int rx_set_port_hpd(uint8_t port_id, bool val)
        return 0;
 }
 
-void rx_set_cur_hpd(uint8_t val)
+/* add param to differentiate repeater/main state machine/etc
+ * 0: main loop; 2: workaround; 3: repeater flow; 4: special use
+ */
+void rx_set_cur_hpd(u8 val, u8 func)
 {
+       rx_pr("func-%d to", func);
        rx_set_port_hpd(rx.port, val);
 }
 
@@ -2362,7 +2366,7 @@ void hdmirx_load_firm_reset(int type)
        rx.firm_change = 1;
        msleep(20);
        /*External_Mute(1);rx_aud_pll_ctl(0);*/
-       rx_set_cur_hpd(0);
+       rx_set_cur_hpd(0, 4);
        /*type 2 only pull down hpd*/
        if (type == 2) {
                downstream_hpd_flag = 0;
@@ -3035,7 +3039,7 @@ void rx_debug_load22key(void)
        if (ret) {
                rx_pr("load 2.2 key\n");
                sm_pause = 1;
-               rx_set_cur_hpd(0);
+               rx_set_cur_hpd(0, 4);
                hdcp22_on = 1;
                hdcp22_kill_esm = 1;
                while (wait_kill_done_cnt++ < 10) {
@@ -3061,7 +3065,7 @@ void rx_debug_load22key(void)
                hdmirx_hw_config();
                hpd_to_esm = 1;
                /* mdelay(900); */
-               rx_set_cur_hpd(1);
+               rx_set_cur_hpd(1, 4);
                sm_pause = 0;
        }
 }
index 447d353..18c7047 100644 (file)
@@ -1213,7 +1213,7 @@ extern unsigned int rx_hdcp22_rd_reg_bits(unsigned int addr, unsigned int mask);
 extern int rx_get_aud_pll_err_sts(void);
 extern void rx_force_hpd_cfg(uint8_t hpd_level);
 extern int rx_set_port_hpd(uint8_t port_id, bool val);
-extern void rx_set_cur_hpd(uint8_t val);
+void rx_set_cur_hpd(u8 val, u8 func);
 extern unsigned int rx_get_hdmi5v_sts(void);
 extern unsigned int rx_get_hpd_sts(void);
 
index 9e7e8da..d08e723 100644 (file)
@@ -101,7 +101,8 @@ void rx_check_repeat(void)
 
        if (rx.hdcp.repeat != repeat_plug) {
                /*pull down hpd if downstream plug low*/
-               rx_set_cur_hpd(0);
+               /* rx_set_cur_hpd(0, 3); */
+               rx_send_hpd_pulse();
                rx_pr("firm_change:%d,repeat_plug:%d,repeat:%d\n",
                        rx.firm_change, repeat_plug, rx.hdcp.repeat);
                rx_set_repeat_signal(repeat_plug);
@@ -113,7 +114,7 @@ void rx_check_repeat(void)
                        memset(&receive_edid, 0, sizeof(receive_edid));
                        up_phy_addr = 0;
                        /*new_edid = true;*/
-                       /* rx_set_cur_hpd(1); */
+                       /* rx_set_cur_hpd(1, 3); */
                        /*rx.firm_change = 0;*/
                        rx_pr("1firm_change:%d,repeat_plug:%d,repeat:%d\n",
                                rx.firm_change, repeat_plug, rx.hdcp.repeat);
index f999d1a..637afbc 100644 (file)
@@ -1906,7 +1906,7 @@ void hdmirx_open_port(enum tvin_port_e port)
                }
                if (rx.state > FSM_HPD_LOW)
                        rx.state = FSM_HPD_LOW;
-               rx_set_cur_hpd(0);
+               rx_set_cur_hpd(0, 0);
                /* need reset the whole module when switch port */
                wait_ddc_idle();
                hdmi_rx_top_edid_update();
@@ -2139,7 +2139,7 @@ void rx_main_state_machine(void)
                fsm_restart();
                break;
        case FSM_HPD_LOW:
-               rx_set_cur_hpd(0);
+               rx_set_cur_hpd(0, 0);
                set_scdc_cfg(1, 0);
                rx.state = FSM_INIT;
                break;
@@ -2160,7 +2160,7 @@ void rx_main_state_machine(void)
                downstream_hpd_flag = 0;
                edid_update_flag = 0;
                pre_port = rx.port;
-               rx_set_cur_hpd(1);
+               rx_set_cur_hpd(1, 0);
                rx.phy.cable_clk = 0;
                rx.phy.cablesel = 0;
                set_scdc_cfg(0, 1);
@@ -2229,7 +2229,7 @@ void rx_main_state_machine(void)
                                } else
                                        rx.err_rec_mode = ERR_REC_HPD_RST;
                        } else if (rx.err_rec_mode == ERR_REC_HPD_RST) {
-                               rx_set_cur_hpd(0);
+                               rx_set_cur_hpd(0, 2);
                                rx.phy.cable_clk = 0;
                                rx.state = FSM_INIT;
                                rx.err_rec_mode = ERR_REC_EQ_RETRY;
@@ -2323,7 +2323,7 @@ void rx_main_state_machine(void)
                                rx.err_rec_mode = ERR_REC_HPD_RST;
                                rx_set_eq_run_state(E_EQ_START);
                        } else if (rx.err_rec_mode == ERR_REC_HPD_RST) {
-                               rx_set_cur_hpd(0);
+                               rx_set_cur_hpd(0, 2);
                                rx.phy.cable_clk = 0;
                                rx.state = FSM_INIT;
                                rx.err_rec_mode = ERR_REC_EQ_RETRY;
@@ -2839,7 +2839,7 @@ int hdmirx_debug(const char *buf, int size)
        if (strncmp(tmpbuf, "help", 4) == 0) {
                rx_debug_help();
        } else if (strncmp(tmpbuf, "hpd", 3) == 0)
-               rx_set_cur_hpd(tmpbuf[3] == '0' ? 0 : 1);
+               rx_set_cur_hpd((tmpbuf[3] == '0' ? 0 : 1), 4);
        else if (strncmp(tmpbuf, "cable_status", 12) == 0) {
                size = hdmirx_rd_top(TOP_HPD_PWR5V) >> 20;
                rx_pr("cable_status = %x\n", size);
@@ -2980,7 +2980,7 @@ int hdmirx_debug(const char *buf, int size)
 
 void rx_dw_edid_monitor(void)
 {
-       if (!hdmi_cec_en)
+       if ((!hdmi_cec_en) || (hdmirx_repeat_support()))
                return;
        if (tx_hpd_event == E_RCV) {
                if (rx.open_fg)