From ae0631efa265707c7039429cda28c748092d8791 Mon Sep 17 00:00:00 2001 From: Yong Qin Date: Wed, 11 Jul 2018 16:44:27 +0800 Subject: [PATCH] cec: disable cec module clear logic addr PD#169892: cec: disable cec module clear logic addr 1.for replace "keep reset" when cec disable Change-Id: I2af29cd4d89ffd13bf35a41fd41d2eb0dbf68e55 Signed-off-by: Yong Qin --- drivers/amlogic/cec/hdmi_ao_cec.c | 51 ++++++++++++++++++++++++--------------- drivers/amlogic/cec/hdmi_ao_cec.h | 2 +- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/drivers/amlogic/cec/hdmi_ao_cec.c b/drivers/amlogic/cec/hdmi_ao_cec.c index 981bd29..ce29413 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.c +++ b/drivers/amlogic/cec/hdmi_ao_cec.c @@ -1672,21 +1672,24 @@ static bool cec_service_suspended(void) static void cec_task(struct work_struct *work) { - struct delayed_work *dwork; - - dwork = &cec_dev->cec_work; - if (cec_dev && (!wake_ok || cec_service_suspended())) - cec_rx_process(); - - - /*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; + struct delayed_work *dwork = &cec_dev->cec_work; + unsigned int cec_cfg; + + cec_cfg = cec_config(0, 0); + if (cec_cfg & (1 << HDMI_OPTION_ENABLE_CEC)) { + /*cec module on*/ + if (cec_dev && (!wake_ok || cec_service_suspended())) + cec_rx_process(); + + /*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_cfg == 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*/ @@ -1994,7 +1997,7 @@ static ssize_t fun_cfg_store(struct class *cla, struct class_attribute *attr, return -EINVAL; cec_config(val, 1); if (val == 0) - cec_keep_reset(); + cec_clear_logical_addr();/*cec_keep_reset();*/ else cec_pre_init(); return count; @@ -2098,7 +2101,8 @@ static ssize_t hdmitx_cec_write(struct file *f, const char __user *buf, size_t size, loff_t *p) { unsigned char tempbuf[16] = {}; - int ret; + int ret = CEC_FAIL_OTHER; + unsigned int cec_cfg; if (size > 16) size = 16; @@ -2108,10 +2112,18 @@ static ssize_t hdmitx_cec_write(struct file *f, const char __user *buf, if (copy_from_user(tempbuf, buf, size)) return -EINVAL; - ret = cec_ll_tx(tempbuf, size); + cec_cfg = cec_config(0, 0); + if (cec_cfg & (1 << HDMI_OPTION_ENABLE_CEC)) { + /*cec module on*/ + ret = cec_ll_tx(tempbuf, size); + } else { + CEC_ERR("err:cec module disabled\n"); + } + return ret; } + static void init_cec_port_info(struct hdmi_port_info *port, struct ao_cec_dev *cec_dev) { @@ -2327,7 +2339,8 @@ static long hdmitx_cec_ioctl(struct file *f, cec_dev->hal_flag &= ~(tmp); CEC_INFO("disable CEC\n"); cec_config(CEC_FUNC_CFG_NONE, 1); - cec_keep_reset(); + /*cec_keep_reset();*/ + cec_clear_logical_addr(); } break; diff --git a/drivers/amlogic/cec/hdmi_ao_cec.h b/drivers/amlogic/cec/hdmi_ao_cec.h index 7d8eae0..9f8dbc8 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 "Ver**2018/07/03**\n" +#define CEC_DRIVER_VERSION "Ver**2018/07/16**\n" #define CEC_FRAME_DELAY msecs_to_jiffies(400) #define CEC_DEV_NAME "cec" -- 2.7.4