summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSungJun Park <sjpark@codeaurora.org>2014-07-10 19:56:16 -0700
committerSungJun Park <sjpark@codeaurora.org>2014-07-11 10:57:51 -0700
commitd593e628392fadd54fe78fedc4aa9bb473977769 (patch)
tree22d52d3e416c195ffe70b89ff7c61b0f70b5f043
parentb0502dadb3feb7282109d8f6825b6a89f2398092 (diff)
downloadandroid_hardware_qcom_bt-d593e628392fadd54fe78fedc4aa9bb473977769.tar.gz
android_hardware_qcom_bt-d593e628392fadd54fe78fedc4aa9bb473977769.tar.bz2
android_hardware_qcom_bt-d593e628392fadd54fe78fedc4aa9bb473977769.zip
Bluetooth: Add get baudrate opcode
To optimize GKI dynamic memory allocation, it needs to control the memory allocation based on baudrate. So, add opcode to get baudrate from transport layer. CRs-Fixed: 690830 Change-Id: Iea2d1d2751f88e949a95c486a9d7a146a1cdb05e
-rw-r--r--libbt-vendor/src/bt_vendor_qcom.c19
-rw-r--r--libbt-vendor/src/hci_uart.c83
2 files changed, 102 insertions, 0 deletions
diff --git a/libbt-vendor/src/bt_vendor_qcom.c b/libbt-vendor/src/bt_vendor_qcom.c
index f00d09c..2c7a406 100644
--- a/libbt-vendor/src/bt_vendor_qcom.c
+++ b/libbt-vendor/src/bt_vendor_qcom.c
@@ -877,6 +877,25 @@ static int op(bt_vendor_opcode_t opcode, void *param)
#endif
}
break;
+ case BT_VND_OP_GET_LINESPEED:
+ {
+ retval = -1;
+ switch(btSocType)
+ {
+ case BT_SOC_ROME:
+ if(!is_soc_initialized()) {
+ ALOGE("BT_VND_OP_GET_LINESPEED: error"
+ " - transport driver not initialized!");
+ }else {
+ retval = 3000000;
+ }
+ break;
+ default:
+ retval = userial_vendor_get_baud();
+ break;
+ }
+ break;
+ }
}
return retval;
diff --git a/libbt-vendor/src/hci_uart.c b/libbt-vendor/src/hci_uart.c
index 52a84e2..1077fbf 100644
--- a/libbt-vendor/src/hci_uart.c
+++ b/libbt-vendor/src/hci_uart.c
@@ -106,6 +106,70 @@ uint8_t userial_to_tcio_baud(uint8_t cfg_baud, uint32_t *baud)
return TRUE;
}
+/*******************************************************************************
+**
+** Function userial_to_baud_tcio
+**
+** Description helper function converts TCIO baud rate into integer
+**
+** Returns uint32_t
+**
+*******************************************************************************/
+int userial_tcio_baud_to_int(uint32_t baud)
+{
+ int baud_rate =0;
+
+ switch (baud)
+ {
+ case B600:
+ baud_rate = 600;
+ break;
+ case B1200:
+ baud_rate = 1200;
+ break;
+ case B9600:
+ baud_rate = 9600;
+ break;
+ case B19200:
+ baud_rate = 19200;
+ break;
+ case B57600:
+ baud_rate = 57600;
+ break;
+ case B115200:
+ baud_rate = 115200;
+ break;
+ case B230400:
+ baud_rate = 230400;
+ break;
+ case B460800:
+ baud_rate = 460800;
+ break;
+ case B921600:
+ baud_rate = 921600;
+ break;
+ case B1000000:
+ baud_rate = 1000000;
+ break;
+ case B2000000:
+ baud_rate = 2000000;
+ break;
+ case B3000000:
+ baud_rate = 3000000;
+ break;
+ case B4000000:
+ baud_rate = 4000000;
+ break;
+ default:
+ ALOGE( "%s: unsupported baud %d", __FUNCTION__, baud);
+ break;
+ }
+
+ ALOGI( "%s: Current Baudrate = %d bps", __FUNCTION__, baud_rate);
+ return baud_rate;
+}
+
+
#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
/*******************************************************************************
**
@@ -293,7 +357,26 @@ void userial_vendor_set_baud(uint8_t userial_baud)
cfsetospeed(&vnd_userial.termios, tcio_baud);
cfsetispeed(&vnd_userial.termios, tcio_baud);
tcsetattr(vnd_userial.fd, TCSADRAIN, &vnd_userial.termios); /* don't change speed until last write done */
+}
+
+/*******************************************************************************
+**
+** Function userial_vendor_get_baud
+**
+** Description Get current baud rate
+**
+** Returns int
+**
+*******************************************************************************/
+int userial_vendor_get_baud(void)
+{
+ if (vnd_userial.fd == -1)
+ {
+ ALOGE( "%s: uart port(%s) has not been opened", __FUNCTION__, BT_HS_UART_DEVICE );
+ return -1;
+ }
+ return userial_tcio_baud_to_int(cfgetispeed(&vnd_userial.termios));
}
/*******************************************************************************