From c324ce5c73eaa290e626b3363907413d8fee919e Mon Sep 17 00:00:00 2001 From: Yong Qin Date: Mon, 12 Nov 2018 11:38:33 +0800 Subject: [PATCH] cec: add device match for tl1 [1/1] PD#172587 Problem: add device match for tl1 Solution: 1.add cecb ver 2.add ceca status reg flag Verify: 1.run TPM 2.run chip Change-Id: I304abfd1d6f1f216f9f0c56ca19a8bdb2ccfeabb Signed-off-by: Yong Qin --- drivers/amlogic/cec/hdmi_ao_cec.c | 30 +++++++++++++++++++----------- drivers/amlogic/cec/hdmi_ao_cec.h | 24 ++++++++++++++++-------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/drivers/amlogic/cec/hdmi_ao_cec.c b/drivers/amlogic/cec/hdmi_ao_cec.c index ea38c2f..e0cac09 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.c +++ b/drivers/amlogic/cec/hdmi_ao_cec.c @@ -76,12 +76,15 @@ static struct early_suspend aocec_suspend_handler; #define MAX_INT 0x7ffffff struct cec_platform_data_s { - unsigned int chip_id; + /*unsigned int chip_id;*/ unsigned char line_reg;/*cec gpio_i reg:0 ao;1 periph*/ unsigned int line_bit;/*cec gpio position in reg*/ 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 */ }; + struct cec_wakeup_t { unsigned int wk_logic_addr:8; unsigned int wk_phy_addr:16; @@ -583,7 +586,7 @@ static void ao_cecb_init(void) /* Release SW reset */ cec_set_reg_bits(AO_CECB_GEN_CNTL, 0, 0, 1); - if (cec_dev->plat_data->chip_id >= CEC_CHIP_ID_TL1) { + if (cec_dev->plat_data->cecb_ver >= CECB_VER_2) { reg = 0; reg |= (0 << 6);/*curb_err_init*/ reg |= (0 << 5);/*en_chk_sbitlow*/ @@ -696,7 +699,7 @@ static int dump_cecrx_reg(char *b) s += sprintf(b + s, "CEC MODULE REGS:\n"); s += sprintf(b + s, "CEC_CTRL = 0x%02x\n", hdmirx_cec_read(0x1f00)); - if (cec_dev->plat_data->chip_id >= CEC_CHIP_ID_TL1) + if (cec_dev->plat_data->cecb_ver >= CECB_VER_2) s += sprintf(b + s, "CEC_CTRL2 = 0x%02x\n", hdmirx_cec_read(0x1f04)); s += sprintf(b + s, "CEC_MASK = 0x%02x\n", hdmirx_cec_read(0x1f08)); @@ -704,7 +707,7 @@ static int dump_cecrx_reg(char *b) s += sprintf(b + s, "CEC_ADDR_H = 0x%02x\n", hdmirx_cec_read(0x1f18)); s += sprintf(b + s, "CEC_TX_CNT = 0x%02x\n", hdmirx_cec_read(0x1f1c)); s += sprintf(b + s, "CEC_RX_CNT = 0x%02x\n", hdmirx_cec_read(0x1f20)); - if (cec_dev->plat_data->chip_id >= CEC_CHIP_ID_TL1) + if (cec_dev->plat_data->cecb_ver >= CECB_VER_2) s += sprintf(b + s, "CEC_STAT0 = 0x%02x\n", hdmirx_cec_read(0x1f24)); s += sprintf(b + s, "CEC_LOCK = 0x%02x\n", hdmirx_cec_read(0x1fc0)); @@ -985,7 +988,7 @@ void cec_enable_arc_pin(bool enable) { unsigned int data; - if (cec_dev->plat_data->chip_id >= CEC_CHIP_ID_TL1) { + 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*/ if (enable) @@ -2077,7 +2080,7 @@ static ssize_t dump_reg_show(struct class *cla, cec_reg_name2[i], aocec_rd_reg(i + 0x90)); } - if (cec_dev->plat_data->chip_id >= CEC_CHIP_ID_TL1) { + if (cec_dev->plat_data->ceca_sts_reg) { for (i = 0; i < ARRAY_SIZE(ceca_reg_name3); i++) { s += sprintf(b + s, "%s:%2x\n", ceca_reg_name3[i], aocec_rd_reg(i + 0xA0)); @@ -2947,38 +2950,43 @@ static void aocec_late_resume(struct early_suspend *h) #ifdef CONFIG_OF static const struct cec_platform_data_s cec_gxl_data = { - .chip_id = CEC_CHIP_ID_GXTVBB, .line_reg = 0, .line_bit = 8, .ee_to_ao = 0, + .ceca_sts_reg = 0, + .cecb_ver = CECB_VER_0, }; static const struct cec_platform_data_s cec_txlx_data = { - .chip_id = CEC_CHIP_ID_TXLX, .line_reg = 0, .line_bit = 7, .ee_to_ao = 1, + .ceca_sts_reg = 0, + .cecb_ver = CECB_VER_1, }; static const struct cec_platform_data_s cec_g12a_data = { - .chip_id = CEC_CHIP_ID_G12A, .line_reg = 1, .line_bit = 3, .ee_to_ao = 1, + .ceca_sts_reg = 0, + .cecb_ver = CECB_VER_1, }; static const struct cec_platform_data_s cec_txl_data = { - .chip_id = CEC_CHIP_ID_TXL, .line_reg = 0, .line_bit = 7, .ee_to_ao = 0, + .ceca_sts_reg = 0, + .cecb_ver = CECB_VER_0, }; static const struct cec_platform_data_s cec_tl1_data = { - .chip_id = CEC_CHIP_ID_TL1, .line_reg = 0, .line_bit = 7, .ee_to_ao = 1, + .ceca_sts_reg = 1, + .cecb_ver = CECB_VER_2, }; diff --git a/drivers/amlogic/cec/hdmi_ao_cec.h b/drivers/amlogic/cec/hdmi_ao_cec.h index bd4b8a3..14a9fd4 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.h +++ b/drivers/amlogic/cec/hdmi_ao_cec.h @@ -18,7 +18,8 @@ #ifndef __AO_CEC_H__ #define __AO_CEC_H__ -#define CEC_DRIVER_VERSION "Ver 2018/10/23\n" + +#define CEC_DRIVER_VERSION "Ver 2018/10/31\n" #define CEC_FRAME_DELAY msecs_to_jiffies(400) #define CEC_DEV_NAME "cec" @@ -28,15 +29,22 @@ #define HR_DELAY(n) (ktime_set(0, n * 1000 * 1000)) -enum cec_chip_ver { - CEC_CHIP_ID_GXTVBB = 0, - CEC_CHIP_ID_TXL, - CEC_CHIP_ID_TXLX, - CEC_CHIP_ID_G12A, - CEC_CHIP_ID_TXHD, - CEC_CHIP_ID_TL1, +enum cecbver { + /*first version*/ + CECB_VER_0 = 0, + /*ee to ao */ + CECB_VER_1 = 1, + /* + * 1.fix bug: cts 7-1 + * 2.fix bug: Do not signal initiator error, when it's + * myself who pulled down the line when functioning as a follower + * 3.fix bug: Receive messages are ignored and not acknowledge + * 4.add status reg + */ + CECB_VER_2 = 2, }; + #define L_1 1 #define L_2 2 #define L_3 3 -- 2.7.4