spectral_ioctl.h 24 KB

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