spectral_ioctl.h 22 KB

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