1 /* 2 * Copyright (c) 2019-2021 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 #include "cfg_ucfg_api.h" 27 28 struct psoc_mlme_obj *wlan_psoc_mlme_get_cmpt_obj(struct wlan_objmgr_psoc *psoc) 29 { 30 struct psoc_mlme_obj *psoc_mlme; 31 32 psoc_mlme = wlan_objmgr_psoc_get_comp_private_obj(psoc, 33 WLAN_UMAC_COMP_MLME); 34 if (!psoc_mlme) { 35 mlme_err("PSOC MLME component object is NULL"); 36 return NULL; 37 } 38 39 return psoc_mlme; 40 } 41 42 qdf_export_symbol(wlan_psoc_mlme_get_cmpt_obj); 43 44 mlme_psoc_ext_t *wlan_psoc_mlme_get_ext_hdl(struct wlan_objmgr_psoc *psoc) 45 { 46 struct psoc_mlme_obj *psoc_mlme; 47 48 psoc_mlme = wlan_psoc_mlme_get_cmpt_obj(psoc); 49 if (psoc_mlme) 50 return psoc_mlme->ext_psoc_ptr; 51 52 return NULL; 53 } 54 55 qdf_export_symbol(wlan_psoc_mlme_get_ext_hdl); 56 57 void wlan_psoc_mlme_set_ext_hdl(struct psoc_mlme_obj *psoc_mlme, 58 mlme_psoc_ext_t *psoc_ext_hdl) 59 { 60 psoc_mlme->ext_psoc_ptr = psoc_ext_hdl; 61 } 62 63 void wlan_psoc_set_phy_config(struct wlan_objmgr_psoc *psoc, 64 struct psoc_phy_config *phy_config) 65 { 66 struct psoc_mlme_obj *mlme_psoc_obj; 67 struct psoc_phy_config *config; 68 69 if (!phy_config) { 70 mlme_err("phy_config is NUll"); 71 return; 72 } 73 mlme_psoc_obj = wlan_psoc_mlme_get_cmpt_obj(psoc); 74 if (!mlme_psoc_obj) 75 return; 76 77 config = &mlme_psoc_obj->psoc_cfg.phy_config; 78 79 qdf_mem_copy(config, phy_config, sizeof(*config)); 80 } 81 82 static void mlme_init_cfg(struct wlan_objmgr_psoc *psoc) 83 { 84 struct psoc_mlme_obj *mlme_psoc_obj; 85 86 mlme_psoc_obj = wlan_psoc_mlme_get_cmpt_obj(psoc); 87 88 if (!mlme_psoc_obj) 89 return; 90 91 wlan_cm_init_score_config(psoc, &mlme_psoc_obj->psoc_cfg.score_config); 92 mlme_psoc_obj->psoc_cfg.phy_config.max_chan_switch_ie = 93 cfg_get(psoc, CFG_MLME_MAX_CHAN_SWITCH_IE_ENABLE); 94 } 95 96 QDF_STATUS mlme_psoc_open(struct wlan_objmgr_psoc *psoc) 97 { 98 mlme_init_cfg(psoc); 99 100 return QDF_STATUS_SUCCESS; 101 } 102 103 QDF_STATUS mlme_psoc_close(struct wlan_objmgr_psoc *psoc) 104 { 105 return QDF_STATUS_SUCCESS; 106 } 107 108 qdf_export_symbol(wlan_psoc_mlme_set_ext_hdl); 109