qcacmn: Initial version of coex component
Add initial set of coex files, implement the basic functions.
Coex component is used to process coex related configurations.
CRs-Fixed: 2565088
Change-Id: I8b9600809691b808f97c621cb329a6ab9941814c
diff --git a/init_deinit/dispatcher/src/dispatcher_init_deinit.c b/init_deinit/dispatcher/src/dispatcher_init_deinit.c
index df71a65..0781988 100644
--- a/init_deinit/dispatcher/src/dispatcher_init_deinit.c
+++ b/init_deinit/dispatcher/src/dispatcher_init_deinit.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -72,6 +72,10 @@
#include <wlan_cfr_utils_api.h>
#endif
+#ifdef FEATURE_COEX
+#include <wlan_coex_utils_api.h>
+#endif
+
/**
* DOC: This file provides various init/deinit trigger point for new
* components.
@@ -707,6 +711,50 @@
}
#endif /* WLAN_SUPPORT_FILS */
+#ifdef FEATURE_COEX
+static QDF_STATUS dispatcher_coex_init(void)
+{
+ return wlan_coex_init();
+}
+
+static QDF_STATUS dispatcher_coex_deinit(void)
+{
+ return wlan_coex_deinit();
+}
+
+static QDF_STATUS dispatcher_coex_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+ return wlan_coex_psoc_open(psoc);
+}
+
+static QDF_STATUS dispatcher_coex_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+ return wlan_coex_psoc_close(psoc);
+}
+#else
+static inline QDF_STATUS dispatcher_coex_init(void)
+{
+ return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS dispatcher_coex_deinit(void)
+{
+ return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS
+dispatcher_coex_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+ return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS
+dispatcher_coex_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+ return QDF_STATUS_SUCCESS;
+}
+#endif /* FEATURE_COEX */
+
QDF_STATUS dispatcher_init(void)
{
if (QDF_STATUS_SUCCESS != wlan_objmgr_global_obj_init())
@@ -772,6 +820,9 @@
if (QDF_STATUS_SUCCESS != dispatcher_init_cfr())
goto cfr_init_fail;
+ if (QDF_STATUS_SUCCESS != dispatcher_coex_init())
+ goto coex_init_fail;
+
/*
* scheduler INIT has to be the last as each component's
* initialization has to happen first and then at the end
@@ -783,6 +834,8 @@
return QDF_STATUS_SUCCESS;
scheduler_init_fail:
+ dispatcher_coex_deinit();
+coex_init_fail:
dispatcher_deinit_cfr();
cfr_init_fail:
wlan_cmn_mlme_deinit();
@@ -836,6 +889,8 @@
QDF_BUG(QDF_STATUS_SUCCESS == scheduler_deinit());
+ QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_coex_deinit());
+
QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_cfr());
QDF_BUG(QDF_STATUS_SUCCESS == wlan_cmn_mlme_deinit());
@@ -924,8 +979,13 @@
if (QDF_STATUS_SUCCESS != dispatcher_ftm_psoc_open(psoc))
goto ftm_psoc_open_fail;
+ if (QDF_STATUS_SUCCESS != dispatcher_coex_psoc_open(psoc))
+ goto coex_psoc_open_fail;
+
return QDF_STATUS_SUCCESS;
+coex_psoc_open_fail:
+ dispatcher_ftm_psoc_close(psoc);
ftm_psoc_open_fail:
son_psoc_close(psoc);
psoc_son_fail:
@@ -946,6 +1006,8 @@
QDF_STATUS dispatcher_psoc_close(struct wlan_objmgr_psoc *psoc)
{
+ QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_coex_psoc_close(psoc));
+
QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_ftm_psoc_close(psoc));
QDF_BUG(QDF_STATUS_SUCCESS == son_psoc_close(psoc));
diff --git a/target_if/coex/inc/target_if_coex.h b/target_if/coex/inc/target_if_coex.h
new file mode 100644
index 0000000..d496efa
--- /dev/null
+++ b/target_if/coex/inc/target_if_coex.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: contains coex target if declarations
+ */
+#ifndef __TARGET_IF_COEX_H__
+#define __TARGET_IF_COEX_H__
+
+#include <target_if.h>
+
+/**
+ * target_if_coex_register_tx_ops() - Register coex target_if tx ops
+ * @tx_ops: pointer to target if tx ops
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
+ */
+QDF_STATUS
+target_if_coex_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
+#endif
diff --git a/target_if/coex/src/target_if_coex.c b/target_if/coex/src/target_if_coex.c
new file mode 100644
index 0000000..6dd3c70
--- /dev/null
+++ b/target_if/coex/src/target_if_coex.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: contains coex target if functions
+ */
+#include <wlan_coex_main.h>
+#include <target_if_coex.h>
+
+static QDF_STATUS
+target_if_coex_config_send(struct wlan_objmgr_pdev *pdev,
+ struct coex_config_params *param)
+{
+ wmi_unified_t pdev_wmi_handle;
+
+ pdev_wmi_handle = GET_WMI_HDL_FROM_PDEV(pdev);
+ if (!pdev_wmi_handle) {
+ coex_err("Invalid PDEV WMI handle");
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ return wmi_unified_send_coex_config_cmd(pdev_wmi_handle, param);
+}
+
+QDF_STATUS
+target_if_coex_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
+{
+ struct wlan_lmac_if_coex_tx_ops *coex_ops;
+
+ if (!tx_ops) {
+ coex_err("target if tx ops is NULL!");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ coex_ops = &tx_ops->coex_ops;
+ coex_ops->coex_config_send = target_if_coex_config_send;
+
+ return QDF_STATUS_SUCCESS;
+}
diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c
index f860f59..a37f721 100644
--- a/target_if/core/src/target_if_main.c
+++ b/target_if/core/src/target_if_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -80,6 +80,10 @@
#endif
#include <target_if_vdev_mgr_tx_ops.h>
+#ifdef FEATURE_COEX
+#include <target_if_coex.h>
+#endif
+
static struct target_if_ctx *g_target_if_ctx;
struct target_if_ctx *target_if_get_ctx()
@@ -338,6 +342,20 @@
}
#endif
+#ifdef FEATURE_COEX
+static QDF_STATUS
+target_if_coex_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
+{
+ return target_if_coex_register_tx_ops(tx_ops);
+}
+#else
+static inline QDF_STATUS
+target_if_coex_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
+{
+ return QDF_STATUS_SUCCESS;
+}
+#endif
+
static void target_if_target_tx_ops_register(
struct wlan_lmac_if_tx_ops *tx_ops)
{
@@ -441,6 +459,8 @@
target_if_vdev_mgr_tx_ops_register(tx_ops);
+ target_if_coex_tx_ops_register(tx_ops);
+
/* Converged UMAC components to register their TX-ops here */
return QDF_STATUS_SUCCESS;
}
diff --git a/umac/cmn_services/inc/wlan_cmn.h b/umac/cmn_services/inc/wlan_cmn.h
index 42e516d..494a0c0 100644
--- a/umac/cmn_services/inc/wlan_cmn.h
+++ b/umac/cmn_services/inc/wlan_cmn.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -272,6 +272,7 @@
* @WLAN_UMAC_COMP_FWOL FW Offload
* @WLAN_UMAC_COMP_INTEROP_ISSUES_AP interop issues ap component
* @WLAN_UMAC_COMP_BLACKLIST_MGR: Blacklist mgr component
+ * @WLAN_UMAC_COMP_COEX: Coex config component
* @WLAN_UMAC_COMP_ID_MAX: Maximum components in UMAC
*
* This id is static.
@@ -311,6 +312,7 @@
WLAN_UMAC_COMP_CFR = 30,
WLAN_UMAC_COMP_INTEROP_ISSUES_AP = 31,
WLAN_UMAC_COMP_BLACKLIST_MGR = 32,
+ WLAN_UMAC_COMP_COEX = 33,
WLAN_UMAC_COMP_ID_MAX,
};
diff --git a/umac/coex/core/inc/wlan_coex_main.h b/umac/coex/core/inc/wlan_coex_main.h
new file mode 100644
index 0000000..23cf0fb
--- /dev/null
+++ b/umac/coex/core/inc/wlan_coex_main.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains declarations for coex core functions
+ */
+
+#ifndef _WLAN_COEX_MAIN_API_H_
+#define _WLAN_COEX_MAIN_API_H_
+
+#ifdef FEATURE_COEX
+#include "wlan_coex_ucfg_api.h"
+#include "wmi_unified_param.h"
+#include "wlan_objmgr_psoc_obj.h"
+#include "wlan_objmgr_vdev_obj.h"
+
+#define coex_err(params...) \
+ QDF_TRACE_ERROR(QDF_MODULE_ID_COEX, params)
+#define coex_info(params...) \
+ QDF_TRACE_INFO(QDF_MODULE_ID_COEX, params)
+#define coex_debug(params...) \
+ QDF_TRACE_DEBUG(QDF_MODULE_ID_COEX, params)
+
+/**
+ * struct coex_psoc_obj - coex object definition
+ * @coex_config_updated: callback functions for each config type, which will
+ * be called when config is updated.
+ */
+struct coex_psoc_obj {
+ update_coex_cb coex_config_updated[COEX_CONFIG_TYPE_MAX];
+};
+
+/**
+ * wlan_psoc_get_coex_obj() - private API to get coex object from psoc
+ * @psoc: psoc object
+ *
+ * Return: coex object
+ */
+#define wlan_psoc_get_coex_obj(psoc) \
+ wlan_psoc_get_coex_obj_fl(psoc, __func__, __LINE__)
+
+static inline struct coex_psoc_obj *
+wlan_psoc_get_coex_obj_fl(struct wlan_objmgr_psoc *psoc,
+ const char *func, uint32_t line)
+{
+ struct coex_psoc_obj *psoc_obj;
+
+ psoc_obj = (struct coex_psoc_obj *)
+ wlan_objmgr_psoc_get_comp_private_obj(psoc,
+ WLAN_UMAC_COMP_COEX);
+ if (!psoc_obj) {
+ coex_err("%s:%u, Failed to get coex psoc object", func, line);
+ return NULL;
+ }
+ return psoc_obj;
+}
+
+/**
+ * wlan_coex_psoc_init() - API to initialize coex component
+ * @psoc: soc context
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_coex_psoc_init(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * wlan_coex_psoc_deinit() - API to deinitialize coex component
+ * @psoc: soc context
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_coex_psoc_deinit(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * wlan_coex_config_send() - private API to send coex config
+ * @vdev: pointer to vdev object
+ * @param: parameters of coex config
+ *
+ * Return: status of operation
+ */
+QDF_STATUS wlan_coex_config_send(struct wlan_objmgr_vdev *vdev,
+ struct coex_config_params *param);
+
+/**
+ * wlan_coex_config_updated() - private API to notify that coex config
+ * is updated.
+ * @vdev: pointer to vdev object
+ * @type: type of coex config
+ *
+ * Return: status of operation
+ */
+QDF_STATUS
+wlan_coex_config_updated(struct wlan_objmgr_vdev *vdev, uint8_t type);
+
+/**
+ * wlan_coex_psoc_created_notification() - PSOC obj create callback
+ * @psoc: PSOC object
+ * @arg_list: Variable argument list
+ *
+ * This callback is registered with object manager during initialization to
+ * get notified when the object is created.
+ *
+ * Return: Success or Failure
+ */
+QDF_STATUS wlan_coex_psoc_created_notification(struct wlan_objmgr_psoc *psoc,
+ void *arg_list);
+
+/**
+ * wlan_coex_psoc_destroyed_notification() - PSOC obj delete callback
+ * @psoc: PSOC object
+ * @arg_list: Variable argument list
+ *
+ * This callback is registered with object manager during initialization to
+ * get notified when the object is deleted.
+ *
+ * Return: Success or Failure
+ */
+QDF_STATUS wlan_coex_psoc_destroyed_notification(struct wlan_objmgr_psoc *psoc,
+ void *arg_list);
+#endif
+#endif
diff --git a/umac/coex/core/src/wlan_coex_main.c b/umac/coex/core/src/wlan_coex_main.c
new file mode 100644
index 0000000..39bcb4e
--- /dev/null
+++ b/umac/coex/core/src/wlan_coex_main.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains definitions for coex core functions
+ */
+
+#include <wlan_coex_ucfg_api.h>
+#include <wlan_coex_tgt_api.h>
+#include <wlan_coex_main.h>
+
+QDF_STATUS wlan_coex_psoc_created_notification(struct wlan_objmgr_psoc *psoc,
+ void *arg_list)
+{
+ struct coex_psoc_obj *psoc_obj;
+ QDF_STATUS status;
+
+ psoc_obj = qdf_mem_malloc(sizeof(*psoc_obj));
+ if (!psoc_obj)
+ return QDF_STATUS_E_NOMEM;
+
+ /* Attach scan private date to psoc */
+ status = wlan_objmgr_psoc_component_obj_attach(psoc,
+ WLAN_UMAC_COMP_COEX,
+ psoc_obj,
+ QDF_STATUS_SUCCESS);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ coex_err("Failed to attach psoc coex component");
+ qdf_mem_free(psoc_obj);
+ } else {
+ coex_debug("Coex object attach to psoc successful");
+ }
+
+ return status;
+}
+
+QDF_STATUS wlan_coex_psoc_destroyed_notification(struct wlan_objmgr_psoc *psoc,
+ void *arg_list)
+{
+ void *psoc_obj;
+ QDF_STATUS status;
+
+ psoc_obj = wlan_psoc_get_coex_obj(psoc);
+ if (!psoc_obj)
+ return QDF_STATUS_E_FAILURE;
+
+ status = wlan_objmgr_psoc_component_obj_detach(psoc,
+ WLAN_UMAC_COMP_COEX,
+ psoc_obj);
+ if (QDF_IS_STATUS_ERROR(status))
+ coex_err("Failed to detach psoc coex component");
+
+ qdf_mem_free(psoc_obj);
+
+ return status;
+}
+
+QDF_STATUS
+wlan_coex_psoc_init(struct wlan_objmgr_psoc *psoc)
+{
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+wlan_coex_psoc_deinit(struct wlan_objmgr_psoc *psoc)
+{
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_coex_config_send(struct wlan_objmgr_vdev *vdev,
+ struct coex_config_params *param)
+{
+ QDF_STATUS status;
+
+ status = tgt_send_coex_config(vdev, param);
+ if (QDF_IS_STATUS_ERROR(status))
+ coex_err("failed to send coex config");
+
+ return status;
+}
+
+QDF_STATUS
+wlan_coex_config_updated(struct wlan_objmgr_vdev *vdev, uint8_t type)
+{
+ struct wlan_objmgr_psoc *psoc;
+ struct coex_psoc_obj *coex_obj;
+ QDF_STATUS status = QDF_STATUS_SUCCESS;
+
+ if (!vdev) {
+ coex_err("NULL vdev");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (type >= COEX_CONFIG_TYPE_MAX) {
+ coex_err("config type out of range: %d", type);
+ return QDF_STATUS_E_INVAL;
+ }
+
+ psoc = wlan_vdev_get_psoc(vdev);
+ if (!psoc) {
+ coex_err("NULL psoc");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ coex_obj = wlan_psoc_get_coex_obj(psoc);
+ if (!coex_obj)
+ return QDF_STATUS_E_INVAL;
+
+ if (coex_obj->coex_config_updated[type])
+ status = coex_obj->coex_config_updated[type](vdev);
+
+ return status;
+}
diff --git a/umac/coex/dispatcher/inc/wlan_coex_tgt_api.h b/umac/coex/dispatcher/inc/wlan_coex_tgt_api.h
new file mode 100644
index 0000000..452ce1b
--- /dev/null
+++ b/umac/coex/dispatcher/inc/wlan_coex_tgt_api.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains coex south bound interface definitions
+ */
+
+#ifndef _WLAN_COEX_TGT_API_H_
+#define _WLAN_COEX_TGT_API_H_
+
+#ifdef FEATURE_COEX
+struct coex_config_params;
+
+/**
+ * tgt_send_coex_config() - invoke target_if send coex config
+ * @vdev: vdev object
+ * @param: coex config parameters
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+tgt_send_coex_config(struct wlan_objmgr_vdev *vdev,
+ struct coex_config_params *param);
+#endif
+#endif
diff --git a/umac/coex/dispatcher/inc/wlan_coex_ucfg_api.h b/umac/coex/dispatcher/inc/wlan_coex_ucfg_api.h
new file mode 100644
index 0000000..498301f
--- /dev/null
+++ b/umac/coex/dispatcher/inc/wlan_coex_ucfg_api.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains coex north bound interface declarations
+ */
+
+#ifndef _WLAN_COEX_UCFG_API_H_
+#define _WLAN_COEX_UCFG_API_H_
+
+#include "qdf_status.h"
+#include <wlan_objmgr_vdev_obj.h>
+#include <wlan_objmgr_psoc_obj.h>
+
+/**
+ * enum coex_config_type - coex config type definitions
+ * @COEX_CONFIG_BTC_CHAIN_MODE: config BT coex chain mode
+ * @COEX_CONFIG_TYPE_MAX: max value
+ */
+enum coex_config_type {
+ COEX_CONFIG_BTC_CHAIN_MODE,
+ /* keep last */
+ COEX_CONFIG_TYPE_MAX,
+};
+
+/**
+ * typedef update_coex_cb() - cb to inform coex config
+ * @vdev: vdev pointer
+ *
+ * Return: void
+ */
+typedef QDF_STATUS (*update_coex_cb)(struct wlan_objmgr_vdev *vdev);
+
+#ifdef FEATURE_COEX
+/**
+ * ucfg_coex_register_cfg_updated_handler() - API to register coex config
+ * updated handler.
+ * @psoc: pointer to psoc object
+ * @type: type of coex config
+ * @handler: handler to be registered
+ *
+ * Return: status of operation
+ */
+QDF_STATUS
+ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
+ enum coex_config_type type,
+ update_coex_cb handler);
+#else
+static inline QDF_STATUS
+ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
+ enum coex_config_type type,
+ update_coex_cb handler)
+{
+ return QDF_STATUS_SUCCESS;
+}
+#endif
+#endif
diff --git a/umac/coex/dispatcher/inc/wlan_coex_utils_api.h b/umac/coex/dispatcher/inc/wlan_coex_utils_api.h
new file mode 100644
index 0000000..76bb68d
--- /dev/null
+++ b/umac/coex/dispatcher/inc/wlan_coex_utils_api.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_coex_utils_api.h
+ *
+ * This header file provides declaration of public APIs exposed to other UMAC
+ * components.
+ */
+
+#ifndef _WLAN_COEX_UTILS_API_H_
+#define _WLAN_COEX_UTILS_API_H_
+#include <wlan_objmgr_psoc_obj.h>
+
+/*
+ * wlan_coex_init() - Coex module initialization API
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS wlan_coex_init(void);
+
+/*
+ * wlan_coex_deinit() - Coex module deinitialization API
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS wlan_coex_deinit(void);
+
+/**
+ * wlan_coex_psoc_open() - Open coex component
+ * @psoc: soc context
+ *
+ * This function gets called when dispatcher opening.
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success
+ */
+QDF_STATUS
+wlan_coex_psoc_open(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * wlan_coex_psoc_close() - Close coex component
+ * @psoc: soc context
+ *
+ * This function gets called when dispatcher closing.
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success
+ */
+QDF_STATUS
+wlan_coex_psoc_close(struct wlan_objmgr_psoc *psoc);
+#endif
diff --git a/umac/coex/dispatcher/src/wlan_coex_tgt_api.c b/umac/coex/dispatcher/src/wlan_coex_tgt_api.c
new file mode 100644
index 0000000..4022a7c
--- /dev/null
+++ b/umac/coex/dispatcher/src/wlan_coex_tgt_api.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains coex south bound interface definitions
+ */
+
+#include <wlan_coex_main.h>
+#include <wlan_coex_tgt_api.h>
+#include <wlan_lmac_if_def.h>
+#include "wlan_objmgr_pdev_obj.h"
+
+static inline struct wlan_lmac_if_coex_tx_ops *
+wlan_psoc_get_coex_txops(struct wlan_objmgr_psoc *psoc)
+{
+ return &psoc->soc_cb.tx_ops.coex_ops;
+}
+
+static inline struct wlan_lmac_if_coex_tx_ops *
+wlan_vdev_get_coex_txops(struct wlan_objmgr_vdev *vdev)
+{
+ struct wlan_objmgr_psoc *psoc;
+
+ psoc = wlan_vdev_get_psoc(vdev);
+ if (!psoc) {
+ coex_err("NULL psoc");
+ return NULL;
+ }
+
+ return wlan_psoc_get_coex_txops(psoc);
+}
+
+QDF_STATUS
+tgt_send_coex_config(struct wlan_objmgr_vdev *vdev,
+ struct coex_config_params *param)
+{
+ struct wlan_lmac_if_coex_tx_ops *coex_ops;
+ struct wlan_objmgr_psoc *psoc;
+ struct wlan_objmgr_pdev *pdev;
+
+ if (!vdev) {
+ coex_err("NULL vdev");
+ return QDF_STATUS_E_NULL_VALUE;
+ }
+
+ psoc = wlan_vdev_get_psoc(vdev);
+ if (!psoc) {
+ coex_err("NULL psoc");
+ return QDF_STATUS_E_NULL_VALUE;
+ }
+
+ pdev = wlan_vdev_get_pdev(vdev);
+ if (!pdev) {
+ coex_err("NULL pdev");
+ return QDF_STATUS_E_NULL_VALUE;
+ }
+
+ coex_ops = wlan_psoc_get_coex_txops(psoc);
+ QDF_ASSERT(coex_ops->coex_config_send);
+ if (coex_ops->coex_config_send)
+ return coex_ops->coex_config_send(pdev, param);
+
+ return QDF_STATUS_SUCCESS;
+}
diff --git a/umac/coex/dispatcher/src/wlan_coex_ucfg_api.c b/umac/coex/dispatcher/src/wlan_coex_ucfg_api.c
new file mode 100644
index 0000000..fdf1f15
--- /dev/null
+++ b/umac/coex/dispatcher/src/wlan_coex_ucfg_api.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains coex north bound interface definitions
+ */
+
+#include <wlan_coex_main.h>
+#include <wlan_coex_ucfg_api.h>
+
+QDF_STATUS
+ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
+ enum coex_config_type type,
+ update_coex_cb handler)
+{
+ struct coex_psoc_obj *coex_obj;
+
+ if (type >= COEX_CONFIG_TYPE_MAX) {
+ coex_err("invalid coex type: %d", type);
+ return QDF_STATUS_E_INVAL;
+ }
+
+ coex_obj = wlan_psoc_get_coex_obj(psoc);
+ if (!coex_obj)
+ return QDF_STATUS_E_INVAL;
+
+ coex_obj->coex_config_updated[type] = handler;
+
+ return QDF_STATUS_SUCCESS;
+}
diff --git a/umac/coex/dispatcher/src/wlan_coex_utils_api.c b/umac/coex/dispatcher/src/wlan_coex_utils_api.c
new file mode 100644
index 0000000..3217878
--- /dev/null
+++ b/umac/coex/dispatcher/src/wlan_coex_utils_api.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_coex_utils_api.c
+ *
+ * This file provides definitions of public APIs exposed to other UMAC
+ * components.
+ */
+
+#include <wlan_coex_main.h>
+#include <wlan_objmgr_global_obj.h>
+#include <wlan_coex_utils_api.h>
+
+QDF_STATUS wlan_coex_init(void)
+{
+ QDF_STATUS status;
+
+ status = wlan_objmgr_register_psoc_create_handler(
+ WLAN_UMAC_COMP_COEX,
+ wlan_coex_psoc_created_notification, NULL);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ coex_err("Failed to register psoc create handler");
+ goto fail_create_psoc;
+ }
+
+ status = wlan_objmgr_register_psoc_destroy_handler(
+ WLAN_UMAC_COMP_COEX,
+ wlan_coex_psoc_destroyed_notification, NULL);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ coex_err("Failed to create psoc delete handler");
+ goto fail_psoc_destroy;
+ }
+
+ coex_debug("coex psoc create and delete handler registered");
+ return status;
+
+fail_psoc_destroy:
+ wlan_objmgr_unregister_psoc_create_handler(
+ WLAN_UMAC_COMP_COEX,
+ wlan_coex_psoc_created_notification, NULL);
+fail_create_psoc:
+ return status;
+}
+
+QDF_STATUS wlan_coex_deinit(void)
+{
+ QDF_STATUS status;
+
+ status = wlan_objmgr_unregister_psoc_destroy_handler(
+ WLAN_UMAC_COMP_COEX,
+ wlan_coex_psoc_destroyed_notification, NULL);
+ if (status != QDF_STATUS_SUCCESS)
+ coex_err("Failed to unregister psoc delete handler");
+
+ status = wlan_objmgr_unregister_psoc_create_handler(
+ WLAN_UMAC_COMP_COEX,
+ wlan_coex_psoc_created_notification, NULL);
+ if (status != QDF_STATUS_SUCCESS)
+ coex_err("Failed to unregister psoc create handler");
+
+ return status;
+}
+
+QDF_STATUS
+wlan_coex_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+ return wlan_coex_psoc_init(psoc);
+}
+
+QDF_STATUS
+wlan_coex_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+ return wlan_coex_psoc_deinit(psoc);
+}
diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h
index 2e8c7a8..15cf260 100644
--- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h
+++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@@ -912,6 +912,19 @@
};
#endif
+#ifdef FEATURE_COEX
+struct coex_config_params;
+
+/**
+ * struct wlan_lmac_if_coex_tx_ops - south bound tx function pointers for coex
+ * @coex_config_send: function pointer to send coex config to fw
+ */
+struct wlan_lmac_if_coex_tx_ops {
+ QDF_STATUS (*coex_config_send)(struct wlan_objmgr_pdev *pdev,
+ struct coex_config_params *param);
+};
+#endif
+
/**
* struct wlan_lmac_if_tx_ops - south bound tx function pointers
* @mgmt_txrx_tx_ops: mgmt txrx tx ops
@@ -919,9 +932,10 @@
* @dfs_tx_ops: dfs tx ops.
* @green_ap_tx_ops: green_ap tx_ops
* @cp_stats_tx_ops: cp stats tx_ops
+ * @coex_ops: coex tx_ops
*
* Callback function tabled to be registered with umac.
- * umac will use the functional table to send events/frames to lmac/wmi
+ * umac will use the functional table to send events/frames to wmi
*/
struct wlan_lmac_if_tx_ops {
@@ -990,6 +1004,10 @@
#endif
struct wlan_lmac_if_ftm_tx_ops ftm_tx_ops;
+
+#ifdef FEATURE_COEX
+ struct wlan_lmac_if_coex_tx_ops coex_ops;
+#endif
};
/**