summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-11-15 03:57:23 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-11-15 03:57:23 -0800
commit56318c7d03b1ee828f042c37434aa5cabe28ef7f (patch)
tree0b92ee2778e5b7336774df4ecb26db47f2786536
parentde1a0b4f00aad17995abd7def4a76b4bbdf58f3b (diff)
parentd12f05bdaf9e00bc9a89915e51967407f5340ba8 (diff)
downloadandroid_hardware_qcom_bt-56318c7d03b1ee828f042c37434aa5cabe28ef7f.tar.gz
android_hardware_qcom_bt-56318c7d03b1ee828f042c37434aa5cabe28ef7f.tar.bz2
android_hardware_qcom_bt-56318c7d03b1ee828f042c37434aa5cabe28ef7f.zip
Merge "Bluetooth: Optimize Bluetooth turn ON time"
-rwxr-xr-xlibbt-vendor/include/hw_rome.h9
-rw-r--r--libbt-vendor/src/hw_rome.c96
2 files changed, 90 insertions, 15 deletions
diff --git a/libbt-vendor/include/hw_rome.h b/libbt-vendor/include/hw_rome.h
index 405622a..040336e 100755
--- a/libbt-vendor/include/hw_rome.h
+++ b/libbt-vendor/include/hw_rome.h
@@ -163,6 +163,12 @@
#define ROME_3_1_FW_SU "bprm.cnss.3.1"
#define ROME_3_2_FW_SU "btfwp.cnss.3.2"
+/* This header value in rampatch file decides event handling mechanism in the HOST */
+#define ROME_SKIP_EVT_NONE 0x00
+#define ROME_SKIP_EVT_VSE 0x01
+#define ROME_SKIP_EVT_CC 0x02
+#define ROME_SKIP_EVT_VSE_CC 0x03
+
/******************************************************************************
** Local type definitions
******************************************************************************/
@@ -186,7 +192,8 @@ typedef struct {
unsigned int tlv_patch_data_len;
unsigned char sign_ver;
unsigned char sign_algorithm;
- unsigned short reserved1;
+ unsigned char dwnd_cfg;
+ unsigned char reserved1;
unsigned short prod_id;
unsigned short build_ver;
unsigned short patch_ver;
diff --git a/libbt-vendor/src/hw_rome.c b/libbt-vendor/src/hw_rome.c
index d612831..b1e9bb8 100644
--- a/libbt-vendor/src/hw_rome.c
+++ b/libbt-vendor/src/hw_rome.c
@@ -68,12 +68,14 @@ unsigned char *pdata_buffer = NULL;
patch_info rampatch_patch_info;
int rome_ver = ROME_VER_UNKNOWN;
unsigned char gTlv_type;
+unsigned char gTlv_dwndCfg;
static unsigned int wipower_flag = 0;
static unsigned int wipower_handoff_ready = 0;
char *rampatch_file_path;
char *nvm_file_path;
char *fw_su_info = NULL;
extern char enable_extldo;
+unsigned char wait_vsc_evt = TRUE;
/******************************************************************************
** Extern variables
@@ -335,14 +337,16 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size)
goto failed;
}
- /* Check for response from the Controller */
- if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) {
- ret = -ETIMEDOUT;
- ALOGI("%s: Failed to get HCI-VS Event from SOC", __FUNCTION__);
- goto failed;
+ if (wait_vsc_evt) {
+ /* Check for response from the Controller */
+ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) {
+ ret = -ETIMEDOUT;
+ ALOGI("%s: Failed to get HCI-VS Event from SOC", __FUNCTION__);
+ goto failed;
+ }
+ ALOGI("%s: Received HCI-Vendor Specific Event from SOC", __FUNCTION__);
}
- ALOGI("%s: Received HCI-Vendor Specific Event from SOC", __FUNCTION__);
failed:
return ret;
}
@@ -782,6 +786,7 @@ int rome_get_tlv_file(char *file_path)
/* To handle different event between rampatch and NVM */
gTlv_type = ptlv_header->tlv_type;
+ gTlv_dwndCfg = ptlv_header->tlv.patch.dwnd_cfg;
if(ptlv_header->tlv_type == TLV_TYPE_PATCH){
ALOGI("====================================================");
@@ -793,6 +798,7 @@ int rome_get_tlv_file(char *file_path)
ALOGI("Patch Data Length\t\t\t : %d bytes",ptlv_header->tlv.patch.tlv_patch_data_len);
ALOGI("Signing Format Version\t : 0x%x", ptlv_header->tlv.patch.sign_ver);
ALOGI("Signature Algorithm\t\t : 0x%x", ptlv_header->tlv.patch.sign_algorithm);
+ ALOGI("Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg);
ALOGI("Reserved\t\t\t : 0x%x", ptlv_header->tlv.patch.reserved1);
ALOGI("Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id);
ALOGI("Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver);
@@ -913,19 +919,81 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
ALOGI("%s: TLV size: %d, Total Seg num: %d, remain size: %d",
__FUNCTION__,tlv_size, total_segment, remain_size);
+ if (gTlv_type == TLV_TYPE_PATCH) {
+ /* Prior to Rome version 3.2(including inital few rampatch release of Rome 3.2), the event
+ * handling mechanism is ROME_SKIP_EVT_NONE. After few release of rampatch for Rome 3.2, the
+ * mechamism is changed to ROME_SKIP_EVT_VSE_CC. Rest of the mechanism is not used for now
+ */
+ switch(gTlv_dwndCfg)
+ {
+ case ROME_SKIP_EVT_NONE:
+ wait_vsc_evt = TRUE;
+ wait_cc_evt = TRUE;
+ ALOGI("Event handling type: ROME_SKIP_EVT_NONE");
+ break;
+ case ROME_SKIP_EVT_VSE_CC:
+ wait_vsc_evt = FALSE;
+ wait_cc_evt = FALSE;
+ ALOGI("Event handling type: ROME_SKIP_EVT_VSE_CC");
+ break;
+ /* Not handled for now */
+ case ROME_SKIP_EVT_VSE:
+ case ROME_SKIP_EVT_CC:
+ default:
+ ALOGE("Unsupported Event handling: %d", gTlv_dwndCfg);
+ break;
+ }
+ } else {
+ wait_vsc_evt = TRUE;
+ wait_cc_evt = TRUE;
+ }
+
for(i=0;i<total_segment ;i++){
- /* In case of ROME 1.1, last rampatch segment command will not wait for
- command complete event */
- wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH )
- && !remain_size && ((i+1) == total_segment))? FALSE: TRUE;
+ if ((i+1) == total_segment) {
+ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ /* If the Rome version is from 1.1 to 3.1
+ * 1. No CCE for the last command segment but all other segment
+ * 2. All the command segments get VSE including the last one
+ */
+ wait_cc_evt = !remain_size ? FALSE: TRUE;
+ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ /* If the Rome version is 3.2
+ * 1. None of the command segments receive CCE
+ * 2. No command segments receive VSE except the last one
+ * 3. If gTlv_dwndCfg is ROME_SKIP_EVT_NONE then the logic is
+ * same as Rome 2.1, 2.2, 3.0
+ */
+ if (gTlv_dwndCfg == ROME_SKIP_EVT_NONE) {
+ wait_cc_evt = !remain_size ? FALSE: TRUE;
+ } else if (gTlv_dwndCfg == ROME_SKIP_EVT_VSE_CC) {
+ wait_vsc_evt = !remain_size ? TRUE: FALSE;
+ }
+ }
+ }
+
if((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0)
goto error;
}
- /* In case remain data still remain, last rampatch segment command will not wait
- for command complete event here */
- wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH )
- && remain_size )? FALSE:TRUE;
+ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ /* If the Rome version is from 1.1 to 3.1
+ * 1. No CCE for the last command segment but all other segment
+ * 2. All the command segments get VSE including the last one
+ */
+ wait_cc_evt = remain_size ? FALSE: TRUE;
+ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ /* If the Rome version is 3.2
+ * 1. None of the command segments receive CCE
+ * 2. No command segments receive VSE except the last one
+ * 3. If gTlv_dwndCfg is ROME_SKIP_EVT_NONE then the logic is
+ * same as Rome 2.1, 2.2, 3.0
+ */
+ if (gTlv_dwndCfg == ROME_SKIP_EVT_NONE) {
+ wait_cc_evt = remain_size ? FALSE: TRUE;
+ } else if (gTlv_dwndCfg == ROME_SKIP_EVT_VSE_CC) {
+ wait_vsc_evt = remain_size ? TRUE: FALSE;
+ }
+ }
if(remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt);