From cfd8ed74ce61b94a004e0edd712d3cd7bf76e1f8 Mon Sep 17 00:00:00 2001 From: Yong Qin Date: Wed, 10 Apr 2019 16:37:54 +0800 Subject: [PATCH] cec: cec bringup for tm2 [1/1] PD#SWPL-6945 Problem: bringup for tm2 Solution: add chip support and modify dts Verify: tm2 Change-Id: I718c3b81912a3555e19866f96d392bfb09d27384 Signed-off-by: Yong Qin --- arch/arm/boot/dts/amlogic/tm2_pxp.dts | 6 +++-- .../arm/boot/dts/amlogic/tm2_t962e2_ab311.dts | 6 +++-- .../arm/boot/dts/amlogic/tm2_t962e2_ab319.dts | 6 +++-- .../arm/boot/dts/amlogic/tm2_t962x3_ab301.dts | 6 +++-- .../arm/boot/dts/amlogic/tm2_t962x3_ab309.dts | 6 +++-- arch/arm64/boot/dts/amlogic/tm2_pxp.dts | 6 +++-- .../boot/dts/amlogic/tm2_t962e2_ab311.dts | 6 +++-- .../boot/dts/amlogic/tm2_t962e2_ab319.dts | 6 +++-- .../boot/dts/amlogic/tm2_t962x3_ab301.dts | 6 +++-- .../boot/dts/amlogic/tm2_t962x3_ab309.dts | 6 +++-- drivers/amlogic/cec/hdmi_ao_cec.c | 25 +++++++++++++++++++ drivers/amlogic/cec/hdmi_ao_cec.h | 8 ++++++ 12 files changed, 73 insertions(+), 20 deletions(-) diff --git a/arch/arm/boot/dts/amlogic/tm2_pxp.dts b/arch/arm/boot/dts/amlogic/tm2_pxp.dts index d1165eee0c64..e812ec0f7cb5 100644 --- a/arch/arm/boot/dts/amlogic/tm2_pxp.dts +++ b/arch/arm/boot/dts/amlogic/tm2_pxp.dts @@ -548,7 +548,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -556,10 +556,12 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ + output = <1>; /*output port number*/ arc_port_mask = <0x2>; interrupts = <0 205 1 0 199 1>; diff --git a/arch/arm/boot/dts/amlogic/tm2_t962e2_ab311.dts b/arch/arm/boot/dts/amlogic/tm2_t962e2_ab311.dts index ccea9250688b..dabb01f4671e 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962e2_ab311.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962e2_ab311.dts @@ -872,7 +872,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -880,10 +880,12 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ + output = <1>; /*output port number*/ arc_port_mask = <0x2>; interrupts = <0 205 1 0 199 1>; diff --git a/arch/arm/boot/dts/amlogic/tm2_t962e2_ab319.dts b/arch/arm/boot/dts/amlogic/tm2_t962e2_ab319.dts index 8e61cadadbf8..7e041a8151d3 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962e2_ab319.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962e2_ab319.dts @@ -851,7 +851,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -859,10 +859,12 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ + output = <1>; /*output port number*/ arc_port_mask = <0x2>; interrupts = <0 205 1 0 199 1>; diff --git a/arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts b/arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts index 281a219fd5c3..517a72f8b9a9 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts @@ -872,7 +872,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -880,11 +880,13 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ arc_port_mask = <0x2>; + output = <1>; /*output port number*/ interrupts = <0 205 1 0 199 1>; interrupt-names = "hdmi_aocecb","hdmi_aocec"; diff --git a/arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts b/arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts index 37dfc5ab9a6c..57f919479250 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts @@ -851,7 +851,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -859,11 +859,13 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ arc_port_mask = <0x2>; + output = <1>; /*output port number*/ interrupts = <0 205 1 0 199 1>; interrupt-names = "hdmi_aocecb","hdmi_aocec"; diff --git a/arch/arm64/boot/dts/amlogic/tm2_pxp.dts b/arch/arm64/boot/dts/amlogic/tm2_pxp.dts index 5951e7526823..defa536fe773 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_pxp.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_pxp.dts @@ -547,7 +547,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -555,10 +555,12 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ + output = <1>; /*output port number*/ arc_port_mask = <0x2>; interrupts = <0 205 1 0 199 1>; diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab311.dts b/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab311.dts index 44ab736125f9..995204cd7f09 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab311.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab311.dts @@ -867,7 +867,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -875,10 +875,12 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ + output = <1>; /*output port number*/ arc_port_mask = <0x2>; interrupts = <0 205 1 0 199 1>; diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab319.dts b/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab319.dts index f9f60602f56f..def6627bf18b 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab319.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab319.dts @@ -850,7 +850,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -858,10 +858,12 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ + output = <1>; /*output port number*/ arc_port_mask = <0x2>; interrupts = <0 205 1 0 199 1>; diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts b/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts index ec42a3ce80dd..03701b9a342c 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts @@ -867,7 +867,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -875,10 +875,12 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ + output = <1>; /*output port number*/ arc_port_mask = <0x2>; interrupts = <0 205 1 0 199 1>; diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts b/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts index 7db627f29e7f..bc874844090b 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts @@ -850,7 +850,7 @@ }; aocec: aocec { - compatible = "amlogic, aocec-tl1"; + compatible = "amlogic, aocec-tm2"; /*device_name = "aocec";*/ status = "okay"; vendor_name = "Amlogic"; /* Max Chars: 8 */ @@ -858,11 +858,13 @@ * http://standards.ieee.org/develop/regauth/oui/oui.txt */ vendor_id = <0x000000>; - product_desc = "TL1"; /* Max Chars: 16 */ + product_desc = "TM2"; /* Max Chars: 16 */ cec_osd_string = "AML_TV"; /* Max Chars: 14 */ port_num = <3>; ee_cec; + /*cec_sel = <2>;*/ arc_port_mask = <0x2>; + output = <1>; /*output port number*/ interrupts = <0 205 1 0 199 1>; interrupt-names = "hdmi_aocecb","hdmi_aocec"; diff --git a/drivers/amlogic/cec/hdmi_ao_cec.c b/drivers/amlogic/cec/hdmi_ao_cec.c index 47173ef4d74b..90ac72ffdf76 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.c +++ b/drivers/amlogic/cec/hdmi_ao_cec.c @@ -82,6 +82,7 @@ struct cec_platform_data_s { bool ee_to_ao;/*ee cec hw module mv to ao;ao cec delete*/ bool ceca_sts_reg;/*add new internal status register*/ enum cecbver cecb_ver;/* detail discription ref enum cecbver */ + enum cecaver ceca_ver; }; @@ -1135,6 +1136,13 @@ void cec_enable_arc_pin(bool enable) { unsigned int data; + if (is_meson_sm1_cpu() || + cpu_after_eq(MESON_CPU_MAJOR_ID_TM2)) { + /*sm1 and tm2 later, audio module handle this*/ + + return; + } + if (cec_dev->plat_data->cecb_ver >= CECB_VER_2) { data = rd_reg_hhi(HHI_HDMIRX_ARC_CNTL); /* enable bit 1:1 bit 0: 0*/ @@ -3065,6 +3073,7 @@ static const struct cec_platform_data_s cec_g12a_data = { .line_bit = 3, .ee_to_ao = 1, .ceca_sts_reg = 0, + .ceca_ver = CECA_VER_0, .cecb_ver = CECB_VER_1, }; @@ -3073,6 +3082,7 @@ static const struct cec_platform_data_s cec_txl_data = { .line_bit = 7, .ee_to_ao = 0, .ceca_sts_reg = 0, + .ceca_ver = CECA_VER_0, .cecb_ver = CECB_VER_0, }; @@ -3081,6 +3091,7 @@ static const struct cec_platform_data_s cec_tl1_data = { .line_bit = 10, .ee_to_ao = 1, .ceca_sts_reg = 1, + .ceca_ver = CECA_VER_0, .cecb_ver = CECB_VER_2, }; @@ -3089,6 +3100,16 @@ static const struct cec_platform_data_s cec_sm1_data = { .line_bit = 3, .ee_to_ao = 1, .ceca_sts_reg = 1, + .ceca_ver = CECA_VER_1, + .cecb_ver = CECB_VER_2, +}; + +static const struct cec_platform_data_s cec_tm2_data = { + .line_reg = 0, + .line_bit = 3, + .ee_to_ao = 1, + .ceca_sts_reg = 1, + .ceca_ver = CECA_VER_1, .cecb_ver = CECB_VER_2, }; @@ -3117,6 +3138,10 @@ static const struct of_device_id aml_cec_dt_match[] = { .compatible = "amlogic, aocec-sm1", .data = &cec_sm1_data, }, + { + .compatible = "amlogic, aocec-tm2", + .data = &cec_tm2_data, + }, {} }; #endif diff --git a/drivers/amlogic/cec/hdmi_ao_cec.h b/drivers/amlogic/cec/hdmi_ao_cec.h index e76e6484ef5a..9ea6ec37170f 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.h +++ b/drivers/amlogic/cec/hdmi_ao_cec.h @@ -29,6 +29,14 @@ #define CEC_PHY_PORT_NUM 4 #define HR_DELAY(n) (ktime_set(0, n * 1000 * 1000)) +enum cecaver { + /*first version*/ + CECA_VER_0 = 0, + + /*support multi logical address*/ + CECA_VER_1 = 1, +}; + enum cecbver { /*first version*/ CECB_VER_0 = 0,