1 /* 2 * Copyright (c) 2011, 2017-2020 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef _SPECTRAL_IOCTL_H_ 20 #define _SPECTRAL_IOCTL_H_ 21 #include <wlan_dfs_ioctl.h> 22 23 #ifndef AH_MAX_CHAINS 24 #define AH_MAX_CHAINS 3 25 #endif 26 27 /* 28 * ioctl defines 29 */ 30 31 #define SPECTRAL_SET_CONFIG (DFS_LAST_IOCTL + 1) 32 #define SPECTRAL_GET_CONFIG (DFS_LAST_IOCTL + 2) 33 #define SPECTRAL_SHOW_INTERFERENCE (DFS_LAST_IOCTL + 3) 34 #define SPECTRAL_ENABLE_SCAN (DFS_LAST_IOCTL + 4) 35 #define SPECTRAL_DISABLE_SCAN (DFS_LAST_IOCTL + 5) 36 #define SPECTRAL_ACTIVATE_SCAN (DFS_LAST_IOCTL + 6) 37 #define SPECTRAL_STOP_SCAN (DFS_LAST_IOCTL + 7) 38 #define SPECTRAL_SET_DEBUG_LEVEL (DFS_LAST_IOCTL + 8) 39 #define SPECTRAL_IS_ACTIVE (DFS_LAST_IOCTL + 9) 40 #define SPECTRAL_IS_ENABLED (DFS_LAST_IOCTL + 10) 41 #define SPECTRAL_CLASSIFY_SCAN (DFS_LAST_IOCTL + 11) 42 #define SPECTRAL_GET_CLASSIFIER_CONFIG (DFS_LAST_IOCTL + 12) 43 #define SPECTRAL_EACS (DFS_LAST_IOCTL + 13) 44 #define SPECTRAL_ACTIVATE_FULL_SCAN (DFS_LAST_IOCTL + 14) 45 #define SPECTRAL_STOP_FULL_SCAN (DFS_LAST_IOCTL + 15) 46 #define SPECTRAL_GET_CAPABILITY_INFO (DFS_LAST_IOCTL + 16) 47 #define SPECTRAL_GET_DIAG_STATS (DFS_LAST_IOCTL + 17) 48 #define SPECTRAL_GET_CHAN_WIDTH (DFS_LAST_IOCTL + 18) 49 #define SPECTRAL_GET_CHANINFO (DFS_LAST_IOCTL + 19) 50 #define SPECTRAL_CLEAR_CHANINFO (DFS_LAST_IOCTL + 20) 51 #define SPECTRAL_SET_ICM_ACTIVE (DFS_LAST_IOCTL + 21) 52 #define SPECTRAL_GET_NOMINAL_NOISEFLOOR (DFS_LAST_IOCTL + 22) 53 #define SPECTRAL_GET_DEBUG_LEVEL (DFS_LAST_IOCTL + 23) 54 #define SPECTRAL_SET_DMA_DEBUG (DFS_LAST_IOCTL + 24) 55 56 /* 57 * Increase spectral sub version if struct spectral_samp_msg updated. 58 */ 59 #define SPECTRAL_VERSION (3) 60 #define SPECTRAL_SUB_VERSION (1) 61 62 /* 63 * ioctl parameter types 64 */ 65 enum spectral_params { 66 SPECTRAL_PARAM_FFT_PERIOD, 67 SPECTRAL_PARAM_SCAN_PERIOD, 68 SPECTRAL_PARAM_SCAN_COUNT, 69 SPECTRAL_PARAM_SHORT_REPORT, 70 SPECTRAL_PARAM_SPECT_PRI, 71 SPECTRAL_PARAM_FFT_SIZE, 72 SPECTRAL_PARAM_GC_ENA, 73 SPECTRAL_PARAM_RESTART_ENA, 74 SPECTRAL_PARAM_NOISE_FLOOR_REF, 75 SPECTRAL_PARAM_INIT_DELAY, 76 SPECTRAL_PARAM_NB_TONE_THR, 77 SPECTRAL_PARAM_STR_BIN_THR, 78 SPECTRAL_PARAM_WB_RPT_MODE, 79 SPECTRAL_PARAM_RSSI_RPT_MODE, 80 SPECTRAL_PARAM_RSSI_THR, 81 SPECTRAL_PARAM_PWR_FORMAT, 82 SPECTRAL_PARAM_RPT_MODE, 83 SPECTRAL_PARAM_BIN_SCALE, 84 SPECTRAL_PARAM_DBM_ADJ, 85 SPECTRAL_PARAM_CHN_MASK, 86 SPECTRAL_PARAM_ACTIVE, 87 SPECTRAL_PARAM_STOP, 88 SPECTRAL_PARAM_ENABLE, 89 SPECTRAL_PARAM_FREQUENCY, 90 SPECTRAL_PARAM_CHAN_FREQUENCY, 91 SPECTRAL_PARAM_CHAN_WIDTH, 92 SPECTRAL_PARAM_MAX, 93 }; 94 95 /** 96 * enum spectral_report_mode: Spectral report mode 97 * @SPECTRAL_REPORT_MODE_0: No FFT report (only spectral scan summary report) 98 * @SPECTRAL_REPORT_MODE_1: FFT report header + spectral scan summary report 99 * @SPECTRAL_REPORT_MODE_2: FFt report header + in-band bins per 100 * FFT (half of the number of FFT bins), where the 101 * FFT input is sampled at two times the channel 102 * bandwidth + spectral scan summary report 103 * @SPECTRAL_REPORT_MODE_3: FFT report header + all bins per FFT, where the FFT 104 * input is sampled at two times the channel bandwidth 105 * + spectral scan summary report 106 * @SPECTRAL_REPORT_MODE_MAX: Max number of report modes 107 */ 108 enum spectral_report_mode { 109 SPECTRAL_REPORT_MODE_0, 110 SPECTRAL_REPORT_MODE_1, 111 SPECTRAL_REPORT_MODE_2, 112 SPECTRAL_REPORT_MODE_3, 113 SPECTRAL_REPORT_MODE_MAX, 114 }; 115 116 /** 117 * enum spectral_fft_size : FFT size values 118 * @SPECTRAL_FFT_SIZE_INVALID: Invalid FFT size 119 * @SPECTRAL_FFT_SIZE_1: FFT size 1 120 * @SPECTRAL_FFT_SIZE_2: FFT size 2 121 * @SPECTRAL_FFT_SIZE_3: FFT size 3 122 * @SPECTRAL_FFT_SIZE_4: FFT size 4 123 * @SPECTRAL_FFT_SIZE_5: FFT size 5 124 * @SPECTRAL_FFT_SIZE_6: FFT size 6 125 * @SPECTRAL_FFT_SIZE_7: FFT size 7 126 * @SPECTRAL_FFT_SIZE_8: FFT size 8 127 * @SPECTRAL_FFT_SIZE_9: FFT size 9 128 * @SPECTRAL_FFT_SIZE_10: FFT size 10 129 * @SPECTRAL_FFT_SIZE_MAX: Max number of FFT size 130 */ 131 enum spectral_fft_size { 132 SPECTRAL_FFT_SIZE_INVALID, 133 SPECTRAL_FFT_SIZE_1, 134 SPECTRAL_FFT_SIZE_2, 135 SPECTRAL_FFT_SIZE_3, 136 SPECTRAL_FFT_SIZE_4, 137 SPECTRAL_FFT_SIZE_5, 138 SPECTRAL_FFT_SIZE_6, 139 SPECTRAL_FFT_SIZE_7, 140 SPECTRAL_FFT_SIZE_8, 141 SPECTRAL_FFT_SIZE_9, 142 SPECTRAL_FFT_SIZE_10, 143 SPECTRAL_FFT_SIZE_MAX, 144 }; 145 146 /** 147 * enum spectral_scan_mode - Spectral scan mode 148 * @SPECTRAL_SCAN_MODE_NORMAL: Normal mode 149 * @SPECTRAL_SCAN_MODE_AGILE: Agile mode 150 * @SPECTRAL_SCAN_MODE_MAX: Max number of Spectral modes 151 * @SPECTRAL_SCAN_MODE_INVALID: Invalid Spectral mode 152 */ 153 enum spectral_scan_mode { 154 SPECTRAL_SCAN_MODE_NORMAL, 155 SPECTRAL_SCAN_MODE_AGILE, 156 SPECTRAL_SCAN_MODE_MAX, 157 SPECTRAL_SCAN_MODE_INVALID = 0xff, 158 }; 159 160 struct spectral_ioctl_params { 161 int16_t spectral_fft_period; 162 int16_t pectral_period; 163 int16_t spectral_count; 164 uint16_t spectral_short_report; 165 uint16_t spectral_pri; 166 }; 167 168 /** 169 * spectral_cap_hw_gen: Definitions for the Spectral hardware generation. 170 * This corresponds to definitions in qca_wlan_vendor_spectral_scan_cap_hw_gen. 171 * @SPECTRAL_CAP_HW_GEN_1: Generation 1 172 * @SPECTRAL_CAP_HW_GEN_2: Generation 2 173 * @SPECTRAL_CAP_HW_GEN_3: Generation 3 174 */ 175 enum spectral_cap_hw_gen { 176 SPECTRAL_CAP_HW_GEN_1 = 0, 177 SPECTRAL_CAP_HW_GEN_2 = 1, 178 SPECTRAL_CAP_HW_GEN_3 = 2, 179 }; 180 181 /** 182 * struct spectral_config_frequency - Spectral scan frequency 183 * @cfreq1: Center frequency (in MHz) of the span of interest(primary 80 MHz 184 * span for 80 + 80 agile scan request) or center frequency (in MHz) 185 * of any WLAN channel in the span of interest. 186 * @cfreq2: Applicable only for Agile Spectral scan request in 80+80 MHz mode. 187 * For 80+80 mode it represents the center frequency (in MHz) of the 188 * secondary 80 MHz span of interest or center frequency (in MHz) of 189 * any WLAN channel in the secondary 80 MHz span of interest. 190 */ 191 struct spectral_config_frequency { 192 uint32_t cfreq1; 193 uint32_t cfreq2; 194 }; 195 196 /** 197 * struct spectral_config - spectral config parameters 198 * @ss_fft_period: Skip interval for FFT reports 199 * @ss_period: Spectral scan period 200 * @ss_count: # of reports to return from ss_active 201 * @ss_short_report: Set to report only 1 set of FFT results 202 * @radar_bin_thresh_sel: Select threshold to classify strong bin for FFT 203 * @ss_spectral_pri: Priority, and are we doing a noise power cal ? 204 * @ss_fft_size: Defines the number of FFT data points to compute, 205 * defined as a log index num_fft_pts = 206 * 2^ss_fft_size 207 * @ss_gc_ena: Set, to enable targeted gain change before 208 * starting the spectral scan FFT 209 * @ss_restart_ena: Set, to enable abort of receive frames when in high 210 * priority and a spectral scan is queued 211 * @ss_noise_floor_ref: Noise floor reference number (signed) for the 212 * calculation of bin power (dBm) Though stored as an 213 * unsigned this should be treated as a signed 8-bit int. 214 * @ss_init_delay: Disallow spectral scan triggers after tx/rx packets 215 * by setting this delay value to roughly SIFS time 216 * period or greater Delay timer count in units of 0.25us 217 * @ss_nb_tone_thr: Number of strong bins (inclusive) per sub-channel, 218 * below which a signal is declared a narrowband tone 219 * @ss_str_bin_thr: Bin/max_bin ratio threshold over which a bin is 220 * declared strong (for spectral scan bandwidth analysis) 221 * @ss_wb_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER 222 * (phy_error=36), if none of the sub-channels are 223 * deemed narrowband 224 * @ss_rssi_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER 225 * (phy_error=36), if the ADC RSSI is below the 226 * threshold ss_rssi_thr 227 * @ss_rssi_thr: ADC RSSI must be greater than or equal to this 228 * threshold (signed Db) to ensure spectral scan 229 * reporting with normal phy error codes (please see 230 * ss_rssi_rpt_mode above).Though stored as an unsigned 231 * value, this should be treated as a signed 8-bit int 232 * @ss_pwr_format: Format of frequency bin magnitude for spectral scan 233 * triggered FFTs 0: linear magnitude 234 * 1: log magnitude (20*log10(lin_mag), 1/2 dB step size) 235 * @ss_rpt_mode: Format of per-FFT reports to software for spectral 236 * scan triggered FFTs 237 * 0: No FFT report (only pulse end summary) 238 * 1: 2-dword summary of metrics for each completed FFT 239 * 2: 2-dword summary + 1x-oversampled bins(in-band) per 240 * FFT 241 * 3: 2-dword summary + 2x-oversampled bins (all) per FFT 242 * @ss_bin_scale: Number of LSBs to shift out to scale the FFT bins 243 * for spectral scan triggered FFTs 244 * @ss_dbm_adj: Set (with ss_pwr_format=1), to report bin 245 * magnitudes 246 * converted to dBm power using the noisefloor 247 * calibration results 248 * @ss_chn_mask: Per chain enable mask to select input ADC for search 249 * FFT 250 * @ss_nf_cal: nf calibrated values for ctl+ext 251 * @ss_nf_pwr: nf pwr values for ctl+ext 252 * @ss_nf_temp_data: temperature data taken during nf scan 253 * @ss_frequency: This specifies the frequency span over which Spectral 254 * scan would be carried out. Its value depends on the 255 * Spectral scan mode. 256 * Normal mode:- 257 * Not applicable. Spectral scan would happen in the 258 * operating span. 259 * Agile mode:- 260 * cfreq1 represents the center frequency (in MHz) of 261 * the span of interest(primary 80 MHz span for 80 + 80 262 * agile scan request) or center frequency (in MHz) of 263 * any WLAN channel in the span of interest. cfreq2 is 264 * applicable only for Agile Spectral scan request in 265 * 80+80 MHz mode. For 80+80 mode it represents the 266 * center frequency (in MHz) of the secondary 80 MHz 267 * span of interest or center frequency (in MHz) of 268 * any WLAN channel in the secondary 80 MHz span of 269 * interest. 270 */ 271 struct spectral_config { 272 uint16_t ss_fft_period; 273 uint16_t ss_period; 274 uint16_t ss_count; 275 uint16_t ss_short_report; 276 uint8_t radar_bin_thresh_sel; 277 uint16_t ss_spectral_pri; 278 uint16_t ss_fft_size; 279 uint16_t ss_gc_ena; 280 uint16_t ss_restart_ena; 281 uint16_t ss_noise_floor_ref; 282 uint16_t ss_init_delay; 283 uint16_t ss_nb_tone_thr; 284 uint16_t ss_str_bin_thr; 285 uint16_t ss_wb_rpt_mode; 286 uint16_t ss_rssi_rpt_mode; 287 uint16_t ss_rssi_thr; 288 uint16_t ss_pwr_format; 289 uint16_t ss_rpt_mode; 290 uint16_t ss_bin_scale; 291 uint16_t ss_dbm_adj; 292 uint16_t ss_chn_mask; 293 int8_t ss_nf_cal[AH_MAX_CHAINS * 2]; 294 int8_t ss_nf_pwr[AH_MAX_CHAINS * 2]; 295 int32_t ss_nf_temp_data; 296 struct spectral_config_frequency ss_frequency; 297 }; 298 299 /** 300 * struct spectral_caps - Spectral capabilities structure 301 * @phydiag_cap: Phydiag capability 302 * @radar_cap: Radar detection capability 303 * @spectral_cap: Spectral capability 304 * @advncd_spectral_cap: Advanced spectral capability 305 * @hw_gen: Spectral hw generation as defined in spectral_cap_hw_gen 306 * @is_scaling_params_populated: indicates whether scaling params is populated 307 * @formula_id: formula_id 308 * @low_level_offset: low_level_offset 309 * @high_level_offset: high_level_offset 310 * @rssi_thr: rssi_thr 311 * @default_agc_max_gain: default_agc_max_gain 312 * @agile_spectral_cap: agile Spectral capability for 20/40/80 313 * @agile_spectral_cap_160: agile Spectral capability for 160 MHz 314 * @agile_spectral_cap_80p80: agile Spectral capability for 80p80 315 * @num_detectors_20mhz: number of Spectral detectors in 20 MHz 316 * @num_detectors_40mhz: number of Spectral detectors in 40 MHz 317 * @num_detectors_80mhz: number of Spectral detectors in 80 MHz 318 * @num_detectors_160mhz: number of Spectral detectors in 160 MHz 319 * @num_detectors_80p80mhz: number of Spectral detectors in 80p80 MHz 320 */ 321 struct spectral_caps { 322 uint8_t phydiag_cap; 323 uint8_t radar_cap; 324 uint8_t spectral_cap; 325 uint8_t advncd_spectral_cap; 326 uint32_t hw_gen; 327 bool is_scaling_params_populated; 328 uint16_t formula_id; 329 int16_t low_level_offset; 330 int16_t high_level_offset; 331 int16_t rssi_thr; 332 uint8_t default_agc_max_gain; 333 bool agile_spectral_cap; 334 bool agile_spectral_cap_160; 335 bool agile_spectral_cap_80p80; 336 uint32_t num_detectors_20mhz; 337 uint32_t num_detectors_40mhz; 338 uint32_t num_detectors_80mhz; 339 uint32_t num_detectors_160mhz; 340 uint32_t num_detectors_80p80mhz; 341 }; 342 343 #define SPECTRAL_IOCTL_PARAM_NOVAL (65535) 344 345 #define MAX_SPECTRAL_CHAINS (3) 346 #define MAX_NUM_BINS (1024) 347 #define MAX_NUM_BINS_PRI80 (1024) 348 #define MAX_NUM_BINS_SEC80 (520) 349 #define MAX_NUM_BINS_5MHZ (32) 350 /* 5 categories x (lower + upper) bands */ 351 #define MAX_INTERF 10 352 353 /** 354 * enum dcs_int_type - Interference type indicated by DCS 355 * @SPECTRAL_DCS_INT_NONE: No interference 356 * @SPECTRAL_DCS_INT_CW: CW interference 357 * @SPECTRAL_DCS_INT_WIFI: WLAN interference 358 */ 359 enum dcs_int_type { 360 SPECTRAL_DCS_INT_NONE, 361 SPECTRAL_DCS_INT_CW, 362 SPECTRAL_DCS_INT_WIFI 363 }; 364 365 /** 366 * struct interf_rsp - Interference record 367 * @interf_type: eINTERF_TYPE giving type of interference 368 * @interf_min_freq: Minimum frequency in MHz at which interference has been 369 * found 370 * @interf_max_freq: Maximum frequency in MHz at which interference has been 371 * found 372 * @advncd_spectral_cap: Advanced spectral capability 373 */ 374 struct interf_rsp { 375 uint8_t interf_type; 376 uint16_t interf_min_freq; 377 uint16_t interf_max_freq; 378 } __packed; 379 380 /** 381 * struct interf_src_rsp - List of interference sources 382 * @count: Number of interference records 383 * @interf: Array of interference records 384 */ 385 struct interf_src_rsp { 386 uint16_t count; 387 struct interf_rsp interf[MAX_INTERF]; 388 } __packed; 389 390 /** 391 * struct spectral_classifier_params - spectral classifier parameters 392 * @spectral_20_40_mode: Is AP in 20/40 mode? 393 * @spectral_dc_index: DC index 394 * @spectral_dc_in_mhz: DC in MHz 395 * @upper_chan_in_mhz: Upper channel in MHz 396 * @lower_chan_in_mhz: Lower channel in MHz 397 */ 398 struct spectral_classifier_params { 399 int spectral_20_40_mode; 400 int spectral_dc_index; 401 int spectral_dc_in_mhz; 402 int upper_chan_in_mhz; 403 int lower_chan_in_mhz; 404 } __packed; 405 406 /** 407 * struct spectral_samp_data - Spectral Analysis Messaging Protocol Data format 408 * @spectral_data_len: Indicates the bin size 409 * @spectral_data_len_sec80: Indicates the bin size for secondary 80 segment 410 * @spectral_rssi: Indicates RSSI 411 * @spectral_rssi_sec80: Indicates RSSI for secondary 80 segment 412 * @spectral_combined_rssi: Indicates combined RSSI from all antennas 413 * @spectral_upper_rssi: Indicates RSSI of upper band 414 * @spectral_lower_rssi: Indicates RSSI of lower band 415 * @spectral_chain_ctl_rssi: RSSI for control channel, for all antennas 416 * @spectral_chain_ext_rssi: RSSI for extension channel, for all antennas 417 * @spectral_max_scale: Indicates scale factor 418 * @spectral_bwinfo: Indicates bandwidth info 419 * @spectral_tstamp: Indicates timestamp 420 * @spectral_max_index: Indicates the index of max magnitude 421 * @spectral_max_index_sec80: Indicates the index of max magnitude for secondary 422 * 80 segment 423 * @spectral_max_mag: Indicates the maximum magnitude 424 * @spectral_max_mag_sec80: Indicates the maximum magnitude for secondary 80 425 * segment 426 * @spectral_max_exp: Indicates the max exp 427 * @spectral_last_tstamp: Indicates the last time stamp 428 * @spectral_upper_max_index: Indicates the index of max mag in upper band 429 * @spectral_lower_max_index: Indicates the index of max mag in lower band 430 * @spectral_nb_upper: Not Used 431 * @spectral_nb_lower: Not Used 432 * @classifier_params: Indicates classifier parameters 433 * @bin_pwr_count: Indicates the number of FFT bins 434 * @lb_edge_extrabins: Number of extra bins on left band edge 435 * @rb_edge_extrabins: Number of extra bins on right band edge 436 * @bin_pwr_count_sec80: Indicates the number of FFT bins in secondary 80 437 * segment 438 * @bin_pwr: Contains FFT magnitudes 439 * @bin_pwr_sec80: Contains FFT magnitudes for the secondary 80 440 * segment 441 * @interf_list: List of interfernce sources 442 * @noise_floor: Indicates the current noise floor 443 * @noise_floor_sec80: Indicates the current noise floor for secondary 80 444 * segment 445 * @ch_width: Channel width 20/40/80/160 MHz 446 * @spectral_mode: Spectral scan mode 447 * @spectral_pri80ind: Indication from hardware that the sample was 448 * received on the primary 80 MHz segment. If this 449 * is set when smode = SPECTRAL_SCAN_MODE_AGILE, it 450 * indicates that Spectral was carried out on pri80 451 * instead of the Agile frequency due to a 452 * channel switch - Software may choose 453 * to ignore the sample in this case. 454 * @spectral_pri80ind_sec80: Indication from hardware that the sample was 455 * received on the primary 80 MHz segment instead of 456 * the secondary 80 MHz segment due to a channel 457 * switch - Software may choose to ignore the sample 458 * if this is set. Applicable only if smode = 459 * SPECTRAL_SCAN_MODE_NORMAL and for 160/80+80 MHz 460 * Spectral operation. 461 * @last_raw_timestamp: Previous FFT report's raw timestamp. In case of 462 * 160Mhz it will be primary 80 segment's timestamp 463 * as both primary & secondary segment's timestamp 464 * are expected to be almost equal. 465 * @timestamp_war_offset: Offset calculated based on reset_delay and 466 * last_raw_timestamp. It will be added to 467 * raw_timestamp to get spectral_tstamp. 468 * @raw_timestamp: Actual FFT timestamp reported by HW on primary 469 * segment. 470 * @raw_timestamp_sec80: Actual FFT timestamp reported by HW on sec80 MHz 471 * segment. 472 * @reset_delay: Time gap between the last spectral report before 473 * reset and the end of reset. It is provided by FW 474 * via direct DMA framework. 475 * @target_reset_count: Indicates the number of times target went through 476 * reset routine after spectral was enabled. 477 * @bin_pwr_count_5mhz: Indicates the number of FFT bins in the extra 478 * 5 MHz for 165 MHz/ Restricted 80p80 mode 479 * @bin_pwr_5mhz: Contains FFT magnitudes corresponding to the extra 480 * 5 MHz in 165 MHz/ Restricted 80p80 mode 481 */ 482 struct spectral_samp_data { 483 int16_t spectral_data_len; 484 int16_t spectral_data_len_sec80; 485 int16_t spectral_rssi; 486 int16_t spectral_rssi_sec80; 487 int8_t spectral_combined_rssi; 488 int8_t spectral_upper_rssi; 489 int8_t spectral_lower_rssi; 490 int8_t spectral_chain_ctl_rssi[MAX_SPECTRAL_CHAINS]; 491 int8_t spectral_chain_ext_rssi[MAX_SPECTRAL_CHAINS]; 492 uint8_t spectral_max_scale; 493 int16_t spectral_bwinfo; 494 int32_t spectral_tstamp; 495 int16_t spectral_max_index; 496 int16_t spectral_max_index_sec80; 497 int16_t spectral_max_mag; 498 int16_t spectral_max_mag_sec80; 499 uint8_t spectral_max_exp; 500 int32_t spectral_last_tstamp; 501 int16_t spectral_upper_max_index; 502 int16_t spectral_lower_max_index; 503 uint8_t spectral_nb_upper; 504 uint8_t spectral_nb_lower; 505 struct spectral_classifier_params classifier_params; 506 uint16_t bin_pwr_count; 507 /* 508 * For 11ac chipsets prior to AR900B version 2.0, a max of 512 bins are 509 * delivered. However, there can be additional bins reported for 510 * AR900B version 2.0 and QCA9984 as described next: 511 * 512 * AR900B version 2.0: An additional tone is processed on the right 513 * hand side in order to facilitate detection of radar pulses out to 514 * the extreme band-edge of the channel frequency. 515 * Since the HW design processes four tones at a time, 516 * this requires one additional Dword to be added to the 517 * search FFT report. 518 * 519 * QCA9984: When spectral_scan_rpt_mode=2, i.e 2-dword summary + 520 * 1x-oversampled bins (in-band) per FFT, 521 * then 8 more bins (4 more on left side and 4 more on right side) 522 * are added. 523 */ 524 uint8_t lb_edge_extrabins; 525 uint8_t rb_edge_extrabins; 526 uint16_t bin_pwr_count_sec80; 527 uint8_t bin_pwr[MAX_NUM_BINS_PRI80]; 528 uint8_t bin_pwr_sec80[MAX_NUM_BINS_SEC80]; 529 struct interf_src_rsp interf_list; 530 int16_t noise_floor; 531 int16_t noise_floor_sec80; 532 uint32_t ch_width; 533 uint8_t spectral_agc_total_gain; 534 uint8_t spectral_agc_total_gain_sec80; 535 uint8_t spectral_gainchange; 536 uint8_t spectral_gainchange_sec80; 537 enum spectral_scan_mode spectral_mode; 538 uint8_t spectral_pri80ind; 539 uint8_t spectral_pri80ind_sec80; 540 uint32_t last_raw_timestamp; 541 uint32_t timestamp_war_offset; 542 uint32_t raw_timestamp; 543 uint32_t raw_timestamp_sec80; 544 uint32_t reset_delay; 545 uint32_t target_reset_count; 546 uint32_t agile_ch_width; 547 uint16_t bin_pwr_count_5mhz; 548 uint8_t bin_pwr_5mhz[MAX_NUM_BINS_5MHZ]; 549 } __packed; 550 551 /** 552 * struct spectral_samp_msg - Spectral SAMP message 553 * @signature: Validates the SAMP message 554 * @freq: Operating frequency in MHz 555 * @vhtop_ch_freq_seg1: VHT Segment 1 centre frequency in MHz 556 * @vhtop_ch_freq_seg2: VHT Segment 2 centre frequency in MHz 557 * @agile_freq1: Center frequency in MHz of the entire span(for 80+80 MHz 558 * agile Scan it is primary 80 MHz span) across which 559 * Agile Spectral is carried out. Applicable only for Agile 560 * Spectral samples. 561 * @agile_freq2: Center frequency in MHz of the secondary 80 MHz span 562 * across which Agile Spectral is carried out. Applicable 563 * only for Agile Spectral samples in 80+80 MHz mode. 564 * @freq_loading: How busy was the channel 565 * @dcs_enabled: Whether DCS is enabled 566 * @int_type: Interference type indicated by DCS 567 * @macaddr: Indicates the device interface 568 * @samp_data: SAMP Data 569 */ 570 struct spectral_samp_msg { 571 uint32_t signature; 572 uint16_t freq; 573 uint16_t vhtop_ch_freq_seg1; 574 uint16_t vhtop_ch_freq_seg2; 575 uint16_t agile_freq1; 576 uint16_t agile_freq2; 577 uint16_t freq_loading; 578 uint16_t dcs_enabled; 579 enum dcs_int_type int_type; 580 uint8_t macaddr[6]; 581 struct spectral_samp_data samp_data; 582 } __packed; 583 584 #endif 585