1 /* 2 * Copyright (c) 2011,2017-2018 The Linux Foundation. All rights reserved. 3 * 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 #ifndef _TARGET_IF_SPECTRAL_H_ 21 #define _TARGET_IF_SPECTRAL_H_ 22 23 #include <wlan_objmgr_cmn.h> 24 #include <wlan_objmgr_psoc_obj.h> 25 #include <wlan_objmgr_pdev_obj.h> 26 #include <wlan_objmgr_vdev_obj.h> 27 #include <qdf_lock.h> 28 #include <wlan_spectral_public_structs.h> 29 #include <reg_services_public_struct.h> 30 #ifdef DIRECT_BUF_RX_ENABLE 31 #include <target_if_direct_buf_rx_api.h> 32 #endif 33 #ifdef WIN32 34 #pragma pack(push, target_if_spectral, 1) 35 #define __ATTRIB_PACK 36 #else 37 #ifndef __ATTRIB_PACK 38 #define __ATTRIB_PACK __attribute__ ((packed)) 39 #endif 40 #endif 41 42 #include <spectral_defs_i.h> 43 44 #define STATUS_PASS 1 45 #define STATUS_FAIL 0 46 #undef spectral_dbg_line 47 #define spectral_dbg_line() \ 48 spectral_debug("----------------------------------------------------") 49 50 #undef spectral_ops_not_registered 51 #define spectral_ops_not_registered(str) \ 52 spectral_info("SPECTRAL : %s not registered\n", (str)) 53 #undef not_yet_implemented 54 #define not_yet_implemented() \ 55 spectral_info("SPECTRAL : %s : %d Not yet implemented\n", \ 56 __func__, __LINE__) 57 58 #define SPECTRAL_HT20_NUM_BINS 56 59 #define SPECTRAL_HT20_FFT_LEN 56 60 #define SPECTRAL_HT20_DC_INDEX (SPECTRAL_HT20_FFT_LEN / 2) 61 #define SPECTRAL_HT20_DATA_LEN 60 62 #define SPECTRAL_HT20_TOTAL_DATA_LEN (SPECTRAL_HT20_DATA_LEN + 3) 63 #define SPECTRAL_HT40_TOTAL_NUM_BINS 128 64 #define SPECTRAL_HT40_DATA_LEN 135 65 #define SPECTRAL_HT40_TOTAL_DATA_LEN (SPECTRAL_HT40_DATA_LEN + 3) 66 #define SPECTRAL_HT40_FFT_LEN 128 67 #define SPECTRAL_HT40_DC_INDEX (SPECTRAL_HT40_FFT_LEN / 2) 68 69 /* 70 * Used for the SWAR to obtain approximate combined rssi 71 * in secondary 80Mhz segment 72 */ 73 #define OFFSET_CH_WIDTH_20 65 74 #define OFFSET_CH_WIDTH_40 62 75 #define OFFSET_CH_WIDTH_80 56 76 #define OFFSET_CH_WIDTH_160 50 77 78 #ifdef BIG_ENDIAN_HOST 79 #define SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(destp, srcp, len) do { \ 80 int j; \ 81 uint32_t *src, *dest; \ 82 src = (uint32_t *)(srcp); \ 83 dest = (uint32_t *)(destp); \ 84 for (j = 0; j < roundup((len), sizeof(uint32_t)) / 4; j++) { \ 85 *(dest + j) = qdf_le32_to_cpu(*(src + j)); \ 86 } \ 87 } while (0) 88 #else 89 #define SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(destp, srcp, len) \ 90 OS_MEMCPY((destp), (srcp), (len)); 91 #endif 92 93 #define DUMMY_NF_VALUE (-123) 94 /* 5 categories x (lower + upper) bands */ 95 #define MAX_INTERF 10 96 #define HOST_MAX_ANTENNA 3 97 /* Mask for time stamp from descriptor */ 98 #define SPECTRAL_TSMASK 0xFFFFFFFF 99 #define SPECTRAL_SIGNATURE 0xdeadbeef 100 101 /* START of spectral GEN II HW specific details */ 102 #define SPECTRAL_PHYERR_SIGNATURE_GEN2 0xbb 103 #define TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN2 0xF9 104 #define TLV_TAG_ADC_REPORT_GEN2 0xFA 105 #define TLV_TAG_SEARCH_FFT_REPORT_GEN2 0xFB 106 107 /** 108 * enum spectral_160mhz_report_delivery_state - 160 MHz state machine states 109 * @SPECTRAL_REPORT_WAIT_PRIMARY80: Wait for primary80 report 110 * @SPECTRAL_REPORT_RX_PRIMARY80: Receive primary 80 report 111 * @SPECTRAL_REPORT_WAIT_SECONDARY80: Wait for secondory 80 report 112 * @SPECTRAL_REPORT_RX_SECONDARY80: Receive secondary 80 report 113 */ 114 enum spectral_160mhz_report_delivery_state { 115 SPECTRAL_REPORT_WAIT_PRIMARY80, 116 SPECTRAL_REPORT_RX_PRIMARY80, 117 SPECTRAL_REPORT_WAIT_SECONDARY80, 118 SPECTRAL_REPORT_RX_SECONDARY80, 119 }; 120 121 /** 122 * enum spectral_detector_id - Spectral detector id 123 * @SPECTRAL_DETECTOR_PRIMARY: Primary detector 124 * @SPECTRAL_DETECTOR_SECONDARY: Secondary detector 125 * @SPECTRAL_DETECTOR_AGILE: Agile detector 126 * @SPECTRAL_DETECTOR_INVALID: Invalid detector 127 */ 128 enum spectral_detector_id { 129 SPECTRAL_DETECTOR_PRIMARY, 130 SPECTRAL_DETECTOR_SECONDARY, 131 SPECTRAL_DETECTOR_AGILE, 132 SPECTRAL_DETECTOR_INVALID, 133 }; 134 135 /** 136 * enum spectral_160mhz_report_delivery_event - 160 MHz state machine event 137 * @SPECTRAL_REPORT_EVENT_DETECTORID0: Received detector id 0 138 * @SPECTRAL_REPORT_EVENT_DETECTORID1: Received detector id 1 139 * @SPECTRAL_REPORT_EVENT_DETECTORID_INVALID: Received invalid detector id 140 */ 141 enum spectral_160mhz_report_delivery_event { 142 SPECTRAL_REPORT_EVENT_DETECTORID0, 143 SPECTRAL_REPORT_EVENT_DETECTORID1, 144 SPECTRAL_REPORT_EVENT_DETECTORID_INVALID, 145 }; 146 147 /** 148 * struct spectral_search_fft_info_gen2 - spectral search fft report for gen2 149 * @relpwr_db: Total bin power in db 150 * @num_str_bins_ib: Number of strong bins 151 * @base_pwr: Base power 152 * @total_gain_info: Total gain 153 * @fft_chn_idx: FFT chain on which report is originated 154 * @avgpwr_db: Average power in db 155 * @peak_mag: Peak power seen in the bins 156 * @peak_inx: Index of bin holding peak power 157 */ 158 struct spectral_search_fft_info_gen2 { 159 uint32_t relpwr_db; 160 uint32_t num_str_bins_ib; 161 uint32_t base_pwr; 162 uint32_t total_gain_info; 163 uint32_t fft_chn_idx; 164 uint32_t avgpwr_db; 165 uint32_t peak_mag; 166 int16_t peak_inx; 167 }; 168 169 /* 170 * XXX Check if we should be handling the endinness difference in some 171 * other way opaque to the host 172 */ 173 #ifdef BIG_ENDIAN_HOST 174 175 /** 176 * struct spectral_phyerr_tlv_gen2 - phyerr tlv info for big endian host 177 * @signature: signature 178 * @tag: tag 179 * @length: length 180 */ 181 struct spectral_phyerr_tlv_gen2 { 182 uint8_t signature; 183 uint8_t tag; 184 uint16_t length; 185 } __ATTRIB_PACK; 186 187 #else 188 189 /** 190 * struct spectral_phyerr_tlv_gen2 - phyerr tlv info for little endian host 191 * @length: length 192 * @tag: tag 193 * @signature: signature 194 */ 195 struct spectral_phyerr_tlv_gen2 { 196 uint16_t length; 197 uint8_t tag; 198 uint8_t signature; 199 } __ATTRIB_PACK; 200 201 #endif /* BIG_ENDIAN_HOST */ 202 203 /** 204 * struct spectral_phyerr_hdr_gen2 - phyerr header for gen2 HW 205 * @hdr_a: Header[0:31] 206 * @hdr_b: Header[32:63] 207 */ 208 struct spectral_phyerr_hdr_gen2 { 209 uint32_t hdr_a; 210 uint32_t hdr_b; 211 }; 212 213 /* 214 * Segment ID information for 80+80. 215 * 216 * If the HW micro-architecture specification extends this DWORD for other 217 * purposes, then redefine+rename accordingly. For now, the specification 218 * mentions only segment ID (though this doesn't require an entire DWORD) 219 * without mention of any generic terminology for the DWORD, or any reservation. 220 * We use nomenclature accordingly. 221 */ 222 typedef uint32_t SPECTRAL_SEGID_INFO; 223 224 /** 225 * struct spectral_phyerr_fft_gen2 - fft info in phyerr event 226 * @buf: fft report 227 */ 228 struct spectral_phyerr_fft_gen2 { 229 uint8_t buf[0]; 230 }; 231 /* END of spectral GEN II HW specific details */ 232 233 /* START of spectral GEN III HW specific details */ 234 235 #define get_bitfield(value, size, pos) \ 236 (((value) >> (pos)) & ((1 << (size)) - 1)) 237 #define unsigned_to_signed(value, width) \ 238 (((value) >= (1 << ((width) - 1))) ? \ 239 (value - (1 << (width))) : (value)) 240 241 #define SSCAN_REPORT_DETECTOR_ID_POS_GEN3 (29) 242 #define SSCAN_REPORT_DETECTOR_ID_SIZE_GEN3 (2) 243 #define SPECTRAL_PHYERR_SIGNATURE_GEN3 (0xFA) 244 #define TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN3 (0x02) 245 #define TLV_TAG_SEARCH_FFT_REPORT_GEN3 (0x03) 246 #define SPECTRAL_PHYERR_TLVSIZE_GEN3 (4) 247 248 #define PHYERR_HDR_SIG_POS \ 249 (offsetof(struct spectral_phyerr_fft_report_gen3, fft_hdr_sig)) 250 #define PHYERR_HDR_TAG_POS \ 251 (offsetof(struct spectral_phyerr_fft_report_gen3, fft_hdr_tag)) 252 #define SPECTRAL_FFT_BINS_POS \ 253 (offsetof(struct spectral_phyerr_fft_report_gen3, buf)) 254 255 /** 256 * struct phyerr_info - spectral search fft report for gen3 257 * @data: handle to phyerror buffer 258 * @datalen: length of phyerror bufer 259 * @p_rfqual: rf quality matrices 260 * @p_chaninfo: pointer to chaninfo 261 * @tsf64: 64 bit TSF 262 * @acs_stats: acs stats 263 */ 264 struct phyerr_info { 265 uint8_t *data; 266 uint32_t datalen; 267 struct target_if_spectral_rfqual_info *p_rfqual; 268 struct target_if_spectral_chan_info *p_chaninfo; 269 uint64_t tsf64; 270 struct target_if_spectral_acs_stats *acs_stats; 271 }; 272 273 /** 274 * struct spectral_search_fft_info_gen3 - spectral search fft report for gen3 275 * @timestamp: Timestamp at which fft report was generated 276 * @fft_detector_id: Which radio generated this report 277 * @fft_num: The FFT count number. Set to 0 for short FFT. 278 * @fft_radar_check: NA for spectral 279 * @fft_peak_sidx: Index of bin with maximum power 280 * @fft_chn_idx: Rx chain index 281 * @fft_base_pwr_db: Base power in dB 282 * @fft_total_gain_db: Total gain in dB 283 * @fft_num_str_bins_ib: Number of strong bins in the report 284 * @fft_peak_mag: Peak magnitude 285 * @fft_avgpwr_db: Average power in dB 286 * @fft_relpwr_db: Relative power in dB 287 */ 288 struct spectral_search_fft_info_gen3 { 289 uint32_t timestamp; 290 uint32_t fft_detector_id; 291 uint32_t fft_num; 292 uint32_t fft_radar_check; 293 int32_t fft_peak_sidx; 294 uint32_t fft_chn_idx; 295 uint32_t fft_base_pwr_db; 296 uint32_t fft_total_gain_db; 297 uint32_t fft_num_str_bins_ib; 298 int32_t fft_peak_mag; 299 uint32_t fft_avgpwr_db; 300 uint32_t fft_relpwr_db; 301 }; 302 303 /** 304 * struct spectral_phyerr_sfftreport_gen3 - fft info in phyerr event 305 * @fft_timestamp: Timestamp at which fft report was generated 306 * @fft_hdr_sig: signature 307 * @fft_hdr_tag: tag 308 * @fft_hdr_length: length 309 * @hdr_a: Header[0:31] 310 * @hdr_b: Header[32:63] 311 * @hdr_c: Header[64:95] 312 * @resv: Header[96:127] 313 * @buf: fft bins 314 */ 315 struct spectral_phyerr_fft_report_gen3 { 316 uint32_t fft_timestamp; 317 #ifdef BIG_ENDIAN_HOST 318 uint8_t fft_hdr_sig; 319 uint8_t fft_hdr_tag; 320 uint16_t fft_hdr_length; 321 #else 322 uint16_t fft_hdr_length; 323 uint8_t fft_hdr_tag; 324 uint8_t fft_hdr_sig; 325 #endif /* BIG_ENDIAN_HOST */ 326 uint32_t hdr_a; 327 uint32_t hdr_b; 328 uint32_t hdr_c; 329 uint32_t resv; 330 uint8_t buf[0]; 331 } __ATTRIB_PACK; 332 333 /** 334 * struct sscan_report_fields_gen3 - Fields of spectral report 335 * @sscan_agc_total_gain: The AGC total gain in DB. 336 * @inband_pwr_db: The in-band power of the signal in 1/2 DB steps 337 * @sscan_gainchange: This bit is set to 1 if a gainchange occurred during 338 * the spectral scan FFT. Software may choose to 339 * disregard the results. 340 */ 341 struct sscan_report_fields_gen3 { 342 uint8_t sscan_agc_total_gain; 343 int16_t inband_pwr_db; 344 uint8_t sscan_gainchange; 345 }; 346 347 /** 348 * struct spectral_sscan_report_gen3 - spectral report in phyerr event 349 * @sscan_timestamp: Timestamp at which fft report was generated 350 * @sscan_hdr_sig: signature 351 * @sscan_hdr_tag: tag 352 * @sscan_hdr_length: length 353 * @hdr_a: Header[0:31] 354 * @resv: Header[32:63] 355 * @hdr_b: Header[64:95] 356 * @resv: Header[96:127] 357 */ 358 struct spectral_sscan_report_gen3 { 359 u_int32_t sscan_timestamp; 360 #ifdef BIG_ENDIAN_HOST 361 u_int8_t sscan_hdr_sig; 362 u_int8_t sscan_hdr_tag; 363 u_int16_t sscan_hdr_length; 364 #else 365 u_int16_t sscan_hdr_length; 366 u_int8_t sscan_hdr_tag; 367 u_int8_t sscan_hdr_sig; 368 #endif /* BIG_ENDIAN_HOST */ 369 u_int32_t hdr_a; 370 u_int32_t res1; 371 u_int32_t hdr_b; 372 u_int32_t res2; 373 } __ATTRIB_PACK; 374 375 #ifdef DIRECT_BUF_RX_ENABLE 376 /** 377 * struct Spectral_report - spectral report 378 * @data: Report buffer 379 * @noisefloor: Noise floor values 380 */ 381 struct spectral_report { 382 uint8_t *data; 383 int32_t noisefloor[DBR_MAX_CHAINS]; 384 }; 385 #endif 386 /* END of spectral GEN III HW specific details */ 387 388 typedef signed char pwr_dbm; 389 390 /** 391 * enum spectral_gen - spectral hw generation 392 * @SPECTRAL_GEN1 : spectral hw gen 1 393 * @SPECTRAL_GEN2 : spectral hw gen 2 394 * @SPECTRAL_GEN3 : spectral hw gen 3 395 */ 396 enum spectral_gen { 397 SPECTRAL_GEN1, 398 SPECTRAL_GEN2, 399 SPECTRAL_GEN3, 400 }; 401 402 #if ATH_PERF_PWR_OFFLOAD 403 /** 404 * enum target_if_spectral_info - Enumerations for specifying which spectral 405 * information (among parameters and states) 406 * is desired. 407 * @TARGET_IF_SPECTRAL_INFO_ACTIVE: Indicated whether spectral is active 408 * @TARGET_IF_SPECTRAL_INFO_ENABLED: Indicated whether spectral is enabled 409 * @TARGET_IF_SPECTRAL_INFO_PARAMS: Config params 410 */ 411 enum target_if_spectral_info { 412 TARGET_IF_SPECTRAL_INFO_ACTIVE, 413 TARGET_IF_SPECTRAL_INFO_ENABLED, 414 TARGET_IF_SPECTRAL_INFO_PARAMS, 415 }; 416 #endif /* ATH_PERF_PWR_OFFLOAD */ 417 418 /* forward declaration */ 419 struct target_if_spectral; 420 421 /** 422 * struct target_if_spectral_chan_info - Channel information 423 * @center_freq1: center frequency 1 in MHz 424 * @center_freq2: center frequency 2 in MHz -valid only for 425 * 11ACVHT 80PLUS80 mode 426 * @chan_width: channel width in MHz 427 */ 428 struct target_if_spectral_chan_info { 429 uint16_t center_freq1; 430 uint16_t center_freq2; 431 uint8_t chan_width; 432 }; 433 434 /** 435 * struct target_if_spectral_acs_stats - EACS stats from spectral samples 436 * @nfc_ctl_rssi: Control chan rssi 437 * @nfc_ext_rssi: Extension chan rssi 438 * @ctrl_nf: Control chan Noise Floor 439 * @ext_nf: Extension chan Noise Floor 440 */ 441 struct target_if_spectral_acs_stats { 442 int8_t nfc_ctl_rssi; 443 int8_t nfc_ext_rssi; 444 int8_t ctrl_nf; 445 int8_t ext_nf; 446 }; 447 448 /** 449 * struct target_if_spectral_perchain_rssi_info - per chain rssi info 450 * @rssi_pri20: Rssi of primary 20 Mhz 451 * @rssi_sec20: Rssi of secondary 20 Mhz 452 * @rssi_sec40: Rssi of secondary 40 Mhz 453 * @rssi_sec80: Rssi of secondary 80 Mhz 454 */ 455 struct target_if_spectral_perchain_rssi_info { 456 int8_t rssi_pri20; 457 int8_t rssi_sec20; 458 int8_t rssi_sec40; 459 int8_t rssi_sec80; 460 }; 461 462 /** 463 * struct target_if_spectral_rfqual_info - RF measurement information 464 * @rssi_comb: RSSI Information 465 * @pc_rssi_info: XXX : For now, we know we are getting information 466 * for only 4 chains at max. For future extensions 467 * use a define 468 * @noise_floor: Noise floor information 469 */ 470 struct target_if_spectral_rfqual_info { 471 int8_t rssi_comb; 472 struct target_if_spectral_perchain_rssi_info pc_rssi_info[4]; 473 int16_t noise_floor[4]; 474 }; 475 476 #define GET_TARGET_IF_SPECTRAL_OPS(spectral) \ 477 ((struct target_if_spectral_ops *)(&((spectral)->spectral_ops))) 478 479 /** 480 * struct target_if_spectral_ops - spectral low level ops table 481 * @get_tsf64: Get 64 bit TSF value 482 * @get_capability: Get capability info 483 * @set_rxfilter: Set rx filter 484 * @get_rxfilter: Get rx filter 485 * @is_spectral_active: Check whether icm is active 486 * @is_spectral_enabled: Check whether spectral is enabled 487 * @start_spectral_scan: Start spectral scan 488 * @stop_spectral_scan: Stop spectral scan 489 * @get_extension_channel: Get extension channel 490 * @get_ctl_noisefloor: Get control noise floor 491 * @get_ext_noisefloor: Get extension noise floor 492 * @configure_spectral: Set spectral configurations 493 * @get_spectral_config: Get spectral configurations 494 * @get_ent_spectral_mask: Get spectral mask 495 * @get_mac_address: Get mac address 496 * @get_current_channel: Get current channel 497 * @reset_hw: Reset HW 498 * @get_chain_noise_floor: Get Channel noise floor 499 * @spectral_process_phyerr: Process phyerr event 500 * @process_spectral_report: Process spectral report 501 */ 502 struct target_if_spectral_ops { 503 uint64_t (*get_tsf64)(void *arg); 504 uint32_t (*get_capability)( 505 void *arg, enum spectral_capability_type type); 506 uint32_t (*set_rxfilter)(void *arg, int rxfilter); 507 uint32_t (*get_rxfilter)(void *arg); 508 uint32_t (*is_spectral_active)(void *arg); 509 uint32_t (*is_spectral_enabled)(void *arg); 510 uint32_t (*start_spectral_scan)(void *arg); 511 uint32_t (*stop_spectral_scan)(void *arg); 512 uint32_t (*get_extension_channel)(void *arg); 513 int8_t (*get_ctl_noisefloor)(void *arg); 514 int8_t (*get_ext_noisefloor)(void *arg); 515 uint32_t (*configure_spectral)( 516 void *arg, 517 struct spectral_config *params); 518 uint32_t (*get_spectral_config)( 519 void *arg, 520 struct spectral_config *params); 521 uint32_t (*get_ent_spectral_mask)(void *arg); 522 uint32_t (*get_mac_address)(void *arg, char *addr); 523 uint32_t (*get_current_channel)(void *arg); 524 uint32_t (*reset_hw)(void *arg); 525 uint32_t (*get_chain_noise_floor)(void *arg, int16_t *nf_buf); 526 int (*spectral_process_phyerr)(struct target_if_spectral *spectral, 527 uint8_t *data, uint32_t datalen, 528 struct target_if_spectral_rfqual_info *p_rfqual, 529 struct target_if_spectral_chan_info *p_chaninfo, 530 uint64_t tsf64, 531 struct target_if_spectral_acs_stats *acs_stats); 532 int (*process_spectral_report)(struct wlan_objmgr_pdev *pdev, 533 void *payload); 534 }; 535 536 /** 537 * struct target_if_spectral_stats - spectral stats info 538 * @num_spectral_detects: Total num. of spectral detects 539 * @total_phy_errors: Total number of phyerrors 540 * @owl_phy_errors: Indicated phyerrors in old gen1 chipsets 541 * @pri_phy_errors: Phyerrors in primary channel 542 * @ext_phy_errors: Phyerrors in secondary channel 543 * @dc_phy_errors: Phyerrors due to dc 544 * @early_ext_phy_errors: Early secondary channel phyerrors 545 * @bwinfo_errors: Bandwidth info errors 546 * @datalen_discards: Invalid data length errors, seen in gen1 chipsets 547 * @rssi_discards bw: Indicates reports dropped due to RSSI threshold 548 * @last_reset_tstamp: Last reset time stamp 549 */ 550 struct target_if_spectral_stats { 551 uint32_t num_spectral_detects; 552 uint32_t total_phy_errors; 553 uint32_t owl_phy_errors; 554 uint32_t pri_phy_errors; 555 uint32_t ext_phy_errors; 556 uint32_t dc_phy_errors; 557 uint32_t early_ext_phy_errors; 558 uint32_t bwinfo_errors; 559 uint32_t datalen_discards; 560 uint32_t rssi_discards; 561 uint64_t last_reset_tstamp; 562 }; 563 564 /** 565 * struct target_if_spectral_event - spectral event structure 566 * @se_ts: Original 15 bit recv timestamp 567 * @se_full_ts: 64-bit full timestamp from interrupt time 568 * @se_rssi: Rssi of spectral event 569 * @se_bwinfo: Rssi of spectral event 570 * @se_dur: Duration of spectral pulse 571 * @se_chanindex: Channel of event 572 * @se_list: List of spectral events 573 */ 574 struct target_if_spectral_event { 575 uint32_t se_ts; 576 uint64_t se_full_ts; 577 uint8_t se_rssi; 578 uint8_t se_bwinfo; 579 uint8_t se_dur; 580 uint8_t se_chanindex; 581 582 STAILQ_ENTRY(spectral_event) se_list; 583 }; 584 585 /** 586 * struct target_if_chain_noise_pwr_info - Noise power info for each channel 587 * @rptcount: Count of reports in pwr array 588 * @un_cal_nf: Uncalibrated noise floor 589 * @factory_cal_nf: Noise floor as calibrated at the factory for module 590 * @median_pwr: Median power (median of pwr array) 591 * @pwr: Power reports 592 */ 593 struct target_if_chain_noise_pwr_info { 594 int rptcount; 595 pwr_dbm un_cal_nf; 596 pwr_dbm factory_cal_nf; 597 pwr_dbm median_pwr; 598 pwr_dbm pwr[]; 599 } __ATTRIB_PACK; 600 601 /** 602 * struct target_if_spectral_chan_stats - Channel information 603 * @cycle_count: Cycle count 604 * @channel_load: Channel load 605 * @per: Period 606 * @noisefloor: Noise floor 607 * @comp_usablity: Computed usability 608 * @maxregpower: Maximum allowed regulatary power 609 * @comp_usablity_sec80: Computed usability of secondary 80 Mhz 610 * @maxregpower_sec80: Max regulatory power in secondary 80 Mhz 611 */ 612 struct target_if_spectral_chan_stats { 613 int cycle_count; 614 int channel_load; 615 int per; 616 int noisefloor; 617 uint16_t comp_usablity; 618 int8_t maxregpower; 619 uint16_t comp_usablity_sec80; 620 int8_t maxregpower_sec80; 621 }; 622 623 #if ATH_PERF_PWR_OFFLOAD 624 625 /** 626 * struct target_if_spectral_cache - Cache used to minimize WMI operations 627 * in offload architecture 628 * @osc_spectral_enabled: Whether Spectral is enabled 629 * @osc_spectral_active: Whether spectral is active 630 * XXX: Ideally, we should NOT cache this 631 * since the hardware can self clear the bit, 632 * the firmware can possibly stop spectral due to 633 * intermittent off-channel activity, etc 634 * A WMI read command should be introduced to handle 635 * this This will be discussed. 636 * @osc_params: Spectral parameters 637 * @osc_is_valid: Whether the cache is valid 638 */ 639 struct target_if_spectral_cache { 640 uint8_t osc_spectral_enabled; 641 uint8_t osc_spectral_active; 642 struct spectral_config osc_params; 643 uint8_t osc_is_valid; 644 }; 645 646 /** 647 * struct target_if_spectral_param_state_info - Structure used to represent and 648 * manage spectral information 649 * (parameters and states) 650 * @osps_lock: Lock to synchronize accesses to information 651 * @osps_cache: Cacheable' information 652 */ 653 struct target_if_spectral_param_state_info { 654 qdf_spinlock_t osps_lock; 655 struct target_if_spectral_cache osps_cache; 656 /* XXX - Non-cacheable information goes here, in the future */ 657 }; 658 #endif /* ATH_PERF_PWR_OFFLOAD */ 659 660 struct vdev_spectral_configure_params; 661 struct vdev_spectral_enable_params; 662 663 /** 664 * struct wmi_spectral_cmd_ops - structure used holding the operations 665 * related to wmi commands on spectral parameters. 666 * @wmi_spectral_configure_cmd_send: 667 * @wmi_spectral_enable_cmd_send: 668 */ 669 struct wmi_spectral_cmd_ops { 670 QDF_STATUS (*wmi_spectral_configure_cmd_send)( 671 void *wmi_hdl, 672 struct vdev_spectral_configure_params *param); 673 QDF_STATUS (*wmi_spectral_enable_cmd_send)( 674 void *wmi_hdl, 675 struct vdev_spectral_enable_params *param); 676 }; 677 678 /** 679 * struct target_if_spectral - main spectral structure 680 * @pdev: Pointer to pdev 681 * @spectral_ops: Target if internal Spectral low level operations table 682 * @capability: Spectral capabilities structure 683 * @spectral_lock: Lock used for internal Spectral operations 684 * @spectral_curchan_radindex: Current channel spectral index 685 * @spectral_extchan_radindex: Extension channel spectral index 686 * @spectraldomain: Current Spectral domain 687 * @spectral_proc_phyerr: Flags to process for PHY errors 688 * @spectral_defaultparams: Default PHY params per Spectral stat 689 * @spectral_stats: Spectral related stats 690 * @events: Events structure 691 * @sc_spectral_ext_chan_ok: Can spectral be detected on the extension channel? 692 * @sc_spectral_combined_rssi_ok: Can use combined spectral RSSI? 693 * @sc_spectral_20_40_mode: Is AP in 20-40 mode? 694 * @sc_spectral_noise_pwr_cal: Noise power cal required? 695 * @sc_spectral_non_edma: Is the spectral capable device Non-EDMA? 696 * @upper_is_control: Upper segment is primary 697 * @upper_is_extension: Upper segment is secondary 698 * @lower_is_control: Lower segment is primary 699 * @lower_is_extension: Lower segment is secondary 700 * @sc_spectraltest_ieeechan: IEEE channel number to return to after a spectral 701 * mute test 702 * @spectral_numbins: Number of bins 703 * @spectral_fft_len: FFT length 704 * @spectral_data_len: Total phyerror report length 705 * @lb_edge_extrabins: Number of extra bins on left band edge 706 * @rb_edge_extrabins: Number of extra bins on right band edge 707 * @spectral_max_index_offset: Max FFT index offset (20 MHz mode) 708 * @spectral_upper_max_index_offset: Upper max FFT index offset (20/40 MHz mode) 709 * @spectral_lower_max_index_offset: Lower max FFT index offset (20/40 MHz mode) 710 * @spectral_dc_index: At which index DC is present 711 * @send_single_packet: Deprecated 712 * @spectral_sent_msg: Indicates whether we send report to upper layers 713 * @params: Spectral parameters 714 * @last_capture_time: Indicates timestamp of previouse report 715 * @num_spectral_data: Number of Spectral samples received in current session 716 * @total_spectral_data: Total number of Spectral samples received 717 * @max_rssi: Maximum RSSI 718 * @detects_control_channel: NA 719 * @detects_extension_channel: NA 720 * @detects_below_dc: NA 721 * @detects_above_dc: NA 722 * @sc_scanning: Indicates active wifi scan 723 * @sc_spectral_scan: Indicates active specral scan 724 * @sc_spectral_full_scan: Deprecated 725 * @scan_start_tstamp: Deprecated 726 * @last_tstamp: Deprecated 727 * @first_tstamp: Deprecated 728 * @spectral_samp_count: Deprecated 729 * @sc_spectral_samp_count: Deprecated 730 * @noise_pwr_reports_reqd: Number of noise power reports required 731 * @noise_pwr_reports_recv: Number of noise power reports received 732 * @noise_pwr_reports_lock: Lock used for Noise power report processing 733 * @noise_pwr_chain_ctl: Noise power report - control channel 734 * @noise_pwr_chain_ext: Noise power report - extension channel 735 * @chaninfo: Channel statistics 736 * @tsf64: Latest TSF Value 737 * @param_info: Offload architecture Spectral parameter cache information 738 * @ch_width: Indicates Channel Width 20/40/80/160 MHz with values 0, 1, 2, 3 739 * respectively 740 * @diag_stats: Diagnostic statistics 741 * @is_160_format: Indicates whether information provided by HW is in altered 742 * format for 802.11ac 160/80+80 MHz support (QCA9984 onwards) 743 * @is_lb_edge_extrabins_format: Indicates whether information provided by 744 * HW has 4 extra bins, at left band edge, for report mode 2 745 * @is_rb_edge_extrabins_format: Indicates whether information provided 746 * by HW has 4 extra bins, at right band edge, for report mode 2 747 * @is_sec80_rssi_war_required: Indicates whether the software workaround is 748 * required to obtain approximate combined RSSI for secondary 80Mhz segment 749 * @simctx: Spectral Simulation context 750 * @spectral_gen: Spectral hardware generation 751 * @hdr_sig_exp: Expected signature in PHYERR TLV header, for the given hardware 752 * generation 753 * @tag_sscan_summary_exp: Expected Spectral Scan Summary tag in PHYERR TLV 754 * header, for the given hardware generation 755 * @tag_sscan_fft_exp: Expected Spectral Scan FFT report tag in PHYERR TLV 756 * header, for the given hardware generation 757 * @tlvhdr_size: Expected PHYERR TLV header size, for the given hardware 758 * generation 759 * @nl_cb: Netlink callbacks 760 * @use_nl_bcast: Whether to use Netlink broadcast/unicast 761 * @send_phy_data: Send data to the applicaton layer 762 * @inband_fftbin_size_adj: Whether to carry out FFT bin size adjustment for 763 * in-band report format. This would be required on some chipsets under the 764 * following circumstances: In report mode 2 only the in-band bins are DMA'ed. 765 * Scatter/gather is used. However, the HW generates all bins, not just in-band, 766 * and reports the number of bins accordingly. The subsystem arranging for the 767 * DMA cannot change this value. On such chipsets the adjustment required at the 768 * host driver is to check if report format is 2, and if so halve the number of 769 * bins reported to get the number actually DMA'ed. 770 * @null_fftbin_adj: Whether to remove NULL FFT bins for report mode (1) in 771 * which only summary of metrics for each completed FFT + spectral scan summary 772 * report are to be provided. This would be required on some chipsets under the 773 * following circumstances: In report mode 1, HW reports a length corresponding 774 * to all bins, and provides bins with value 0. This is because the subsystem 775 * arranging for the FFT information does not arrange for DMA of FFT bin values 776 * (as expected), but cannot arrange for a smaller length to be reported by HW. 777 * In these circumstances, the driver would have to disregard the NULL bins and 778 * report a bin count of 0 to higher layers. 779 */ 780 struct target_if_spectral { 781 struct wlan_objmgr_pdev *pdev_obj; 782 struct target_if_spectral_ops spectral_ops; 783 struct spectral_caps capability; 784 qdf_spinlock_t spectral_lock; 785 int16_t spectral_curchan_radindex; 786 int16_t spectral_extchan_radindex; 787 uint32_t spectraldomain; 788 uint32_t spectral_proc_phyerr; 789 struct spectral_config spectral_defaultparams; 790 struct target_if_spectral_stats spectral_stats; 791 struct target_if_spectral_event *events; 792 unsigned int sc_spectral_ext_chan_ok:1, 793 sc_spectral_combined_rssi_ok:1, 794 sc_spectral_20_40_mode:1, 795 sc_spectral_noise_pwr_cal:1, 796 sc_spectral_non_edma:1; 797 int upper_is_control; 798 int upper_is_extension; 799 int lower_is_control; 800 int lower_is_extension; 801 uint8_t sc_spectraltest_ieeechan; 802 int spectral_numbins; 803 int spectral_fft_len; 804 int spectral_data_len; 805 806 /* 807 * For 11ac chipsets prior to AR900B version 2.0, a max of 512 bins are 808 * delivered. However, there can be additional bins reported for 809 * AR900B version 2.0 and QCA9984 as described next: 810 * 811 * AR900B version 2.0: An additional tone is processed on the right 812 * hand side in order to facilitate detection of radar pulses out to 813 * the extreme band-edge of the channel frequency. Since the HW design 814 * processes four tones at a time, this requires one additional Dword 815 * to be added to the search FFT report. 816 * 817 * QCA9984: When spectral_scan_rpt_mode = 2, i.e 2-dword summary + 818 * 1x-oversampled bins (in-band) per FFT, then 8 more bins 819 * (4 more on left side and 4 more on right side)are added. 820 */ 821 822 int lb_edge_extrabins; 823 int rb_edge_extrabins; 824 int spectral_max_index_offset; 825 int spectral_upper_max_index_offset; 826 int spectral_lower_max_index_offset; 827 int spectral_dc_index; 828 int send_single_packet; 829 int spectral_sent_msg; 830 int classify_scan; 831 os_timer_t classify_timer; 832 struct spectral_config params; 833 struct spectral_classifier_params classifier_params; 834 int last_capture_time; 835 int num_spectral_data; 836 int total_spectral_data; 837 int max_rssi; 838 int detects_control_channel; 839 int detects_extension_channel; 840 int detects_below_dc; 841 int detects_above_dc; 842 int sc_scanning; 843 int sc_spectral_scan; 844 int sc_spectral_full_scan; 845 uint64_t scan_start_tstamp; 846 uint32_t last_tstamp; 847 uint32_t first_tstamp; 848 uint32_t spectral_samp_count; 849 uint32_t sc_spectral_samp_count; 850 int noise_pwr_reports_reqd; 851 int noise_pwr_reports_recv; 852 qdf_spinlock_t noise_pwr_reports_lock; 853 struct target_if_chain_noise_pwr_info 854 *noise_pwr_chain_ctl[HOST_MAX_ANTENNA]; 855 struct target_if_chain_noise_pwr_info 856 *noise_pwr_chain_ext[HOST_MAX_ANTENNA]; 857 uint64_t tsf64; 858 #if ATH_PERF_PWR_OFFLOAD 859 struct target_if_spectral_param_state_info param_info; 860 #endif 861 uint32_t ch_width; 862 struct spectral_diag_stats diag_stats; 863 bool is_160_format; 864 bool is_lb_edge_extrabins_format; 865 bool is_rb_edge_extrabins_format; 866 bool is_sec80_rssi_war_required; 867 #ifdef QCA_SUPPORT_SPECTRAL_SIMULATION 868 void *simctx; 869 #endif 870 enum spectral_gen spectral_gen; 871 uint8_t hdr_sig_exp; 872 uint8_t tag_sscan_summary_exp; 873 uint8_t tag_sscan_fft_exp; 874 uint8_t tlvhdr_size; 875 struct wmi_spectral_cmd_ops param_wmi_cmd_ops; 876 struct spectral_nl_cb nl_cb; 877 bool use_nl_bcast; 878 int (*send_phy_data)(struct wlan_objmgr_pdev *pdev); 879 u_int8_t fftbin_size_war; 880 u_int8_t inband_fftbin_size_adj; 881 u_int8_t null_fftbin_adj; 882 enum spectral_160mhz_report_delivery_state state_160mhz_delivery; 883 void *spectral_report_cache; 884 }; 885 886 /** 887 * struct target_if_samp_msg_params - Spectral Analysis Messaging Protocol 888 * data format 889 * @rssi: RSSI (except for secondary 80 segment) 890 * @rssi_sec80: RSSI for secondary 80 segment 891 * @lower_rssi: RSSI of lower band 892 * @upper_rssi: RSSI of upper band 893 * @chain_ctl_rssi: RSSI for control channel, for all antennas 894 * @chain_ext_rssi: RSSI for extension channel, for all antennas 895 * @bwinfo: bandwidth info 896 * @data_len: length of FFT data (except for secondary 80 segment) 897 * @data_len_sec80: length of FFT data for secondary 80 segment 898 * @tstamp: timestamp 899 * @last_tstamp: last time stamp 900 * @max_mag: maximum magnitude (except for secondary 80 segment) 901 * @max_mag_sec80: maximum magnitude for secondary 80 segment 902 * @max_index: index of max magnitude (except for secondary 80 segment) 903 * @max_index_sec80: index of max magnitude for secondary 80 segment 904 * @max_exp: max exp 905 * @peak: peak frequency (obsolete) 906 * @pwr_count: number of FFT bins (except for secondary 80 segment) 907 * @pwr_count_sec80: number of FFT bins in secondary 80 segment 908 * @nb_lower: This is deprecated 909 * @nb_upper: This is deprecated 910 * @max_upper_index: index of max mag in upper band 911 * @max_lower_index: index of max mag in lower band 912 * @bin_pwr_data: Contains FFT magnitudes (except for secondary 80 segment) 913 * @bin_pwr_data_sec80: Contains FFT magnitudes for the secondary 80 segment 914 * @freq: Center frequency of primary 20MHz channel in MHz 915 * @vhtop_ch_freq_seg1: VHT operation first segment center frequency in MHz 916 * @vhtop_ch_freq_seg2: VHT operation second segment center frequency in MHz 917 * @freq_loading: spectral control duty cycles 918 * @noise_floor: current noise floor (except for secondary 80 segment) 919 * @noise_floor_sec80: current noise floor for secondary 80 segment 920 * @interf_list: List of interfernce sources 921 * @classifier_params: classifier parameters 922 * @sc: classifier parameters 923 */ 924 struct target_if_samp_msg_params { 925 int8_t rssi; 926 int8_t rssi_sec80; 927 int8_t lower_rssi; 928 int8_t upper_rssi; 929 int8_t chain_ctl_rssi[HOST_MAX_ANTENNA]; 930 int8_t chain_ext_rssi[HOST_MAX_ANTENNA]; 931 uint16_t bwinfo; 932 uint16_t datalen; 933 uint16_t datalen_sec80; 934 uint32_t tstamp; 935 uint32_t last_tstamp; 936 uint16_t max_mag; 937 uint16_t max_mag_sec80; 938 uint16_t max_index; 939 uint16_t max_index_sec80; 940 uint8_t max_exp; 941 int peak; 942 int pwr_count; 943 int pwr_count_sec80; 944 int8_t nb_lower; 945 int8_t nb_upper; 946 uint16_t max_lower_index; 947 uint16_t max_upper_index; 948 uint8_t *bin_pwr_data; 949 uint8_t *bin_pwr_data_sec80; 950 uint16_t freq; 951 uint16_t vhtop_ch_freq_seg1; 952 uint16_t vhtop_ch_freq_seg2; 953 uint16_t freq_loading; 954 int16_t noise_floor; 955 int16_t noise_floor_sec80; 956 struct interf_src_rsp interf_list; 957 struct spectral_classifier_params classifier_params; 958 struct ath_softc *sc; 959 uint8_t agc_total_gain; 960 uint8_t agc_total_gain_sec80; 961 uint8_t gainchange; 962 uint8_t gainchange_sec80; 963 }; 964 965 #ifdef WLAN_CONV_SPECTRAL_ENABLE 966 /** 967 * target_if_spectral_dump_fft() - Dump Spectral FFT 968 * @pfft: Pointer to Spectral Phyerr FFT 969 * @fftlen: FFT length 970 * 971 * Return: Success or failure 972 */ 973 int target_if_spectral_dump_fft(uint8_t *pfft, int fftlen); 974 975 /** 976 * target_if_dbg_print_samp_param() - Print contents of SAMP struct 977 * @p: Pointer to SAMP message 978 * 979 * Return: Void 980 */ 981 void target_if_dbg_print_samp_param(struct target_if_samp_msg_params *p); 982 983 /** 984 * target_if_get_offset_swar_sec80() - Get offset for SWAR according to 985 * the channel width 986 * @channel_width: Channel width 987 * 988 * Return: Offset for SWAR 989 */ 990 uint32_t target_if_get_offset_swar_sec80(uint32_t channel_width); 991 992 /** 993 * target_if_sptrl_register_tx_ops() - Register Spectral target_if Tx Ops 994 * @tx_ops: Tx Ops 995 * 996 * Return: void 997 */ 998 void target_if_sptrl_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); 999 1000 /** 1001 * target_if_spectral_create_samp_msg() - Create the spectral samp message 1002 * @spectral : Pointer to spectral internal structure 1003 * @params : spectral samp message parameters 1004 * 1005 * API to create the spectral samp message 1006 * 1007 * Return: void 1008 */ 1009 void target_if_spectral_create_samp_msg( 1010 struct target_if_spectral *spectral, 1011 struct target_if_samp_msg_params *params); 1012 1013 /** 1014 * target_if_spectral_process_phyerr_gen3() - Process phyerror event for gen3 1015 * @pdev: Pointer to pdev object 1016 * @payload: Pointer to spectral report 1017 * 1018 * Process phyerror event for gen3 1019 * 1020 * Return: Success/Failure 1021 */ 1022 int target_if_spectral_process_report_gen3( 1023 struct wlan_objmgr_pdev *pdev, 1024 void *buf); 1025 1026 /** 1027 * target_if_process_phyerr_gen2() - Process PHY Error for gen2 1028 * @spectral: Pointer to Spectral object 1029 * @data: Pointer to phyerror event buffer 1030 * @datalen: Data length 1031 * @p_rfqual: RF quality info 1032 * @p_chaninfo: Channel info 1033 * @tsf64: 64 bit tsf timestamp 1034 * @acs_stats: ACS stats 1035 * 1036 * Process PHY Error for gen2 1037 * 1038 * Return: Success/Failure 1039 */ 1040 int target_if_process_phyerr_gen2( 1041 struct target_if_spectral *spectral, 1042 uint8_t *data, 1043 uint32_t datalen, struct target_if_spectral_rfqual_info *p_rfqual, 1044 struct target_if_spectral_chan_info *p_chaninfo, 1045 uint64_t tsf64, 1046 struct target_if_spectral_acs_stats *acs_stats); 1047 1048 /** 1049 * target_if_spectral_send_intf_found_msg() - Indicate to application layer that 1050 * interference has been found 1051 * @pdev: Pointer to pdev 1052 * @cw_int: 1 if CW interference is found, 0 if WLAN interference is found 1053 * @dcs_enabled: 1 if DCS is enabled, 0 if DCS is disabled 1054 * 1055 * Send message to application layer 1056 * indicating that interference has been found 1057 * 1058 * Return: None 1059 */ 1060 void target_if_spectral_send_intf_found_msg( 1061 struct wlan_objmgr_pdev *pdev, 1062 uint16_t cw_int, uint32_t dcs_enabled); 1063 1064 /** 1065 * target_if_stop_spectral_scan() - Stop spectral scan 1066 * @pdev: Pointer to pdev object 1067 * 1068 * API to stop the current on-going spectral scan 1069 * 1070 * Return: None 1071 */ 1072 void target_if_stop_spectral_scan(struct wlan_objmgr_pdev *pdev); 1073 1074 /** 1075 * target_if_spectral_get_vdev() - Get pointer to vdev to be used for Spectral 1076 * operations 1077 * @spectral: Pointer to Spectral target_if internal private data 1078 * 1079 * Spectral operates on pdev. However, in order to retrieve some WLAN 1080 * properties, a vdev is required. To facilitate this, the function returns the 1081 * first vdev in our pdev. The caller should release the reference to the vdev 1082 * once it is done using it. 1083 * TODO: If the framework later provides an API to obtain the first active 1084 * vdev, then it would be preferable to use this API. 1085 * 1086 * Return: Pointer to vdev on success, NULL on failure 1087 */ 1088 struct wlan_objmgr_vdev *target_if_spectral_get_vdev( 1089 struct target_if_spectral *spectral); 1090 1091 /** 1092 * target_if_spectral_dump_hdr_gen2() - Dump Spectral header for gen2 1093 * @phdr: Pointer to Spectral Phyerr Header 1094 * 1095 * Dump Spectral header 1096 * 1097 * Return: Success/Failure 1098 */ 1099 int target_if_spectral_dump_hdr_gen2(struct spectral_phyerr_hdr_gen2 *phdr); 1100 1101 /** 1102 * target_if_get_combrssi_sec80_seg_gen2() - Get approximate combined RSSI 1103 * for Secondary 80 segment 1104 * @spectral: Pointer to spectral object 1105 * @p_sfft_sec80: Pointer to search fft info of secondary 80 segment 1106 * 1107 * Get approximate combined RSSI for Secondary 80 segment 1108 * 1109 * Return: Combined RSSI for secondary 80Mhz segment 1110 */ 1111 int8_t target_if_get_combrssi_sec80_seg_gen2( 1112 struct target_if_spectral *spectral, 1113 struct spectral_search_fft_info_gen2 *p_sfft_sec80); 1114 1115 /** 1116 * target_if_spectral_dump_tlv_gen2() - Dump Spectral TLV for gen2 1117 * @ptlv: Pointer to Spectral Phyerr TLV 1118 * @is_160_format: Indicates 160 format 1119 * 1120 * Dump Spectral TLV for gen2 1121 * 1122 * Return: Success/Failure 1123 */ 1124 int target_if_spectral_dump_tlv_gen2( 1125 struct spectral_phyerr_tlv_gen2 *ptlv, bool is_160_format); 1126 1127 /** 1128 * target_if_spectral_dump_phyerr_data_gen2() - Dump Spectral 1129 * related PHY Error for gen2 1130 * @data: Pointer to phyerror buffer 1131 * @datalen: Data length 1132 * @is_160_format: Indicates 160 format 1133 * 1134 * Dump Spectral related PHY Error for gen2 1135 * 1136 * Return: Success/Failure 1137 */ 1138 int target_if_spectral_dump_phyerr_data_gen2( 1139 uint8_t *data, 1140 uint32_t datalen, 1141 bool is_160_format); 1142 1143 /** 1144 * target_if_dump_fft_report_gen3() - Dump FFT Report for gen3 1145 * @spectral: Pointer to Spectral object 1146 * @p_fft_report: Pointer to fft report 1147 * @p_sfft: Pointer to search fft report 1148 * 1149 * Dump FFT Report for gen3 1150 * 1151 * Return: Success/Failure 1152 */ 1153 int target_if_dump_fft_report_gen3(struct target_if_spectral *spectral, 1154 struct spectral_phyerr_fft_report_gen3 *p_fft_report, 1155 struct spectral_search_fft_info_gen3 *p_sfft); 1156 1157 /** 1158 * target_if_dbg_print_samp_msg() - Print contents of SAMP Message 1159 * @p: Pointer to SAMP message 1160 * 1161 * Print contents of SAMP Message 1162 * 1163 * Return: Void 1164 */ 1165 void target_if_dbg_print_samp_msg(struct spectral_samp_msg *pmsg); 1166 1167 /** 1168 * target_if_process_sfft_report_gen3() - Process Search FFT Report for gen3 1169 * @p_fft_report: Pointer to fft report 1170 * @p_sfft: Pointer to search fft report 1171 * 1172 * Process Search FFT Report for gen3 1173 * 1174 * Return: Success/Failure 1175 */ 1176 int target_if_process_sfft_report_gen3( 1177 struct spectral_phyerr_fft_report_gen3 *p_fft_report, 1178 struct spectral_search_fft_info_gen3 *p_fft_info); 1179 1180 /** 1181 * get_target_if_spectral_handle_from_pdev() - Get handle to target_if internal 1182 * Spectral data 1183 * @pdev: Pointer to pdev 1184 * 1185 * Return: Handle to target_if internal Spectral data on success, NULL on 1186 * failure 1187 */ 1188 static inline 1189 struct target_if_spectral *get_target_if_spectral_handle_from_pdev( 1190 struct wlan_objmgr_pdev *pdev) 1191 { 1192 struct target_if_spectral *spectral = NULL; 1193 struct wlan_objmgr_psoc *psoc = NULL; 1194 1195 psoc = wlan_pdev_get_psoc(pdev); 1196 1197 spectral = (struct target_if_spectral *) 1198 psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_get_target_handle( 1199 pdev); 1200 return spectral; 1201 } 1202 1203 /** 1204 * target_if_vdev_get_chan_freq() - Get the operating channel frequency of a 1205 * given vdev 1206 * @pdev: Pointer to vdev 1207 * 1208 * Get the operating channel frequency of a given vdev 1209 * 1210 * Return: Operating channel frequency of a vdev 1211 */ 1212 static inline 1213 int16_t target_if_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev) 1214 { 1215 struct wlan_objmgr_psoc *psoc = NULL; 1216 1217 psoc = wlan_vdev_get_psoc(vdev); 1218 if (!psoc) { 1219 spectral_err("psoc is NULL"); 1220 return -EINVAL; 1221 } 1222 1223 return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_chan_freq( 1224 vdev); 1225 } 1226 1227 /** 1228 * target_if_vdev_get_ch_width() - Get the operating channel bandwidth of a 1229 * given vdev 1230 * @pdev: Pointer to vdev 1231 * 1232 * Get the operating channel bandwidth of a given vdev 1233 * 1234 * Return: channel bandwidth enumeration corresponding to the vdev 1235 */ 1236 static inline 1237 enum phy_ch_width target_if_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev) 1238 { 1239 struct wlan_objmgr_psoc *psoc = NULL; 1240 1241 psoc = wlan_vdev_get_psoc(vdev); 1242 if (!psoc) { 1243 spectral_err("psoc is NULL"); 1244 return CH_WIDTH_INVALID; 1245 } 1246 1247 return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_ch_width( 1248 vdev); 1249 } 1250 1251 /** 1252 * target_if_vdev_get_sec20chan_freq_mhz() - Get the frequency of secondary 1253 * 20 MHz channel for a given vdev 1254 * @pdev: Pointer to vdev 1255 * 1256 * Get the frequency of secondary 20Mhz channel for a given vdev 1257 * 1258 * Return: Frequency of secondary 20Mhz channel for a given vdev 1259 */ 1260 static inline 1261 int target_if_vdev_get_sec20chan_freq_mhz( 1262 struct wlan_objmgr_vdev *vdev, 1263 uint16_t *sec20chan_freq) 1264 { 1265 struct wlan_objmgr_psoc *psoc = NULL; 1266 1267 psoc = wlan_vdev_get_psoc(vdev); 1268 if (!psoc) { 1269 spectral_err("psoc is NULL"); 1270 return -EINVAL; 1271 } 1272 1273 return psoc->soc_cb.rx_ops.sptrl_rx_ops. 1274 sptrlro_vdev_get_sec20chan_freq_mhz(vdev, sec20chan_freq); 1275 } 1276 1277 /** 1278 * target_if_spectral_set_rxchainmask() - Set Spectral Rx chainmask 1279 * @pdev: Pointer to pdev 1280 * @spectral_rx_chainmask: Spectral Rx chainmask 1281 * 1282 * Return: None 1283 */ 1284 static inline 1285 void target_if_spectral_set_rxchainmask(struct wlan_objmgr_pdev *pdev, 1286 uint8_t spectral_rx_chainmask) 1287 { 1288 struct target_if_spectral *spectral = NULL; 1289 1290 spectral = get_target_if_spectral_handle_from_pdev(pdev); 1291 spectral->params.ss_chn_mask = spectral_rx_chainmask; 1292 } 1293 1294 /** 1295 * target_if_spectral_process_phyerr() - Process Spectral PHY error 1296 * @pdev: Pointer to pdev 1297 * @data: PHY error data received from FW 1298 * @datalen: Length of data 1299 * @p_rfqual: Pointer to RF Quality information 1300 * @p_chaninfo: Pointer to channel information 1301 * @tsf: TSF time instance at which the Spectral sample was received 1302 * @acs_stats: ACS stats 1303 * 1304 * Process Spectral PHY error by extracting necessary information from the data 1305 * sent by FW, and send the extracted information to application layer. 1306 * 1307 * Return: None 1308 */ 1309 static inline 1310 void target_if_spectral_process_phyerr( 1311 struct wlan_objmgr_pdev *pdev, 1312 uint8_t *data, uint32_t datalen, 1313 struct target_if_spectral_rfqual_info *p_rfqual, 1314 struct target_if_spectral_chan_info *p_chaninfo, 1315 uint64_t tsf64, 1316 struct target_if_spectral_acs_stats *acs_stats) 1317 { 1318 struct target_if_spectral *spectral = NULL; 1319 struct target_if_spectral_ops *p_sops = NULL; 1320 1321 spectral = get_target_if_spectral_handle_from_pdev(pdev); 1322 p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral); 1323 p_sops->spectral_process_phyerr(spectral, data, datalen, 1324 p_rfqual, p_chaninfo, 1325 tsf64, acs_stats); 1326 } 1327 1328 /** 1329 * save_spectral_report_skb() - Save Spectral report skb 1330 * @spectral: Pointer to Spectral 1331 * @skb: Pointer to skb 1332 * 1333 * Save spectral report skb 1334 * 1335 * Return: void 1336 */ 1337 static inline void 1338 save_spectral_report_skb(struct target_if_spectral *spectral, void *skb) { 1339 if (spectral->ch_width == CH_WIDTH_160MHZ) 1340 spectral->spectral_report_cache = skb; 1341 } 1342 1343 /** 1344 * restore_spectral_report_skb() - Restore Spectral report skb 1345 * @spectral: Pointer to Spectral 1346 * @skb: Pointer to restore location 1347 * 1348 * Restore spectral report skb 1349 * 1350 * Return: void 1351 */ 1352 static inline void 1353 restore_spectral_report_skb(struct target_if_spectral *spectral, void **dest) { 1354 if (spectral->ch_width == CH_WIDTH_160MHZ) { 1355 QDF_ASSERT(spectral->spectral_report_cache); 1356 *dest = spectral->spectral_report_cache; 1357 } 1358 } 1359 1360 /** 1361 * clear_spectral_report_skb() - Clear Spectral report skb 1362 * @spectral: Pointer to Spectral 1363 * 1364 * Clear spectral report skb 1365 * 1366 * Return: void 1367 */ 1368 static inline void 1369 clear_spectral_report_skb(struct target_if_spectral *spectral) { 1370 if (spectral->ch_width == CH_WIDTH_160MHZ) 1371 spectral->spectral_report_cache = NULL; 1372 } 1373 1374 /** 1375 * free_and_clear_spectral_report_skb() - Free and clear Spectral report skb 1376 * @spectral: Pointer to Spectral 1377 * 1378 * Free and clear spectral report skb 1379 * 1380 * Return: void 1381 */ 1382 static inline void 1383 free_and_clear_spectral_report_skb(struct target_if_spectral *spectral) { 1384 if (spectral->spectral_report_cache) 1385 spectral->nl_cb.free_nbuff(spectral->pdev_obj); 1386 spectral->spectral_report_cache = NULL; 1387 } 1388 1389 /** 1390 * init_160mhz_delivery_state_machine() - Initialize 160MHz Spectral 1391 * state machine 1392 * @spectral: Pointer to Spectral 1393 * 1394 * Initialize 160MHz Spectral state machine 1395 * 1396 * Return: void 1397 */ 1398 static inline void 1399 init_160mhz_delivery_state_machine(struct target_if_spectral *spectral) { 1400 spectral->state_160mhz_delivery = 1401 SPECTRAL_REPORT_WAIT_PRIMARY80; 1402 spectral->spectral_report_cache = NULL; 1403 } 1404 1405 /** 1406 * deinit_160mhz_delivery_state_machine() - Deinitialize 160MHz Spectral 1407 * state machine 1408 * @spectral: Pointer to Spectral 1409 * 1410 * Deinitialize 160MHz Spectral state machine 1411 * 1412 * Return: void 1413 */ 1414 static inline void 1415 deinit_160mhz_delivery_state_machine(struct target_if_spectral *spectral) { 1416 if (spectral->spectral_report_cache) 1417 spectral->nl_cb.free_nbuff(spectral->pdev_obj); 1418 spectral->spectral_report_cache = NULL; 1419 } 1420 1421 /** 1422 * reset_160mhz_delivery_state_machine() - Reset 160MHz Spectral state machine 1423 * @spectral: Pointer to Spectral 1424 * 1425 * Reset 160MHz Spectral state machine 1426 * 1427 * Return: void 1428 */ 1429 static inline void 1430 reset_160mhz_delivery_state_machine(struct target_if_spectral *spectral) { 1431 if (spectral->ch_width == CH_WIDTH_160MHZ) { 1432 spectral->state_160mhz_delivery = 1433 SPECTRAL_REPORT_WAIT_PRIMARY80; 1434 free_and_clear_spectral_report_skb(spectral); 1435 } 1436 } 1437 1438 /** 1439 * is_secondaryseg_expected() - Is waiting for secondary 80 report 1440 * @spectral: Pointer to Spectral 1441 * 1442 * Return true if secondary 80 report expected and mode is 160 MHz 1443 * 1444 * Return: true or false 1445 */ 1446 static inline 1447 bool is_secondaryseg_expected(struct target_if_spectral *spectral) 1448 { 1449 return 1450 ((spectral->ch_width == CH_WIDTH_160MHZ) && 1451 (spectral->state_160mhz_delivery == SPECTRAL_REPORT_WAIT_SECONDARY80)); 1452 } 1453 1454 /** 1455 * is_primaryseg_expected() - Is waiting for primary 80 report 1456 * @spectral: Pointer to Spectral 1457 * 1458 * Return true if mode is 160 Mhz and primary 80 report expected or 1459 * mode is not 160 Mhz 1460 * 1461 * Return: true or false 1462 */ 1463 static inline 1464 bool is_primaryseg_expected(struct target_if_spectral *spectral) 1465 { 1466 return 1467 ((spectral->ch_width != CH_WIDTH_160MHZ) || 1468 ((spectral->ch_width == CH_WIDTH_160MHZ) && 1469 (spectral->state_160mhz_delivery == SPECTRAL_REPORT_WAIT_PRIMARY80))); 1470 } 1471 1472 /** 1473 * is_primaryseg_rx_inprog() - Is primary 80 report processing is in progress 1474 * @spectral: Pointer to Spectral 1475 * 1476 * Is primary 80 report processing is in progress 1477 * 1478 * Return: true or false 1479 */ 1480 static inline 1481 bool is_primaryseg_rx_inprog(struct target_if_spectral *spectral) 1482 { 1483 return 1484 ((spectral->ch_width != CH_WIDTH_160MHZ) || 1485 ((spectral->ch_width == CH_WIDTH_160MHZ) && 1486 ((spectral->spectral_gen == SPECTRAL_GEN2) || 1487 ((spectral->spectral_gen == SPECTRAL_GEN3) && 1488 (spectral->state_160mhz_delivery == SPECTRAL_REPORT_RX_PRIMARY80))))); 1489 } 1490 1491 /** 1492 * is_secondaryseg_rx_inprog() - Is secondary80 report processing is in progress 1493 * @spectral: Pointer to Spectral 1494 * 1495 * Is secondary 80 report processing is in progress 1496 * 1497 * Return: true or false 1498 */ 1499 static inline 1500 bool is_secondaryseg_rx_inprog(struct target_if_spectral *spectral) 1501 { 1502 return 1503 ((spectral->ch_width == CH_WIDTH_160MHZ) && 1504 ((spectral->spectral_gen == SPECTRAL_GEN2) || 1505 ((spectral->spectral_gen == SPECTRAL_GEN3) && 1506 (spectral->state_160mhz_delivery == SPECTRAL_REPORT_RX_SECONDARY80)))); 1507 } 1508 1509 /** 1510 * target_if_160mhz_delivery_state_change() - State transition for 160Mhz 1511 * Spectral 1512 * @spectral: Pointer to spectral object 1513 * @detector_id: Detector id 1514 * 1515 * Move the states of state machine for 160MHz spectral scan report receive 1516 * 1517 * Return: QDF_STATUS 1518 */ 1519 QDF_STATUS 1520 target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral, 1521 uint8_t detector_id); 1522 1523 /** 1524 * target_if_sops_is_spectral_enabled() - Get whether Spectral is enabled 1525 * @arg: Pointer to handle for Spectral target_if internal private data 1526 * 1527 * Function to check whether Spectral is enabled 1528 * 1529 * Return: True if Spectral is enabled, false if Spectral is not enabled 1530 */ 1531 uint32_t target_if_sops_is_spectral_enabled(void *arg); 1532 1533 /** 1534 * target_if_sops_is_spectral_active() - Get whether Spectral is active 1535 * @arg: Pointer to handle for Spectral target_if internal private data 1536 * 1537 * Function to check whether Spectral is active 1538 * 1539 * Return: True if Spectral is active, false if Spectral is not active 1540 */ 1541 uint32_t target_if_sops_is_spectral_active(void *arg); 1542 1543 /** 1544 * target_if_sops_start_spectral_scan() - Start Spectral scan 1545 * @arg: Pointer to handle for Spectral target_if internal private data 1546 * 1547 * Function to start spectral scan 1548 * 1549 * Return: 0 on success else failure 1550 */ 1551 uint32_t target_if_sops_start_spectral_scan(void *arg); 1552 1553 /** 1554 * target_if_sops_stop_spectral_scan() - Stop Spectral scan 1555 * @arg: Pointer to handle for Spectral target_if internal private data 1556 * 1557 * Function to stop spectral scan 1558 * 1559 * Return: 0 in case of success, -1 on failure 1560 */ 1561 uint32_t target_if_sops_stop_spectral_scan(void *arg); 1562 1563 /** 1564 * target_if_spectral_get_extension_channel() - Get the current Extension 1565 * channel (in MHz) 1566 * @arg: Pointer to handle for Spectral target_if internal private data 1567 * 1568 * Return: Current Extension channel (in MHz) on success, 0 on failure or if 1569 * extension channel is not present. 1570 */ 1571 uint32_t target_if_spectral_get_extension_channel(void *arg); 1572 1573 /** 1574 * target_if_spectral_get_current_channel() - Get the current channel (in MHz) 1575 * @arg: Pointer to handle for Spectral target_if internal private data 1576 * 1577 * Return: Current channel (in MHz) on success, 0 on failure 1578 */ 1579 uint32_t target_if_spectral_get_current_channel(void *arg); 1580 1581 1582 /** 1583 * target_if_spectral_reset_hw() - Reset the hardware 1584 * @arg: Pointer to handle for Spectral target_if internal private data 1585 * 1586 * This is only a placeholder since it is not currently required in the offload 1587 * case. 1588 * 1589 * Return: 0 1590 */ 1591 uint32_t target_if_spectral_reset_hw(void *arg); 1592 1593 /** 1594 * target_if_spectral_get_chain_noise_floor() - Get the Chain noise floor from 1595 * Noisefloor history buffer 1596 * @arg: Pointer to handle for Spectral target_if internal private data 1597 * @nf_buf: Pointer to buffer into which chain Noise Floor data should be copied 1598 * 1599 * This is only a placeholder since it is not currently required in the offload 1600 * case. 1601 * 1602 * Return: 0 1603 */ 1604 uint32_t target_if_spectral_get_chain_noise_floor(void *arg, int16_t *nf_buf); 1605 1606 /** 1607 * target_if_spectral_get_ext_noisefloor() - Get the extension channel 1608 * noisefloor 1609 * @arg: Pointer to handle for Spectral target_if internal private data 1610 * 1611 * This is only a placeholder since it is not currently required in the offload 1612 * case. 1613 * 1614 * Return: 0 1615 */ 1616 int8_t target_if_spectral_get_ext_noisefloor(void *arg); 1617 1618 /** 1619 * target_if_spectral_get_ctl_noisefloor() - Get the control channel noisefloor 1620 * @arg: Pointer to handle for Spectral target_if internal private data 1621 * 1622 * This is only a placeholder since it is not currently required in the offload 1623 * case. 1624 * 1625 * Return: 0 1626 */ 1627 int8_t target_if_spectral_get_ctl_noisefloor(void *arg); 1628 1629 /** 1630 * target_if_spectral_get_capability() - Get whether a given Spectral hardware 1631 * capability is available 1632 * @arg: Pointer to handle for Spectral target_if internal private data 1633 * @type: Spectral hardware capability type 1634 * 1635 * Return: True if the capability is available, false if the capability is not 1636 * available 1637 */ 1638 uint32_t target_if_spectral_get_capability( 1639 void *arg, enum spectral_capability_type type); 1640 1641 /** 1642 * target_if_spectral_set_rxfilter() - Set the RX Filter before Spectral start 1643 * @arg: Pointer to handle for Spectral target_if internal private data 1644 * @rxfilter: Rx filter to be used 1645 * 1646 * Note: This is only a placeholder function. It is not currently required since 1647 * FW should be taking care of setting the required filters. 1648 * 1649 * Return: 0 1650 */ 1651 uint32_t target_if_spectral_set_rxfilter(void *arg, int rxfilter); 1652 1653 /** 1654 * target_if_spectral_sops_configure_params() - Configure user supplied Spectral 1655 * parameters 1656 * @arg: Pointer to handle for Spectral target_if internal private data 1657 * @params: Spectral parameters 1658 * 1659 * Return: 0 in case of success, -1 on failure 1660 */ 1661 uint32_t target_if_spectral_sops_configure_params( 1662 void *arg, struct spectral_config *params); 1663 1664 /** 1665 * target_if_spectral_get_rxfilter() - Get the current RX Filter settings 1666 * @arg: Pointer to handle for Spectral target_if internal private data 1667 * 1668 * Note: This is only a placeholder function. It is not currently required since 1669 * FW should be taking care of setting the required filters. 1670 * 1671 * Return: 0 1672 */ 1673 uint32_t target_if_spectral_get_rxfilter(void *arg); 1674 1675 /** 1676 * target_if_pdev_spectral_deinit() - De-initialize target_if Spectral 1677 * functionality for the given pdev 1678 * @pdev: Pointer to pdev object 1679 * 1680 * Return: None 1681 */ 1682 void target_if_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev); 1683 1684 /** 1685 * target_if_set_spectral_config() - Set spectral config 1686 * @pdev: Pointer to pdev object 1687 * @threshtype: config type 1688 * @value: config value 1689 * 1690 * API to set spectral configurations 1691 * 1692 * Return: 0 in case of success, -1 on failure 1693 */ 1694 int target_if_set_spectral_config(struct wlan_objmgr_pdev *pdev, 1695 const uint32_t threshtype, 1696 const uint32_t value); 1697 1698 /** 1699 * target_if_pdev_spectral_init() - Initialize target_if Spectral 1700 * functionality for the given pdev 1701 * @pdev: Pointer to pdev object 1702 * 1703 * Return: On success, pointer to Spectral target_if internal private data, on 1704 * failure, NULL 1705 */ 1706 void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev); 1707 1708 /** 1709 * target_if_spectral_sops_get_params() - Get user configured Spectral 1710 * parameters 1711 * @arg: Pointer to handle for Spectral target_if internal private data 1712 * @params: Pointer to buffer into which Spectral parameters should be copied 1713 * 1714 * Return: 0 in case of success, -1 on failure 1715 */ 1716 uint32_t target_if_spectral_sops_get_params( 1717 void *arg, struct spectral_config *params); 1718 1719 /** 1720 * target_if_init_spectral_capability() - Initialize Spectral capability 1721 * @spectral: Pointer to Spectral target_if internal private data 1722 * 1723 * This is a workaround. 1724 * 1725 * Return: None 1726 */ 1727 void target_if_init_spectral_capability(struct target_if_spectral *spectral); 1728 1729 /** 1730 * target_if_start_spectral_scan() - Start spectral scan 1731 * @pdev: Pointer to pdev object 1732 * 1733 * API to start spectral scan 1734 * 1735 * Return: 0 in case of success, -1 on failure 1736 */ 1737 int target_if_start_spectral_scan(struct wlan_objmgr_pdev *pdev); 1738 1739 /** 1740 * target_if_get_spectral_config() - Get spectral configuration 1741 * @pdev: Pointer to pdev object 1742 * @param: Pointer to spectral_config structure in which the configuration 1743 * should be returned 1744 * 1745 * API to get the current spectral configuration 1746 * 1747 * Return: 0 in case of success, -1 on failure 1748 */ 1749 void target_if_get_spectral_config(struct wlan_objmgr_pdev *pdev, 1750 struct spectral_config *param); 1751 1752 /** 1753 * target_if_spectral_scan_enable_params() - Enable use of desired Spectral 1754 * parameters 1755 * @spectral: Pointer to Spectral target_if internal private data 1756 * @spectral_params: Pointer to Spectral parameters 1757 * 1758 * Enable use of desired Spectral parameters by configuring them into HW, and 1759 * starting Spectral scan 1760 * 1761 * Return: 0 on success, 1 on failure 1762 */ 1763 int target_if_spectral_scan_enable_params( 1764 struct target_if_spectral *spectral, struct spectral_config *spectral_params); 1765 1766 /** 1767 * target_if_is_spectral_active() - Get whether Spectral is active 1768 * @pdev: Pointer to pdev object 1769 * 1770 * Return: True if Spectral is active, false if Spectral is not active 1771 */ 1772 bool target_if_is_spectral_active(struct wlan_objmgr_pdev *pdev); 1773 1774 /** 1775 * target_if_is_spectral_enabled() - Get whether Spectral is enabled 1776 * @pdev: Pointer to pdev object 1777 * 1778 * Return: True if Spectral is enabled, false if Spectral is not enabled 1779 */ 1780 bool target_if_is_spectral_enabled(struct wlan_objmgr_pdev *pdev); 1781 1782 /** 1783 * target_if_set_debug_level() - Set debug level for Spectral 1784 * @pdev: Pointer to pdev object 1785 * @debug_level: Debug level 1786 * 1787 * Return: 0 in case of success 1788 */ 1789 int target_if_set_debug_level(struct wlan_objmgr_pdev *pdev, 1790 uint32_t debug_level); 1791 1792 /** 1793 * target_if_get_debug_level() - Get debug level for Spectral 1794 * @pdev: Pointer to pdev object 1795 * 1796 * Return: Current debug level 1797 */ 1798 uint32_t target_if_get_debug_level(struct wlan_objmgr_pdev *pdev); 1799 1800 1801 /** 1802 * target_if_get_spectral_capinfo() - Get Spectral capability information 1803 * @pdev: Pointer to pdev object 1804 * @outdata: Buffer into which data should be copied 1805 * 1806 * Return: void 1807 */ 1808 void target_if_get_spectral_capinfo( 1809 struct wlan_objmgr_pdev *pdev, 1810 void *outdata); 1811 1812 1813 /** 1814 * target_if_get_spectral_diagstats() - Get Spectral diagnostic statistics 1815 * @pdev: Pointer to pdev object 1816 * @outdata: Buffer into which data should be copied 1817 * 1818 * Return: void 1819 */ 1820 void target_if_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev, 1821 void *outdata); 1822 1823 /* 1824 * target_if_spectral_send_tlv_to_host - target_if_spectral_send_tlv_to_host 1825 * @spectral: Send the TLV information to Host 1826 * @data: Pointer to the TLV 1827 * @datalen: tlv length 1828 * 1829 * Return: Success/Failure 1830 * 1831 */ 1832 int target_if_spectral_send_tlv_to_host( 1833 struct target_if_spectral *spectral, 1834 uint8_t *data, uint32_t datalen); 1835 1836 void target_if_register_wmi_spectral_cmd_ops( 1837 struct wlan_objmgr_pdev *pdev, 1838 struct wmi_spectral_cmd_ops *cmd_ops); 1839 1840 QDF_STATUS 1841 target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral, 1842 uint8_t detector_id); 1843 #ifdef DIRECT_BUF_RX_ENABLE 1844 /** 1845 * target_if_consume_sfft_report_gen3() - Process fft report for gen3 1846 * @spectral: Pointer to spectral object 1847 * @report: Pointer to spectral report 1848 * 1849 * Process fft report for gen3 1850 * 1851 * Return: Success/Failure 1852 */ 1853 int 1854 target_if_consume_spectral_report_gen3( 1855 struct target_if_spectral *spectral, 1856 struct spectral_report *report); 1857 #endif 1858 1859 #ifdef WIN32 1860 #pragma pack(pop, target_if_spectral) 1861 #endif 1862 #ifdef __ATTRIB_PACK 1863 #undef __ATTRIB_PACK 1864 #endif 1865 1866 #endif /* WLAN_CONV_SPECTRAL_ENABLE */ 1867 #endif /* _TARGET_IF_SPECTRAL_H_ */ 1868