spectral_ioctl.h 24 KB

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