diff options
author | Kiran Kelageri <kirankelageri@codeaurora.org> | 2015-08-04 15:46:33 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:21:49 -0600 |
commit | 4a924fdcae4493b082295b76511d448456c5e36a (patch) | |
tree | fef44680c55ba85f3175fdb599da8eb23e27ddd0 /hci | |
parent | 273de486f3b1771be80b83ed30fa7df4449c7eab (diff) | |
download | android_system_bt-4a924fdcae4493b082295b76511d448456c5e36a.tar.gz android_system_bt-4a924fdcae4493b082295b76511d448456c5e36a.tar.bz2 android_system_bt-4a924fdcae4493b082295b76511d448456c5e36a.zip |
Bluetooth: Enable SSR.
Enabling SSR feature.
Change-Id: I26eab5b3a10ac7823ff5e9f2adc3bc187939c87e
Diffstat (limited to 'hci')
-rw-r--r-- | hci/include/bt_vendor_lib.h | 5 | ||||
-rw-r--r-- | hci/include/hci_layer.h | 5 | ||||
-rw-r--r-- | hci/include/vendor.h | 5 | ||||
-rw-r--r-- | hci/src/hci_layer.c | 19 | ||||
-rw-r--r-- | hci/src/vendor.c | 8 |
5 files changed, 41 insertions, 1 deletions
diff --git a/hci/include/bt_vendor_lib.h b/hci/include/bt_vendor_lib.h index 65d448bf4..e312ab8c4 100644 --- a/hci/include/bt_vendor_lib.h +++ b/hci/include/bt_vendor_lib.h @@ -343,6 +343,11 @@ typedef struct { /** Closes the interface */ void (*cleanup)(void); + + /** SSR cleanup is used in HW reset cases + * which would close all the client channels + * and turns off the chip*/ + void (*ssr_cleanup)(void); } bt_vendor_interface_t; diff --git a/hci/include/hci_layer.h b/hci/include/hci_layer.h index bdc468146..26841440d 100644 --- a/hci/include/hci_layer.h +++ b/hci/include/hci_layer.h @@ -98,6 +98,11 @@ typedef struct hci_t { // Send some data downward through the HCI layer void (*transmit_downward)(data_dispatcher_type_t type, void *data); + + /** SSR cleanup is used in HW reset cases + ** which would close all the client channels + ** and turns off the chip*/ + void (*ssr_cleanup)(void); } hci_t; const hci_t *hci_layer_get_interface(); diff --git a/hci/include/vendor.h b/hci/include/vendor.h index 3181e6221..ec948fe60 100644 --- a/hci/include/vendor.h +++ b/hci/include/vendor.h @@ -65,6 +65,11 @@ typedef struct vendor_t{ // Registers a callback for an asynchronous vendor-specific command. void (*set_callback)(vendor_async_opcode_t opcode, vendor_cb callback); + + /** SSR cleanup is used in HW reset cases + ** which would close all the client channels + ** and turns off the chip*/ + void (*ssr_cleanup) (void); } vendor_t; const vendor_t *vendor_get_interface(); diff --git a/hci/src/hci_layer.c b/hci/src/hci_layer.c index 5138ce6e1..0d1c62b92 100644 --- a/hci/src/hci_layer.c +++ b/hci/src/hci_layer.c @@ -44,6 +44,7 @@ #include "packet_fragmenter.h" #include "osi/include/reactor.h" #include "vendor.h" +#include "bt_target.h" // TODO(zachoverflow): remove this hack extern #include <hardware/bluetooth.h> @@ -162,6 +163,8 @@ static bool filter_incoming_event(BT_HDR *packet); static serial_data_type_t event_to_data_type(uint16_t event); static waiting_command_t *get_waiting_command(command_opcode_t opcode); +void ssr_cleanup (void); + // Module lifecycle functions static future_t *start_up(void) { @@ -517,7 +520,8 @@ static void command_timed_out(UNUSED_ATTR void *context) { } LOG_ERROR("%s restarting the bluetooth process.", __func__); - usleep(10000); + ssr_cleanup(); + usleep(20000); kill(getpid(), SIGKILL); } @@ -690,6 +694,18 @@ intercepted:; return true; } +/** SSR cleanup is used in HW reset cases +** which would close all the client channels +** and turns off the chip*/ +void ssr_cleanup (void) { + LOG_INFO("%s", __func__); + if (vendor != NULL) { + vendor->ssr_cleanup(); + } else { + LOG_ERROR("%s: vendor is NULL", __func__); + } +} + // Callback for the fragmenter to dispatch up a completely reassembled packet static void dispatch_reassembled(BT_HDR *packet) { // Events should already have been dispatched before this point @@ -758,6 +774,7 @@ static void init_layer_interface() { interface.transmit_command = transmit_command; interface.transmit_command_futured = transmit_command_futured; interface.transmit_downward = transmit_downward; + interface.ssr_cleanup = ssr_cleanup; interface_created = true; } } diff --git a/hci/src/vendor.c b/hci/src/vendor.c index 2e220e4a7..ccc0003d5 100644 --- a/hci/src/vendor.c +++ b/hci/src/vendor.c @@ -89,6 +89,13 @@ static void vendor_close(void) { lib_interface = NULL; lib_handle = NULL; } +void vendor_ssrcleanup(void) { + if (lib_interface) + lib_interface->ssr_cleanup(); + else + LOG_ERROR("%s lib_interface is NULL", __func__); + +} static int send_command(vendor_opcode_t opcode, void *param) { assert(lib_interface != NULL); @@ -204,6 +211,7 @@ static const vendor_t interface = { send_command, send_async_command, set_callback, + vendor_ssrcleanup }; const vendor_t *vendor_get_interface() { |