bt: msm8909: fix the disconnection issue after SSR am: baf7d9db11
am: f91c3ec940

Change-Id: I0896685744419d5eb7e0401982097a46eb4de454
diff --git a/Android.mk b/Android.mk
index 68705a7..c2d1878 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,5 +1,5 @@
 # TODO:  Find a better way to separate build configs for ADP vs non-ADP devices
-ifneq ($(TARGET_BOARD_AUTO),true)
+ifneq ($(BOARD_IS_AUTOMOTIVE),true)
   ifneq ($(filter msm8960 msm8x27 msm8226,$(TARGET_BOARD_PLATFORM)),)
     include $(call all-named-subdir-makefiles,msm8960)
   else
diff --git a/msm8909/libbt-vendor/src/hw_ar3k.c b/msm8909/libbt-vendor/src/hw_ar3k.c
index 2f6da66..4f813ba 100644
--- a/msm8909/libbt-vendor/src/hw_ar3k.c
+++ b/msm8909/libbt-vendor/src/hw_ar3k.c
@@ -50,6 +50,7 @@
 #include <string.h>
 
 #include "bt_hci_bdroid.h"
+#include "bt_vendor_qcom.h"
 #include "hci_uart.h"
 #include "hw_ar3k.h"
 
diff --git a/msm8909/libbt-vendor/src/hw_rome.c b/msm8909/libbt-vendor/src/hw_rome.c
index 3df11ba..24bedd6 100644
--- a/msm8909/libbt-vendor/src/hw_rome.c
+++ b/msm8909/libbt-vendor/src/hw_rome.c
@@ -54,8 +54,6 @@
 #include "hci_uart.h"
 #include "hw_rome.h"
 
-#define BT_VERSION_FILEPATH "/data/misc/bluedroid/bt_fw_version.txt"
-
 #ifdef __cplusplus
 }
 #endif
@@ -178,16 +176,6 @@
                                                 rsp[PATCH_SOC_VER_OFFSET]  ));
                 }
 
-                if (NULL != (btversionfile = fopen(BT_VERSION_FILEPATH, "wb"))) {
-                    fprintf(btversionfile, "Bluetooth Controller Product ID    : 0x%08x\n", productid);
-                    fprintf(btversionfile, "Bluetooth Controller Patch Version : 0x%04x\n", patchversion);
-                    fprintf(btversionfile, "Bluetooth Controller Build Version : 0x%04x\n", rome_ver);
-                    fprintf(btversionfile, "Bluetooth Controller SOC Version   : 0x%08x\n", soc_id);
-                    fclose(btversionfile);
-                }else {
-                    ALOGI("Failed to dump SOC version info. Errno:%d", errno);
-                }
-
                 /* Rome Chipset Version can be decided by Patch version and SOC version,
                 Upper 2 bytes will be used for Patch version and Lower 2 bytes will be
                 used for SOC as combination for BT host driver */
@@ -228,12 +216,6 @@
                 *(build_label+build_lbl_len) = '\0';
 
                 ALOGI("BT SoC FW SU Build info: %s, %d", build_label, build_lbl_len);
-                if (NULL != (btversionfile = fopen(BT_VERSION_FILEPATH, "a+b"))) {
-                    fprintf(btversionfile, "Bluetooth Contoller SU Build info  : %s\n", build_label);
-                    fclose(btversionfile);
-                } else {
-                    ALOGI("Failed to dump  FW SU build info. Errno:%d", errno);
-                }
             break;
         }
         break;
diff --git a/msm8992/libbt-vendor/src/hw_ar3k.c b/msm8992/libbt-vendor/src/hw_ar3k.c
index 9ca5b3c..dbe6b51 100644
--- a/msm8992/libbt-vendor/src/hw_ar3k.c
+++ b/msm8992/libbt-vendor/src/hw_ar3k.c
@@ -45,6 +45,7 @@
 #include <dirent.h>
 #include <ctype.h>
 #include <cutils/properties.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <termios.h>
