From 9dfdd473dcd5a208bca9bc56a9a3c9220ef82d72 Mon Sep 17 00:00:00 2001 From: Ahmed ElArabawy Date: Fri, 2 Mar 2018 14:32:02 -0800 Subject: [PATCH] WiFi: Vendor HAL function to wait for driver ready This commit adds a vendor hal function to wait for the driver to be ready. This ensures the driver is ready for operatin before framework starts to use it Bug: 73482286 Test: Manual test (reboot and make sure wifi comes up consistently) Test: The reboot test has been performed more than 10 times in a row Test: Also, tested toggling wifi off/on then rebooted, wifi starts fine Change-Id: I31bc594525762454b0c2f491486ffe575843c858 Signed-off-by: Ahmed ElArabawy --- include/hardware_legacy/wifi_hal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 6c14aaa..ab343c7 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -106,6 +106,17 @@ typedef struct wifi_interface_info *wifi_interface_handle; /* Initialize/Cleanup */ wifi_error wifi_initialize(wifi_handle *handle); + +/** + * wifi_wait_for_driver + * Function should block until the driver is ready to proceed. + * Any errors from this function is considered fatal & will fail the HAL startup sequence. + * + * on success returns WIFI_SUCCESS + * on failure returns WIFI_ERROR_TIMED_OUT + */ +wifi_error wifi_wait_for_driver_ready(void); + typedef void (*wifi_cleaned_up_handler) (wifi_handle handle); void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler); void wifi_event_loop(wifi_handle handle); @@ -267,6 +278,7 @@ typedef struct wlan_driver_wake_reason_cnt_t { //wifi HAL function pointer table typedef struct { wifi_error (* wifi_initialize) (wifi_handle *); + wifi_error (* wifi_wait_for_driver_ready) (void); void (* wifi_cleanup) (wifi_handle, wifi_cleaned_up_handler); void (*wifi_event_loop)(wifi_handle); void (* wifi_get_error_info) (wifi_error , const char **);