cec: clean cec task function
authorYong Qin <yong.qin@amlogic.com>
Fri, 15 Jun 2018 06:05:23 +0000 (14:05 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 2 Jul 2018 05:30:50 +0000 (22:30 -0700)
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 <yong.qin@amlogic.com>
drivers/amlogic/cec/hdmi_ao_cec.c
drivers/amlogic/cec/hdmi_ao_cec.h

index cc2b12b..9768e5e 100644 (file)
@@ -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);
index 0e8b827..a1dc059 100644 (file)
@@ -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))