From c50c2e7c6f9e1f136fd41df24e1d64b8553b2fc4 Mon Sep 17 00:00:00 2001 From: Yong Qin Date: Fri, 15 Jun 2018 14:05:23 +0800 Subject: [PATCH] cec: clean cec task function PD#168415: cec: clean cec rx buffer check 1.for new chip version, needn't check rx buffer Change-Id: Ieb49508f2563fd6212f97163d0fbb5b73c5486c5 Signed-off-by: Yong Qin --- drivers/amlogic/cec/hdmi_ao_cec.c | 25 ++++++++++++++++++------- drivers/amlogic/cec/hdmi_ao_cec.h | 5 ++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/amlogic/cec/hdmi_ao_cec.c b/drivers/amlogic/cec/hdmi_ao_cec.c index cc2b12b..9768e5e3 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.c +++ b/drivers/amlogic/cec/hdmi_ao_cec.c @@ -1363,7 +1363,7 @@ static void cec_pre_init(void) static int cec_late_check_rx_buffer(void) { int ret; - struct delayed_work *dwork = &cec_dev->cec_work; + /*struct delayed_work *dwork = &cec_dev->cec_work;*/ ret = cec_rx_buf_check(); if (!ret) @@ -1376,7 +1376,7 @@ static int cec_late_check_rx_buffer(void) cec_rx_buf_clear(); return 0; } else { - mod_delayed_work(cec_dev->cec_thread, dwork, 0); + /*mod_delayed_work(cec_dev->cec_thread, dwork, 0);*/ return 1; } } @@ -1678,8 +1678,19 @@ static void cec_task(struct work_struct *work) if (cec_dev && (!wake_ok || cec_service_suspended())) cec_rx_process(); - if (!cec_late_check_rx_buffer()) - queue_delayed_work(cec_dev->cec_thread, dwork, CEC_FRAME_DELAY); + + /*for check rx buffer for old chip version, cec rx irq process*/ + /*in internal hdmi rx, for avoid msg lose */ + if ((cec_dev->cpu_type < MESON_CPU_MAJOR_ID_TXLX) && + (cec_config(0, 0) == CEC_FUNC_CFG_ALL)) { + if (cec_late_check_rx_buffer()) { + /*msg in*/ + mod_delayed_work(cec_dev->cec_thread, dwork, 0); + return; + } + } + /*triger next process*/ + queue_delayed_work(cec_dev->cec_thread, dwork, CEC_FRAME_DELAY); } static irqreturn_t cec_isr_handler(int irq, void *dev_instance) @@ -2306,12 +2317,12 @@ static long hdmitx_cec_ioctl(struct file *f, tmp = (1 << HDMI_OPTION_ENABLE_CEC); if (arg) { cec_dev->hal_flag |= tmp; - cec_config(0x2f, 1); + cec_config(CEC_FUNC_CFG_ALL, 1); cec_pre_init(); } else { cec_dev->hal_flag &= ~(tmp); CEC_INFO("disable CEC\n"); - cec_config(0x0, 1); + cec_config(CEC_FUNC_CFG_NONE, 1); cec_keep_reset(); } break; @@ -2320,7 +2331,7 @@ static long hdmitx_cec_ioctl(struct file *f, tmp = (1 << HDMI_OPTION_SYSTEM_CEC_CONTROL); if (arg) { cec_dev->hal_flag |= tmp; - cec_config(0x2f, 1); + cec_config(CEC_FUNC_CFG_ALL, 1); } else cec_dev->hal_flag &= ~(tmp); cec_dev->hal_flag |= (1 << HDMI_OPTION_SERVICE_FLAG); diff --git a/drivers/amlogic/cec/hdmi_ao_cec.h b/drivers/amlogic/cec/hdmi_ao_cec.h index 0e8b827..a1dc059 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.h +++ b/drivers/amlogic/cec/hdmi_ao_cec.h @@ -18,7 +18,7 @@ #ifndef __AO_CEC_H__ #define __AO_CEC_H__ -#define CEC_DRIVER_VERSION "2018/06/14\n" +#define CEC_DRIVER_VERSION "2018/06/15\n" #define CEC_FRAME_DELAY msecs_to_jiffies(400) #define CEC_DEV_NAME "cec" @@ -33,6 +33,9 @@ #define ONE_TOUCH_STANDBY_MASK 2 #define AUTO_POWER_ON_MASK 3 +#define CEC_FUNC_CFG_ALL 0x2f +#define CEC_FUNC_CFG_NONE 0x0 + #define AO_BASE 0xc8100000 #define AO_GPIO_I ((0x0A << 2)) -- 2.7.4