From 198a001492b8d07b71b1e6b53e486a403c7dd4cf Mon Sep 17 00:00:00 2001 From: Yong Qin Date: Wed, 8 Aug 2018 19:27:05 +0800 Subject: [PATCH] cec: cec: auto power down function fail PD#171408: cec: auto power down function fail 1.reason: set auto pw down, disabled cec function Change-Id: I554b085345bc144e6ff4166aae8c2d9d6620c524 Signed-off-by: Yong Qin --- drivers/amlogic/cec/hdmi_ao_cec.c | 29 +++++++++++++++------- drivers/amlogic/cec/hdmi_ao_cec.h | 16 +++++++----- .../amlogic/media/vout/hdmi_tx/hdmi_tx_cec_20.h | 2 ++ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/drivers/amlogic/cec/hdmi_ao_cec.c b/drivers/amlogic/cec/hdmi_ao_cec.c index 5cd1dde..7ff6b77 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.c +++ b/drivers/amlogic/cec/hdmi_ao_cec.c @@ -1696,7 +1696,7 @@ static void cec_task(struct work_struct *work) unsigned int cec_cfg; cec_cfg = cec_config(0, 0); - if (cec_cfg & (1 << HDMI_OPTION_ENABLE_CEC)) { + if (cec_cfg & CEC_FUNC_CFG_CEC_ON) { /*cec module on*/ if (cec_dev && (!wake_ok || cec_service_suspended())) cec_rx_process(); @@ -2246,7 +2246,7 @@ static ssize_t hdmitx_cec_write(struct file *f, const char __user *buf, return -EINVAL; cec_cfg = cec_config(0, 0); - if (cec_cfg & (1 << HDMI_OPTION_ENABLE_CEC)) { + if (cec_cfg & CEC_FUNC_CFG_CEC_ON) { /*cec module on*/ ret = cec_ll_tx(tempbuf, size); } else { @@ -2442,28 +2442,37 @@ static long hdmitx_cec_ioctl(struct file *f, case CEC_IOC_SET_OPTION_WAKEUP: tmp = cec_config(0, 0); - tmp &= ~(1 << AUTO_POWER_ON_MASK); - tmp |= (arg << AUTO_POWER_ON_MASK); + if (arg) + tmp |= CEC_FUNC_CFG_AUTO_POWER_ON; + else + tmp &= ~(CEC_FUNC_CFG_AUTO_POWER_ON); cec_config(tmp, 1); break; case CEC_IOC_SET_AUTO_DEVICE_OFF: tmp = cec_config(0, 0); - tmp &= ~(1 << ONE_TOUCH_STANDBY_MASK); - tmp |= (arg << ONE_TOUCH_STANDBY_MASK); + if (arg) + tmp |= CEC_FUNC_CFG_AUTO_STANDBY; + else + tmp &= ~(CEC_FUNC_CFG_AUTO_STANDBY); cec_config(tmp, 1); break; case CEC_IOC_SET_OPTION_ENALBE_CEC: + a = cec_config(0, 0); + if (arg) + a |= CEC_FUNC_CFG_CEC_ON; + else + a &= ~(CEC_FUNC_CFG_CEC_ON); + cec_config(a, 1); + tmp = (1 << HDMI_OPTION_ENABLE_CEC); if (arg) { cec_dev->hal_flag |= tmp; - cec_config(CEC_FUNC_CFG_ALL, 1); cec_pre_init(); } else { cec_dev->hal_flag &= ~(tmp); CEC_INFO("disable CEC\n"); - cec_config(CEC_FUNC_CFG_NONE, 1); /*cec_keep_reset();*/ cec_clear_logical_addr(); } @@ -2473,7 +2482,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(CEC_FUNC_CFG_ALL, 1); + /*cec_config(CEC_FUNC_CFG_ALL, 1);*/ } else cec_dev->hal_flag &= ~(tmp); cec_dev->hal_flag |= (1 << HDMI_OPTION_SERVICE_FLAG); @@ -2953,6 +2962,8 @@ static int aml_cec_probe(struct platform_device *pdev) start_bit_check.function = cec_line_check; /* for init */ cec_pre_init(); + /* default enable all function*/ + cec_config(CEC_FUNC_CFG_ALL, 1); queue_delayed_work(cec_dev->cec_thread, &cec_dev->cec_work, 0); CEC_ERR("boot:%#x;%#x\n", *((unsigned int *)&cec_dev->wakup_data), cec_dev->wakeup_reason); diff --git a/drivers/amlogic/cec/hdmi_ao_cec.h b/drivers/amlogic/cec/hdmi_ao_cec.h index 9d19aaf..4c48392 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/08/08\n" +#define CEC_DRIVER_VERSION "Ver 2018/08/10\n" #define CEC_FRAME_DELAY msecs_to_jiffies(400) #define CEC_DEV_NAME "cec" @@ -31,14 +31,18 @@ #define L_1 1 #define L_2 2 #define L_3 3 - +/* #define CEC_FUNC_MASK 0 #define ONE_TOUCH_PLAY_MASK 1 -#define ONE_TOUCH_STANDBY_MASK 2 +#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 CEC_FUNC_CFG_CEC_ON 0x01 +#define CEC_FUNC_CFG_OTP_ON 0x02 +#define CEC_FUNC_CFG_AUTO_STANDBY 0x04 +#define CEC_FUNC_CFG_AUTO_POWER_ON 0x08 +#define CEC_FUNC_CFG_ALL 0x2f +#define CEC_FUNC_CFG_NONE 0x0 /*#define AO_BASE 0xc8100000*/ diff --git a/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_cec_20.h b/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_cec_20.h index 6f30e0b..8689c98 100644 --- a/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_cec_20.h +++ b/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_cec_20.h @@ -295,10 +295,12 @@ enum cec_version_e { #define INFO_MASK_PLAY_MODE (1<<10) /*CEC UI MASK*/ +/* #define CEC_FUNC_MSAK 0 #define ONE_TOUCH_PLAY_MASK 1 #define ONE_TOUCH_STANDBY_MASK 2 #define AUTO_POWER_ON_MASK 3 +*/ /* * only for 1 tx device -- 2.7.4