@@ -434,19 +435,19 @@
 static int get_ps_type(char *ptr, int index, char *type, char *sub_type)
 {
     int i;
-    int delim = FALSE;
+    int delim = false;
 
     if (index > MAX_PREAMBLE_LEN)
         return -EILSEQ;
 
     for (i = 1; i < index; i++) {
         if (__is_delim(ptr[i])) {
-            delim = TRUE;
+            delim = true;
             continue;
         }
 
         if (isalpha(ptr[i])) {
-            if (delim == FALSE)
+            if (delim == false)
                 (*type) = toupper(ptr[i]);
             else
                 (*sub_type)	= toupper(ptr[i]);
@@ -471,7 +472,7 @@
     char sub_type = '\0';
 
     format->type = PS_HEX;
-    format->array = TRUE;
+    format->array = true;
 
     if (strstr(buf, "[") != buf)
         return 0;
@@ -485,10 +486,10 @@
 
     /* Check is data type is of array */
     if (type == ARRAY || sub_type == ARRAY)
-        format->array = TRUE;
+        format->array = true;
 
     if (type == STRING || sub_type == STRING)
-        format->array = FALSE;
+        format->array = false;
 
     if (type == DECIMAL || type == BINARY)
         format->type = PS_DEC;
@@ -517,7 +518,7 @@
         ptr++;
     }
 
-    if (type.type == PS_HEX && type.array != TRUE)
+    if (type.type == PS_HEX && type.array != true)
         return strtol(ptr, NULL, 16);
 
     return UNDEFINED;
@@ -630,7 +631,7 @@
             read_count = (byte_count > ENTRY_PER_LINE) ?
             ENTRY_PER_LINE : byte_count;
 
-            if (format.type == PS_HEX && format.array == TRUE) {
+            if (format.type == PS_HEX && format.array == true) {
                 while (read_count > 0) {
                     update_tag_data(tag, &status, ptr);
                     read_count -= 2;
diff --git a/msm8992/libbt-vendor/src/hw_rome.c b/msm8992/libbt-vendor/src/hw_rome.c
index 715df4b..031ea80 100644
--- a/msm8992/libbt-vendor/src/hw_rome.c
+++ b/msm8992/libbt-vendor/src/hw_rome.c
@@ -55,8 +55,6 @@
 #include "hci_uart.h"
 #include "hw_rome.h"
 
-#define BT_VERSION_FILEPATH "/data/misc/bluedroid/bt_fw_version.txt"
-
 #ifdef __cplusplus
 }
 #endif
@@ -130,7 +128,7 @@
     int build_lbl_len;
 
     if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE))
-        ALOGI("%s: Received HCI-Vendor Specific event", __FUNCTION__);
+        ALOGV("%s: Received HCI-Vendor Specific event", __FUNCTION__);
     else {
         ALOGI("%s: Failed to receive HCI-Vendor Specific event", __FUNCTION__);
         err = -EIO;
@@ -175,16 +173,6 @@
                                                 rsp[PATCH_SOC_VER_OFFSET]  ));
                 }
 
-                if (NULL != (btversionfile = fopen(BT_VERSION_FILEPATH, "wb"))) {
-                    fprintf(btversionfile, "Bluetooth Controller Product ID    : 0x%08x\n", productid);
-                    fprintf(btversionfile, "Bluetooth Controller Patch Version : 0x%04x\n", patchversion);
-                    fprintf(btversionfile, "Bluetooth Controller Build Version : 0x%04x\n", rome_ver);
-                    fprintf(btversionfile, "Bluetooth Controller SOC Version   : 0x%08x\n", soc_id);
-                    fclose(btversionfile);
-                }else {
-                    ALOGI("Failed to dump SOC version info. Errno:%d", errno);
-                }
-
                 /* Rome Chipset Version can be decided by Patch version and SOC version,
                 Upper 2 bytes will be used for Patch version and Lower 2 bytes will be
                 used for SOC as combination for BT host driver */
