summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Zhang <lukez@codeaurora.org>2016-01-06 17:43:42 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-01-14 12:32:10 -0800
commit0eb12198916fbc3ab03cce27ea41914eef447b65 (patch)
tree7837979a286fc8662d7a5abcb67787045e4d6628
parente9b87a1eaa3da3fe40706314cfa3fe1ae2f0de86 (diff)
downloadandroid_hardware_qcom_bt-0eb12198916fbc3ab03cce27ea41914eef447b65.tar.gz
android_hardware_qcom_bt-0eb12198916fbc3ab03cce27ea41914eef447b65.tar.bz2
android_hardware_qcom_bt-0eb12198916fbc3ab03cce27ea41914eef447b65.zip
Delay the operation to vote off UART clock in libbtvendor
During BT turn on procedure, power collapse happens which causes libbtvendor unable to wake up after launching wcnss_filter. Here we prevent it by delaying the operation to vote off UART clock. CRs-fixed: 959206 Change-Id: Ia31e397ddc522140d9ed28019b2700a3dd8d074e
-rw-r--r--libbt-vendor/src/bt_vendor_qcom.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/libbt-vendor/src/bt_vendor_qcom.c b/libbt-vendor/src/bt_vendor_qcom.c
index 15901bb..d1ca184 100644
--- a/libbt-vendor/src/bt_vendor_qcom.c
+++ b/libbt-vendor/src/bt_vendor_qcom.c
@@ -730,7 +730,7 @@ static int op(bt_vendor_opcode_t opcode, void *param)
case BT_VND_OP_USERIAL_OPEN:
{
int (*fd_array)[] = (int (*)[]) param;
- int idx, fd;
+ int idx, fd = -1, fd_filter = -1;
ALOGI("bt-vendor : BT_VND_OP_USERIAL_OPEN");
switch(btSocType)
{
@@ -843,14 +843,10 @@ static int op(bt_vendor_opcode_t opcode, void *param)
}
if(rome_soc_init(fd, (char*)vnd_local_bd_addr)<0) {
retval = -1;
- userial_clock_operation(fd, USERIAL_OP_CLK_OFF);
} else {
ALOGV("rome_soc_init is completed");
property_set("wc_transport.soc_initialized", "1");
- userial_clock_operation(fd, USERIAL_OP_CLK_OFF);
skip_init = false;
- /*Close the UART port*/
- close(fd);
}
}
}
@@ -864,40 +860,46 @@ static int op(bt_vendor_opcode_t opcode, void *param)
start_hci_filter();
if (is_ant_req) {
ALOGV("connect to ant channel");
- ant_fd = fd = connect_to_local_socket("ant_sock");
+ ant_fd = fd_filter = connect_to_local_socket("ant_sock");
}
else
#endif
{
ALOGV("connect to bt channel");
- vnd_userial.fd = fd = connect_to_local_socket("bt_sock");
+ vnd_userial.fd = fd_filter = connect_to_local_socket("bt_sock");
}
- if (fd != -1) {
+ if (fd_filter != -1) {
ALOGV("%s: received the socket fd: %d is_ant_req: %d\n",
- __func__, fd, is_ant_req);
+ __func__, fd_filter, is_ant_req);
if((strcmp(emb_wp_mode, "true") == 0) && !is_ant_req) {
if (rome_ver >= ROME_VER_3_0) {
/* get rome supported feature request */
ALOGE("%s: %x08 %0x", __FUNCTION__,rome_ver, ROME_VER_3_0);
- rome_get_addon_feature_list(fd);
+ rome_get_addon_feature_list(fd_filter);
}
}
if (!skip_init) {
/*Skip if already sent*/
- enable_controller_log(fd, is_ant_req);
+ enable_controller_log(fd_filter, is_ant_req);
skip_init = true;
}
- for (idx=0; idx < CH_MAX; idx++)
- (*fd_array)[idx] = fd;
- retval = 1;
+
+ for (idx=0; idx < CH_MAX; idx++) {
+ (*fd_array)[idx] = fd_filter;
}
+
+ retval = 1;
+ }
else {
retval = -1;
}
- } else {
- if (fd >= 0)
- close(fd);
+ }
+
+ if (fd >= 0) {
+ userial_clock_operation(fd, USERIAL_OP_CLK_OFF);
+ /*Close the UART port*/
+ close(fd);
}
}
break;