xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlme/psoc_mgr/dispatcher/src/wlan_psoc_mlme_api.c (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 /*
2  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: Implements PSOC MLME public APIs
19  */
20 
21 #include <wlan_objmgr_psoc_obj.h>
22 #include <wlan_mlme_dbg.h>
23 #include <include/wlan_psoc_mlme.h>
24 #include <wlan_psoc_mlme_api.h>
25 #include <qdf_module.h>
26 
27 struct psoc_mlme_obj *wlan_psoc_mlme_get_cmpt_obj(struct wlan_objmgr_psoc *psoc)
28 {
29 	struct psoc_mlme_obj *psoc_mlme;
30 
31 	psoc_mlme = wlan_objmgr_psoc_get_comp_private_obj(psoc,
32 							  WLAN_UMAC_COMP_MLME);
33 	if (!psoc_mlme) {
34 		mlme_err("PSOC MLME component object is NULL");
35 		return NULL;
36 	}
37 
38 	return psoc_mlme;
39 }
40 
41 qdf_export_symbol(wlan_psoc_mlme_get_cmpt_obj);
42 
43 mlme_psoc_ext_t *wlan_psoc_mlme_get_ext_hdl(struct wlan_objmgr_psoc *psoc)
44 {
45 	struct psoc_mlme_obj *psoc_mlme;
46 
47 	psoc_mlme = wlan_psoc_mlme_get_cmpt_obj(psoc);
48 	if (psoc_mlme)
49 		return psoc_mlme->ext_psoc_ptr;
50 
51 	return NULL;
52 }
53 
54 qdf_export_symbol(wlan_psoc_mlme_get_ext_hdl);
55 
56 void wlan_psoc_mlme_set_ext_hdl(struct psoc_mlme_obj *psoc_mlme,
57 				mlme_psoc_ext_t *psoc_ext_hdl)
58 {
59 	psoc_mlme->ext_psoc_ptr = psoc_ext_hdl;
60 }
61 
62 void wlan_psoc_set_phy_config(struct wlan_objmgr_psoc *psoc,
63 			      struct psoc_phy_config *phy_config)
64 {
65 	struct psoc_mlme_obj *mlme_psoc_obj;
66 	struct psoc_phy_config *config;
67 
68 	if (!phy_config) {
69 		mlme_err("phy_config is NUll");
70 		return;
71 	}
72 	mlme_psoc_obj = wlan_psoc_mlme_get_cmpt_obj(psoc);
73 	if (!mlme_psoc_obj)
74 		return;
75 
76 	config = &mlme_psoc_obj->psoc_cfg.phy_config;
77 
78 	qdf_mem_copy(config, phy_config, sizeof(*config));
79 }
80 
81 static void mlme_init_cfg(struct wlan_objmgr_psoc *psoc)
82 {
83 	struct psoc_mlme_obj *mlme_psoc_obj;
84 
85 	mlme_psoc_obj = wlan_psoc_mlme_get_cmpt_obj(psoc);
86 
87 	if (!mlme_psoc_obj)
88 		return;
89 
90 	wlan_cm_init_score_config(psoc, &mlme_psoc_obj->psoc_cfg.score_config);
91 }
92 
93 QDF_STATUS mlme_psoc_open(struct wlan_objmgr_psoc *psoc)
94 {
95 	mlme_init_cfg(psoc);
96 
97 	return QDF_STATUS_SUCCESS;
98 }
99 
100 QDF_STATUS mlme_psoc_close(struct wlan_objmgr_psoc *psoc)
101 {
102 	return QDF_STATUS_SUCCESS;
103 }
104 
105 qdf_export_symbol(wlan_psoc_mlme_set_ext_hdl);
106