summaryrefslogtreecommitdiffstats
path: root/hci/src/hci_hal_mct.c
diff options
context:
space:
mode:
authorSrinu Jella <sjella@codeaurora.org>2015-09-21 19:29:50 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:22:19 -0600
commit13f3c2e0b68a4d4f15330dbcac78aafae4c07aac (patch)
tree9eed93f7180dd00f2a27a8f37348305ada0b6896 /hci/src/hci_hal_mct.c
parent30245df6d0e2e06aa797d38339d59078b6635dc8 (diff)
downloadandroid_system_bt-13f3c2e0b68a4d4f15330dbcac78aafae4c07aac.tar.gz
android_system_bt-13f3c2e0b68a4d4f15330dbcac78aafae4c07aac.tar.bz2
android_system_bt-13f3c2e0b68a4d4f15330dbcac78aafae4c07aac.zip
Bluetooth: Add support to send h/w error event
- Bluedroid stack needs to be reset whenever H/w chip restarts like Subsytem restart. - Emulates the hardware error event on detecting SSR event from PR controller. CRs-Fixed: 914079 Change-Id: I9248a4e6ad689fc590fd4fd0f7a067cd33bf314f
Diffstat (limited to 'hci/src/hci_hal_mct.c')
-rw-r--r--hci/src/hci_hal_mct.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/hci/src/hci_hal_mct.c b/hci/src/hci_hal_mct.c
index 9b3707c7f..adc17c3ad 100644
--- a/hci/src/hci_hal_mct.c
+++ b/hci/src/hci_hal_mct.c
@@ -32,6 +32,11 @@
#define HCI_HAL_SERIAL_BUFFER_SIZE 1026
+#ifdef QCOM_WCN_SSR
+#include <termios.h>
+#include <sys/ioctl.h>
+#endif
+
// Our interface and modules we import
static const hci_hal_t interface;
static const hci_hal_callbacks_t *callbacks;
@@ -125,6 +130,31 @@ static void hal_close() {
uart_fds[i] = INVALID_FD;
}
+#ifdef QCOM_WCN_SSR
+static bool hal_dev_in_reset()
+{
+ volatile int serial_bits;
+ bool dev_reset_done =0;
+ uint8_t retry_count = 0;
+ ioctl(uart_fds[CH_EVT], TIOCMGET, &serial_bits);
+ if (serial_bits & TIOCM_OUT2) {
+ while(serial_bits & TIOCM_OUT1) {
+ LOG_WARN("userial_device in reset \n");
+ sleep(2);
+ retry_count++;
+ ioctl(uart_fds[CH_EVT], TIOCMGET, &serial_bits);
+ if((serial_bits & TIOCM_OUT1))
+ dev_reset_done = 0;
+ else
+ dev_reset_done = 1;
+ if(retry_count == 6)
+ break;
+ }
+ }
+ return dev_reset_done;
+}
+#endif
+
static size_t read_data(serial_data_type_t type, uint8_t *buffer, size_t max_size, bool block) {
if (type == DATA_TYPE_ACL) {
return eager_reader_read(acl_stream, buffer, max_size, block);
@@ -196,6 +226,9 @@ static const hci_hal_t interface = {
read_data,
packet_finished,
transmit_data,
+#ifdef QCOM_WCN_SSR
+ hal_dev_in_reset
+#endif
};
const hci_hal_t *hci_hal_mct_get_interface() {