@@ -195,7 +183,7 @@
                 switch (err = rsp[CMD_STATUS_OFFSET])
                     {
                     case HCI_CMD_SUCCESS:
-                        ALOGI("%s: Download Packet successfully!", __FUNCTION__);
+                        ALOGV("%s: Download Packet successfully!", __FUNCTION__);
                         break;
                     case PATCH_LEN_ERROR:
                         ALOGI("%s: Invalid patch length argument passed for EDL PATCH "
@@ -225,12 +213,6 @@
                 *(build_label+build_lbl_len) = '\0';
 
                 ALOGI("BT SoC FW SU Build info: %s, %d", build_label, build_lbl_len);
-                if (NULL != (btversionfile = fopen(BT_VERSION_FILEPATH, "a+b"))) {
-                    fprintf(btversionfile, "Bluetooth Contoller SU Build info  : %s\n", build_label);
-                    fclose(btversionfile);
-                } else {
-                    ALOGI("Failed to dump  FW SU build info. Errno:%d", errno);
-                }
             break;
         }
         break;
@@ -434,7 +416,7 @@
             cmd[9]  = EXTRACT_BYTE(p_base_addr, 3);
             memcpy(&cmd[10], (pdata_buffer + offset), size);
 
-            ALOGD("%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes",
+            ALOGV("%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes",
                 __FUNCTION__, size);
             ALOGV("HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t"
                 "0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2],
@@ -456,7 +438,7 @@
             segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
             break;
         case EDL_PATCH_TLV_REQ_CMD:
-            ALOGD("%s: Sending EDL_PATCH_TLV_REQ_CMD", __FUNCTION__);
+            ALOGV("%s: Sending EDL_PATCH_TLV_REQ_CMD", __FUNCTION__);
             /* Parameter Total Length */
             cmd[3] = size +2;
 
@@ -946,7 +928,7 @@
         }
     }
 
-    ALOGI("%s: Successfully downloaded patch segment: %d", __FUNCTION__, index);
+    ALOGV("%s: Successfully downloaded patch segment: %d", __FUNCTION__, index);
     return err;
 }
 
@@ -1734,6 +1716,10 @@
    if (ret != 6) {
      ALOGE("%s: command failed", __func__);
    }
+   ret = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE);
+   if (ret < 0) {
+       ALOGE("%s: Failed to get CC for enable SoC log", __FUNCTION__);
+   }
 }
 
 
diff --git a/msm8996/libbt-vendor/src/bt_vendor_qcom.c b/msm8996/libbt-vendor/src/bt_vendor_qcom.c
index 56a1552..3ad87b8 100644
--- a/msm8996/libbt-vendor/src/bt_vendor_qcom.c
+++ b/msm8996/libbt-vendor/src/bt_vendor_qcom.c
@@ -27,14 +27,17 @@
 #define LOG_TAG "bt_vendor"
 #define BLUETOOTH_MAC_ADDR_BOOT_PROPERTY "ro.boot.btmacaddr"
 
+#include <fcntl.h>
+#include <pthread.h>
+#include <sys/socket.h>
+#include <termios.h>
+#include <unistd.h>
+
 #include <utils/Log.h>
 #include <cutils/properties.h>
-#include <fcntl.h>
-#include <termios.h>
 #include "bt_vendor_qcom.h"
 #include "hci_uart.h"
 #include "hci_smd.h"
-#include <sys/socket.h>
 #include <cutils/sockets.h>
 #include <linux/un.h>
 #ifdef BT_NV_SUPPORT
