qcacmn: Converge the Spectral feature

Add Spectral TxOps and RxOps interfaces in
psoc towards converging the Spectral feature.

CRs-Fixed: 2028657
Change-Id: If5b46fb9d71529060df6e5b242fcc8976fce82f8
diff --git a/umac/cmn_services/inc/wlan_cmn.h b/umac/cmn_services/inc/wlan_cmn.h
index 2cc452e..f86e5a6 100644
--- a/umac/cmn_services/inc/wlan_cmn.h
+++ b/umac/cmn_services/inc/wlan_cmn.h
@@ -111,6 +111,7 @@
  * @WLAN_UMAC_COMP_CRYPTO:        CRYPTO
  * @WLAN_UMAC_COMP_NAN:           Neighbor Aware Networking
  * @WLAN_UMAC_COMP_DFS:           DFS
+ * @WLAN_UMAC_COMP_SPECTRAL:      Spectral
  * @WLAN_UMAC_COMP_ID_MAX:        Maximum components in UMAC
  * @WLAN_UMAC_COMP_OFFCHAN_TXRX:  Offchan TxRx
  *
@@ -136,6 +137,7 @@
 	WLAN_UMAC_COMP_DFS,
 	WLAN_UMAC_COMP_OFFCHAN_TXRX,
 	WLAN_UMAC_COMP_SON,
+	WLAN_UMAC_COMP_SPECTRAL,
 	WLAN_UMAC_COMP_ID_MAX,
 };
 
diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h
index 88573ac..5add6c4 100644
--- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h
+++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h
@@ -176,6 +176,7 @@
  * @WLAN_REGULATORY_SB_ID:      SB regulatory operations
  * @WLAN_REGULATORY_NB_ID:      NB regulatory operations
  * @WLAN_POLICY_MGR_ID:         Policy Manager operations
