1*5113495bSYour Name /* 2*5113495bSYour Name * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. 3*5113495bSYour Name * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. 4*5113495bSYour Name * 5*5113495bSYour Name * 6*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for 7*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the 8*5113495bSYour Name * above copyright notice and this permission notice appear in all 9*5113495bSYour Name * copies. 10*5113495bSYour Name * 11*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 12*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 13*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 14*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 15*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 16*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 17*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 18*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE. 19*5113495bSYour Name */ 20*5113495bSYour Name 21*5113495bSYour Name #ifndef _SPECTRAL_DEFS_I_H_ 22*5113495bSYour Name #define _SPECTRAL_DEFS_I_H_ 23*5113495bSYour Name 24*5113495bSYour Name #include <wlan_objmgr_cmn.h> 25*5113495bSYour Name #include <wlan_objmgr_global_obj.h> 26*5113495bSYour Name #include <wlan_objmgr_psoc_obj.h> 27*5113495bSYour Name #include <wlan_objmgr_pdev_obj.h> 28*5113495bSYour Name #include <wlan_objmgr_vdev_obj.h> 29*5113495bSYour Name #include <qdf_list.h> 30*5113495bSYour Name #include <qdf_timer.h> 31*5113495bSYour Name #include <qdf_util.h> 32*5113495bSYour Name #include <wlan_spectral_public_structs.h> 33*5113495bSYour Name #include <wlan_spectral_utils_api.h> 34*5113495bSYour Name #include <spectral_ioctl.h> 35*5113495bSYour Name 36*5113495bSYour Name #define spectral_fatal(format, args...) \ 37*5113495bSYour Name QDF_TRACE_FATAL(QDF_MODULE_ID_SPECTRAL, format, ## args) 38*5113495bSYour Name #define spectral_err(format, args...) \ 39*5113495bSYour Name QDF_TRACE_ERROR(QDF_MODULE_ID_SPECTRAL, format, ## args) 40*5113495bSYour Name #define spectral_warn(format, args...) \ 41*5113495bSYour Name QDF_TRACE_WARN(QDF_MODULE_ID_SPECTRAL, format, ## args) 42*5113495bSYour Name #define spectral_info(format, args...) \ 43*5113495bSYour Name QDF_TRACE_INFO(QDF_MODULE_ID_SPECTRAL, format, ## args) 44*5113495bSYour Name #define spectral_debug(format, args...) \ 45*5113495bSYour Name QDF_TRACE_DEBUG(QDF_MODULE_ID_SPECTRAL, format, ## args) 46*5113495bSYour Name 47*5113495bSYour Name #define spectral_fatal_nofl(format, args...) \ 48*5113495bSYour Name QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 49*5113495bSYour Name #define spectral_err_nofl(format, args...) \ 50*5113495bSYour Name QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 51*5113495bSYour Name #define spectral_warn_nofl(format, args...) \ 52*5113495bSYour Name QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 53*5113495bSYour Name #define spectral_info_nofl(format, args...) \ 54*5113495bSYour Name QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 55*5113495bSYour Name #define spectral_debug_nofl(format, args...) \ 56*5113495bSYour Name QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 57*5113495bSYour Name 58*5113495bSYour Name #define spectral_fatal_rl(format, args...) \ 59*5113495bSYour Name QDF_TRACE_FATAL_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 60*5113495bSYour Name #define spectral_err_rl(format, args...) \ 61*5113495bSYour Name QDF_TRACE_ERROR_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 62*5113495bSYour Name #define spectral_warn_rl(format, args...) \ 63*5113495bSYour Name QDF_TRACE_WARN_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 64*5113495bSYour Name #define spectral_info_rl(format, args...) \ 65*5113495bSYour Name QDF_TRACE_INFO_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 66*5113495bSYour Name #define spectral_debug_rl(format, args...) \ 67*5113495bSYour Name QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 68*5113495bSYour Name 69*5113495bSYour Name #define spectral_fatal_rl_nofl(format, args...) \ 70*5113495bSYour Name QDF_TRACE_FATAL_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 71*5113495bSYour Name #define spectral_err_rl_nofl(format, args...) \ 72*5113495bSYour Name QDF_TRACE_ERROR_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 73*5113495bSYour Name #define spectral_warn_rl_nofl(format, args...) \ 74*5113495bSYour Name QDF_TRACE_WARN_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 75*5113495bSYour Name #define spectral_info_rl_nofl(format, args...) \ 76*5113495bSYour Name QDF_TRACE_INFO_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 77*5113495bSYour Name #define spectral_debug_rl_nofl(format, args...) \ 78*5113495bSYour Name QDF_TRACE_DEBUG_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 79*5113495bSYour Name 80*5113495bSYour Name /** 81*5113495bSYour Name * struct pdev_spectral - Radio specific spectral object 82*5113495bSYour Name * @psptrl_pdev: Back-pointer to struct wlan_objmgr_pdev 83*5113495bSYour Name * @spectral_sock: Spectral Netlink socket for sending samples to 84*5113495bSYour Name * applications 85*5113495bSYour Name * @psptrl_target_handle: reference to spectral lmac object 86*5113495bSYour Name * @skb: Socket buffer for sending samples to applications 87*5113495bSYour Name * @spectral_pid : Spectral port ID 88*5113495bSYour Name */ 89*5113495bSYour Name struct pdev_spectral { 90*5113495bSYour Name struct wlan_objmgr_pdev *psptrl_pdev; 91*5113495bSYour Name struct sock *spectral_sock; 92*5113495bSYour Name void *psptrl_target_handle; 93*5113495bSYour Name struct sk_buff *skb[SPECTRAL_MSG_TYPE_MAX]; 94*5113495bSYour Name uint32_t spectral_pid; 95*5113495bSYour Name }; 96*5113495bSYour Name 97*5113495bSYour Name struct spectral_wmi_ops; 98*5113495bSYour Name struct spectral_tgt_ops; 99*5113495bSYour Name 100*5113495bSYour Name /** 101*5113495bSYour Name * struct spectral_context - spectral global context 102*5113495bSYour Name * @psoc_obj: Reference to psoc global object 103*5113495bSYour Name * @psoc_target_handle: Reference to psoc target_if object 104*5113495bSYour Name * @legacy_cbacks: Spectral legacy callbacks 105*5113495bSYour Name * 106*5113495bSYour Name * Call back functions to invoke independent of OL/DA 107*5113495bSYour Name * @sptrlc_spectral_control: 108*5113495bSYour Name * @sptrlc_ucfg_phyerr_config: ucfg handler for phyerr 109*5113495bSYour Name * @sptrlc_pdev_spectral_init: Init pdev Spectral 110*5113495bSYour Name * @sptrlc_pdev_spectral_deinit: Deinit pdev Spectral 111*5113495bSYour Name * @sptrlc_psoc_spectral_init: Spectral psoc init 112*5113495bSYour Name * @sptrlc_psoc_spectral_deinit: Spectral psoc deinit 113*5113495bSYour Name * @sptrlc_set_spectral_config: Set spectral configurations 114*5113495bSYour Name * @sptrlc_get_spectral_config: Get spectral configurations 115*5113495bSYour Name * @sptrlc_start_spectral_scan: Start spectral scan 116*5113495bSYour Name * @sptrlc_stop_spectral_scan: Stop spectral scan 117*5113495bSYour Name * @sptrlc_is_spectral_active: Check if spectral scan is active 118*5113495bSYour Name * @sptrlc_is_spectral_enabled: Check if spectral is enabled 119*5113495bSYour Name * @sptrlc_set_debug_level: Set debug level 120*5113495bSYour Name * @sptrlc_get_debug_level: Get debug level 121*5113495bSYour Name * @sptrlc_get_spectral_capinfo: Get spectral capability info 122*5113495bSYour Name * @sptrlc_get_spectral_diagstats: Get spectral diag status 123*5113495bSYour Name * @sptrlc_register_spectral_wmi_ops: Register Spectral WMI operations 124*5113495bSYour Name * @sptrlc_register_spectral_tgt_ops: Register Spectral target operations 125*5113495bSYour Name * @sptrlc_register_netlink_cb: Register Netlink callbacks 126*5113495bSYour Name * @sptrlc_use_nl_bcast: Check whether to use Netlink broadcast/unicast 127*5113495bSYour Name * @sptrlc_deregister_netlink_cb: De-register Netlink callbacks 128*5113495bSYour Name * @sptrlc_process_spectral_report: Process spectral report 129*5113495bSYour Name * @sptrlc_set_dma_debug: Set DMA debug 130*5113495bSYour Name */ 131*5113495bSYour Name struct spectral_context { 132*5113495bSYour Name struct wlan_objmgr_psoc *psoc_obj; 133*5113495bSYour Name void *psoc_target_handle; 134*5113495bSYour Name struct spectral_legacy_cbacks legacy_cbacks; 135*5113495bSYour Name QDF_STATUS (*sptrlc_spectral_control) 136*5113495bSYour Name (struct wlan_objmgr_pdev *pdev, 137*5113495bSYour Name struct spectral_cp_request *sscan_req); 138*5113495bSYour Name int (*sptrlc_ucfg_phyerr_config)(struct wlan_objmgr_pdev *pdev, 139*5113495bSYour Name void *ad); 140*5113495bSYour Name void * (*sptrlc_pdev_spectral_init)(struct wlan_objmgr_pdev *pdev); 141*5113495bSYour Name void (*sptrlc_pdev_spectral_deinit)(struct wlan_objmgr_pdev *pdev); 142*5113495bSYour Name void * (*sptrlc_psoc_spectral_init)(struct wlan_objmgr_psoc *psoc); 143*5113495bSYour Name void (*sptrlc_psoc_spectral_deinit)(struct wlan_objmgr_psoc *psoc); 144*5113495bSYour Name QDF_STATUS (*sptrlc_set_spectral_config) 145*5113495bSYour Name (struct wlan_objmgr_pdev *pdev, 146*5113495bSYour Name const struct spectral_cp_param *param, 147*5113495bSYour Name const enum spectral_scan_mode smode, 148*5113495bSYour Name enum spectral_cp_error_code *err); 149*5113495bSYour Name QDF_STATUS (*sptrlc_get_spectral_config) 150*5113495bSYour Name (struct wlan_objmgr_pdev *pdev, 151*5113495bSYour Name struct spectral_config *sptrl_config, 152*5113495bSYour Name const enum spectral_scan_mode smode); 153*5113495bSYour Name QDF_STATUS (*sptrlc_start_spectral_scan) 154*5113495bSYour Name (struct wlan_objmgr_pdev *pdev, 155*5113495bSYour Name uint8_t vdev_id, 156*5113495bSYour Name const enum spectral_scan_mode smode, 157*5113495bSYour Name enum spectral_cp_error_code *err); 158*5113495bSYour Name QDF_STATUS (*sptrlc_stop_spectral_scan) 159*5113495bSYour Name (struct wlan_objmgr_pdev *pdev, 160*5113495bSYour Name enum spectral_scan_mode smode, 161*5113495bSYour Name enum spectral_cp_error_code *err); 162*5113495bSYour Name bool (*sptrlc_is_spectral_active)(struct wlan_objmgr_pdev *pdev, 163*5113495bSYour Name enum spectral_scan_mode smode); 164*5113495bSYour Name bool (*sptrlc_is_spectral_enabled)(struct wlan_objmgr_pdev *pdev, 165*5113495bSYour Name enum spectral_scan_mode smode); 166*5113495bSYour Name QDF_STATUS (*sptrlc_set_debug_level)(struct wlan_objmgr_pdev *pdev, 167*5113495bSYour Name uint32_t debug_level); 168*5113495bSYour Name uint32_t (*sptrlc_get_debug_level)(struct wlan_objmgr_pdev *pdev); 169*5113495bSYour Name QDF_STATUS (*sptrlc_get_spectral_capinfo)(struct wlan_objmgr_pdev *pdev, 170*5113495bSYour Name struct spectral_caps *scaps); 171*5113495bSYour Name QDF_STATUS (*sptrlc_get_spectral_diagstats) 172*5113495bSYour Name (struct wlan_objmgr_pdev *pdev, 173*5113495bSYour Name struct spectral_diag_stats *stats); 174*5113495bSYour Name QDF_STATUS (*sptrlc_register_spectral_wmi_ops)( 175*5113495bSYour Name struct wlan_objmgr_psoc *psoc, 176*5113495bSYour Name struct spectral_wmi_ops *wmi_ops); 177*5113495bSYour Name QDF_STATUS (*sptrlc_register_spectral_tgt_ops)( 178*5113495bSYour Name struct wlan_objmgr_psoc *psoc, 179*5113495bSYour Name struct spectral_tgt_ops *tgt_ops); 180*5113495bSYour Name void (*sptrlc_register_netlink_cb)( 181*5113495bSYour Name struct wlan_objmgr_pdev *pdev, 182*5113495bSYour Name struct spectral_nl_cb *nl_cb); 183*5113495bSYour Name bool (*sptrlc_use_nl_bcast)(struct wlan_objmgr_pdev *pdev); 184*5113495bSYour Name void (*sptrlc_deregister_netlink_cb)(struct wlan_objmgr_pdev *pdev); 185*5113495bSYour Name int (*sptrlc_process_spectral_report)( 186*5113495bSYour Name struct wlan_objmgr_pdev *pdev, 187*5113495bSYour Name void *payload); 188*5113495bSYour Name QDF_STATUS (*sptrlc_set_dma_debug)( 189*5113495bSYour Name struct wlan_objmgr_pdev *pdev, 190*5113495bSYour Name enum spectral_dma_debug dma_debug_type, 191*5113495bSYour Name bool dma_debug_enable); 192*5113495bSYour Name }; 193*5113495bSYour Name 194*5113495bSYour Name #endif /* _SPECTRAL_DEFS_I_H_ */ 195