diff --git a/msm8996/libbt-vendor/src/hw_ar3k.c b/msm8996/libbt-vendor/src/hw_ar3k.c
index 681cd09..f8e3342 100644
--- a/msm8996/libbt-vendor/src/hw_ar3k.c
+++ b/msm8996/libbt-vendor/src/hw_ar3k.c
@@ -437,19 +437,19 @@
 static int get_ps_type(char *ptr, int index, char *type, char *sub_type)
 {
     int i;
-    int delim = FALSE;
+    int delim = false;
 
     if (index > MAX_PREAMBLE_LEN)
         return -EILSEQ;
 
     for (i = 1; i < index; i++) {
         if (__is_delim(ptr[i])) {
-            delim = TRUE;
+            delim = true;
             continue;
         }
 
         if (isalpha(ptr[i])) {
-            if (delim == FALSE)
+            if (delim == false)
                 (*type) = toupper(ptr[i]);
             else
                 (*sub_type)	= toupper(ptr[i]);
@@ -474,7 +474,7 @@
     char sub_type = '\0';
 
     format->type = PS_HEX;
-    format->array = TRUE;
+    format->array = true;
 
     if (strstr(buf, "[") != buf)
         return 0;
@@ -488,10 +488,10 @@
 
     /* Check is data type is of array */
     if (type == ARRAY || sub_type == ARRAY)
-        format->array = TRUE;
+        format->array = true;
 
     if (type == STRING || sub_type == STRING)
-        format->array = FALSE;
+        format->array = false;
 
     if (type == DECIMAL || type == BINARY)
         format->type = PS_DEC;
@@ -520,7 +520,7 @@
         ptr++;
     }
 
-    if (type.type == PS_HEX && type.array != TRUE)
+    if (type.type == PS_HEX && type.array != true)
         return strtol(ptr, NULL, 16);
 
     return UNDEFINED;
@@ -633,7 +633,7 @@
             read_count = (byte_count > ENTRY_PER_LINE) ?
             ENTRY_PER_LINE : byte_count;
 
-            if (format.type == PS_HEX && format.array == TRUE) {
+            if (format.type == PS_HEX && format.array == true) {
                 while (read_count > 0) {
                     update_tag_data(tag, &status, ptr);
                     read_count -= 2;
diff --git a/msm8996/libbt-vendor/src/hw_rome.c b/msm8996/libbt-vendor/src/hw_rome.c
index 6a19d77..2b5cb37 100644
--- a/msm8996/libbt-vendor/src/hw_rome.c
+++ b/msm8996/libbt-vendor/src/hw_rome.c
@@ -56,7 +56,6 @@
 #include "hci_uart.h"
 #include "hw_rome.h"
 
-#define BT_VERSION_FILEPATH "/data/misc/bluedroid/bt_fw_version.txt"
 #define BOARD_ID_LEN 0x5
 #define MSB_NIBBLE_MASK 0xF0
 #define LSB_NIBBLE_MASK 0x0F
@@ -144,7 +143,7 @@
     int build_lbl_len;
 
     if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE))
-        ALOGI("%s: Received HCI-Vendor Specific event", __FUNCTION__);
+        ALOGV("%s: Received HCI-Vendor Specific event", __FUNCTION__);
     else {
         ALOGI("%s: Failed to receive HCI-Vendor Specific event", __FUNCTION__);
         err = -EIO;
@@ -189,16 +188,6 @@
                                                 rsp[PATCH_SOC_VER_OFFSET]  ));
                 }
 
-                if (NULL != (btversionfile = fopen(BT_VERSION_FILEPATH, "wb"))) {
-                    fprintf(btversionfile, "Bluetooth Controller Product ID    : 0x%08x\n", productid);
-                    fprintf(btversionfile, "Bluetooth Controller Patch Version : 0x%04x\n", patchversion);
-                    fprintf(btversionfile, "Bluetooth Controller Build Version : 0x%04x\n", rome_ver);
-                    fprintf(btversionfile, "Bluetooth Controller SOC Version   : 0x%08x\n", soc_id);
-                    fclose(btversionfile);
-                }else {
-                    ALOGI("Failed to dump SOC version info. Errno:%d", errno);
-                }
-
                 /* Rome Chipset Version can be decided by Patch version and SOC version,
                 Upper 2 bytes will be used for Patch version and Lower 2 bytes will be
                 used for SOC as combination for BT host driver */
@@ -209,7 +198,7 @@
                 switch (err = rsp[CMD_STATUS_OFFSET])
                     {
                     case HCI_CMD_SUCCESS:
-                        ALOGI("%s: Download Packet successfully!", __FUNCTION__);
+                        ALOGV("%s: Download Packet successfully!", __FUNCTION__);
                         break;
                     case PATCH_LEN_ERROR:
                         ALOGI("%s: Invalid patch length argument passed for EDL PATCH "
@@ -239,12 +228,6 @@
                 *(build_label+build_lbl_len) = '\0';
 
                 ALOGI("BT SoC FW SU Build info: %s, %d", build_label, build_lbl_len);
-                if (NULL != (btversionfile = fopen(BT_VERSION_FILEPATH, "a+b"))) {
-                    fprintf(btversionfile, "Bluetooth Contoller SU Build info  : %s\n", build_label);
-                    fclose(btversionfile);
-                } else {
-                    ALOGI("Failed to dump  FW SU build info. Errno:%d", errno);
-                }
             break;
             case EDL_BOARD_ID_RESPONSE:
                 ALOGI("%s: board id %x %x!!", __FUNCTION__, rsp[6], rsp[7]);
@@ -482,7 +465,7 @@
             cmd[9]  = EXTRACT_BYTE(p_base_addr, 3);
             memcpy(&cmd[10], (pdata_buffer + offset), size);
 
-            ALOGD("%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes",
+            ALOGV("%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes",
                 __FUNCTION__, size);
             ALOGV("HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t"
                 "0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2],
@@ -504,7 +487,7 @@
             segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
             break;
         case EDL_PATCH_TLV_REQ_CMD:
-            ALOGD("%s: Sending EDL_PATCH_TLV_REQ_CMD", __FUNCTION__);
+            ALOGV("%s: Sending EDL_PATCH_TLV_REQ_CMD", __FUNCTION__);
             /* Parameter Total Length */
             cmd[3] = size +2;
 
@@ -994,7 +977,7 @@
         }
     }
 
-    ALOGI("%s: Successfully downloaded patch segment: %d", __FUNCTION__, index);
+    ALOGV("%s: Successfully downloaded patch segment: %d", __FUNCTION__, index);
     return err;
 }
 
diff --git a/msm8998/libbt-vendor/Android.mk b/msm8998/libbt-vendor/Android.mk
index f69700f..9cc65cf 100644
--- a/msm8998/libbt-vendor/Android.mk
+++ b/msm8998/libbt-vendor/Android.mk
@@ -27,13 +27,14 @@
         src/hci_uart.c \
         src/hci_smd.c \
         src/hw_rome.c \
-        src/hw_ar3k.c \
-        src/bt_vendor_persist.cpp
+        src/hw_ar3k.c
 
+ifneq ($(TARGET_USES_AOSP),true)
 #Disable this flag in case if FM over UART support not needed
 ifeq ($(QCOM_BT_FM_OVER_UART),true)
 LOCAL_CFLAGS := -DFM_OVER_UART
 endif
+endif
 
 ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
 LOCAL_CFLAGS += -DPANIC_ON_SOC_CRASH
@@ -63,8 +64,7 @@
 
 LOCAL_SHARED_LIBRARIES := \
         libcutils \
-        liblog \
-        libbtnv
+        liblog
 
 LOCAL_MODULE := libbt-vendor
 LOCAL_MODULE_TAGS := optional
@@ -78,7 +78,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
 endif
 
-LOCAL_CFLAGS += -DBT_NV_SUPPORT
+#LOCAL_CFLAGS += -DBT_NV_SUPPORT
 
 ifneq ($(BOARD_ANT_WIRELESS_DEVICE),)
 LOCAL_CFLAGS += -DENABLE_ANT
diff --git a/msm8998/libbt-vendor/src/bt_vendor_qcom.c b/msm8998/libbt-vendor/src/bt_vendor_qcom.c
index 2d4d689..5573935 100644
--- a/msm8998/libbt-vendor/src/bt_vendor_qcom.c
+++ b/msm8998/libbt-vendor/src/bt_vendor_qcom.c
@@ -348,7 +348,7 @@
            //Filter should have been started OR in the process of initializing
            //Make sure of hci_filter_status and return the state based on it
        } else {
-
+           property_set("wc_transport.clean_up","0");
            property_set("wc_transport.hci_filter_status", "0");
            property_set(BT_VND_FILTER_START, "true");
            ALOGV("%s: %s set to true ", __func__, BT_VND_FILTER_START );
@@ -627,7 +627,7 @@
 
     temp->rfkill_id = -1;
     temp->enable_extldo = FALSE;
-    temp->cb = cb;
+    temp->cb = (bt_vendor_callbacks_t*)cb;
     temp->ant_fd = -1;
     temp->soc_type = get_bt_soc_type();
     soc_init(temp->soc_type);
@@ -731,7 +731,7 @@
 }
 
 /* flavor of op without locks */
-static int __op(bt_vendor_opcode_t opcode, void *param)
+static int op(bt_vendor_opcode_t opcode, void *param)
 {
     int retval = BT_STATUS_SUCCESS;
     int nCnt = 0;
@@ -957,12 +957,14 @@
                                      ignore_boot_prop = TRUE;
                                 }
 #endif //READ_BT_ADDR_FROM_PROP
+#ifdef BT_NV_SUPPORT
                                     /* Always read BD address from NV file */
                                 if(ignore_boot_prop && !bt_vendor_nv_read(1, q->bdaddr))
                                 {
                                    /* Since the BD address is configured in boot time We should not be here */
                                    ALOGI("Failed to read BD address. Use the one from bluedroid stack/ftm");
                                 }
+#endif //BT_NV_SUPPORT
                                 if(rome_soc_init(fd, (char*)q->bdaddr)<0) {
                                     retval = -1;
                                 } else {
@@ -1039,7 +1041,11 @@
                             retval = start_hci_filter();
                             if (retval < 0) {
                                 ALOGE("WCNSS_FILTER wouldn't have started in time\n");
-
+                                /*
+                                 Set the following property to -1 so that the SSR cleanup routine
+                                 can reset SOC.
+                                 */
+                                property_set("wc_transport.hci_filter_status", "-1");
                             } else {
 #ifdef ENABLE_ANT
                                 if (is_ant_req) {
@@ -1285,28 +1291,14 @@
     return retval;
 }
 
-static int op(bt_vendor_opcode_t opcode, void *param)
-{
-    int ret;
-    ALOGV("++%s", __FUNCTION__);
-    pthread_mutex_lock(&q_lock);
-    if (!q) {
-        ALOGE("op called with NULL context");
-        ret = -BT_STATUS_INVAL;
-        goto out;
-    }
-    ret = __op(opcode, param);
-out:
-    pthread_mutex_unlock(&q_lock);
-    ALOGV("--%s ret = 0x%x", __FUNCTION__, ret);
-    return ret;
-}
-
 static void ssr_cleanup(int reason)
 {
     int pwr_state = BT_VND_PWR_OFF;
     int ret;
     unsigned char trig_ssr = 0xEE;
+#ifndef ENABLE_ANT
+    (void)reason;  // unused
+#endif
 
     ALOGI("++%s", __FUNCTION__);
 
@@ -1338,22 +1330,22 @@
         }
 
         /* Close both ANT channel */
-        __op(BT_VND_OP_ANT_USERIAL_CLOSE, NULL);
+        op(BT_VND_OP_ANT_USERIAL_CLOSE, NULL);
 #endif
         /* Close both BT channel */
-        __op(BT_VND_OP_USERIAL_CLOSE, NULL);
+        op(BT_VND_OP_USERIAL_CLOSE, NULL);
 
 #ifdef FM_OVER_UART
-        __op(BT_VND_OP_FM_USERIAL_CLOSE, NULL);
+        op(BT_VND_OP_FM_USERIAL_CLOSE, NULL);
 #endif
         /*CTRL OFF twice to make sure hw
          * turns off*/
 #ifdef ENABLE_ANT
-        __op(BT_VND_OP_POWER_CTRL, &pwr_state);
+        op(BT_VND_OP_POWER_CTRL, &pwr_state);
 #endif
     }
     /*Generally switching of chip should be enough*/
-    __op(BT_VND_OP_POWER_CTRL, &pwr_state);
+    op(BT_VND_OP_POWER_CTRL, &pwr_state);
 
 out:
     pthread_mutex_unlock(&q_lock);
@@ -1458,6 +1450,5 @@
     sizeof(bt_vendor_interface_t),
     init,
     op,
-    cleanup,
-    ssr_cleanup
+    cleanup
 };
diff --git a/msm8998/libbt-vendor/src/hw_ar3k.c b/msm8998/libbt-vendor/src/hw_ar3k.c
index a5d73e2..1a68aab 100644
--- a/msm8998/libbt-vendor/src/hw_ar3k.c
+++ b/msm8998/libbt-vendor/src/hw_ar3k.c
@@ -50,6 +50,7 @@
 #include <string.h>
 
 #include "bt_hci_bdroid.h"
+#include "bt_vendor_qcom.h"
 #include "hci_uart.h"
 #include "hw_ar3k.h"
 #include "bt_vendor_qcom.h"
diff --git a/msm8998/libbt-vendor/src/hw_rome.c b/msm8998/libbt-vendor/src/hw_rome.c
index ccfb137..57a41d4 100644
--- a/msm8998/libbt-vendor/src/hw_rome.c
+++ b/msm8998/libbt-vendor/src/hw_rome.c
@@ -54,8 +54,6 @@
 #include "hci_uart.h"
 #include "hw_rome.h"
 
-#define BT_VERSION_FILEPATH "/data/misc/bluedroid/bt_fw_version.txt"
-
 #ifdef __cplusplus
 }
 #endif
