summaryrefslogtreecommitdiff
authorTao Zeng <tao.zeng@amlogic.com>2015-12-03 07:00:18 (GMT)
committer Tao Zeng <tao.zeng@amlogic.com>2015-12-03 07:05:54 (GMT)
commit53c019c2ebf958765fc2fcdcd224263319739937 (patch)
treea402d8840d16e5ba5b7eede639f3b3b383124748
parent4550f073db5ef54912b270691afb86740aeca127 (diff)
downloadhdmi_cec-53c019c2ebf958765fc2fcdcd224263319739937.zip
hdmi_cec-53c019c2ebf958765fc2fcdcd224263319739937.tar.gz
hdmi_cec-53c019c2ebf958765fc2fcdcd224263319739937.tar.bz2
PD#116255: Make AO CEC support both TX and RX
Change-Id: I6a2f5bb00e242114ae4a3adc527686019770cf64
Diffstat
-rw-r--r--hdmi_cec.c9
-rw-r--r--hdmi_cec.h4
2 files changed, 8 insertions, 5 deletions
diff --git a/hdmi_cec.c b/hdmi_cec.c
index 71c53df..9ef9d23 100644
--- a/hdmi_cec.c
+++ b/hdmi_cec.c
@@ -58,9 +58,6 @@
#define E(format, args...) ALOGE("[%s]"format, __func__, ##args)
-#define CEC_RX 0
-#define CEC_TX 1
-
#define CEC_FILE "/dev/cec"
#define MAX_PORT 32
@@ -482,6 +479,7 @@ static int open_cec( const struct hw_module_t* module, char const *name,
struct hw_device_t **device )
{
char value[PROPERTY_VALUE_MAX] = {};
+ int ret;
D("name:%s\n", name);
hal_info = malloc(sizeof(*hal_info));
@@ -500,9 +498,9 @@ static int open_cec( const struct hw_module_t* module, char const *name,
property_get("ro.hdmi.device_type", value, "0");
D("get ro.hdmi.device_type:%s\n", value);
if (value[0] == '4') {
- hal_info->device_type = CEC_TX;
+ hal_info->device_type = DEV_TYPE_TX;
} else {
- hal_info->device_type = CEC_RX;
+ hal_info->device_type = DEV_TYPE_RX;
}
hdmi_cec_device_t *dev = malloc(sizeof(hdmi_cec_device_t));
@@ -542,6 +540,7 @@ static int open_cec( const struct hw_module_t* module, char const *name,
E("can't open %s\n", CEC_FILE);
return -EINVAL;
}
+ ioctl(hal_info->fd, CEC_IOC_SET_DEV_TYPE, hal_info->device_type);
pthread_create(&hal_info->ThreadId, NULL, cec_rx_loop, hal_info);
D("creat thread:%ld for poll cec message, fd:%d\n",
diff --git a/hdmi_cec.h b/hdmi_cec.h
index 9738675..fd8cde2 100644
--- a/hdmi_cec.h
+++ b/hdmi_cec.h
@@ -15,10 +15,14 @@
#define CEC_IOC_GET_CONNECT_STATUS _IOR(CEC_IOC_MAGIC, 0x0A, uint32_t)
#define CEC_IOC_ADD_LOGICAL_ADDR _IOW(CEC_IOC_MAGIC, 0x0B, uint32_t)
#define CEC_IOC_CLR_LOGICAL_ADDR _IOW(CEC_IOC_MAGIC, 0x0C, uint32_t)
+#define CEC_IOC_SET_DEV_TYPE _IOW(CEC_IOC_MAGIC, 0x0D, uint32_t)
#define CEC_FAIL_NONE 0
#define CEC_FAIL_NACK 1
#define CEC_FAIL_BUSY 2
#define CEC_FAIL_OTHER 3
+#define DEV_TYPE_RX 0
+#define DEV_TYPE_TX 4
+
#endif /* __HDMI_CEC_H__ */