CEC: AOCEC libcec support
authorRay <1458889+Raybuntu@users.noreply.github.com>
Wed, 20 Feb 2019 14:16:11 +0000 (15:16 +0100)
committerNick <nick@khadas.com>
Fri, 17 May 2019 08:08:52 +0000 (16:08 +0800)
drivers/amlogic/cec/hdmi_ao_cec.c
drivers/amlogic/cec/hdmi_ao_cec.h

index e7fc5ce..47173ef 100644 (file)
@@ -65,7 +65,7 @@ static struct early_suspend aocec_suspend_handler;
 
 
 #define CEC_FRAME_DELAY                msecs_to_jiffies(400)
-#define CEC_DEV_NAME           "cec"
+#define CEC_DEV_NAME           "aocec"
 
 #define CEC_POWER_ON           (0 << 0)
 #define CEC_EARLY_SUSPEND      (1 << 0)
@@ -2051,7 +2051,8 @@ static void cec_task(struct work_struct *work)
        cec_cfg = cec_config(0, 0);
        if (cec_cfg & CEC_FUNC_CFG_CEC_ON) {
                /*cec module on*/
-               if (cec_dev && (!wake_ok || cec_service_suspended()))
+               if (cec_dev && (!wake_ok || cec_service_suspended())
+                       && !(cec_dev->hal_flag & (1 << HDMI_OPTION_SYSTEM_CEC_CONTROL)))
                        cec_rx_process();
 
                /*for check rx buffer for old chip version, cec rx irq process*/
@@ -2614,6 +2615,11 @@ static ssize_t hdmitx_cec_write(struct file *f, const char __user *buf,
        if (cec_cfg & CEC_FUNC_CFG_CEC_ON) {
                /*cec module on*/
                ret = cec_ll_tx(tempbuf, size);
+               if (ret == CEC_FAIL_NACK) {
+                       return -1;
+               } else {
+                       return size;
+               }
        } else {
                CEC_ERR("err:cec module disabled\n");
        }
@@ -2998,9 +3004,7 @@ static char *aml_cec_class_devnode(struct device *dev, umode_t *mode)
 {
        if (mode) {
                *mode = 0666;
-               CEC_INFO("mode is %x\n", *mode);
-       } else
-               CEC_INFO("mode is null\n");
+       }
        return NULL;
 }
 
index 1154770..e76e648 100644 (file)
@@ -22,7 +22,7 @@
 #define CEC_DRIVER_VERSION     "Ver 2019/3/25\n"
 
 #define CEC_FRAME_DELAY                msecs_to_jiffies(400)
-#define CEC_DEV_NAME           "cec"
+#define CEC_DEV_NAME           "aocec"
 
 #define CEC_EARLY_SUSPEND      (1 << 0)
 #define CEC_DEEP_SUSPEND       (1 << 1)