From daa52d6fb414804cd2fdb82917afbeaba8c157d7 Mon Sep 17 00:00:00 2001 From: hongmin hua Date: Tue, 26 Jun 2018 20:40:42 +0800 Subject: [PATCH] cec: txl: add cec support for txl PD#168480: cec: txl: add cec support for txl Change-Id: I76c4c241aa882f9a454fed8813fd0d733995bf5d Signed-off-by: hongmin hua --- drivers/amlogic/cec/hdmi_ao_cec.c | 33 +++++++++++-------- .../media/vin/tvin/hdmirx/hdmi_rx_drv.h | 3 +- .../media/vin/tvin/hdmirx/hdmi_rx_wrapper.c | 11 +++++++ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/drivers/amlogic/cec/hdmi_ao_cec.c b/drivers/amlogic/cec/hdmi_ao_cec.c index ce2941343cca..8689dff37f76 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.c +++ b/drivers/amlogic/cec/hdmi_ao_cec.c @@ -442,7 +442,6 @@ void cecrx_irq_handle(void) if (!ee_cec) return; - if (cec_dev->plat_data->ee_to_ao) shift = 16; /* TX DONE irq, increase tx buffer pointer */ @@ -945,9 +944,9 @@ static int cec_ll_trigle_tx(const unsigned char *msg, int len) } cec_timeout_cnt = 0; return 0; - } else { - CEC_ERR("error msg sts:0x%x\n", reg); } + CEC_ERR("error msg sts:0x%x\n", reg); + return -1; } @@ -1375,10 +1374,9 @@ static int cec_late_check_rx_buffer(void) CEC_INFO("buffer got unrecorgnized msg\n"); cec_rx_buf_clear(); return 0; - } else { - /*mod_delayed_work(cec_dev->cec_thread, dwork, 0);*/ - return 1; } + + return 1; } void cec_key_report(int suspend) @@ -1884,14 +1882,14 @@ static ssize_t port_status_show(struct class *cla, if (cec_dev->dev_type == DEV_TYPE_PLAYBACK) { tmp = tx_hpd; return sprintf(buf, "%x\n", tmp); - } else { - tmp = hdmirx_rd_top(TOP_HPD_PWR5V); - CEC_INFO("TOP_HPD_PWR5V:%x\n", tmp); - tmp >>= 20; - tmp &= 0xf; - tmp |= (tx_hpd << 16); - return sprintf(buf, "%x\n", tmp); } + + tmp = hdmirx_rd_top(TOP_HPD_PWR5V); + CEC_INFO("TOP_HPD_PWR5V:%x\n", tmp); + tmp >>= 20; + tmp &= 0xf; + tmp |= (tx_hpd << 16); + return sprintf(buf, "%x\n", tmp); } static ssize_t pin_status_show(struct class *cla, @@ -2516,6 +2514,11 @@ static const struct cec_platform_data_s cec_g12a_data = { .ee_to_ao = 1, }; +static const struct cec_platform_data_s cec_txl_data = { + .line_bit = 7, + .ee_to_ao = 0, +}; + static const struct of_device_id aml_cec_dt_match[] = { { .compatible = "amlogic, amlogic-aocec", @@ -2529,6 +2532,10 @@ static const struct of_device_id aml_cec_dt_match[] = { .compatible = "amlogic, aocec-g12a", .data = &cec_g12a_data, }, + { + .compatible = "amlogic, aocec-txl", + .data = &cec_txl_data, + }, }; #endif 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 23173792a15f..05acc39e29a3 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.2018/06/21" +#define RX_VER0 "ver.2018-06-27" /* * * @@ -413,6 +413,7 @@ extern void rx_send_hpd_pulse(void); /* irq */ extern void rx_irq_en(bool enable); extern irqreturn_t irq_handler(int irq, void *params); +extern void cecrx_irq_handle(void); /* user interface */ extern int pc_mode_en; 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 76fd00b2ed8b..092ca63735d5 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -259,6 +259,7 @@ static int hdmi_rx_ctrl_irq_handler(void) uint32_t intr_hdmi = 0; uint32_t intr_md = 0; uint32_t intr_pedc = 0; + uint32_t intr_aud_cec = 0; /* uint32_t intr_aud_clk = 0; */ uint32_t intr_aud_fifo = 0; uint32_t intr_hdcp22 = 0; @@ -298,6 +299,16 @@ static int hdmi_rx_ctrl_irq_handler(void) hdmirx_rd_dwc(DWC_HDMI2_IEN); } + if (is_meson_txl_cpu()) { + intr_aud_cec = + hdmirx_rd_dwc(DWC_AUD_CEC_ISTS) & + hdmirx_rd_dwc(DWC_AUD_CEC_IEN); + if (intr_aud_cec != 0) { + cecrx_irq_handle(); + hdmirx_wr_dwc(DWC_AUD_CEC_ICLR, intr_aud_cec); + } + } + if (intr_hdcp22 != 0) { hdmirx_wr_dwc(DWC_HDMI2_ICLR, intr_hdcp22); skip_frame(skip_frame_cnt);