[APR-1563] wlbt: HAL changes for wifi low latency mode
authorAbhishek Chaudhary <ab.chaudhary@samsung.com>
Wed, 31 Jul 2019 10:39:43 +0000 (16:09 +0530)
committerKim Gunho <gunho.kim@samsung.com>
Mon, 9 Sep 2019 08:01:26 +0000 (17:01 +0900)
When Wi-Fi Low latency lock is enabled:
- PS will be disabled
- Soft roam will be disabled

Change-Id: I4efbcb8eac4c442a36214875af6f10007ae4efa9
SCSC-Bug-Id: HOST-10487
Signed-off-by: Abhishek Chaudhary <ab.chaudhary@samsung.com>
common.h
wifi_hal.cpp

index c100b4d13972617ccaa4c40958965555d610066a..2ebf763f99b3b7650c19203291f23bacd53398a8 100755 (executable)
--- a/common.h
+++ b/common.h
@@ -156,6 +156,7 @@ typedef enum {
     SLSI_NL80211_VENDOR_SUBCMD_CONFIGURE_ND_OFFLOAD,
     SLSI_NL80211_VENDOR_SUBCMD_GET_ROAMING_CAPABILITIES,
     SLSI_NL80211_VENDOR_SUBCMD_SET_ROAMING_STATE,
+    SLSI_NL80211_VENDOR_SUBCMD_SET_LATENCY_MODE,
 
     SLSI_NL80211_VENDOR_SUBCMD_NAN_ENABLE = ANDROID_NL80211_SUBCMD_NAN_RANGE_START,
     SLSI_NL80211_VENDOR_SUBCMD_NAN_DISABLE,
index d48e81466b8e96e3c659127dce261706a35b2cbf..6e0ab1c94a99be0051c2f76755147c2e82241543 100755 (executable)
@@ -40,6 +40,7 @@
 #define FEATURE_SET_MATRIX           1
 #define ATTR_NODFS_VALUE             3
 #define ATTR_COUNTRY_CODE            4
+#define ATTR_LOW_LATENCY_MODE        5
 
 static int internal_no_seq_check(nl_msg *msg, void *arg);
 static int internal_valid_message_handler(nl_msg *msg, void *arg);
@@ -408,6 +409,7 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn)
     fn->wifi_get_packet_filter_capabilities = wifi_get_packet_filter_capabilities;
     fn->wifi_set_packet_filter = wifi_set_packet_filter;
     fn->wifi_read_packet_filter = wifi_read_packet_filter;
+    fn->wifi_set_latency_mode = wifi_set_latency_mode;
 
     return WIFI_SUCCESS;
 }
@@ -1059,7 +1061,33 @@ protected:
 
 };
 
+class SetLatencyLockCommand : public WifiCommand {
+private:
+    wifi_latency_mode mMode;
+public:
+    SetLatencyLockCommand(wifi_interface_handle handle, wifi_latency_mode mode)
+        : WifiCommand(handle, 0) {
+        mMode = mode;
+    }
+    virtual int create() {
+        int ret;
+
+        ret = mMsg.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_LATENCY_MODE);
+        if (ret < 0) {
+             ALOGE("Can't create message to send to driver - %d", ret);
+             return ret;
+        }
 
+        nlattr *data = mMsg.attr_start(NL80211_ATTR_VENDOR_DATA);
+        ret = mMsg.put_u8(ATTR_LOW_LATENCY_MODE, mMode);
+        if (ret < 0) {
+            return ret;
+        }
+
+        mMsg.attr_end(data);
+        return WIFI_SUCCESS;
+    }
+};
 
 static int wifi_get_multicast_id(wifi_handle handle, const char *name, const char *group)
 {
@@ -1218,6 +1246,9 @@ wifi_error wifi_set_country_code(wifi_interface_handle handle, const char *count
     return (wifi_error) command.requestResponse();
 }
 
-
+wifi_error wifi_set_latency_mode(wifi_interface_handle handle, wifi_latency_mode mode) {
+    SetLatencyLockCommand cmd(handle, mode);
+    return (wifi_error) cmd.requestResponse();
+}
 /////////////////////////////////////////////////////////////////////////////