+ * @WLAN_SPECTRAL_ID:           Spectral operations
  * @WLAN_REF_ID_MAX:            Max id used to generate ref count tracking array
  */
  /* New value added to the enum must also be reflected in function
@@ -209,6 +210,7 @@
 	WLAN_POLICY_MGR_ID    = 24,
 	WLAN_SON_ID           = 25,
 	WLAN_SA_API_ID        = 26,
+	WLAN_SPECTRAL_ID      = 27,
 	WLAN_REF_ID_MAX,
 } wlan_objmgr_ref_dbgid;
 
@@ -246,6 +248,7 @@
 					"WLAN_REGULATORY_SB_ID",
 					"WLAN_REGULATORY_NB_ID",
 					"WLAN_SON_ID",
+					"WLAN_SPECTRAL_ID",
 					"WLAN_REF_ID_MAX" };
 
     return (char *)strings[id];
diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c
index 5ca3772..a65a0bb 100644
--- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c
+++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c
@@ -113,6 +113,7 @@
 	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_register_psoc_create_handler);
 
 QDF_STATUS wlan_objmgr_unregister_psoc_create_handler(
 		enum wlan_umac_comp_id id,
@@ -139,6 +140,7 @@
 	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_unregister_psoc_create_handler);
 
 QDF_STATUS wlan_objmgr_register_psoc_destroy_handler(
 		enum wlan_umac_comp_id id,
@@ -165,6 +167,7 @@
 	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_register_psoc_destroy_handler);
 
 QDF_STATUS wlan_objmgr_unregister_psoc_destroy_handler(
 		enum wlan_umac_comp_id id,
@@ -191,6 +194,7 @@
 	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_unregister_psoc_destroy_handler);
 
 QDF_STATUS wlan_objmgr_register_psoc_status_handler(
 		enum wlan_umac_comp_id id,
@@ -270,6 +274,7 @@
 	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_register_pdev_create_handler);
 
 QDF_STATUS wlan_objmgr_unregister_pdev_create_handler(
 		enum wlan_umac_comp_id id,
@@ -296,6 +301,7 @@
 	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_unregister_pdev_create_handler);
 
 QDF_STATUS wlan_objmgr_register_pdev_destroy_handler(
 		enum wlan_umac_comp_id id,
@@ -322,6 +328,7 @@
 	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_register_pdev_destroy_handler);
 
 QDF_STATUS wlan_objmgr_unregister_pdev_destroy_handler(
 		enum wlan_umac_comp_id id,
@@ -348,6 +355,7 @@
 	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_unregister_pdev_destroy_handler);
 
 QDF_STATUS wlan_objmgr_register_pdev_status_handler(
 		enum wlan_umac_comp_id id,
diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c
index d65ee49..a9e49ec 100644
--- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c
+++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c
@@ -288,6 +288,7 @@
 	}
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_pdev_component_obj_attach);
 
 QDF_STATUS wlan_objmgr_pdev_component_obj_detach(
 		struct wlan_objmgr_pdev *pdev,
@@ -355,6 +356,7 @@
 	}
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_pdev_component_obj_detach);
 
 /**
  ** APIs to operations on pdev objects
diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c
index b2ee683..baca628 100644
--- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c
+++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c
@@ -311,6 +311,7 @@
 
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_psoc_component_obj_attach);
 
 QDF_STATUS wlan_objmgr_psoc_component_obj_detach(
 		struct wlan_objmgr_psoc *psoc,
@@ -382,6 +383,7 @@
 
 	return QDF_STATUS_SUCCESS;
 }
+EXPORT_SYMBOL(wlan_objmgr_psoc_component_obj_detach);
 
 QDF_STATUS wlan_objmgr_iterate_obj_list(
 		struct wlan_objmgr_psoc *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 d6679d0..59a6bbc 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
@@ -37,6 +37,9 @@
 #ifdef WLAN_SA_API_ENABLE
 #include "wlan_sa_api_utils_defs.h"
 #endif
+#ifdef WLAN_CONV_SPECTRAL_ENABLE
+#include "wlan_spectral_public_structs.h"
+#endif
 #include <reg_services_public_struct.h>
 
 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
@@ -398,6 +401,58 @@
 
 #endif
 
+#ifdef WLAN_CONV_SPECTRAL_ENABLE
+/**
+ * struct wlan_lmac_if_sptrl_tx_ops - Spectral south bound Tx operations
+ * @sptrlto_spectral_init:          Initialize LMAC/target_if Spectral
+ * @sptrlto_spectral_deinit:        De-initialize LMAC/target_if Spectral
+ * @sptrlto_set_spectral_config:    Set Spectral configuration
+ * @sptrlto_get_spectral_config:    Get Spectral configuration
+ * @sptrlto_start_spectral_scan:    Start Spectral Scan
+ * @sptrlto_stop_spectral_scan:     Stop Spectral Scan
+ * @sptrlto_is_spectral_active:     Get whether Spectral is active
+ * @sptrlto_is_spectral_enabled:    Get whether Spectral is enabled
+ * @sptrlto_set_icm_active:         Set whether ICM is active or inactive
+ * @sptrlto_get_icm_active:         Get whether ICM is active or inactive
+ * @sptrlto_get_nominal_nf:         Get Nominal Noise Floor for the current
+ *                                  frequency band
+ * @sptrlto_set_debug_level:        Set Spectral debug level
+ * @sptrlto_get_debug_level:        Get Spectral debug level
+ * @sptrlto_get_chaninfo:           Get channel information
+ * @sptrlto_clear_chaninfo:         Clear channel information
+ * @sptrlto_get_spectral_capinfo:   Get Spectral capability information
+ * @sptrlto_get_spectral_diagstats: Get Spectral diagnostic statistics
+ **/
+struct wlan_lmac_if_sptrl_tx_ops {
+	void * (*sptrlto_pdev_spectral_init)(struct wlan_objmgr_pdev *pdev);
+	void (*sptrlto_pdev_spectral_deinit)(struct wlan_objmgr_pdev *pdev);
+	int (*sptrlto_set_spectral_config)(struct wlan_objmgr_pdev *pdev,
+					   const u_int32_t threshtype,
+					   const u_int32_t value);
+	void (*sptrlto_get_spectral_config)(struct wlan_objmgr_pdev *pdev,
+					    struct spectral_config *sptrl_config
+					    );
+	int (*sptrlto_start_spectral_scan)(struct wlan_objmgr_pdev *pdev);
+	void (*sptrlto_stop_spectral_scan)(struct wlan_objmgr_pdev *pdev);
+	bool (*sptrlto_is_spectral_active)(struct wlan_objmgr_pdev *pdev);
+	bool (*sptrlto_is_spectral_enabled)(struct wlan_objmgr_pdev *pdev);
+	int (*sptrlto_set_icm_active)(struct wlan_objmgr_pdev *pdev,
+				      bool isactive);
+	bool (*sptrlto_get_icm_active)(struct wlan_objmgr_pdev *pdev);
+	int16_t (*sptrlto_get_nominal_nf)(struct wlan_objmgr_pdev *pdev);
+	int (*sptrlto_set_debug_level)(struct wlan_objmgr_pdev *pdev,
+				       u_int32_t debug_level);
+	u_int32_t (*sptrlto_get_debug_level)(struct wlan_objmgr_pdev *pdev);
+	void (*sptrlto_get_chaninfo)(struct wlan_objmgr_pdev *pdev,
+				     void *outdata);
+	void (*sptrlto_clear_chaninfo)(struct wlan_objmgr_pdev *pdev);
+	void (*sptrlto_get_spectral_capinfo)(struct wlan_objmgr_pdev *pdev,
+					     void *outdata);
+	void (*sptrlto_get_spectral_diagstats)(struct wlan_objmgr_pdev *pdev,
+					       void *outdata);
+};
+#endif /* WLAN_CONV_SPECTRAL_ENABLE */
+
 #ifdef WIFI_POS_CONVERGED
 /*
  * struct wlan_lmac_if_wifi_pos_tx_ops - structure of firmware tx function
@@ -593,6 +648,10 @@
 	struct wlan_lmac_if_sa_api_tx_ops sa_api_tx_ops;
 #endif
 
+#ifdef WLAN_CONV_SPECTRAL_ENABLE
+	struct wlan_lmac_if_sptrl_tx_ops sptrl_tx_ops;
+#endif
+
 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
 	struct wlan_lmac_if_crypto_tx_ops crypto_tx_ops;
 #endif
@@ -815,6 +874,19 @@
 };
 #endif
 
+#ifdef WLAN_CONV_SPECTRAL_ENABLE
+/**
+ * struct wlan_lmac_if_sptrl_rx_ops - Spectral south bound Rx operations
+ *
+ * @sptrl_send_phydata:        Send Spectral PHY Data
+ * @sptrlro_get_target_handle: Get Spectral handle for target/LMAC private data
+ */
+struct wlan_lmac_if_sptrl_rx_ops {
+	int (*sptrlro_send_phydata)(struct wlan_objmgr_pdev *pdev,
+				    struct sock *sock, qdf_nbuf_t nbuf);
+	void * (*sptrlro_get_target_handle)(struct wlan_objmgr_pdev *pdev);
+};
+#endif /* WLAN_CONV_SPECTRAL_ENABLE */
 
 #ifdef WIFI_POS_CONVERGED
 /**
@@ -1010,6 +1082,11 @@
 #ifdef WLAN_SA_API_ENABLE
 	struct wlan_lmac_if_sa_api_rx_ops sa_api_rx_ops;
 #endif
+
+#ifdef WLAN_CONV_SPECTRAL_ENABLE
+	struct wlan_lmac_if_sptrl_rx_ops sptrl_rx_ops;
+#endif
+
 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
 	struct wlan_lmac_if_crypto_rx_ops crypto_rx_ops;
 #endif