@@ -181,15 +179,6 @@
                                                 rsp[PATCH_SOC_VER_OFFSET]  ));
                 }
 
-                if (NULL != (btversionfile = fopen(BT_VERSION_FILEPATH, "wb"))) {
-                    fprintf(btversionfile, "Bluetooth Controller Product ID    : 0x%08x\n", productid);
-                    fprintf(btversionfile, "Bluetooth Controller Patch Version : 0x%04x\n", patchversion);
-                    fprintf(btversionfile, "Bluetooth Controller Build Version : 0x%04x\n", buildversion);
-                    fprintf(btversionfile, "Bluetooth Controller SOC Version   : 0x%08x\n", soc_id);
-                    fclose(btversionfile);
-                }else {
-                    ALOGI("Failed to dump SOC version info. Errno:%d", errno);
-                }
                 /* Rome Chipset Version can be decided by Patch version and SOC version,
                 Upper 2 bytes will be used for Patch version and Lower 2 bytes will be
                 used for SOC as combination for BT host driver */
@@ -231,12 +220,6 @@
                 *(build_label+build_lbl_len) = '\0';
 
                 ALOGI("BT SoC FW SU Build info: %s, %d", build_label, build_lbl_len);
-                if (NULL != (btversionfile = fopen(BT_VERSION_FILEPATH, "a+b"))) {
-                    fprintf(btversionfile, "Bluetooth Contoller SU Build info  : %s\n", build_label);
-                    fclose(btversionfile);
-                } else {
-                    ALOGI("Failed to dump  FW SU build info. Errno:%d", errno);
-                }
             break;
         }
         break;