wl18xx: add time sync configuration api
authorGuy Mishol <guym@ti.com>
Wed, 24 Aug 2016 11:35:27 +0000 (14:35 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 3 Sep 2016 17:02:34 +0000 (20:02 +0300)
Add time sync configuration api.
The new api allows to configure the synchronization
mode (STA/AP/MESH) and (in case of Mesh mode) the
master address of each zone.

Signed-off-by: Guy Mishol <guym@ti.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ti/wl18xx/acx.c
drivers/net/wireless/ti/wl18xx/acx.h
drivers/net/wireless/ti/wl18xx/event.c
drivers/net/wireless/ti/wlcore/wlcore.h

index 4be0409308cb6f2a9d315b7ed77d2150f65ad6f0..b5525a38264b45d9b7b25a0db75f682764cb5a43 100644 (file)
@@ -309,3 +309,32 @@ out:
        kfree(acx);
        return ret;
 }
+
+int wl18xx_acx_time_sync_cfg(struct wl1271 *wl)
+{
+       struct acx_time_sync_cfg *acx;
+       int ret;
+
+       wl1271_debug(DEBUG_ACX, "acx time sync cfg: mode %d, addr: %pM",
+                    wl->conf.sg.params[WL18XX_CONF_SG_TIME_SYNC],
+                    wl->zone_master_mac_addr);
+
+       acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+       if (!acx) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       acx->sync_mode = wl->conf.sg.params[WL18XX_CONF_SG_TIME_SYNC];
+       memcpy(acx->zone_mac_addr, wl->zone_master_mac_addr, ETH_ALEN);
+
+       ret = wl1271_cmd_configure(wl, ACX_TIME_SYNC_CFG,
+                                  acx, sizeof(*acx));
+       if (ret < 0) {
+               wl1271_warning("acx time sync cfg failed: %d", ret);
+               goto out;
+       }
+out:
+       kfree(acx);
+       return ret;
+}
index 342a2993ef986c3342c02b34188ff4cc5f0fd5be..2edbbbfd8421ccae157d0354bf493cb243377645 100644 (file)
@@ -37,6 +37,7 @@ enum {
        ACX_RX_BA_FILTER                 = 0x0058,
        ACX_AP_SLEEP_CFG                 = 0x0059,
        ACX_DYNAMIC_TRACES_CFG           = 0x005A,
+       ACX_TIME_SYNC_CFG                = 0x005B,
 };
 
 /* numbers of bits the length field takes (add 1 for the actual number) */
@@ -388,6 +389,17 @@ struct acx_dynamic_fw_traces_cfg {
        __le32 dynamic_fw_traces;
 } __packed;
 
+/*
+ * ACX_TIME_SYNC_CFG
+ * configure the time sync parameters
+ */
+struct acx_time_sync_cfg {
+       struct acx_header header;
+       u8 sync_mode;
+       u8 zone_mac_addr[ETH_ALEN];
+       u8 padding[1];
+} __packed;
+
 int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap,
                                  u32 sdio_blk_size, u32 extra_mem_blks,
                                  u32 len_field_size);
@@ -402,5 +414,6 @@ int wl18xx_acx_interrupt_notify_config(struct wl1271 *wl, bool action);
 int wl18xx_acx_rx_ba_filter(struct wl1271 *wl, bool action);
 int wl18xx_acx_ap_sleep(struct wl1271 *wl);
 int wl18xx_acx_dynamic_fw_traces(struct wl1271 *wl);
+int wl18xx_acx_time_sync_cfg(struct wl1271 *wl);
 
 #endif /* __WL18XX_ACX_H__ */
index 2c5df43b8ed91100a13bb4441783ca043632bba8..b36ce185c9f22740add5056aec16858ae1ee9783 100644 (file)
@@ -22,6 +22,7 @@
 #include <net/genetlink.h>
 #include "event.h"
 #include "scan.h"
+#include "conf.h"
 #include "../wlcore/cmd.h"
 #include "../wlcore/debug.h"
 #include "../wlcore/vendor_cmd.h"
index 8f28aa02230cb559efb3cf478af76ebd5d0e75c1..1827546ba8075778b893d8b7b3521ec61e239703 100644 (file)
@@ -501,6 +501,9 @@ struct wl1271 {
 
        /* dynamic fw traces */
        u32 dynamic_fw_traces;
+
+       /* time sync zone master */
+       u8 zone_master_mac_addr[ETH_ALEN];
 };
 
 int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev);