wlcore: abstract debugfs fw_stats to be handled by the lower drivers
[platform/kernel/linux-arm64.git] / drivers / net / wireless / ti / wlcore / acx.c
index 5912541..b9ec42c 100644 (file)
@@ -86,6 +86,7 @@ out:
        kfree(auth);
        return ret;
 }
+EXPORT_SYMBOL_GPL(wl1271_acx_sleep_auth);
 
 int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                        int power)
@@ -708,14 +709,14 @@ out:
        return ret;
 }
 
-int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats)
+int wl1271_acx_statistics(struct wl1271 *wl, void *stats)
 {
        int ret;
 
        wl1271_debug(DEBUG_ACX, "acx statistics");
 
        ret = wl1271_cmd_interrogate(wl, ACX_STATISTICS, stats,
-                                    sizeof(*stats));
+                                    wl->stats.fw_stats_len);
        if (ret < 0) {
                wl1271_warning("acx statistics failed: %d", ret);
                return -ENOMEM;
@@ -997,6 +998,7 @@ out:
        kfree(mem_conf);
        return ret;
 }
+EXPORT_SYMBOL_GPL(wl12xx_acx_mem_cfg);
 
 int wl1271_acx_init_mem_config(struct wl1271 *wl)
 {
@@ -1027,6 +1029,7 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(wl1271_acx_init_mem_config);
 
 int wl1271_acx_init_rx_interrupt(struct wl1271 *wl)
 {
@@ -1150,6 +1153,7 @@ out:
        kfree(acx);
        return ret;
 }
+EXPORT_SYMBOL_GPL(wl1271_acx_pm_config);
 
 int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                               bool enable)
@@ -1714,3 +1718,85 @@ out:
        return ret;
 
 }
+
+#ifdef CONFIG_PM
+/* Set the global behaviour of RX filters - On/Off + default action */
+int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable,
+                                       enum rx_filter_action action)
+{
+       struct acx_default_rx_filter *acx;
+       int ret;
+
+       wl1271_debug(DEBUG_ACX, "acx default rx filter en: %d act: %d",
+                    enable, action);
+
+       acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+       if (!acx)
+               return -ENOMEM;
+
+       acx->enable = enable;
+       acx->default_action = action;
+
+       ret = wl1271_cmd_configure(wl, ACX_ENABLE_RX_DATA_FILTER, acx,
+                                  sizeof(*acx));
+       if (ret < 0) {
+               wl1271_warning("acx default rx filter enable failed: %d", ret);
+               goto out;
+       }
+
+out:
+       kfree(acx);
+       return ret;
+}
+
+/* Configure or disable a specific RX filter pattern */
+int wl1271_acx_set_rx_filter(struct wl1271 *wl, u8 index, bool enable,
+                            struct wl12xx_rx_filter *filter)
+{
+       struct acx_rx_filter_cfg *acx;
+       int fields_size = 0;
+       int acx_size;
+       int ret;
+
+       WARN_ON(enable && !filter);
+       WARN_ON(index >= WL1271_MAX_RX_FILTERS);
+
+       wl1271_debug(DEBUG_ACX,
+                    "acx set rx filter idx: %d enable: %d filter: %p",
+                    index, enable, filter);
+
+       if (enable) {
+               fields_size = wl1271_rx_filter_get_fields_size(filter);
+
+               wl1271_debug(DEBUG_ACX, "act: %d num_fields: %d field_size: %d",
+                     filter->action, filter->num_fields, fields_size);
+       }
+
+       acx_size = ALIGN(sizeof(*acx) + fields_size, 4);
+       acx = kzalloc(acx_size, GFP_KERNEL);
+
+       if (!acx)
+               return -ENOMEM;
+
+       acx->enable = enable;
+       acx->index = index;
+
+       if (enable) {
+               acx->num_fields = filter->num_fields;
+               acx->action = filter->action;
+               wl1271_rx_filter_flatten_fields(filter, acx->fields);
+       }
+
+       wl1271_dump(DEBUG_ACX, "RX_FILTER: ", acx, acx_size);
+
+       ret = wl1271_cmd_configure(wl, ACX_SET_RX_DATA_FILTER, acx, acx_size);
+       if (ret < 0) {
+               wl1271_warning("setting rx filter failed: %d", ret);
+               goto out;
+       }
+
+out:
+       kfree(acx);
+       return ret;
+}
+#endif /* CONFIG_PM */