summaryrefslogtreecommitdiff
authorTao Zeng <tao.zeng@amlogic.com>2016-06-24 06:34:27 (GMT)
committer Tao Zeng <tao.zeng@amlogic.com>2016-06-24 07:23:38 (GMT)
commit986aec1bc94434caf356dfc7f1ee83e1833c1885 (patch)
treee6689c5fc45fa25c0279c566221b9b0cae3d994a
parent646ceff8c18ead58247b674f358827d61ed87593 (diff)
downloadhdmi_cec-986aec1bc94434caf356dfc7f1ee83e1833c1885.zip
hdmi_cec-986aec1bc94434caf356dfc7f1ee83e1833c1885.tar.gz
hdmi_cec-986aec1bc94434caf356dfc7f1ee83e1833c1885.tar.bz2
PD#127058: get port status when boot to avoid double initialize
Logical address will be initialized by hot-plug and boot. Change-Id: I0a7da0c108bd7d583fca01e3154e700d41751a38
Diffstat
-rw-r--r--hdmi_cec.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/hdmi_cec.c b/hdmi_cec.c
index a8d292d..b87a8bd 100644
--- a/hdmi_cec.c
+++ b/hdmi_cec.c
@@ -528,6 +528,34 @@ static void cec_set_option(const struct hdmi_cec_device* dev, int flag, int valu
}
/*
+ * get connect status when boot
+ */
+static void get_boot_connect_status(struct aml_cec_hal *hal_info)
+{
+ unsigned int total;
+ int i, port, ret;
+
+ ret = ioctl(hal_info->fd, CEC_IOC_GET_PORT_NUM, &total);
+ D("total port:%d, ret:%d\n", total, ret);
+ if (ret < 0)
+ return ;
+
+ if (total > MAX_PORT)
+ total = MAX_PORT;
+ hal_info->con_status = 0;
+ for (i = 0; i < total; i++) {
+ port = i + 1;
+ ret = ioctl(hal_info->fd, CEC_IOC_GET_CONNECT_STATUS, &port);
+ if (ret) {
+ D("get port %d connected status failed, ret:%d\n", i, ret);
+ continue;
+ }
+ hal_info->con_status |= ((port ? 1 : 0) << i);
+ }
+ D("con_status:%x\n", hal_info->con_status);
+}
+
+/*
* (*set_audio_return_channel)() configures ARC circuit in the hardware logic
* to start or stop the feature. Flag can be either 1 to start the feature
* or 0 to stop it.
@@ -665,6 +693,7 @@ static int open_cec( const struct hw_module_t* module, char const *name,
return -EINVAL;
}
ret = ioctl(hal_info->fd, CEC_IOC_SET_DEV_TYPE, hal_info->device_type);
+ get_boot_connect_status(hal_info);
pthread_create(&hal_info->ThreadId, NULL, cec_rx_loop, hal_info);
pthread_setname_np(hal_info->ThreadId, "cec_rx_loop");