target_if_spectral.h 71 KB

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