target_if_spectral.h 103 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047
  1. /*
  2. * Copyright (c) 2011,2017-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  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 <wlan_reg_services_api.h>
  26. #include <qdf_lock.h>
  27. #include <wlan_spectral_public_structs.h>
  28. #include <reg_services_public_struct.h>
  29. #ifdef DIRECT_BUF_RX_ENABLE
  30. #include <target_if_direct_buf_rx_api.h>
  31. #endif
  32. #ifdef WIN32
  33. #pragma pack(push, target_if_spectral, 1)
  34. #define __ATTRIB_PACK
  35. #else
  36. #ifndef __ATTRIB_PACK
  37. #define __ATTRIB_PACK __attribute__ ((packed))
  38. #endif
  39. #endif
  40. #include <spectral_defs_i.h>
  41. #include <wmi_unified_param.h>
  42. #define FREQ_OFFSET_10MHZ (10)
  43. #define FREQ_OFFSET_40MHZ (40)
  44. #define FREQ_OFFSET_80MHZ (80)
  45. #define FREQ_OFFSET_85MHZ (85)
  46. #ifndef SPECTRAL_USE_NL_BCAST
  47. #define SPECTRAL_USE_NL_BCAST (0)
  48. #endif
  49. #define STATUS_PASS 1
  50. #define STATUS_FAIL 0
  51. #undef spectral_dbg_line
  52. #define spectral_dbg_line() \
  53. spectral_debug("----------------------------------------------------")
  54. #undef spectral_ops_not_registered
  55. #define spectral_ops_not_registered(str) \
  56. spectral_info("SPECTRAL : %s not registered\n", (str))
  57. #undef not_yet_implemented
  58. #define not_yet_implemented() \
  59. spectral_info("SPECTRAL : %s : %d Not yet implemented\n", \
  60. __func__, __LINE__)
  61. #define SPECTRAL_HT20_NUM_BINS 56
  62. #define SPECTRAL_HT20_FFT_LEN 56
  63. #define SPECTRAL_HT20_DC_INDEX (SPECTRAL_HT20_FFT_LEN / 2)
  64. #define SPECTRAL_HT20_DATA_LEN 60
  65. #define SPECTRAL_HT20_TOTAL_DATA_LEN (SPECTRAL_HT20_DATA_LEN + 3)
  66. #define SPECTRAL_HT40_TOTAL_NUM_BINS 128
  67. #define SPECTRAL_HT40_DATA_LEN 135
  68. #define SPECTRAL_HT40_TOTAL_DATA_LEN (SPECTRAL_HT40_DATA_LEN + 3)
  69. #define SPECTRAL_HT40_FFT_LEN 128
  70. #define SPECTRAL_HT40_DC_INDEX (SPECTRAL_HT40_FFT_LEN / 2)
  71. /*
  72. * Used for the SWAR to obtain approximate combined rssi
  73. * in secondary 80Mhz segment
  74. */
  75. #define OFFSET_CH_WIDTH_20 65
  76. #define OFFSET_CH_WIDTH_40 62
  77. #define OFFSET_CH_WIDTH_80 56
  78. #define OFFSET_CH_WIDTH_160 50
  79. /* Min and max for relevant Spectral params */
  80. #define SPECTRAL_PARAM_FFT_SIZE_MIN_GEN2 (1)
  81. #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN2 (9)
  82. #define SPECTRAL_PARAM_FFT_SIZE_MIN_GEN3 (5)
  83. #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_DEFAULT (9)
  84. #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_QCN9000 (10)
  85. #define SPECTRAL_PARAM_FFT_SIZE_MIN_GEN3_BE (5)
  86. #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_BE (11)
  87. #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_BE_20MHZ (9)
  88. #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_BE_40MHZ (10)
  89. #define INVALID_FFT_SIZE (0xFFFF)
  90. #define SPECTRAL_PARAM_RPT_MODE_MIN (0)
  91. #define SPECTRAL_PARAM_RPT_MODE_MAX (3)
  92. #define SPECTRAL_DWORD_SIZE (4)
  93. #define MAX_FFTBIN_VALUE_LINEAR_MODE (U8_MAX)
  94. #define MAX_FFTBIN_VALUE_DBM_MODE (S8_MAX)
  95. #define MIN_FFTBIN_VALUE_DBM_MODE (S8_MIN)
  96. #define MAX_FFTBIN_VALUE (255)
  97. /* DBR ring debug size for Spectral */
  98. #define SPECTRAL_DBR_RING_DEBUG_SIZE 512
  99. #ifdef BIG_ENDIAN_HOST
  100. #define SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(destp, srcp, len) do { \
  101. int j; \
  102. uint32_t *src, *dest; \
  103. src = (uint32_t *)(srcp); \
  104. dest = (uint32_t *)(destp); \
  105. for (j = 0; j < roundup((len), sizeof(uint32_t)) / 4; j++) { \
  106. *(dest + j) = qdf_le32_to_cpu(*(src + j)); \
  107. } \
  108. } while (0)
  109. #else
  110. #define SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(destp, srcp, len) \
  111. OS_MEMCPY((destp), (srcp), (len));
  112. #endif
  113. #define DUMMY_NF_VALUE (-123)
  114. /* 5 categories x (lower + upper) bands */
  115. #define MAX_INTERF 10
  116. #define HOST_MAX_ANTENNA 3
  117. /* Mask for time stamp from descriptor */
  118. #define SPECTRAL_TSMASK 0xFFFFFFFF
  119. #define SPECTRAL_SIGNATURE 0xdeadbeef
  120. /* Signature to write onto spectral buffer and then later validate */
  121. #define MEM_POISON_SIGNATURE (htobe32(0xdeadbeef))
  122. /* START of spectral GEN II HW specific details */
  123. #define SPECTRAL_PHYERR_SIGNATURE_GEN2 0xbb
  124. #define TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN2 0xF9
  125. #define TLV_TAG_ADC_REPORT_GEN2 0xFA
  126. #define TLV_TAG_SEARCH_FFT_REPORT_GEN2 0xFB
  127. /**
  128. * The Maximum number of detector informations to be filled in the SAMP msg
  129. * is 3, only for 165MHz case. For all other cases this value will be 1.
  130. */
  131. #define MAX_NUM_DEST_DETECTOR_INFO (3)
  132. #define MAX_DETECTORS_PER_PDEV (3)
  133. #define FFT_BIN_SIZE_1BYTE (1)
  134. #ifdef OPTIMIZED_SAMP_MESSAGE
  135. /**
  136. * enum spectral_160mhz_report_delivery_state - 160 MHz state machine states
  137. * @SPECTRAL_REPORT_WAIT_PRIMARY80: Wait for primary80 report
  138. * @SPECTRAL_REPORT_WAIT_SECONDARY80: Wait for secondory 80 report
  139. */
  140. enum spectral_160mhz_report_delivery_state {
  141. SPECTRAL_REPORT_WAIT_PRIMARY80,
  142. SPECTRAL_REPORT_WAIT_SECONDARY80,
  143. };
  144. #else
  145. /**
  146. * enum spectral_160mhz_report_delivery_state - 160 MHz state machine states
  147. * @SPECTRAL_REPORT_WAIT_PRIMARY80: Wait for primary80 report
  148. * @SPECTRAL_REPORT_RX_PRIMARY80: Receive primary 80 report
  149. * @SPECTRAL_REPORT_WAIT_SECONDARY80: Wait for secondory 80 report
  150. * @SPECTRAL_REPORT_RX_SECONDARY80: Receive secondary 80 report
  151. */
  152. enum spectral_160mhz_report_delivery_state {
  153. SPECTRAL_REPORT_WAIT_PRIMARY80,
  154. SPECTRAL_REPORT_RX_PRIMARY80,
  155. SPECTRAL_REPORT_WAIT_SECONDARY80,
  156. SPECTRAL_REPORT_RX_SECONDARY80,
  157. };
  158. #endif /* OPTIMIZED_SAMP_MESSAGE */
  159. /**
  160. * enum spectral_freq_span_id - Spectral frequency span id
  161. * @SPECTRAL_FREQ_SPAN_ID_0: Frequency span 0
  162. * @SPECTRAL_FREQ_SPAN_ID_1: Frequency span 1
  163. * @SPECTRAL_FREQ_SPAN_ID_2: Frequency span 2
  164. */
  165. enum spectral_freq_span_id {
  166. SPECTRAL_FREQ_SPAN_ID_0,
  167. SPECTRAL_FREQ_SPAN_ID_1,
  168. SPECTRAL_FREQ_SPAN_ID_2,
  169. };
  170. /**
  171. * enum spectral_detector_id - Spectral detector id
  172. * @SPECTRAL_DETECTOR_ID_0: Spectral detector 0
  173. * @SPECTRAL_DETECTOR_ID_1: Spectral detector 1
  174. * @SPECTRAL_DETECTOR_ID_2: Spectral detector 2
  175. * @SPECTRAL_DETECTOR_ID_MAX: Max Spectral detector ID
  176. * @SPECTRAL_DETECTOR_ID_INVALID: Invalid Spectral detector ID
  177. */
  178. enum spectral_detector_id {
  179. SPECTRAL_DETECTOR_ID_0,
  180. SPECTRAL_DETECTOR_ID_1,
  181. SPECTRAL_DETECTOR_ID_2,
  182. SPECTRAL_DETECTOR_ID_MAX,
  183. SPECTRAL_DETECTOR_ID_INVALID = 0xff,
  184. };
  185. /**
  186. * struct spectral_search_fft_info_gen2 - spectral search fft report for gen2
  187. * @relpwr_db: Total bin power in db
  188. * @num_str_bins_ib: Number of strong bins
  189. * @base_pwr: Base power
  190. * @total_gain_info: Total gain
  191. * @fft_chn_idx: FFT chain on which report is originated
  192. * @avgpwr_db: Average power in db
  193. * @peak_mag: Peak power seen in the bins
  194. * @peak_inx: Index of bin holding peak power
  195. */
  196. struct spectral_search_fft_info_gen2 {
  197. uint32_t relpwr_db;
  198. uint32_t num_str_bins_ib;
  199. uint32_t base_pwr;
  200. uint32_t total_gain_info;
  201. uint32_t fft_chn_idx;
  202. uint32_t avgpwr_db;
  203. uint32_t peak_mag;
  204. int16_t peak_inx;
  205. };
  206. /*
  207. * XXX Check if we should be handling the endinness difference in some
  208. * other way opaque to the host
  209. */
  210. #ifdef BIG_ENDIAN_HOST
  211. /**
  212. * struct spectral_phyerr_tlv_gen2 - phyerr tlv info for big endian host
  213. * @signature: signature
  214. * @tag: tag
  215. * @length: length
  216. */
  217. struct spectral_phyerr_tlv_gen2 {
  218. uint8_t signature;
  219. uint8_t tag;
  220. uint16_t length;
  221. } __ATTRIB_PACK;
  222. #else
  223. /**
  224. * struct spectral_phyerr_tlv_gen2 - phyerr tlv info for little endian host
  225. * @length: length
  226. * @tag: tag
  227. * @signature: signature
  228. */
  229. struct spectral_phyerr_tlv_gen2 {
  230. uint16_t length;
  231. uint8_t tag;
  232. uint8_t signature;
  233. } __ATTRIB_PACK;
  234. #endif /* BIG_ENDIAN_HOST */
  235. /**
  236. * struct spectral_phyerr_hdr_gen2 - phyerr header for gen2 HW
  237. * @hdr_a: Header[0:31]
  238. * @hdr_b: Header[32:63]
  239. */
  240. struct spectral_phyerr_hdr_gen2 {
  241. uint32_t hdr_a;
  242. uint32_t hdr_b;
  243. };
  244. /*
  245. * Segment ID information for 80+80.
  246. *
  247. * If the HW micro-architecture specification extends this DWORD for other
  248. * purposes, then redefine+rename accordingly. For now, the specification
  249. * mentions only segment ID (though this doesn't require an entire DWORD)
  250. * without mention of any generic terminology for the DWORD, or any reservation.
  251. * We use nomenclature accordingly.
  252. */
  253. typedef uint32_t SPECTRAL_SEGID_INFO;
  254. /**
  255. * struct spectral_phyerr_fft_gen2 - fft info in phyerr event
  256. * @buf: fft report
  257. */
  258. struct spectral_phyerr_fft_gen2 {
  259. uint8_t buf[0];
  260. };
  261. /**
  262. * struct spectral_process_phyerr_info_gen2 - Processed phyerr info structures
  263. * needed to fill SAMP params for gen2
  264. * @p_rfqual: Pointer to RF quality info
  265. * @p_sfft: Pointer to Search fft report info
  266. * @pfft: Pointer to FFT info in Phyerr event
  267. * @acs_stats: Pointer to ACS stats struct
  268. * @tsf64: 64 bit TSF value
  269. * @seg_d : Segment ID
  270. */
  271. struct spectral_process_phyerr_info_gen2 {
  272. struct target_if_spectral_rfqual_info *p_rfqual;
  273. struct spectral_search_fft_info_gen2 *p_sfft;
  274. struct spectral_phyerr_fft_gen2 *pfft;
  275. struct target_if_spectral_acs_stats *acs_stats;
  276. uint64_t tsf64;
  277. uint8_t seg_id;
  278. };
  279. /* END of spectral GEN II HW specific details */
  280. /* START of spectral GEN III HW specific details */
  281. #define get_bitfield(value, size, pos) \
  282. (((value) >> (pos)) & ((1 << (size)) - 1))
  283. #define unsigned_to_signed(value, width) \
  284. (((value) >= (1 << ((width) - 1))) ? \
  285. (value - (1 << (width))) : (value))
  286. #define SSCAN_SUMMARY_REPORT_HDR_A_DETECTOR_ID_POS_GEN3 (29)
  287. #define SSCAN_SUMMARY_REPORT_HDR_A_DETECTOR_ID_SIZE_GEN3 (2)
  288. #define SSCAN_SUMMARY_REPORT_HDR_A_AGC_TOTAL_GAIN_POS_GEN3 (0)
  289. #define SSCAN_SUMMARY_REPORT_HDR_A_AGC_TOTAL_GAIN_SIZE_GEN3 (8)
  290. #define SSCAN_SUMMARY_REPORT_HDR_A_INBAND_PWR_DB_POS_GEN3 (18)
  291. #define SSCAN_SUMMARY_REPORT_HDR_A_INBAND_PWR_DB_SIZE_GEN3 (10)
  292. #define SSCAN_SUMMARY_REPORT_HDR_A_PRI80_POS_GEN3 (31)
  293. #define SSCAN_SUMMARY_REPORT_HDR_A_PRI80_SIZE_GEN3 (1)
  294. #define SSCAN_SUMMARY_REPORT_HDR_B_GAINCHANGE_POS_GEN3_V1 (30)
  295. #define SSCAN_SUMMARY_REPORT_HDR_B_GAINCHANGE_SIZE_GEN3_V1 (1)
  296. #define SSCAN_SUMMARY_REPORT_HDR_C_GAINCHANGE_POS_GEN3_V2 (16)
  297. #define SSCAN_SUMMARY_REPORT_HDR_C_GAINCHANGE_SIZE_GEN3_V2 (1)
  298. #define SPECTRAL_REPORT_LTS_HDR_LENGTH_POS_GEN3 (0)
  299. #define SPECTRAL_REPORT_LTS_HDR_LENGTH_SIZE_GEN3 (16)
  300. #define SPECTRAL_REPORT_LTS_TAG_POS_GEN3 (16)
  301. #define SPECTRAL_REPORT_LTS_TAG_SIZE_GEN3 (8)
  302. #define SPECTRAL_REPORT_LTS_SIGNATURE_POS_GEN3 (24)
  303. #define SPECTRAL_REPORT_LTS_SIGNATURE_SIZE_GEN3 (8)
  304. #define FFT_REPORT_HDR_A_DETECTOR_ID_POS_GEN3 (0)
  305. #define FFT_REPORT_HDR_A_DETECTOR_ID_SIZE_GEN3 (2)
  306. #define FFT_REPORT_HDR_A_FFT_NUM_POS_GEN3 (2)
  307. #define FFT_REPORT_HDR_A_FFT_NUM_SIZE_GEN3 (3)
  308. #define FFT_REPORT_HDR_A_RADAR_CHECK_POS_GEN3_V1 (5)
  309. #define FFT_REPORT_HDR_A_RADAR_CHECK_SIZE_GEN3_V1 (12)
  310. #define FFT_REPORT_HDR_A_RADAR_CHECK_POS_GEN3_V2 (5)
  311. #define FFT_REPORT_HDR_A_RADAR_CHECK_SIZE_GEN3_V2 (14)
  312. #define FFT_REPORT_HDR_A_PEAK_INDEX_POS_GEN3_V1 (17)
  313. #define FFT_REPORT_HDR_A_PEAK_INDEX_SIZE_GEN3_V1 (11)
  314. #define FFT_REPORT_HDR_A_PEAK_INDEX_POS_GEN3_V2 (19)
  315. #define FFT_REPORT_HDR_A_PEAK_INDEX_SIZE_GEN3_V2 (11)
  316. #define FFT_REPORT_HDR_A_CHAIN_INDEX_POS_GEN3_V1 (28)
  317. #define FFT_REPORT_HDR_A_CHAIN_INDEX_SIZE_GEN3_V1 (3)
  318. #define FFT_REPORT_HDR_B_CHAIN_INDEX_POS_GEN3_V2 (0)
  319. #define FFT_REPORT_HDR_B_CHAIN_INDEX_SIZE_GEN3_V2 (3)
  320. #define FFT_REPORT_HDR_B_BASE_PWR_POS_GEN3_V1 (0)
  321. #define FFT_REPORT_HDR_B_BASE_PWR_SIZE_GEN3_V1 (9)
  322. #define FFT_REPORT_HDR_B_BASE_PWR_POS_GEN3_V2 (3)
  323. #define FFT_REPORT_HDR_B_BASE_PWR_SIZE_GEN3_V2 (9)
  324. #define FFT_REPORT_HDR_B_TOTAL_GAIN_POS_GEN3_V1 (9)
  325. #define FFT_REPORT_HDR_B_TOTAL_GAIN_SIZE_GEN3_V1 (8)
  326. #define FFT_REPORT_HDR_B_TOTAL_GAIN_POS_GEN3_V2 (12)
  327. #define FFT_REPORT_HDR_B_TOTAL_GAIN_SIZE_GEN3_V2 (8)
  328. #define FFT_REPORT_HDR_C_NUM_STRONG_BINS_POS_GEN3 (0)
  329. #define FFT_REPORT_HDR_C_NUM_STRONG_BINS_SIZE_GEN3 (8)
  330. #define FFT_REPORT_HDR_C_PEAK_MAGNITUDE_POS_GEN3 (8)
  331. #define FFT_REPORT_HDR_C_PEAK_MAGNITUDE_SIZE_GEN3 (10)
  332. #define FFT_REPORT_HDR_C_AVG_PWR_POS_GEN3 (18)
  333. #define FFT_REPORT_HDR_C_AVG_PWR_SIZE_GEN3 (7)
  334. #define FFT_REPORT_HDR_C_RELATIVE_PWR_POS_GEN3 (25)
  335. #define FFT_REPORT_HDR_C_RELATIVE_PWR_SIZE_GEN3 (7)
  336. #define SPECTRAL_PHYERR_SIGNATURE_GEN3 (0xFA)
  337. #define TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN3 (0x02)
  338. #define TLV_TAG_SEARCH_FFT_REPORT_GEN3 (0x03)
  339. #define SPECTRAL_PHYERR_TLVSIZE_GEN3 (4)
  340. #define NUM_SPECTRAL_DETECTORS_GEN3_V1 (3)
  341. #define NUM_SPECTRAL_DETECTORS_GEN3_V2 (2)
  342. #define FFT_REPORT_HEADER_LENGTH_GEN3_V2 (24)
  343. #define FFT_REPORT_HEADER_LENGTH_GEN3_V1 (16)
  344. #define NUM_PADDING_BYTES_SSCAN_SUMARY_REPORT_GEN3_V1 (0)
  345. #define NUM_PADDING_BYTES_SSCAN_SUMARY_REPORT_GEN3_V2 (16)
  346. #define SPECTRAL_PHYERR_HDR_LTS_POS \
  347. (offsetof(struct spectral_phyerr_fft_report_gen3, fft_hdr_lts))
  348. #define SPECTRAL_FFT_BINS_POS \
  349. (offsetof(struct spectral_phyerr_fft_report_gen3, buf))
  350. /**
  351. * struct phyerr_info - spectral search fft report for gen3
  352. * @data: handle to phyerror buffer
  353. * @datalen: length of phyerror bufer
  354. * @p_rfqual: rf quality matrices
  355. * @p_chaninfo: pointer to chaninfo
  356. * @tsf64: 64 bit TSF
  357. * @acs_stats: acs stats
  358. */
  359. struct phyerr_info {
  360. uint8_t *data;
  361. uint32_t datalen;
  362. struct target_if_spectral_rfqual_info *p_rfqual;
  363. struct target_if_spectral_chan_info *p_chaninfo;
  364. uint64_t tsf64;
  365. struct target_if_spectral_acs_stats *acs_stats;
  366. };
  367. /**
  368. * struct spectral_search_fft_info_gen3 - spectral search fft report for gen3
  369. * @timestamp: Timestamp at which fft report was generated
  370. * @last_raw_timestamp: Previous FFT report's raw timestamp
  371. * @adjusted_timestamp: Adjusted timestamp to account for target reset
  372. * @fft_detector_id: Which radio generated this report
  373. * @fft_num: The FFT count number. Set to 0 for short FFT.
  374. * @fft_radar_check: NA for spectral
  375. * @fft_peak_sidx: Index of bin with maximum power
  376. * @fft_chn_idx: Rx chain index
  377. * @fft_base_pwr_db: Base power in dB
  378. * @fft_total_gain_db: Total gain in dB
  379. * @fft_num_str_bins_ib: Number of strong bins in the report
  380. * @fft_peak_mag: Peak magnitude
  381. * @fft_avgpwr_db: Average power in dB
  382. * @fft_relpwr_db: Relative power in dB
  383. * @fft_bin_count: Number of FFT bins in the FFT report
  384. * @fft_bin_size: Size of one FFT bin in bytes
  385. * @bin_pwr_data: Contains FFT bins extracted from the report
  386. */
  387. struct spectral_search_fft_info_gen3 {
  388. uint32_t timestamp;
  389. uint32_t last_raw_timestamp;
  390. uint32_t adjusted_timestamp;
  391. uint32_t fft_detector_id;
  392. uint32_t fft_num;
  393. uint32_t fft_radar_check;
  394. int32_t fft_peak_sidx;
  395. uint32_t fft_chn_idx;
  396. uint32_t fft_base_pwr_db;
  397. uint32_t fft_total_gain_db;
  398. uint32_t fft_num_str_bins_ib;
  399. int32_t fft_peak_mag;
  400. uint32_t fft_avgpwr_db;
  401. uint32_t fft_relpwr_db;
  402. uint32_t fft_bin_count;
  403. uint8_t fft_bin_size;
  404. uint8_t *bin_pwr_data;
  405. };
  406. /**
  407. * struct spectral_phyerr_sfftreport_gen3 - fft info in phyerr event
  408. * @fft_timestamp: Timestamp at which fft report was generated
  409. * @fft_hdr_lts: length, tag, signature fields
  410. * @hdr_a: Header[0:31]
  411. * @hdr_b: Header[32:63]
  412. * @hdr_c: Header[64:95]
  413. * @resv: Header[96:127]
  414. * @buf: fft bins
  415. */
  416. struct spectral_phyerr_fft_report_gen3 {
  417. uint32_t fft_timestamp;
  418. uint32_t fft_hdr_lts;
  419. uint32_t hdr_a;
  420. uint32_t hdr_b;
  421. uint32_t hdr_c;
  422. uint32_t resv;
  423. uint8_t buf[0];
  424. } __ATTRIB_PACK;
  425. /**
  426. * struct sscan_report_fields_gen3 - Fields of spectral report
  427. * @sscan_agc_total_gain: The AGC total gain in DB.
  428. * @inband_pwr_db: The in-band power of the signal in 1/2 DB steps
  429. * @sscan_gainchange: This bit is set to 1 if a gainchange occurred during
  430. * the spectral scan FFT. Software may choose to
  431. * disregard the results.
  432. * @sscan_pri80: This is set to 1 to indicate that the Spectral scan was
  433. * performed on the pri80 segment. Software may choose to
  434. * disregard the FFT sample if this is set to 1 but detector ID
  435. * does not correspond to the ID for the pri80 segment.
  436. * @sscan_detector_id: Detector ID in Spectral scan report
  437. */
  438. struct sscan_report_fields_gen3 {
  439. uint8_t sscan_agc_total_gain;
  440. int16_t inband_pwr_db;
  441. uint8_t sscan_gainchange;
  442. uint8_t sscan_pri80;
  443. uint8_t sscan_detector_id;
  444. };
  445. /**
  446. * struct spectral_sscan_summary_report_gen3 - Spectral summary report
  447. * event
  448. * @sscan_timestamp: Timestamp at which fft report was generated
  449. * @sscan_hdr_lts: length, tag, signature fields
  450. * @hdr_a: Header[0:31]
  451. * @resv: Header[32:63]
  452. * @hdr_b: Header[64:95]
  453. * @hdr_c: Header[96:127]
  454. */
  455. struct spectral_sscan_summary_report_gen3 {
  456. u_int32_t sscan_timestamp;
  457. u_int32_t sscan_hdr_lts;
  458. u_int32_t hdr_a;
  459. u_int32_t res1;
  460. u_int32_t hdr_b;
  461. u_int32_t hdr_c;
  462. } __ATTRIB_PACK;
  463. #ifdef DIRECT_BUF_RX_ENABLE
  464. /**
  465. * struct Spectral_report - spectral report
  466. * @data: Report buffer
  467. * @noisefloor: Noise floor values
  468. * @reset_delay: Time taken for warm reset in us
  469. * @cfreq1: center frequency 1
  470. * @cfreq2: center frequency 2
  471. * @ch_width: channel width
  472. */
  473. struct spectral_report {
  474. uint8_t *data;
  475. int32_t noisefloor[DBR_MAX_CHAINS];
  476. uint32_t reset_delay;
  477. uint32_t cfreq1;
  478. uint32_t cfreq2;
  479. uint32_t ch_width;
  480. };
  481. #endif
  482. /* END of spectral GEN III HW specific details */
  483. typedef signed char pwr_dbm;
  484. /**
  485. * enum spectral_gen - spectral hw generation
  486. * @SPECTRAL_GEN1 : spectral hw gen 1
  487. * @SPECTRAL_GEN2 : spectral hw gen 2
  488. * @SPECTRAL_GEN3 : spectral hw gen 3
  489. */
  490. enum spectral_gen {
  491. SPECTRAL_GEN1,
  492. SPECTRAL_GEN2,
  493. SPECTRAL_GEN3,
  494. };
  495. /**
  496. * enum spectral_fftbin_size_war - spectral fft bin size war
  497. * @SPECTRAL_FFTBIN_SIZE_NO_WAR : No WAR applicable for Spectral FFT bin size
  498. * @SPECTRAL_FFTBIN_SIZE_2BYTE_TO_1BYTE : Spectral FFT bin size: Retain only
  499. * least significant byte from 2 byte
  500. * FFT bin transferred by HW
  501. * @SPECTRAL_FFTBIN_SIZE_4BYTE_TO_1BYTE : Spectral FFT bin size: Retain only
  502. * least significant byte from 4 byte
  503. * FFT bin transferred by HW
  504. */
  505. enum spectral_fftbin_size_war {
  506. SPECTRAL_FFTBIN_SIZE_NO_WAR = 0,
  507. SPECTRAL_FFTBIN_SIZE_WAR_2BYTE_TO_1BYTE = 1,
  508. SPECTRAL_FFTBIN_SIZE_WAR_4BYTE_TO_1BYTE = 2,
  509. };
  510. /**
  511. * enum spectral_report_format_version - This represents the report format
  512. * version number within each Spectral generation.
  513. * @SPECTRAL_REPORT_FORMAT_VERSION_1 : version 1
  514. * @SPECTRAL_REPORT_FORMAT_VERSION_2 : version 2
  515. */
  516. enum spectral_report_format_version {
  517. SPECTRAL_REPORT_FORMAT_VERSION_1,
  518. SPECTRAL_REPORT_FORMAT_VERSION_2,
  519. };
  520. /**
  521. * struct spectral_fft_bin_len_adj_swar - Encapsulate information required for
  522. * Spectral FFT bin length adjusting software WARS.
  523. * @inband_fftbin_size_adj: Whether to carry out FFT bin size adjustment for
  524. * in-band report format. This would be required on some chipsets under the
  525. * following circumstances: In report mode 2 only the in-band bins are DMA'ed.
  526. * Scatter/gather is used. However, the HW generates all bins, not just in-band,
  527. * and reports the number of bins accordingly. The subsystem arranging for the
  528. * DMA cannot change this value. On such chipsets the adjustment required at the
  529. * host driver is to check if report format is 2, and if so halve the number of
  530. * bins reported to get the number actually DMA'ed.
  531. * @null_fftbin_adj: Whether to remove NULL FFT bins for report mode (1) in
  532. * which only summary of metrics for each completed FFT + spectral scan summary
  533. * report are to be provided. This would be required on some chipsets under the
  534. * following circumstances: In report mode 1, HW reports a length corresponding
  535. * to all bins, and provides bins with value 0. This is because the subsystem
  536. * arranging for the FFT information does not arrange for DMA of FFT bin values
  537. * (as expected), but cannot arrange for a smaller length to be reported by HW.
  538. * In these circumstances, the driver would have to disregard the NULL bins and
  539. * report a bin count of 0 to higher layers.
  540. * @packmode_fftbin_size_adj: Pack mode in HW refers to packing of each Spectral
  541. * FFT bin into 2 bytes. But due to a bug HW reports 2 times the expected length
  542. * when packmode is enabled. This SWAR compensates this bug by dividing the
  543. * length with 2.
  544. * @fftbin_size_war: Type of FFT bin size SWAR
  545. */
  546. struct spectral_fft_bin_len_adj_swar {
  547. u_int8_t inband_fftbin_size_adj;
  548. u_int8_t null_fftbin_adj;
  549. uint8_t packmode_fftbin_size_adj;
  550. enum spectral_fftbin_size_war fftbin_size_war;
  551. };
  552. /**
  553. * struct spectral_report_params - Parameters related to format of Spectral
  554. * report.
  555. * @version: This represents the report format version number within each
  556. * Spectral generation.
  557. * @ssumaary_padding_bytes: Number of bytes of padding after Spectral summary
  558. * report
  559. * @fft_report_hdr_len: Number of bytes in the header of the FFT report. This
  560. * has to be subtracted from the length field of FFT report to find the length
  561. * of FFT bins.
  562. * @fragmentation_160: This indicates whether Spectral reports in 160/80p80 is
  563. * fragmented.
  564. * @detid_mode_table: Detector ID to Spectral scan mode table
  565. * @num_spectral_detectors: Total number of Spectral detectors
  566. * @marker: Describes the boundaries of pri80, 5 MHz and sec80 bins
  567. * @hw_fft_bin_width: FFT bin width reported by the HW
  568. */
  569. struct spectral_report_params {
  570. enum spectral_report_format_version version;
  571. uint8_t ssumaary_padding_bytes;
  572. uint8_t fft_report_hdr_len;
  573. bool fragmentation_160[SPECTRAL_SCAN_MODE_MAX];
  574. enum spectral_scan_mode detid_mode_table[SPECTRAL_DETECTOR_ID_MAX];
  575. uint8_t num_spectral_detectors;
  576. struct spectral_fft_bin_markers_160_165mhz
  577. marker[SPECTRAL_SCAN_MODE_MAX];
  578. uint8_t hw_fft_bin_width;
  579. };
  580. /**
  581. * struct spectral_param_min_max - Spectral parameter minimum and maximum values
  582. * @fft_size_min: Minimum value of fft_size
  583. * @fft_size_max: Maximum value of fft_size for each BW
  584. */
  585. struct spectral_param_min_max {
  586. uint16_t fft_size_min;
  587. uint16_t fft_size_max[CH_WIDTH_MAX];
  588. };
  589. /**
  590. * struct spectral_timestamp_swar - Spectral time stamp WAR related parameters
  591. * @timestamp_war_offset: Offset to be added to correct timestamp
  592. * @target_reset_count: Number of times target exercised the reset routine
  593. * @last_fft_timestamp: last fft report timestamp
  594. */
  595. struct spectral_timestamp_war {
  596. uint32_t timestamp_war_offset[SPECTRAL_SCAN_MODE_MAX];
  597. uint64_t target_reset_count;
  598. uint32_t last_fft_timestamp[SPECTRAL_SCAN_MODE_MAX];
  599. };
  600. #if ATH_PERF_PWR_OFFLOAD
  601. /**
  602. * enum target_if_spectral_info - Enumerations for specifying which spectral
  603. * information (among parameters and states)
  604. * is desired.
  605. * @TARGET_IF_SPECTRAL_INFO_ACTIVE: Indicated whether spectral is active
  606. * @TARGET_IF_SPECTRAL_INFO_ENABLED: Indicated whether spectral is enabled
  607. * @TARGET_IF_SPECTRAL_INFO_PARAMS: Config params
  608. */
  609. enum target_if_spectral_info {
  610. TARGET_IF_SPECTRAL_INFO_ACTIVE,
  611. TARGET_IF_SPECTRAL_INFO_ENABLED,
  612. TARGET_IF_SPECTRAL_INFO_PARAMS,
  613. };
  614. #endif /* ATH_PERF_PWR_OFFLOAD */
  615. /* forward declaration */
  616. struct target_if_spectral;
  617. /**
  618. * struct target_if_spectral_chan_info - Channel information
  619. * @center_freq1: center frequency 1 in MHz
  620. * @center_freq2: center frequency 2 in MHz -valid only for
  621. * 11ACVHT 80PLUS80 mode
  622. * @chan_width: channel width in MHz
  623. */
  624. struct target_if_spectral_chan_info {
  625. uint16_t center_freq1;
  626. uint16_t center_freq2;
  627. uint8_t chan_width;
  628. };
  629. /**
  630. * struct target_if_spectral_acs_stats - EACS stats from spectral samples
  631. * @nfc_ctl_rssi: Control chan rssi
  632. * @nfc_ext_rssi: Extension chan rssi
  633. * @ctrl_nf: Control chan Noise Floor
  634. * @ext_nf: Extension chan Noise Floor
  635. */
  636. struct target_if_spectral_acs_stats {
  637. int8_t nfc_ctl_rssi;
  638. int8_t nfc_ext_rssi;
  639. int8_t ctrl_nf;
  640. int8_t ext_nf;
  641. };
  642. /**
  643. * struct target_if_spectral_perchain_rssi_info - per chain rssi info
  644. * @rssi_pri20: Rssi of primary 20 Mhz
  645. * @rssi_sec20: Rssi of secondary 20 Mhz
  646. * @rssi_sec40: Rssi of secondary 40 Mhz
  647. * @rssi_sec80: Rssi of secondary 80 Mhz
  648. */
  649. struct target_if_spectral_perchain_rssi_info {
  650. int8_t rssi_pri20;
  651. int8_t rssi_sec20;
  652. int8_t rssi_sec40;
  653. int8_t rssi_sec80;
  654. };
  655. /**
  656. * struct target_if_spectral_rfqual_info - RF measurement information
  657. * @rssi_comb: RSSI Information
  658. * @pc_rssi_info: XXX : For now, we know we are getting information
  659. * for only 4 chains at max. For future extensions
  660. * use a define
  661. * @noise_floor: Noise floor information
  662. */
  663. struct target_if_spectral_rfqual_info {
  664. int8_t rssi_comb;
  665. struct target_if_spectral_perchain_rssi_info pc_rssi_info[4];
  666. int16_t noise_floor[4];
  667. };
  668. #define GET_TARGET_IF_SPECTRAL_OPS(spectral) \
  669. ((struct target_if_spectral_ops *)(&((spectral)->spectral_ops)))
  670. /**
  671. * struct target_if_spectral_ops - spectral low level ops table
  672. * @get_tsf64: Get 64 bit TSF value
  673. * @get_capability: Get capability info
  674. * @set_rxfilter: Set rx filter
  675. * @get_rxfilter: Get rx filter
  676. * @is_spectral_active: Check whether icm is active
  677. * @is_spectral_enabled: Check whether spectral is enabled
  678. * @start_spectral_scan: Start spectral scan
  679. * @stop_spectral_scan: Stop spectral scan
  680. * @get_extension_channel: Get extension channel
  681. * @get_ctl_noisefloor: Get control noise floor
  682. * @get_ext_noisefloor: Get extension noise floor
  683. * @configure_spectral: Set spectral configurations
  684. * @get_spectral_config: Get spectral configurations
  685. * @get_ent_spectral_mask: Get spectral mask
  686. * @get_mac_address: Get mac address
  687. * @get_current_channel: Get current channel
  688. * @reset_hw: Reset HW
  689. * @get_chain_noise_floor: Get Channel noise floor
  690. * @spectral_process_phyerr: Process phyerr event
  691. * @process_spectral_report: Process spectral report
  692. * @byte_swap_headers: Apply byte-swap on report headers
  693. * @byte_swap_fft_bins: Apply byte-swap on FFT bins
  694. */
  695. struct target_if_spectral_ops {
  696. uint64_t (*get_tsf64)(void *arg);
  697. uint32_t (*get_capability)(
  698. void *arg, enum spectral_capability_type type);
  699. uint32_t (*set_rxfilter)(void *arg, int rxfilter);
  700. uint32_t (*get_rxfilter)(void *arg);
  701. uint32_t (*is_spectral_active)(void *arg,
  702. enum spectral_scan_mode smode);
  703. uint32_t (*is_spectral_enabled)(void *arg,
  704. enum spectral_scan_mode smode);
  705. uint32_t (*start_spectral_scan)(void *arg,
  706. enum spectral_scan_mode smode,
  707. enum spectral_cp_error_code *err);
  708. uint32_t (*stop_spectral_scan)(void *arg,
  709. enum spectral_scan_mode smode);
  710. uint32_t (*get_extension_channel)(void *arg,
  711. enum spectral_scan_mode smode);
  712. int8_t (*get_ctl_noisefloor)(void *arg);
  713. int8_t (*get_ext_noisefloor)(void *arg);
  714. uint32_t (*configure_spectral)(
  715. void *arg,
  716. struct spectral_config *params,
  717. enum spectral_scan_mode smode);
  718. uint32_t (*get_spectral_config)(
  719. void *arg,
  720. struct spectral_config *params,
  721. enum spectral_scan_mode smode);
  722. uint32_t (*get_ent_spectral_mask)(void *arg);
  723. uint32_t (*get_mac_address)(void *arg, char *addr);
  724. uint32_t (*get_current_channel)(void *arg,
  725. enum spectral_scan_mode smode);
  726. uint32_t (*reset_hw)(void *arg);
  727. uint32_t (*get_chain_noise_floor)(void *arg, int16_t *nf_buf);
  728. int (*spectral_process_phyerr)(struct target_if_spectral *spectral,
  729. uint8_t *data, uint32_t datalen,
  730. struct target_if_spectral_rfqual_info *p_rfqual,
  731. struct target_if_spectral_chan_info *p_chaninfo,
  732. uint64_t tsf64,
  733. struct target_if_spectral_acs_stats *acs_stats);
  734. int (*process_spectral_report)(struct wlan_objmgr_pdev *pdev,
  735. void *payload);
  736. QDF_STATUS (*byte_swap_headers)(
  737. struct target_if_spectral *spectral,
  738. void *data);
  739. QDF_STATUS (*byte_swap_fft_bins)(
  740. const struct spectral_report_params *rparams,
  741. void *bin_pwr_data, size_t num_fftbins);
  742. };
  743. /**
  744. * struct target_if_spectral_stats - spectral stats info
  745. * @num_spectral_detects: Total num. of spectral detects
  746. * @total_phy_errors: Total number of phyerrors
  747. * @owl_phy_errors: Indicated phyerrors in old gen1 chipsets
  748. * @pri_phy_errors: Phyerrors in primary channel
  749. * @ext_phy_errors: Phyerrors in secondary channel
  750. * @dc_phy_errors: Phyerrors due to dc
  751. * @early_ext_phy_errors: Early secondary channel phyerrors
  752. * @bwinfo_errors: Bandwidth info errors
  753. * @datalen_discards: Invalid data length errors, seen in gen1 chipsets
  754. * @rssi_discards bw: Indicates reports dropped due to RSSI threshold
  755. * @last_reset_tstamp: Last reset time stamp
  756. */
  757. struct target_if_spectral_stats {
  758. uint32_t num_spectral_detects;
  759. uint32_t total_phy_errors;
  760. uint32_t owl_phy_errors;
  761. uint32_t pri_phy_errors;
  762. uint32_t ext_phy_errors;
  763. uint32_t dc_phy_errors;
  764. uint32_t early_ext_phy_errors;
  765. uint32_t bwinfo_errors;
  766. uint32_t datalen_discards;
  767. uint32_t rssi_discards;
  768. uint64_t last_reset_tstamp;
  769. };
  770. /**
  771. * struct target_if_spectral_event - spectral event structure
  772. * @se_ts: Original 15 bit recv timestamp
  773. * @se_full_ts: 64-bit full timestamp from interrupt time
  774. * @se_rssi: Rssi of spectral event
  775. * @se_bwinfo: Rssi of spectral event
  776. * @se_dur: Duration of spectral pulse
  777. * @se_chanindex: Channel of event
  778. * @se_list: List of spectral events
  779. */
  780. struct target_if_spectral_event {
  781. uint32_t se_ts;
  782. uint64_t se_full_ts;
  783. uint8_t se_rssi;
  784. uint8_t se_bwinfo;
  785. uint8_t se_dur;
  786. uint8_t se_chanindex;
  787. STAILQ_ENTRY(spectral_event) se_list;
  788. };
  789. /**
  790. * struct target_if_chain_noise_pwr_info - Noise power info for each channel
  791. * @rptcount: Count of reports in pwr array
  792. * @un_cal_nf: Uncalibrated noise floor
  793. * @factory_cal_nf: Noise floor as calibrated at the factory for module
  794. * @median_pwr: Median power (median of pwr array)
  795. * @pwr: Power reports
  796. */
  797. struct target_if_chain_noise_pwr_info {
  798. int rptcount;
  799. pwr_dbm un_cal_nf;
  800. pwr_dbm factory_cal_nf;
  801. pwr_dbm median_pwr;
  802. pwr_dbm pwr[];
  803. } __ATTRIB_PACK;
  804. /**
  805. * struct target_if_spectral_chan_stats - Channel information
  806. * @cycle_count: Cycle count
  807. * @channel_load: Channel load
  808. * @per: Period
  809. * @noisefloor: Noise floor
  810. * @comp_usablity: Computed usability
  811. * @maxregpower: Maximum allowed regulatary power
  812. * @comp_usablity_sec80: Computed usability of secondary 80 Mhz
  813. * @maxregpower_sec80: Max regulatory power in secondary 80 Mhz
  814. */
  815. struct target_if_spectral_chan_stats {
  816. int cycle_count;
  817. int channel_load;
  818. int per;
  819. int noisefloor;
  820. uint16_t comp_usablity;
  821. int8_t maxregpower;
  822. uint16_t comp_usablity_sec80;
  823. int8_t maxregpower_sec80;
  824. };
  825. #if ATH_PERF_PWR_OFFLOAD
  826. /**
  827. * struct target_if_spectral_cache - Cache used to minimize WMI operations
  828. * in offload architecture
  829. * @osc_spectral_enabled: Whether Spectral is enabled
  830. * @osc_spectral_active: Whether spectral is active
  831. * XXX: Ideally, we should NOT cache this
  832. * since the hardware can self clear the bit,
  833. * the firmware can possibly stop spectral due to
  834. * intermittent off-channel activity, etc
  835. * A WMI read command should be introduced to handle
  836. * this This will be discussed.
  837. * @osc_params: Spectral parameters
  838. * @osc_is_valid: Whether the cache is valid
  839. */
  840. struct target_if_spectral_cache {
  841. uint8_t osc_spectral_enabled;
  842. uint8_t osc_spectral_active;
  843. struct spectral_config osc_params;
  844. uint8_t osc_is_valid;
  845. };
  846. /**
  847. * struct target_if_spectral_param_state_info - Structure used to represent and
  848. * manage spectral information
  849. * (parameters and states)
  850. * @osps_lock: Lock to synchronize accesses to information
  851. * @osps_cache: Cacheable' information
  852. */
  853. struct target_if_spectral_param_state_info {
  854. qdf_spinlock_t osps_lock;
  855. struct target_if_spectral_cache osps_cache;
  856. /* XXX - Non-cacheable information goes here, in the future */
  857. };
  858. #endif /* ATH_PERF_PWR_OFFLOAD */
  859. struct vdev_spectral_configure_params;
  860. struct vdev_spectral_enable_params;
  861. /**
  862. * struct spectral_wmi_ops - structure used holding the operations
  863. * related to Spectral WMI
  864. * @wmi_spectral_configure_cmd_send: Configure Spectral parameters
  865. * @wmi_spectral_enable_cmd_send: Enable/Disable Spectral
  866. * @wmi_spectral_crash_inject: Inject FW crash
  867. * @wmi_extract_pdev_sscan_fw_cmd_fixed_param: Extract Fixed params from
  868. * start scan response event
  869. * @wmi_extract_pdev_sscan_fft_bin_index: Extract TLV which describes FFT
  870. * bin indices from start scan response event
  871. * @wmi_unified_register_event_handler: Register WMI event handler
  872. * @wmi_unified_unregister_event_handler: Unregister WMI event handler
  873. * @wmi_service_enabled: API to check whether a given WMI service is enabled
  874. * @extract_pdev_spectral_session_chan_info: Extract Spectral scan session
  875. * channel information
  876. * @extract_pdev_spectral_session_detector_info: Extract Spectral scan session
  877. * detector information
  878. * @extract_spectral_caps_fixed_param: Extract fixed parameters from Spectral
  879. * capabilities event
  880. * @extract_spectral_scan_bw_caps: Extract bandwidth capabilities from Spectral
  881. * capabilities event
  882. * @extract_spectral_fft_size_caps: Extract fft size capabilities from Spectral
  883. * capabilities event
  884. */
  885. struct spectral_wmi_ops {
  886. QDF_STATUS (*wmi_spectral_configure_cmd_send)(
  887. wmi_unified_t wmi_hdl,
  888. struct vdev_spectral_configure_params *param);
  889. QDF_STATUS (*wmi_spectral_enable_cmd_send)(
  890. wmi_unified_t wmi_hdl,
  891. struct vdev_spectral_enable_params *param);
  892. QDF_STATUS (*wmi_spectral_crash_inject)(
  893. wmi_unified_t wmi_handle, struct crash_inject *param);
  894. QDF_STATUS (*wmi_extract_pdev_sscan_fw_cmd_fixed_param)(
  895. wmi_unified_t wmi_handle, uint8_t *evt_buf,
  896. struct spectral_startscan_resp_params *param);
  897. QDF_STATUS (*wmi_extract_pdev_sscan_fft_bin_index)(
  898. wmi_unified_t wmi_handle, uint8_t *evt_buf,
  899. struct spectral_fft_bin_markers_160_165mhz *param);
  900. QDF_STATUS (*wmi_unified_register_event_handler)(
  901. wmi_unified_t wmi_handle,
  902. wmi_conv_event_id event_id,
  903. wmi_unified_event_handler handler_func,
  904. uint8_t rx_ctx);
  905. QDF_STATUS (*wmi_unified_unregister_event_handler)(
  906. wmi_unified_t wmi_handle,
  907. wmi_conv_event_id event_id);
  908. bool (*wmi_service_enabled)(wmi_unified_t wmi_handle,
  909. uint32_t service_id);
  910. QDF_STATUS (*extract_pdev_spectral_session_chan_info)(
  911. wmi_unified_t wmi_handle, void *event,
  912. struct spectral_session_chan_info *chan_info);
  913. QDF_STATUS (*extract_pdev_spectral_session_detector_info)(
  914. wmi_unified_t wmi_handle, void *event,
  915. struct spectral_session_det_info *det_info,
  916. uint8_t det_info_idx);
  917. QDF_STATUS (*extract_spectral_caps_fixed_param)(
  918. wmi_unified_t wmi_handle, void *event,
  919. struct spectral_capabilities_event_params *param);
  920. QDF_STATUS (*extract_spectral_scan_bw_caps)(
  921. wmi_unified_t wmi_handle, void *event,
  922. struct spectral_scan_bw_capabilities *bw_caps);
  923. QDF_STATUS (*extract_spectral_fft_size_caps)(
  924. wmi_unified_t wmi_handle, void *event,
  925. struct spectral_fft_size_capabilities *fft_size_caps);
  926. };
  927. /**
  928. * struct spectral_tgt_ops - structure used holding the operations
  929. * related to target operations
  930. * @tgt_get_psoc_from_scn_hdl: Function to get psoc from scn
  931. */
  932. struct spectral_tgt_ops {
  933. struct wlan_objmgr_psoc *(*tgt_get_psoc_from_scn_hdl)(void *scn_handle);
  934. };
  935. /**
  936. * struct spectral_param_properties - structure holding Spectral
  937. * parameter properties
  938. * @supported: Parameter is supported or not
  939. * @common_all_modes: Parameter should be common for all modes or not
  940. */
  941. struct spectral_param_properties {
  942. bool supported;
  943. bool common_all_modes;
  944. };
  945. /**
  946. * struct target_if_finite_spectral_scan_params - Parameters related to finite
  947. * Spectral scan
  948. * @finite_spectral_scan: Indicates the Spectrl scan is finite/infinite
  949. * @num_reports_expected: Number of Spectral reports expected from target for a
  950. * finite Spectral scan
  951. */
  952. struct target_if_finite_spectral_scan_params {
  953. bool finite_spectral_scan;
  954. uint32_t num_reports_expected;
  955. };
  956. /**
  957. * struct per_session_dest_det_info - Per-session Detector information to be
  958. * filled to samp_detector_info
  959. * @freq_span_id: Contiguous frequency span ID within the SAMP message
  960. * @is_sec80: Indicates pri80/sec80 segment for 160/80p80 BW
  961. * @det_id: Detector ID within samp_freq_span_info corresponding to
  962. * freq_span_id
  963. * @dest_start_bin_idx: Start index of FFT bins within SAMP msg's bin_pwr array
  964. * @dest_end_bin_idx: End index of FFT bins within SAMP msg's bin_pwr array
  965. * @lb_extrabins_start_idx: Left band edge extra bins start index
  966. * @lb_extrabins_num: Number of left band edge extra bins
  967. * @rb_extrabins_start_idx: Right band edge extra bins start index
  968. * @rb_extrabins_num: Number of right band edge extra bins
  969. * @start_freq: Indicates start frequency per-detector (in MHz)
  970. * @end_freq: Indicates last frequency per-detector (in MHz)
  971. * @src_start_bin_idx: Start index within the Spectral report's bin_pwr array,
  972. * where the FFT bins corresponding to this dest_det_id start
  973. */
  974. struct per_session_dest_det_info {
  975. uint8_t freq_span_id;
  976. bool is_sec80;
  977. uint8_t det_id;
  978. uint16_t dest_start_bin_idx;
  979. uint16_t dest_end_bin_idx;
  980. uint16_t lb_extrabins_start_idx;
  981. uint16_t lb_extrabins_num;
  982. uint16_t rb_extrabins_start_idx;
  983. uint16_t rb_extrabins_num;
  984. uint32_t start_freq;
  985. uint32_t end_freq;
  986. uint16_t src_start_bin_idx;
  987. };
  988. /**
  989. * struct per_session_det_map - A map of per-session detector information,
  990. * keyed by the detector id obtained from the Spectral FFT report, mapping to
  991. * detination detector info in SAMP message.
  992. * @dest_det_info: Struct containing per-session detector information
  993. * @num_dest_det_info: Number of destination detectors to which information
  994. * of this detector is to be filled
  995. * @spectral_msg_buf_type: Spectral message buffer type
  996. * @send_to_upper_layers: Indicates whether to send SAMP msg to upper layers
  997. * @det_map_valid: Indicates whether detector map is valid or not
  998. */
  999. struct per_session_det_map {
  1000. struct per_session_dest_det_info
  1001. dest_det_info[MAX_NUM_DEST_DETECTOR_INFO];
  1002. uint8_t num_dest_det_info;
  1003. enum spectral_msg_buf_type buf_type;
  1004. bool send_to_upper_layers;
  1005. bool det_map_valid[SPECTRAL_SCAN_MODE_MAX];
  1006. };
  1007. /**
  1008. * struct per_session_report_info - Consists of per-session Spectral report
  1009. * information to be filled at report level in SAMP message.
  1010. * @pri20_freq: Primary 20MHz operating frequency in MHz
  1011. * @cfreq1: Centre frequency of the frequency span for 20/40/80 MHz BW.
  1012. * Segment 1 centre frequency in MHz for 80p80/160 BW.
  1013. * @cfreq2: For 80p80, indicates segment 2 centre frequency in MHz. For 160MHz,
  1014. * indicates the center frequency of 160MHz span.
  1015. * @operating_bw: Device's operating bandwidth.Valid values = enum phy_ch_width
  1016. * @sscan_cfreq1: Normal/Agile scan Centre frequency of the frequency span for
  1017. * 20/40/80 MHz BW. Center frequency of Primary Segment in MHz for 80p80/160 BW
  1018. * Based on Spectral scan mode.
  1019. * @sscan_cfreq2: For 80p80, Normal/Agile scan Center frequency for Sec80
  1020. * segment. For 160MHz, indicates the center frequency of 160MHz span. Based on
  1021. * spectral scan mode
  1022. * @sscan_bw: Normal/Agile Scan BW based on Spectral scan mode.
  1023. * Valid values = enum phy_ch_width
  1024. * @num_spans: Number of frequency spans
  1025. * @valid: Indicated whether report info is valid
  1026. */
  1027. struct per_session_report_info {
  1028. uint32_t pri20_freq;
  1029. uint32_t cfreq1;
  1030. uint32_t cfreq2;
  1031. enum phy_ch_width operating_bw;
  1032. uint32_t sscan_cfreq1;
  1033. uint32_t sscan_cfreq2;
  1034. enum phy_ch_width sscan_bw;
  1035. uint8_t num_spans;
  1036. bool valid;
  1037. };
  1038. /**
  1039. * struct sscan_detector_list - Spectral scan Detector list, for given Spectral
  1040. * scan mode and operating BW
  1041. * @detectors: List of detectors
  1042. * @num_detectors: Number of detectors for given spectral scan mode, BW
  1043. * and target type
  1044. */
  1045. struct sscan_detector_list {
  1046. uint8_t detectors[SPECTRAL_DETECTOR_ID_MAX];
  1047. uint8_t num_detectors;
  1048. };
  1049. /**
  1050. * struct spectral_supported_bws - Supported sscan bandwidths
  1051. * @bandwidths: bitmap of supported sscan bandwidths. Make sure to maintain this
  1052. * bitmap in the increasing order of bandwidths.
  1053. */
  1054. struct spectral_supported_bws {
  1055. union {
  1056. struct {
  1057. uint32_t supports_sscan_bw_5:1,
  1058. supports_sscan_bw_10:1,
  1059. supports_sscan_bw_20:1,
  1060. supports_sscan_bw_40:1,
  1061. supports_sscan_bw_80:1,
  1062. supports_sscan_bw_160:1,
  1063. supports_sscan_bw_80_80:1,
  1064. supports_sscan_bw_320:1,
  1065. reserved:24;
  1066. };
  1067. uint32_t bandwidths;
  1068. };
  1069. };
  1070. /**
  1071. * get_supported_sscan_bw_pos() - Get the position of a given sscan_bw inside
  1072. * the supported sscan bandwidths bitmap
  1073. * @sscan_bw: Spectral scan bandwidth
  1074. *
  1075. * Return: bit position for a valid sscan bandwidth, else -1
  1076. */
  1077. int get_supported_sscan_bw_pos(enum phy_ch_width sscan_bw);
  1078. /**
  1079. * struct target_if_spectral - main spectral structure
  1080. * @pdev: Pointer to pdev
  1081. * @spectral_ops: Target if internal Spectral low level operations table
  1082. * @capability: Spectral capabilities structure
  1083. * @properties: Spectral parameter properties per mode
  1084. * @spectral_lock: Lock used for internal Spectral operations
  1085. * @vdev_id: VDEV id for all spectral modes
  1086. * @spectral_curchan_radindex: Current channel spectral index
  1087. * @spectral_extchan_radindex: Extension channel spectral index
  1088. * @spectraldomain: Current Spectral domain
  1089. * @spectral_proc_phyerr: Flags to process for PHY errors
  1090. * @spectral_defaultparams: Default PHY params per Spectral stat
  1091. * @spectral_stats: Spectral related stats
  1092. * @events: Events structure
  1093. * @sc_spectral_ext_chan_ok: Can spectral be detected on the extension channel?
  1094. * @sc_spectral_combined_rssi_ok: Can use combined spectral RSSI?
  1095. * @sc_spectral_20_40_mode: Is AP in 20-40 mode?
  1096. * @sc_spectral_noise_pwr_cal: Noise power cal required?
  1097. * @sc_spectral_non_edma: Is the spectral capable device Non-EDMA?
  1098. * @upper_is_control: Upper segment is primary
  1099. * @upper_is_extension: Upper segment is secondary
  1100. * @lower_is_control: Lower segment is primary
  1101. * @lower_is_extension: Lower segment is secondary
  1102. * @sc_spectraltest_ieeechan: IEEE channel number to return to after a spectral
  1103. * mute test
  1104. * @spectral_numbins: Number of bins
  1105. * @spectral_fft_len: FFT length
  1106. * @spectral_data_len: Total phyerror report length
  1107. * @lb_edge_extrabins: Number of extra bins on left band edge
  1108. * @rb_edge_extrabins: Number of extra bins on right band edge
  1109. * @spectral_max_index_offset: Max FFT index offset (20 MHz mode)
  1110. * @spectral_upper_max_index_offset: Upper max FFT index offset (20/40 MHz mode)
  1111. * @spectral_lower_max_index_offset: Lower max FFT index offset (20/40 MHz mode)
  1112. * @spectral_dc_index: At which index DC is present
  1113. * @send_single_packet: Deprecated
  1114. * @spectral_sent_msg: Indicates whether we send report to upper layers
  1115. * @params: Spectral parameters
  1116. * @last_capture_time: Indicates timestamp of previouse report
  1117. * @num_spectral_data: Number of Spectral samples received in current session
  1118. * @total_spectral_data: Total number of Spectral samples received
  1119. * @max_rssi: Maximum RSSI
  1120. * @detects_control_channel: NA
  1121. * @detects_extension_channel: NA
  1122. * @detects_below_dc: NA
  1123. * @detects_above_dc: NA
  1124. * @sc_scanning: Indicates active wifi scan
  1125. * @sc_spectral_scan: Indicates active specral scan
  1126. * @sc_spectral_full_scan: Deprecated
  1127. * @scan_start_tstamp: Deprecated
  1128. * @last_tstamp: Deprecated
  1129. * @first_tstamp: Deprecated
  1130. * @spectral_samp_count: Deprecated
  1131. * @sc_spectral_samp_count: Deprecated
  1132. * @noise_pwr_reports_reqd: Number of noise power reports required
  1133. * @noise_pwr_reports_recv: Number of noise power reports received
  1134. * @noise_pwr_reports_lock: Lock used for Noise power report processing
  1135. * @noise_pwr_chain_ctl: Noise power report - control channel
  1136. * @noise_pwr_chain_ext: Noise power report - extension channel
  1137. * @chaninfo: Channel statistics
  1138. * @tsf64: Latest TSF Value
  1139. * @param_info: Offload architecture Spectral parameter cache information
  1140. * @ch_width: Indicates Channel Width 20/40/80/160 MHz for each Spectral mode
  1141. * @sscan_width_configured: Whether user has configured sscan bandwidth
  1142. * @diag_stats: Diagnostic statistics
  1143. * @is_160_format: Indicates whether information provided by HW is in altered
  1144. * format for 802.11ac 160/80+80 MHz support (QCA9984 onwards)
  1145. * @is_lb_edge_extrabins_format: Indicates whether information provided by
  1146. * HW has 4 extra bins, at left band edge, for report mode 2
  1147. * @is_rb_edge_extrabins_format: Indicates whether information provided
  1148. * by HW has 4 extra bins, at right band edge, for report mode 2
  1149. * @is_sec80_rssi_war_required: Indicates whether the software workaround is
  1150. * required to obtain approximate combined RSSI for secondary 80Mhz segment
  1151. * @simctx: Spectral Simulation context
  1152. * @spectral_gen: Spectral hardware generation
  1153. * @hdr_sig_exp: Expected signature in PHYERR TLV header, for the given hardware
  1154. * generation
  1155. * @tag_sscan_summary_exp: Expected Spectral Scan Summary tag in PHYERR TLV
  1156. * header, for the given hardware generation
  1157. * @tag_sscan_fft_exp: Expected Spectral Scan FFT report tag in PHYERR TLV
  1158. * header, for the given hardware generation
  1159. * @tlvhdr_size: Expected PHYERR TLV header size, for the given hardware
  1160. * generation
  1161. * @nl_cb: Netlink callbacks
  1162. * @use_nl_bcast: Whether to use Netlink broadcast/unicast
  1163. * @send_phy_data: Send data to the application layer for a particular msg type
  1164. * @len_adj_swar: Spectral fft bin length adjustment SWAR related info
  1165. * @timestamp_war: Spectral time stamp WAR related info
  1166. * @dbr_ring_debug: Whether Spectral DBR ring debug is enabled
  1167. * @dbr_buff_debug: Whether Spectral DBR buffer debug is enabled
  1168. * @direct_dma_support: Whether Direct-DMA is supported on the current radio
  1169. * @prev_tstamp: Timestamp of the previously received sample, which has to be
  1170. * compared with the current tstamp to check descrepancy
  1171. * @rparams: Parameters related to Spectral report structure
  1172. * @param_min_max: Spectral parameter's minimum and maximum values
  1173. * @finite_scan: Parameters for finite Spectral scan
  1174. * @detector_list: Detector list for a given Spectral scan mode and channel
  1175. * width, based on the target type.
  1176. * @detector_list_lock: Lock to synchronize accesses to detector list
  1177. * @det_map: Map of per-session detector information keyed by the Spectral HW
  1178. * detector id.
  1179. * @session_det_map_lock: Lock to synchronize accesses to session detector map
  1180. * @report_info: Per session info to be filled at report level in SAMP message
  1181. * @session_report_info_lock: Lock to synchronize access to session report info
  1182. * @supported_bws: Supported sscan bandwidths for all sscan modes and
  1183. * operating widths
  1184. * @supported_sscan_bw_list: List of supported sscan widths for all sscan modes
  1185. * @data_stats: stats in Spectral data path
  1186. */
  1187. struct target_if_spectral {
  1188. struct wlan_objmgr_pdev *pdev_obj;
  1189. struct target_if_spectral_ops spectral_ops;
  1190. struct spectral_caps capability;
  1191. struct spectral_param_properties
  1192. properties[SPECTRAL_SCAN_MODE_MAX][SPECTRAL_PARAM_MAX];
  1193. qdf_spinlock_t spectral_lock;
  1194. uint8_t vdev_id[SPECTRAL_SCAN_MODE_MAX];
  1195. int16_t spectral_curchan_radindex;
  1196. int16_t spectral_extchan_radindex;
  1197. uint32_t spectraldomain;
  1198. uint32_t spectral_proc_phyerr;
  1199. struct spectral_config spectral_defaultparams;
  1200. struct target_if_spectral_stats spectral_stats;
  1201. struct target_if_spectral_event *events;
  1202. unsigned int sc_spectral_ext_chan_ok:1,
  1203. sc_spectral_combined_rssi_ok:1,
  1204. sc_spectral_20_40_mode:1,
  1205. sc_spectral_noise_pwr_cal:1,
  1206. sc_spectral_non_edma:1;
  1207. int upper_is_control;
  1208. int upper_is_extension;
  1209. int lower_is_control;
  1210. int lower_is_extension;
  1211. uint8_t sc_spectraltest_ieeechan;
  1212. int spectral_numbins;
  1213. int spectral_fft_len;
  1214. int spectral_data_len;
  1215. /*
  1216. * For 11ac chipsets prior to AR900B version 2.0, a max of 512 bins are
  1217. * delivered. However, there can be additional bins reported for
  1218. * AR900B version 2.0 and QCA9984 as described next:
  1219. *
  1220. * AR900B version 2.0: An additional tone is processed on the right
  1221. * hand side in order to facilitate detection of radar pulses out to
  1222. * the extreme band-edge of the channel frequency. Since the HW design
  1223. * processes four tones at a time, this requires one additional Dword
  1224. * to be added to the search FFT report.
  1225. *
  1226. * QCA9984: When spectral_scan_rpt_mode = 2, i.e 2-dword summary +
  1227. * 1x-oversampled bins (in-band) per FFT, then 8 more bins
  1228. * (4 more on left side and 4 more on right side)are added.
  1229. */
  1230. int lb_edge_extrabins;
  1231. int rb_edge_extrabins;
  1232. int spectral_max_index_offset;
  1233. int spectral_upper_max_index_offset;
  1234. int spectral_lower_max_index_offset;
  1235. int spectral_dc_index;
  1236. int send_single_packet;
  1237. int spectral_sent_msg;
  1238. int classify_scan;
  1239. qdf_timer_t classify_timer;
  1240. struct spectral_config params[SPECTRAL_SCAN_MODE_MAX];
  1241. bool params_valid[SPECTRAL_SCAN_MODE_MAX];
  1242. struct spectral_classifier_params classifier_params;
  1243. int last_capture_time;
  1244. int num_spectral_data;
  1245. int total_spectral_data;
  1246. int max_rssi;
  1247. int detects_control_channel;
  1248. int detects_extension_channel;
  1249. int detects_below_dc;
  1250. int detects_above_dc;
  1251. int sc_scanning;
  1252. int sc_spectral_scan;
  1253. int sc_spectral_full_scan;
  1254. uint64_t scan_start_tstamp;
  1255. uint32_t last_tstamp;
  1256. uint32_t first_tstamp;
  1257. uint32_t spectral_samp_count;
  1258. uint32_t sc_spectral_samp_count;
  1259. int noise_pwr_reports_reqd;
  1260. int noise_pwr_reports_recv;
  1261. qdf_spinlock_t noise_pwr_reports_lock;
  1262. struct target_if_chain_noise_pwr_info
  1263. *noise_pwr_chain_ctl[HOST_MAX_ANTENNA];
  1264. struct target_if_chain_noise_pwr_info
  1265. *noise_pwr_chain_ext[HOST_MAX_ANTENNA];
  1266. uint64_t tsf64;
  1267. #if ATH_PERF_PWR_OFFLOAD
  1268. struct target_if_spectral_param_state_info
  1269. param_info[SPECTRAL_SCAN_MODE_MAX];
  1270. #endif
  1271. enum phy_ch_width ch_width[SPECTRAL_SCAN_MODE_MAX];
  1272. bool sscan_width_configured[SPECTRAL_SCAN_MODE_MAX];
  1273. struct spectral_diag_stats diag_stats;
  1274. bool is_160_format;
  1275. bool is_lb_edge_extrabins_format;
  1276. bool is_rb_edge_extrabins_format;
  1277. bool is_sec80_rssi_war_required;
  1278. #ifdef QCA_SUPPORT_SPECTRAL_SIMULATION
  1279. void *simctx;
  1280. #endif
  1281. enum spectral_gen spectral_gen;
  1282. uint8_t hdr_sig_exp;
  1283. uint8_t tag_sscan_summary_exp;
  1284. uint8_t tag_sscan_fft_exp;
  1285. uint8_t tlvhdr_size;
  1286. struct spectral_nl_cb nl_cb;
  1287. bool use_nl_bcast;
  1288. int (*send_phy_data)(struct wlan_objmgr_pdev *pdev,
  1289. enum spectral_msg_type smsg_type);
  1290. struct spectral_fft_bin_len_adj_swar len_adj_swar;
  1291. struct spectral_timestamp_war timestamp_war;
  1292. enum spectral_160mhz_report_delivery_state
  1293. state_160mhz_delivery[SPECTRAL_SCAN_MODE_MAX];
  1294. bool dbr_ring_debug;
  1295. bool dbr_buff_debug;
  1296. bool direct_dma_support;
  1297. #ifdef OPTIMIZED_SAMP_MESSAGE
  1298. uint32_t prev_tstamp[MAX_DETECTORS_PER_PDEV];
  1299. #else
  1300. uint32_t prev_tstamp;
  1301. #endif
  1302. struct spectral_report_params rparams;
  1303. struct spectral_param_min_max param_min_max;
  1304. struct target_if_finite_spectral_scan_params
  1305. finite_scan[SPECTRAL_SCAN_MODE_MAX];
  1306. struct sscan_detector_list
  1307. detector_list[SPECTRAL_SCAN_MODE_MAX][CH_WIDTH_MAX];
  1308. qdf_spinlock_t detector_list_lock;
  1309. struct per_session_det_map det_map[MAX_DETECTORS_PER_PDEV];
  1310. qdf_spinlock_t session_det_map_lock;
  1311. struct per_session_report_info report_info[SPECTRAL_SCAN_MODE_MAX];
  1312. qdf_spinlock_t session_report_info_lock;
  1313. struct spectral_supported_bws
  1314. supported_bws[SPECTRAL_SCAN_MODE_MAX][CH_WIDTH_MAX];
  1315. /* Whether a given sscan BW is supported on a given smode */
  1316. bool supported_sscan_bw_list[SPECTRAL_SCAN_MODE_MAX][CH_WIDTH_MAX];
  1317. struct spectral_data_stats data_stats;
  1318. };
  1319. /**
  1320. * struct target_if_psoc_spectral - Target if psoc Spectral object
  1321. * @psoc_obj: psoc object
  1322. * @wmi_ops: Spectral WMI operations
  1323. */
  1324. struct target_if_psoc_spectral {
  1325. struct wlan_objmgr_psoc *psoc_obj;
  1326. struct spectral_wmi_ops wmi_ops;
  1327. };
  1328. #ifdef OPTIMIZED_SAMP_MESSAGE
  1329. /**
  1330. * struct target_if_samp_msg_params - Spectral Analysis Messaging Protocol
  1331. * data format
  1332. * @hw_detector_id: Spectral HW detector ID
  1333. * @rssi: Spectral RSSI
  1334. * @lower_rssi: RSSI of lower band
  1335. * @upper_rssi: RSSI of upper band
  1336. * @chain_ctl_rssi: RSSI for control channel, for all antennas
  1337. * @chain_ext_rssi: RSSI for extension channel, for all antennas
  1338. * @last_raw_timestamp: Previous FFT report's raw timestamp.
  1339. * @raw_timestamp: FFT timestamp reported by HW on primary segment.
  1340. * @timestamp: timestamp
  1341. * @reset_delay: Time gap between the last spectral report before reset and the
  1342. * end of reset.
  1343. * @max_mag: maximum magnitude
  1344. * @max_index: index of max magnitude
  1345. * @noise_floor: current noise floor
  1346. * @pri80ind: Indication from hardware that the sample was received on the
  1347. * primary 80 MHz segment. If this is set when smode =
  1348. * SPECTRAL_SCAN_MODE_AGILE, it indicates that Spectral was carried
  1349. * out on pri80 instead of the Agile frequency due to a channel
  1350. * switch - Software may choose to ignore the sample in this case.
  1351. * @bin_pwr_data: Contains FFT magnitudes
  1352. */
  1353. struct target_if_samp_msg_params {
  1354. uint8_t hw_detector_id;
  1355. int8_t rssi;
  1356. int8_t lower_rssi;
  1357. int8_t upper_rssi;
  1358. int8_t chain_ctl_rssi[HOST_MAX_ANTENNA];
  1359. int8_t chain_ext_rssi[HOST_MAX_ANTENNA];
  1360. uint32_t last_raw_timestamp;
  1361. uint32_t raw_timestamp;
  1362. uint32_t timestamp;
  1363. uint32_t reset_delay;
  1364. uint16_t max_mag;
  1365. uint16_t max_index;
  1366. int16_t noise_floor;
  1367. uint8_t agc_total_gain;
  1368. uint8_t gainchange;
  1369. uint8_t pri80ind;
  1370. uint8_t *bin_pwr_data;
  1371. };
  1372. #else
  1373. /**
  1374. * struct target_if_samp_msg_params - Spectral Analysis Messaging Protocol
  1375. * data format
  1376. * @rssi: RSSI (except for secondary 80 segment)
  1377. * @rssi_sec80: RSSI for secondary 80 segment
  1378. * @lower_rssi: RSSI of lower band
  1379. * @upper_rssi: RSSI of upper band
  1380. * @chain_ctl_rssi: RSSI for control channel, for all antennas
  1381. * @chain_ext_rssi: RSSI for extension channel, for all antennas
  1382. * @bwinfo: bandwidth info
  1383. * @data_len: length of FFT data (except for secondary 80 segment)
  1384. * @data_len_sec80: length of FFT data for secondary 80 segment
  1385. * @tstamp: timestamp
  1386. * @last_tstamp: last time stamp
  1387. * @max_mag: maximum magnitude (except for secondary 80 segment)
  1388. * @max_mag_sec80: maximum magnitude for secondary 80 segment
  1389. * @max_index: index of max magnitude (except for secondary 80 segment)
  1390. * @max_index_sec80: index of max magnitude for secondary 80 segment
  1391. * @max_exp: max exp
  1392. * @peak: peak frequency (obsolete)
  1393. * @pwr_count: number of FFT bins (except for secondary 80 segment)
  1394. * @pwr_count_5mhz: number of FFT bins in extra 5 MHz in
  1395. * 165 MHz/restricted 80p80 mode
  1396. * @pwr_count_sec80: number of FFT bins in secondary 80 segment
  1397. * @nb_lower: This is deprecated
  1398. * @nb_upper: This is deprecated
  1399. * @max_upper_index: index of max mag in upper band
  1400. * @max_lower_index: index of max mag in lower band
  1401. * @bin_pwr_data: Contains FFT magnitudes (except for secondary 80 segment)
  1402. * @bin_pwr_data_5mhz: Contains FFT magnitudes for the extra 5 MHz
  1403. * in 165 MHz/restricted 80p80 mode
  1404. * @bin_pwr_data_sec80: Contains FFT magnitudes for the secondary 80 segment
  1405. * @freq: Center frequency of primary 20MHz channel in MHz
  1406. * @vhtop_ch_freq_seg1: VHT operation first segment center frequency in MHz
  1407. * @vhtop_ch_freq_seg2: VHT operation second segment center frequency in MHz
  1408. * @agile_freq1: Center frequency in MHz of the entire span(for 80+80 MHz
  1409. * agile Scan it is primary 80 MHz span) across which
  1410. * Agile Spectral is carried out. Applicable only for Agile
  1411. * Spectral samples.
  1412. * @agile_freq2: Center frequency in MHz of the secondary 80 MHz span
  1413. * across which Agile Spectral is carried out. Applicable
  1414. * only for Agile Spectral samples in 80+80 MHz mode.
  1415. * @freq_loading: spectral control duty cycles
  1416. * @noise_floor: current noise floor (except for secondary 80 segment)
  1417. * @noise_floor_sec80: current noise floor for secondary 80 segment
  1418. * @interf_list: List of interfernce sources
  1419. * @classifier_params: classifier parameters
  1420. * @sc: classifier parameters
  1421. * @pri80ind: Indication from hardware that the sample was received on the
  1422. * primary 80 MHz segment. If this is set when smode =
  1423. * SPECTRAL_SCAN_MODE_AGILE, it indicates that Spectral was carried out on
  1424. * pri80 instead of the Agile frequency due to a channel switch - Software may
  1425. * choose to ignore the sample in this case.
  1426. * @pri80ind_sec80: Indication from hardware that the sample was received on the
  1427. * primary 80 MHz segment instead of the secondary 80 MHz segment due to a
  1428. * channel switch - Software may choose to ignore the sample if this is set.
  1429. * Applicable only if smode = SPECTRAL_SCAN_MODE_NORMAL and for 160/80+80 MHz
  1430. * Spectral operation and if the chipset supports fragmented 160/80+80 MHz
  1431. * operation.
  1432. * @last_raw_timestamp: Previous FFT report's raw timestamp. In case of 160MHz
  1433. * it will be primary 80 segment's timestamp as both primary & secondary
  1434. * segment's timestamps are expected to be almost equal
  1435. * @timestamp_war_offset: Offset calculated based on reset_delay and
  1436. * last_raw_stamp. It will be added to raw_timestamp to get tstamp.
  1437. * @raw_timestamp: FFT timestamp reported by HW on primary segment.
  1438. * @raw_timestamp_sec80: FFT timestamp reported by HW on secondary 80 segment.
  1439. * @reset_delay: Time gap between the last spectral report before reset and the
  1440. * end of reset.
  1441. * @target_reset_count: Indicates the the number of times the target went
  1442. * through reset routine after spectral was enabled.
  1443. */
  1444. struct target_if_samp_msg_params {
  1445. int8_t rssi;
  1446. int8_t rssi_sec80;
  1447. int8_t lower_rssi;
  1448. int8_t upper_rssi;
  1449. int8_t chain_ctl_rssi[HOST_MAX_ANTENNA];
  1450. int8_t chain_ext_rssi[HOST_MAX_ANTENNA];
  1451. uint16_t bwinfo;
  1452. uint16_t datalen;
  1453. uint16_t datalen_sec80;
  1454. uint32_t tstamp;
  1455. uint32_t last_tstamp;
  1456. uint16_t max_mag;
  1457. uint16_t max_mag_sec80;
  1458. uint16_t max_index;
  1459. uint16_t max_index_sec80;
  1460. uint8_t max_exp;
  1461. int peak;
  1462. int pwr_count;
  1463. int pwr_count_5mhz;
  1464. int pwr_count_sec80;
  1465. int8_t nb_lower;
  1466. int8_t nb_upper;
  1467. uint16_t max_lower_index;
  1468. uint16_t max_upper_index;
  1469. uint8_t *bin_pwr_data;
  1470. uint8_t *bin_pwr_data_5mhz;
  1471. uint8_t *bin_pwr_data_sec80;
  1472. uint16_t freq;
  1473. uint16_t vhtop_ch_freq_seg1;
  1474. uint16_t vhtop_ch_freq_seg2;
  1475. uint16_t agile_freq1;
  1476. uint16_t agile_freq2;
  1477. uint16_t freq_loading;
  1478. int16_t noise_floor;
  1479. int16_t noise_floor_sec80;
  1480. struct interf_src_rsp interf_list;
  1481. struct spectral_classifier_params classifier_params;
  1482. struct ath_softc *sc;
  1483. uint8_t agc_total_gain;
  1484. uint8_t agc_total_gain_sec80;
  1485. uint8_t gainchange;
  1486. uint8_t gainchange_sec80;
  1487. enum spectral_scan_mode smode;
  1488. uint8_t pri80ind;
  1489. uint8_t pri80ind_sec80;
  1490. uint32_t last_raw_timestamp;
  1491. uint32_t timestamp_war_offset;
  1492. uint32_t raw_timestamp;
  1493. uint32_t raw_timestamp_sec80;
  1494. uint32_t reset_delay;
  1495. uint32_t target_reset_count;
  1496. };
  1497. #endif
  1498. /**
  1499. * struct target_if_spectral_agile_mode_cap - Structure to hold agile
  1500. * Spetcral scan capability
  1501. * @agile_spectral_cap: agile Spectral scan capability for 20/40/80 MHz
  1502. * @agile_spectral_cap_160: agile Spectral scan capability for 160 MHz
  1503. * @agile_spectral_cap_80p80: agile Spectral scan capability for 80+80 MHz
  1504. * @agile_spectral_cap_320: agile Spectral scan capability for 320 MHz
  1505. */
  1506. struct target_if_spectral_agile_mode_cap {
  1507. bool agile_spectral_cap;
  1508. bool agile_spectral_cap_160;
  1509. bool agile_spectral_cap_80p80;
  1510. bool agile_spectral_cap_320;
  1511. };
  1512. #ifdef WLAN_CONV_SPECTRAL_ENABLE
  1513. /**
  1514. * target_if_spectral_dump_fft() - Dump Spectral FFT
  1515. * @pfft: Pointer to Spectral Phyerr FFT
  1516. * @fftlen: FFT length
  1517. *
  1518. * Return: Success or failure
  1519. */
  1520. int target_if_spectral_dump_fft(uint8_t *pfft, int fftlen);
  1521. /**
  1522. * target_if_dbg_print_samp_param() - Print contents of SAMP struct
  1523. * @p: Pointer to SAMP message
  1524. *
  1525. * Return: Void
  1526. */
  1527. void target_if_dbg_print_samp_param(struct target_if_samp_msg_params *p);
  1528. /**
  1529. * target_if_get_offset_swar_sec80() - Get offset for SWAR according to
  1530. * the channel width
  1531. * @channel_width: Channel width
  1532. *
  1533. * Return: Offset for SWAR
  1534. */
  1535. uint32_t target_if_get_offset_swar_sec80(uint32_t channel_width);
  1536. /**
  1537. * target_if_sptrl_register_tx_ops() - Register Spectral target_if Tx Ops
  1538. * @tx_ops: Tx Ops
  1539. *
  1540. * Return: void
  1541. */
  1542. void target_if_sptrl_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
  1543. #ifndef OPTIMIZED_SAMP_MESSAGE
  1544. /**
  1545. * target_if_spectral_create_samp_msg() - Create the spectral samp message
  1546. * @spectral : Pointer to spectral internal structure
  1547. * @params : spectral samp message parameters
  1548. *
  1549. * API to create the spectral samp message
  1550. *
  1551. * Return: void
  1552. */
  1553. void target_if_spectral_create_samp_msg(
  1554. struct target_if_spectral *spectral,
  1555. struct target_if_samp_msg_params *params);
  1556. #endif
  1557. #ifdef OPTIMIZED_SAMP_MESSAGE
  1558. /**
  1559. * target_if_spectral_fill_samp_msg() - Fill the Spectral SAMP message
  1560. * @spectral : Pointer to spectral internal structure
  1561. * @params: Spectral SAMP message fields
  1562. *
  1563. * Fill the spectral SAMP message fields using params and detector map.
  1564. *
  1565. * Return: Success/Failure
  1566. */
  1567. QDF_STATUS target_if_spectral_fill_samp_msg(
  1568. struct target_if_spectral *spectral,
  1569. struct target_if_samp_msg_params *params);
  1570. #endif
  1571. /**
  1572. * target_if_spectral_process_phyerr_gen3() - Process phyerror event for gen3
  1573. * @pdev: Pointer to pdev object
  1574. * @payload: Pointer to spectral report
  1575. *
  1576. * Process phyerror event for gen3
  1577. *
  1578. * Return: Success/Failure
  1579. */
  1580. int target_if_spectral_process_report_gen3(
  1581. struct wlan_objmgr_pdev *pdev,
  1582. void *buf);
  1583. /**
  1584. * target_if_process_phyerr_gen2() - Process PHY Error for gen2
  1585. * @spectral: Pointer to Spectral object
  1586. * @data: Pointer to phyerror event buffer
  1587. * @datalen: Data length
  1588. * @p_rfqual: RF quality info
  1589. * @p_chaninfo: Channel info
  1590. * @tsf64: 64 bit tsf timestamp
  1591. * @acs_stats: ACS stats
  1592. *
  1593. * Process PHY Error for gen2
  1594. *
  1595. * Return: Success/Failure
  1596. */
  1597. int target_if_process_phyerr_gen2(
  1598. struct target_if_spectral *spectral,
  1599. uint8_t *data,
  1600. uint32_t datalen, struct target_if_spectral_rfqual_info *p_rfqual,
  1601. struct target_if_spectral_chan_info *p_chaninfo,
  1602. uint64_t tsf64,
  1603. struct target_if_spectral_acs_stats *acs_stats);
  1604. /**
  1605. * target_if_spectral_send_intf_found_msg() - Indicate to application layer that
  1606. * interference has been found
  1607. * @pdev: Pointer to pdev
  1608. * @cw_int: 1 if CW interference is found, 0 if WLAN interference is found
  1609. * @dcs_enabled: 1 if DCS is enabled, 0 if DCS is disabled
  1610. *
  1611. * Send message to application layer
  1612. * indicating that interference has been found
  1613. *
  1614. * Return: None
  1615. */
  1616. void target_if_spectral_send_intf_found_msg(
  1617. struct wlan_objmgr_pdev *pdev,
  1618. uint16_t cw_int, uint32_t dcs_enabled);
  1619. /**
  1620. * target_if_stop_spectral_scan() - Stop spectral scan
  1621. * @pdev: Pointer to pdev object
  1622. * @smode: Spectral scan mode
  1623. * @err: Pointer to error code
  1624. *
  1625. * API to stop the current on-going spectral scan
  1626. *
  1627. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  1628. */
  1629. QDF_STATUS target_if_stop_spectral_scan(struct wlan_objmgr_pdev *pdev,
  1630. const enum spectral_scan_mode smode,
  1631. enum spectral_cp_error_code *err);
  1632. /**
  1633. * target_if_spectral_get_vdev() - Get pointer to vdev to be used for Spectral
  1634. * operations
  1635. * @spectral: Pointer to Spectral target_if internal private data
  1636. * @smode: spectral scan mode
  1637. *
  1638. * Spectral operates on pdev. However, in order to retrieve some WLAN
  1639. * properties, a vdev is required. To facilitate this, the function returns the
  1640. * first vdev in our pdev. The caller should release the reference to the vdev
  1641. * once it is done using it.
  1642. * TODO: If the framework later provides an API to obtain the first active
  1643. * vdev, then it would be preferable to use this API.
  1644. *
  1645. * Return: Pointer to vdev on success, NULL on failure
  1646. */
  1647. struct wlan_objmgr_vdev *target_if_spectral_get_vdev(
  1648. struct target_if_spectral *spectral,
  1649. enum spectral_scan_mode smode);
  1650. /**
  1651. * target_if_spectral_dump_hdr_gen2() - Dump Spectral header for gen2
  1652. * @phdr: Pointer to Spectral Phyerr Header
  1653. *
  1654. * Dump Spectral header
  1655. *
  1656. * Return: Success/Failure
  1657. */
  1658. int target_if_spectral_dump_hdr_gen2(struct spectral_phyerr_hdr_gen2 *phdr);
  1659. /**
  1660. * target_if_get_combrssi_sec80_seg_gen2() - Get approximate combined RSSI
  1661. * for Secondary 80 segment
  1662. * @spectral: Pointer to spectral object
  1663. * @p_sfft_sec80: Pointer to search fft info of secondary 80 segment
  1664. *
  1665. * Get approximate combined RSSI for Secondary 80 segment
  1666. *
  1667. * Return: Combined RSSI for secondary 80Mhz segment
  1668. */
  1669. int8_t target_if_get_combrssi_sec80_seg_gen2(
  1670. struct target_if_spectral *spectral,
  1671. struct spectral_search_fft_info_gen2 *p_sfft_sec80);
  1672. /**
  1673. * target_if_spectral_dump_tlv_gen2() - Dump Spectral TLV for gen2
  1674. * @ptlv: Pointer to Spectral Phyerr TLV
  1675. * @is_160_format: Indicates 160 format
  1676. *
  1677. * Dump Spectral TLV for gen2
  1678. *
  1679. * Return: Success/Failure
  1680. */
  1681. int target_if_spectral_dump_tlv_gen2(
  1682. struct spectral_phyerr_tlv_gen2 *ptlv, bool is_160_format);
  1683. /**
  1684. * target_if_spectral_dump_phyerr_data_gen2() - Dump Spectral
  1685. * related PHY Error for gen2
  1686. * @data: Pointer to phyerror buffer
  1687. * @datalen: Data length
  1688. * @is_160_format: Indicates 160 format
  1689. *
  1690. * Dump Spectral related PHY Error for gen2
  1691. *
  1692. * Return: Success/Failure
  1693. */
  1694. int target_if_spectral_dump_phyerr_data_gen2(
  1695. uint8_t *data,
  1696. uint32_t datalen,
  1697. bool is_160_format);
  1698. /**
  1699. * target_if_dbg_print_samp_msg() - Print contents of SAMP Message
  1700. * @p: Pointer to SAMP message
  1701. *
  1702. * Print contents of SAMP Message
  1703. *
  1704. * Return: Void
  1705. */
  1706. void target_if_dbg_print_samp_msg(struct spectral_samp_msg *pmsg);
  1707. /**
  1708. * get_target_if_spectral_handle_from_pdev() - Get handle to target_if internal
  1709. * Spectral data
  1710. * @pdev: Pointer to pdev
  1711. *
  1712. * Return: Handle to target_if internal Spectral data on success, NULL on
  1713. * failure
  1714. */
  1715. struct target_if_spectral *get_target_if_spectral_handle_from_pdev(
  1716. struct wlan_objmgr_pdev *pdev);
  1717. /**
  1718. * get_target_if_spectral_handle_from_psoc() - Get handle to psoc target_if
  1719. * internal Spectral data
  1720. * @psoc: Pointer to psoc
  1721. *
  1722. * Return: Handle to target_if psoc internal Spectral data on success, NULL on
  1723. * failure
  1724. */
  1725. static inline
  1726. struct target_if_psoc_spectral *get_target_if_spectral_handle_from_psoc(
  1727. struct wlan_objmgr_psoc *psoc)
  1728. {
  1729. struct wlan_lmac_if_rx_ops *rx_ops;
  1730. struct target_if_psoc_spectral *psoc_spectral;
  1731. if (!psoc) {
  1732. spectral_err("psoc is null");
  1733. return NULL;
  1734. }
  1735. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  1736. if (!rx_ops) {
  1737. spectral_err("rx_ops is null");
  1738. return NULL;
  1739. }
  1740. psoc_spectral = (struct target_if_psoc_spectral *)
  1741. rx_ops->sptrl_rx_ops.sptrlro_get_psoc_target_handle(psoc);
  1742. return psoc_spectral;
  1743. }
  1744. /**
  1745. * target_if_vdev_get_chan_freq() - Get the operating channel frequency of a
  1746. * given vdev
  1747. * @pdev: Pointer to vdev
  1748. *
  1749. * Get the operating channel frequency of a given vdev
  1750. *
  1751. * Return: Operating channel frequency of a vdev
  1752. */
  1753. static inline
  1754. int16_t target_if_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev)
  1755. {
  1756. struct wlan_objmgr_psoc *psoc = NULL;
  1757. struct wlan_lmac_if_rx_ops *rx_ops;
  1758. psoc = wlan_vdev_get_psoc(vdev);
  1759. if (!psoc) {
  1760. spectral_err("psoc is NULL");
  1761. return -EINVAL;
  1762. }
  1763. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  1764. if (!rx_ops) {
  1765. spectral_err("rx_ops is null");
  1766. return -EINVAL;
  1767. }
  1768. return rx_ops->sptrl_rx_ops.sptrlro_vdev_get_chan_freq(
  1769. vdev);
  1770. }
  1771. /**
  1772. * target_if_vdev_get_chan_freq_seg2() - Get center frequency of secondary 80 of
  1773. * given vdev
  1774. * @vdev: Pointer to vdev
  1775. *
  1776. * Get the center frequency of secondary 80 of given vdev
  1777. *
  1778. * Return: center frequency of secondary 80
  1779. */
  1780. static inline
  1781. int16_t target_if_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev)
  1782. {
  1783. struct wlan_objmgr_psoc *psoc = NULL;
  1784. struct wlan_lmac_if_rx_ops *rx_ops;
  1785. psoc = wlan_vdev_get_psoc(vdev);
  1786. if (!psoc) {
  1787. spectral_err("psoc is NULL");
  1788. return -EINVAL;
  1789. }
  1790. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  1791. if (!rx_ops) {
  1792. spectral_err("rx_ops is null");
  1793. return -EINVAL;
  1794. }
  1795. return rx_ops->sptrl_rx_ops.sptrlro_vdev_get_chan_freq_seg2(vdev);
  1796. }
  1797. /**
  1798. * target_if_vdev_get_ch_width() - Get the operating channel bandwidth of a
  1799. * given vdev
  1800. * @pdev: Pointer to vdev
  1801. *
  1802. * Get the operating channel bandwidth of a given vdev
  1803. *
  1804. * Return: channel bandwidth enumeration corresponding to the vdev
  1805. */
  1806. static inline
  1807. enum phy_ch_width target_if_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev)
  1808. {
  1809. struct wlan_objmgr_psoc *psoc = NULL;
  1810. enum phy_ch_width ch_width;
  1811. struct wlan_lmac_if_rx_ops *rx_ops;
  1812. psoc = wlan_vdev_get_psoc(vdev);
  1813. if (!psoc) {
  1814. spectral_err("psoc is NULL");
  1815. return CH_WIDTH_INVALID;
  1816. }
  1817. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  1818. if (!rx_ops) {
  1819. spectral_err("rx_ops is null");
  1820. return CH_WIDTH_INVALID;
  1821. }
  1822. ch_width = rx_ops->sptrl_rx_ops.sptrlro_vdev_get_ch_width(vdev);
  1823. if (ch_width == CH_WIDTH_160MHZ) {
  1824. int16_t cfreq2;
  1825. cfreq2 = target_if_vdev_get_chan_freq_seg2(vdev);
  1826. if (cfreq2 < 0) {
  1827. spectral_err("Invalid value for cfreq2 %d", cfreq2);
  1828. return CH_WIDTH_INVALID;
  1829. }
  1830. /* Use non zero cfreq2 to identify 80p80 */
  1831. if (cfreq2)
  1832. ch_width = CH_WIDTH_80P80MHZ;
  1833. }
  1834. return ch_width;
  1835. }
  1836. /**
  1837. * target_if_vdev_get_sec20chan_freq_mhz() - Get the frequency of secondary
  1838. * 20 MHz channel for a given vdev
  1839. * @pdev: Pointer to vdev
  1840. *
  1841. * Get the frequency of secondary 20Mhz channel for a given vdev
  1842. *
  1843. * Return: Frequency of secondary 20Mhz channel for a given vdev
  1844. */
  1845. static inline
  1846. int target_if_vdev_get_sec20chan_freq_mhz(
  1847. struct wlan_objmgr_vdev *vdev,
  1848. uint16_t *sec20chan_freq)
  1849. {
  1850. struct wlan_objmgr_psoc *psoc = NULL;
  1851. struct wlan_lmac_if_rx_ops *rx_ops;
  1852. psoc = wlan_vdev_get_psoc(vdev);
  1853. if (!psoc) {
  1854. spectral_err("psoc is NULL");
  1855. return -EINVAL;
  1856. }
  1857. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  1858. if (!rx_ops) {
  1859. spectral_err("rx_ops is null");
  1860. return -EINVAL;
  1861. }
  1862. return rx_ops->sptrl_rx_ops.
  1863. sptrlro_vdev_get_sec20chan_freq_mhz(vdev, sec20chan_freq);
  1864. }
  1865. /**
  1866. * target_if_spectral_is_feature_disabled_psoc() - Check if Spectral feature is
  1867. * disabled for a given psoc
  1868. * @psoc: Pointer to psoc
  1869. *
  1870. * Return: true or false
  1871. */
  1872. static inline
  1873. bool target_if_spectral_is_feature_disabled_psoc(struct wlan_objmgr_psoc *psoc)
  1874. {
  1875. struct wlan_lmac_if_rx_ops *rx_ops;
  1876. if (!psoc) {
  1877. spectral_err("psoc is NULL");
  1878. return true;
  1879. }
  1880. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  1881. if (!rx_ops) {
  1882. spectral_err("rx_ops is null");
  1883. return true;
  1884. }
  1885. if (rx_ops->sptrl_rx_ops.
  1886. sptrlro_spectral_is_feature_disabled_psoc)
  1887. return rx_ops->sptrl_rx_ops.
  1888. sptrlro_spectral_is_feature_disabled_psoc(psoc);
  1889. return true;
  1890. }
  1891. /**
  1892. * target_if_spectral_is_feature_disabled_pdev() - Check if Spectral feature is
  1893. * disabled for a given pdev
  1894. * @pdev: Pointer to pdev
  1895. *
  1896. * Return: true or false
  1897. */
  1898. static inline
  1899. bool target_if_spectral_is_feature_disabled_pdev(struct wlan_objmgr_pdev *pdev)
  1900. {
  1901. struct wlan_lmac_if_rx_ops *rx_ops;
  1902. struct wlan_objmgr_psoc *psoc;
  1903. if (!pdev) {
  1904. spectral_err("pdev is NULL");
  1905. return true;
  1906. }
  1907. psoc = wlan_pdev_get_psoc(pdev);
  1908. if (!psoc) {
  1909. spectral_err("psoc is NULL");
  1910. return true;
  1911. }
  1912. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  1913. if (!rx_ops) {
  1914. spectral_err("rx_ops is null");
  1915. return true;
  1916. }
  1917. if (rx_ops->sptrl_rx_ops.
  1918. sptrlro_spectral_is_feature_disabled_pdev)
  1919. return rx_ops->sptrl_rx_ops.
  1920. sptrlro_spectral_is_feature_disabled_pdev(pdev);
  1921. return true;
  1922. }
  1923. /**
  1924. * target_if_spectral_set_rxchainmask() - Set Spectral Rx chainmask
  1925. * @pdev: Pointer to pdev
  1926. * @spectral_rx_chainmask: Spectral Rx chainmask
  1927. *
  1928. * Return: None
  1929. */
  1930. static inline
  1931. void target_if_spectral_set_rxchainmask(struct wlan_objmgr_pdev *pdev,
  1932. uint8_t spectral_rx_chainmask)
  1933. {
  1934. struct wlan_objmgr_psoc *psoc = NULL;
  1935. struct target_if_spectral *spectral = NULL;
  1936. enum spectral_scan_mode smode = SPECTRAL_SCAN_MODE_NORMAL;
  1937. struct wlan_lmac_if_rx_ops *rx_ops;
  1938. psoc = wlan_pdev_get_psoc(pdev);
  1939. if (!psoc) {
  1940. spectral_err("psoc is NULL");
  1941. return;
  1942. }
  1943. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  1944. if (!rx_ops) {
  1945. spectral_err("rx_ops is null");
  1946. return;
  1947. }
  1948. if (smode >= SPECTRAL_SCAN_MODE_MAX) {
  1949. spectral_err("Invalid Spectral mode %u", smode);
  1950. return;
  1951. }
  1952. if (rx_ops->sptrl_rx_ops.
  1953. sptrlro_spectral_is_feature_disabled_pdev(pdev)) {
  1954. spectral_info("Spectral feature is disabled");
  1955. return;
  1956. }
  1957. spectral = get_target_if_spectral_handle_from_pdev(pdev);
  1958. if (!spectral) {
  1959. spectral_err("Spectral target if object is null");
  1960. return;
  1961. }
  1962. /* set chainmask for all the modes */
  1963. for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++)
  1964. spectral->params[smode].ss_chn_mask = spectral_rx_chainmask;
  1965. }
  1966. /**
  1967. * target_if_spectral_process_phyerr() - Process Spectral PHY error
  1968. * @pdev: Pointer to pdev
  1969. * @data: PHY error data received from FW
  1970. * @datalen: Length of data
  1971. * @p_rfqual: Pointer to RF Quality information
  1972. * @p_chaninfo: Pointer to channel information
  1973. * @tsf: TSF time instance at which the Spectral sample was received
  1974. * @acs_stats: ACS stats
  1975. *
  1976. * Process Spectral PHY error by extracting necessary information from the data
  1977. * sent by FW, and send the extracted information to application layer.
  1978. *
  1979. * Return: None
  1980. */
  1981. static inline
  1982. void target_if_spectral_process_phyerr(
  1983. struct wlan_objmgr_pdev *pdev,
  1984. uint8_t *data, uint32_t datalen,
  1985. struct target_if_spectral_rfqual_info *p_rfqual,
  1986. struct target_if_spectral_chan_info *p_chaninfo,
  1987. uint64_t tsf64,
  1988. struct target_if_spectral_acs_stats *acs_stats)
  1989. {
  1990. struct target_if_spectral *spectral = NULL;
  1991. struct target_if_spectral_ops *p_sops = NULL;
  1992. spectral = get_target_if_spectral_handle_from_pdev(pdev);
  1993. if (!spectral) {
  1994. spectral_err("Spectral target if object is null");
  1995. return;
  1996. }
  1997. p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral);
  1998. if (!p_sops->spectral_process_phyerr) {
  1999. spectral_err("null spectral_process_phyerr");
  2000. return;
  2001. }
  2002. p_sops->spectral_process_phyerr(spectral, data, datalen,
  2003. p_rfqual, p_chaninfo,
  2004. tsf64, acs_stats);
  2005. }
  2006. static QDF_STATUS
  2007. target_if_get_spectral_msg_type(enum spectral_scan_mode smode,
  2008. enum spectral_msg_type *msg_type) {
  2009. switch (smode) {
  2010. case SPECTRAL_SCAN_MODE_NORMAL:
  2011. *msg_type = SPECTRAL_MSG_NORMAL_MODE;
  2012. break;
  2013. case SPECTRAL_SCAN_MODE_AGILE:
  2014. *msg_type = SPECTRAL_MSG_AGILE_MODE;
  2015. break;
  2016. default:
  2017. spectral_err("Invalid spectral mode");
  2018. return QDF_STATUS_E_FAILURE;
  2019. }
  2020. return QDF_STATUS_SUCCESS;
  2021. }
  2022. static inline bool
  2023. is_ch_width_160_or_80p80(enum phy_ch_width ch_width)
  2024. {
  2025. return (ch_width == CH_WIDTH_160MHZ || ch_width == CH_WIDTH_80P80MHZ);
  2026. }
  2027. /**
  2028. * free_samp_msg_skb() - Free SAMP message skb
  2029. * @spectral: Pointer to Spectral
  2030. * @smode: Spectral Scan mode
  2031. *
  2032. * Free SAMP message skb, if error in report processing
  2033. *
  2034. * Return: void
  2035. */
  2036. static inline void
  2037. free_samp_msg_skb(struct target_if_spectral *spectral,
  2038. enum spectral_scan_mode smode)
  2039. {
  2040. enum spectral_msg_type smsg_type;
  2041. QDF_STATUS ret;
  2042. if (smode >= SPECTRAL_SCAN_MODE_MAX) {
  2043. spectral_err_rl("Invalid Spectral mode %d", smode);
  2044. return;
  2045. }
  2046. if (is_ch_width_160_or_80p80(spectral->ch_width[smode])) {
  2047. ret = target_if_get_spectral_msg_type(smode, &smsg_type);
  2048. if (QDF_IS_STATUS_ERROR(ret)) {
  2049. spectral_err("Failed to get spectral message type");
  2050. return;
  2051. }
  2052. spectral->nl_cb.free_sbuff(spectral->pdev_obj,
  2053. smsg_type);
  2054. }
  2055. }
  2056. /**
  2057. * init_160mhz_delivery_state_machine() - Initialize 160MHz Spectral
  2058. * state machine
  2059. * @spectral: Pointer to Spectral
  2060. *
  2061. * Initialize 160MHz Spectral state machine
  2062. *
  2063. * Return: void
  2064. */
  2065. static inline void
  2066. init_160mhz_delivery_state_machine(struct target_if_spectral *spectral)
  2067. {
  2068. uint8_t smode;
  2069. smode = 0;
  2070. for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++)
  2071. spectral->state_160mhz_delivery[smode] =
  2072. SPECTRAL_REPORT_WAIT_PRIMARY80;
  2073. }
  2074. /**
  2075. * reset_160mhz_delivery_state_machine() - Reset 160MHz Spectral state machine
  2076. * @spectral: Pointer to Spectral
  2077. *
  2078. * Reset 160MHz Spectral state machine
  2079. *
  2080. * Return: void
  2081. */
  2082. static inline void
  2083. reset_160mhz_delivery_state_machine(struct target_if_spectral *spectral,
  2084. enum spectral_scan_mode smode)
  2085. {
  2086. if (smode >= SPECTRAL_SCAN_MODE_MAX) {
  2087. spectral_err_rl("Invalid Spectral mode %d", smode);
  2088. return;
  2089. }
  2090. free_samp_msg_skb(spectral, smode);
  2091. if (is_ch_width_160_or_80p80(spectral->ch_width[smode])) {
  2092. spectral->state_160mhz_delivery[smode] =
  2093. SPECTRAL_REPORT_WAIT_PRIMARY80;
  2094. }
  2095. }
  2096. /**
  2097. * is_secondaryseg_expected() - Is waiting for secondary 80 report
  2098. * @spectral: Pointer to Spectral
  2099. * @smode: Spectral scan mode
  2100. *
  2101. * Return true if secondary 80 report expected and mode is 160 MHz
  2102. *
  2103. * Return: true or false
  2104. */
  2105. static inline
  2106. bool is_secondaryseg_expected(struct target_if_spectral *spectral,
  2107. enum spectral_scan_mode smode)
  2108. {
  2109. return
  2110. (is_ch_width_160_or_80p80(spectral->ch_width[smode]) &&
  2111. spectral->rparams.fragmentation_160[smode] &&
  2112. (spectral->state_160mhz_delivery[smode] ==
  2113. SPECTRAL_REPORT_WAIT_SECONDARY80));
  2114. }
  2115. /**
  2116. * is_primaryseg_expected() - Is waiting for primary 80 report
  2117. * @spectral: Pointer to Spectral
  2118. * @smode: Spectral scan mode
  2119. *
  2120. * Return true if mode is 160 Mhz and primary 80 report expected or
  2121. * mode is not 160 Mhz
  2122. *
  2123. * Return: true or false
  2124. */
  2125. static inline
  2126. bool is_primaryseg_expected(struct target_if_spectral *spectral,
  2127. enum spectral_scan_mode smode)
  2128. {
  2129. return
  2130. (!is_ch_width_160_or_80p80(spectral->ch_width[smode]) ||
  2131. !spectral->rparams.fragmentation_160[smode] ||
  2132. (spectral->state_160mhz_delivery[smode] ==
  2133. SPECTRAL_REPORT_WAIT_PRIMARY80));
  2134. }
  2135. #ifndef OPTIMIZED_SAMP_MESSAGE
  2136. /**
  2137. * is_primaryseg_rx_inprog() - Is primary 80 report processing is in progress
  2138. * @spectral: Pointer to Spectral
  2139. * @smode: Spectral scan mode
  2140. *
  2141. * Is primary 80 report processing is in progress
  2142. *
  2143. * Return: true or false
  2144. */
  2145. static inline
  2146. bool is_primaryseg_rx_inprog(struct target_if_spectral *spectral,
  2147. enum spectral_scan_mode smode)
  2148. {
  2149. return
  2150. (!is_ch_width_160_or_80p80(spectral->ch_width[smode]) ||
  2151. spectral->spectral_gen == SPECTRAL_GEN2 ||
  2152. (spectral->spectral_gen == SPECTRAL_GEN3 &&
  2153. (!spectral->rparams.fragmentation_160[smode] ||
  2154. spectral->state_160mhz_delivery[smode] ==
  2155. SPECTRAL_REPORT_RX_PRIMARY80)));
  2156. }
  2157. /**
  2158. * is_secondaryseg_rx_inprog() - Is secondary80 report processing is in progress
  2159. * @spectral: Pointer to Spectral
  2160. * @smode: Spectral scan mode
  2161. *
  2162. * Is secondary 80 report processing is in progress
  2163. *
  2164. * Return: true or false
  2165. */
  2166. static inline
  2167. bool is_secondaryseg_rx_inprog(struct target_if_spectral *spectral,
  2168. enum spectral_scan_mode smode)
  2169. {
  2170. return
  2171. (is_ch_width_160_or_80p80(spectral->ch_width[smode]) &&
  2172. (spectral->spectral_gen == SPECTRAL_GEN2 ||
  2173. ((spectral->spectral_gen == SPECTRAL_GEN3) &&
  2174. (!spectral->rparams.fragmentation_160[smode] ||
  2175. spectral->state_160mhz_delivery[smode] ==
  2176. SPECTRAL_REPORT_RX_SECONDARY80))));
  2177. }
  2178. #endif
  2179. /**
  2180. * clamp_fft_bin_value() - Clamp the FFT bin value between min and max
  2181. * @fft_bin_value: FFT bin value as reported by HW
  2182. * @pwr_format: FFT bin format (linear or dBm format)
  2183. *
  2184. * Each FFT bin value is represented as an 8 bit integer in SAMP message. But
  2185. * depending on the configuration, the FFT bin value reported by HW might
  2186. * exceed 8 bits. Clamp the FFT bin value between the min and max value
  2187. * which can be represented by 8 bits. For linear mode, min and max FFT bin
  2188. * value which can be represented by 8 bit is 0 and U8_MAX respectively. For
  2189. * dBm mode, min and max FFT bin value which can be represented by 8 bit is
  2190. * S8_MIN and S8_MAX respectively.
  2191. *
  2192. * Return: Clamped FFT bin value
  2193. */
  2194. static inline uint8_t
  2195. clamp_fft_bin_value(uint16_t fft_bin_value, uint16_t pwr_format)
  2196. {
  2197. uint8_t clamped_fft_bin_value = 0;
  2198. switch (pwr_format) {
  2199. case SPECTRAL_PWR_FORMAT_LINEAR:
  2200. if (qdf_unlikely(fft_bin_value > MAX_FFTBIN_VALUE_LINEAR_MODE))
  2201. clamped_fft_bin_value = MAX_FFTBIN_VALUE_LINEAR_MODE;
  2202. else
  2203. clamped_fft_bin_value = fft_bin_value;
  2204. break;
  2205. case SPECTRAL_PWR_FORMAT_DBM:
  2206. if (qdf_unlikely((int16_t)fft_bin_value >
  2207. MAX_FFTBIN_VALUE_DBM_MODE))
  2208. clamped_fft_bin_value = MAX_FFTBIN_VALUE_DBM_MODE;
  2209. else if (qdf_unlikely((int16_t)fft_bin_value <
  2210. MIN_FFTBIN_VALUE_DBM_MODE))
  2211. clamped_fft_bin_value = MIN_FFTBIN_VALUE_DBM_MODE;
  2212. else
  2213. clamped_fft_bin_value = fft_bin_value;
  2214. break;
  2215. default:
  2216. qdf_assert_always(0);
  2217. }
  2218. return clamped_fft_bin_value;
  2219. }
  2220. /**
  2221. * target_if_160mhz_delivery_state_change() - State transition for 160Mhz
  2222. * Spectral
  2223. * @spectral: Pointer to spectral object
  2224. * @smode: Spectral scan mode
  2225. * @detector_id: Detector id
  2226. *
  2227. * Move the states of state machine for 160MHz spectral scan report receive
  2228. *
  2229. * Return: QDF_STATUS
  2230. */
  2231. QDF_STATUS
  2232. target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral,
  2233. enum spectral_scan_mode smode,
  2234. uint8_t detector_id);
  2235. /**
  2236. * target_if_sops_is_spectral_enabled() - Get whether Spectral is enabled
  2237. * @arg: Pointer to handle for Spectral target_if internal private data
  2238. * @smode: Spectral scan mode
  2239. *
  2240. * Function to check whether Spectral is enabled
  2241. *
  2242. * Return: True if Spectral is enabled, false if Spectral is not enabled
  2243. */
  2244. uint32_t target_if_sops_is_spectral_enabled(void *arg,
  2245. enum spectral_scan_mode smode);
  2246. /**
  2247. * target_if_sops_is_spectral_active() - Get whether Spectral is active
  2248. * @arg: Pointer to handle for Spectral target_if internal private data
  2249. * @smode: Spectral scan mode
  2250. *
  2251. * Function to check whether Spectral is active
  2252. *
  2253. * Return: True if Spectral is active, false if Spectral is not active
  2254. */
  2255. uint32_t target_if_sops_is_spectral_active(void *arg,
  2256. enum spectral_scan_mode smode);
  2257. /**
  2258. * target_if_sops_start_spectral_scan() - Start Spectral scan
  2259. * @arg: Pointer to handle for Spectral target_if internal private data
  2260. * @smode: Spectral scan mode
  2261. * @err: Pointer to error code
  2262. *
  2263. * Function to start spectral scan
  2264. *
  2265. * Return: 0 on success else failure
  2266. */
  2267. uint32_t target_if_sops_start_spectral_scan(void *arg,
  2268. enum spectral_scan_mode smode,
  2269. enum spectral_cp_error_code *err);
  2270. /**
  2271. * target_if_sops_stop_spectral_scan() - Stop Spectral scan
  2272. * @arg: Pointer to handle for Spectral target_if internal private data
  2273. * @smode: Spectral scan mode
  2274. *
  2275. * Function to stop spectral scan
  2276. *
  2277. * Return: 0 in case of success, -1 on failure
  2278. */
  2279. uint32_t target_if_sops_stop_spectral_scan(void *arg,
  2280. enum spectral_scan_mode smode);
  2281. /**
  2282. * target_if_spectral_get_extension_channel() - Get the current Extension
  2283. * channel (in MHz)
  2284. * @arg: Pointer to handle for Spectral target_if internal private data
  2285. * @smode: Spectral scan mode
  2286. *
  2287. * Return: Current Extension channel (in MHz) on success, 0 on failure or if
  2288. * extension channel is not present.
  2289. */
  2290. uint32_t
  2291. target_if_spectral_get_extension_channel(void *arg,
  2292. enum spectral_scan_mode smode);
  2293. /**
  2294. * target_if_spectral_get_current_channel() - Get the current channel (in MHz)
  2295. * @arg: Pointer to handle for Spectral target_if internal private data
  2296. * @smode: Spectral scan mode
  2297. *
  2298. * Return: Current channel (in MHz) on success, 0 on failure
  2299. */
  2300. uint32_t
  2301. target_if_spectral_get_current_channel(void *arg,
  2302. enum spectral_scan_mode smode);
  2303. /**
  2304. * target_if_spectral_reset_hw() - Reset the hardware
  2305. * @arg: Pointer to handle for Spectral target_if internal private data
  2306. *
  2307. * This is only a placeholder since it is not currently required in the offload
  2308. * case.
  2309. *
  2310. * Return: 0
  2311. */
  2312. uint32_t target_if_spectral_reset_hw(void *arg);
  2313. /**
  2314. * target_if_spectral_get_chain_noise_floor() - Get the Chain noise floor from
  2315. * Noisefloor history buffer
  2316. * @arg: Pointer to handle for Spectral target_if internal private data
  2317. * @nf_buf: Pointer to buffer into which chain Noise Floor data should be copied
  2318. *
  2319. * This is only a placeholder since it is not currently required in the offload
  2320. * case.
  2321. *
  2322. * Return: 0
  2323. */
  2324. uint32_t target_if_spectral_get_chain_noise_floor(void *arg, int16_t *nf_buf);
  2325. /**
  2326. * target_if_spectral_get_ext_noisefloor() - Get the extension channel
  2327. * noisefloor
  2328. * @arg: Pointer to handle for Spectral target_if internal private data
  2329. *
  2330. * This is only a placeholder since it is not currently required in the offload
  2331. * case.
  2332. *
  2333. * Return: 0
  2334. */
  2335. int8_t target_if_spectral_get_ext_noisefloor(void *arg);
  2336. /**
  2337. * target_if_spectral_get_ctl_noisefloor() - Get the control channel noisefloor
  2338. * @arg: Pointer to handle for Spectral target_if internal private data
  2339. *
  2340. * This is only a placeholder since it is not currently required in the offload
  2341. * case.
  2342. *
  2343. * Return: 0
  2344. */
  2345. int8_t target_if_spectral_get_ctl_noisefloor(void *arg);
  2346. /**
  2347. * target_if_spectral_get_capability() - Get whether a given Spectral hardware
  2348. * capability is available
  2349. * @arg: Pointer to handle for Spectral target_if internal private data
  2350. * @type: Spectral hardware capability type
  2351. *
  2352. * Return: True if the capability is available, false if the capability is not
  2353. * available
  2354. */
  2355. uint32_t target_if_spectral_get_capability(
  2356. void *arg, enum spectral_capability_type type);
  2357. /**
  2358. * target_if_spectral_set_rxfilter() - Set the RX Filter before Spectral start
  2359. * @arg: Pointer to handle for Spectral target_if internal private data
  2360. * @rxfilter: Rx filter to be used
  2361. *
  2362. * Note: This is only a placeholder function. It is not currently required since
  2363. * FW should be taking care of setting the required filters.
  2364. *
  2365. * Return: 0
  2366. */
  2367. uint32_t target_if_spectral_set_rxfilter(void *arg, int rxfilter);
  2368. /**
  2369. * target_if_spectral_sops_configure_params() - Configure user supplied Spectral
  2370. * parameters
  2371. * @arg: Pointer to handle for Spectral target_if internal private data
  2372. * @params: Spectral parameters
  2373. * @smode: Spectral scan mode
  2374. *
  2375. * Return: 0 in case of success, -1 on failure
  2376. */
  2377. uint32_t target_if_spectral_sops_configure_params(
  2378. void *arg, struct spectral_config *params,
  2379. enum spectral_scan_mode smode);
  2380. /**
  2381. * target_if_spectral_get_rxfilter() - Get the current RX Filter settings
  2382. * @arg: Pointer to handle for Spectral target_if internal private data
  2383. *
  2384. * Note: This is only a placeholder function. It is not currently required since
  2385. * FW should be taking care of setting the required filters.
  2386. *
  2387. * Return: 0
  2388. */
  2389. uint32_t target_if_spectral_get_rxfilter(void *arg);
  2390. /**
  2391. * target_if_pdev_spectral_deinit() - De-initialize target_if Spectral
  2392. * functionality for the given pdev
  2393. * @pdev: Pointer to pdev object
  2394. *
  2395. * Return: None
  2396. */
  2397. void target_if_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev);
  2398. /**
  2399. * target_if_set_spectral_config() - Set spectral config
  2400. * @pdev: Pointer to pdev object
  2401. * @param: Spectral parameter id and value
  2402. * @smode: Spectral scan mode
  2403. * @err: Pointer to Spectral error code
  2404. *
  2405. * API to set spectral configurations
  2406. *
  2407. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2408. */
  2409. QDF_STATUS target_if_set_spectral_config(struct wlan_objmgr_pdev *pdev,
  2410. const struct spectral_cp_param *param,
  2411. const enum spectral_scan_mode smode,
  2412. enum spectral_cp_error_code *err);
  2413. /**
  2414. * target_if_pdev_spectral_init() - Initialize target_if Spectral
  2415. * functionality for the given pdev
  2416. * @pdev: Pointer to pdev object
  2417. *
  2418. * Return: On success, pointer to Spectral target_if internal private data, on
  2419. * failure, NULL
  2420. */
  2421. void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev);
  2422. /**
  2423. * target_if_spectral_sops_get_params() - Get user configured Spectral
  2424. * parameters
  2425. * @arg: Pointer to handle for Spectral target_if internal private data
  2426. * @params: Pointer to buffer into which Spectral parameters should be copied
  2427. * @smode: Spectral scan mode
  2428. *
  2429. * Return: 0 in case of success, -1 on failure
  2430. */
  2431. uint32_t target_if_spectral_sops_get_params(
  2432. void *arg, struct spectral_config *params,
  2433. enum spectral_scan_mode smode);
  2434. /**
  2435. * target_if_init_spectral_capability() - Initialize Spectral capability
  2436. *
  2437. * @spectral: Pointer to Spectral target_if internal private data
  2438. * @target_type: target type
  2439. *
  2440. * This is a workaround.
  2441. *
  2442. * Return: QDF_STATUS
  2443. */
  2444. QDF_STATUS
  2445. target_if_init_spectral_capability(struct target_if_spectral *spectral,
  2446. uint32_t target_type);
  2447. /**
  2448. * target_if_start_spectral_scan() - Start spectral scan
  2449. * @pdev: Pointer to pdev object
  2450. * @vdev_id: VDEV id
  2451. * @smode: Spectral scan mode
  2452. * @err: Spectral error code
  2453. *
  2454. * API to start spectral scan
  2455. *
  2456. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2457. */
  2458. QDF_STATUS target_if_start_spectral_scan(struct wlan_objmgr_pdev *pdev,
  2459. uint8_t vdev_id,
  2460. enum spectral_scan_mode smode,
  2461. enum spectral_cp_error_code *err);
  2462. /**
  2463. * target_if_get_spectral_config() - Get spectral configuration
  2464. * @pdev: Pointer to pdev object
  2465. * @param: Pointer to spectral_config structure in which the configuration
  2466. * should be returned
  2467. * @smode: Spectral scan mode
  2468. *
  2469. * API to get the current spectral configuration
  2470. *
  2471. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2472. */
  2473. QDF_STATUS target_if_get_spectral_config(struct wlan_objmgr_pdev *pdev,
  2474. struct spectral_config *param,
  2475. enum spectral_scan_mode smode);
  2476. /**
  2477. * target_if_spectral_scan_enable_params() - Enable use of desired Spectral
  2478. * parameters
  2479. * @spectral: Pointer to Spectral target_if internal private data
  2480. * @spectral_params: Pointer to Spectral parameters
  2481. * @smode: Spectral scan mode
  2482. * @err: Spectral error code
  2483. *
  2484. * Enable use of desired Spectral parameters by configuring them into HW, and
  2485. * starting Spectral scan
  2486. *
  2487. * Return: 0 on success, 1 on failure
  2488. */
  2489. int target_if_spectral_scan_enable_params(
  2490. struct target_if_spectral *spectral,
  2491. struct spectral_config *spectral_params,
  2492. enum spectral_scan_mode smode,
  2493. enum spectral_cp_error_code *err);
  2494. /**
  2495. * target_if_is_spectral_active() - Get whether Spectral is active
  2496. * @pdev: Pointer to pdev object
  2497. * @smode: Spectral scan mode
  2498. *
  2499. * Return: True if Spectral is active, false if Spectral is not active
  2500. */
  2501. bool target_if_is_spectral_active(struct wlan_objmgr_pdev *pdev,
  2502. enum spectral_scan_mode smode);
  2503. /**
  2504. * target_if_is_spectral_enabled() - Get whether Spectral is enabled
  2505. * @pdev: Pointer to pdev object
  2506. * @smode: Spectral scan mode
  2507. *
  2508. * Return: True if Spectral is enabled, false if Spectral is not enabled
  2509. */
  2510. bool target_if_is_spectral_enabled(struct wlan_objmgr_pdev *pdev,
  2511. enum spectral_scan_mode smode);
  2512. /**
  2513. * target_if_set_debug_level() - Set debug level for Spectral
  2514. * @pdev: Pointer to pdev object
  2515. * @debug_level: Debug level
  2516. *
  2517. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2518. *
  2519. */
  2520. QDF_STATUS target_if_set_debug_level(struct wlan_objmgr_pdev *pdev,
  2521. uint32_t debug_level);
  2522. /**
  2523. * target_if_get_debug_level() - Get debug level for Spectral
  2524. * @pdev: Pointer to pdev object
  2525. *
  2526. * Return: Current debug level
  2527. */
  2528. uint32_t target_if_get_debug_level(struct wlan_objmgr_pdev *pdev);
  2529. /**
  2530. * target_if_get_spectral_capinfo() - Get Spectral capability information
  2531. * @pdev: Pointer to pdev object
  2532. * @scaps: Buffer into which data should be copied
  2533. *
  2534. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2535. */
  2536. QDF_STATUS target_if_get_spectral_capinfo(struct wlan_objmgr_pdev *pdev,
  2537. struct spectral_caps *scaps);
  2538. /**
  2539. * target_if_get_spectral_diagstats() - Get Spectral diagnostic statistics
  2540. * @pdev: Pointer to pdev object
  2541. * @stats: Buffer into which data should be copied
  2542. *
  2543. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2544. */
  2545. QDF_STATUS target_if_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev,
  2546. struct spectral_diag_stats *stats);
  2547. QDF_STATUS
  2548. target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral,
  2549. enum spectral_scan_mode smode,
  2550. uint8_t detector_id);
  2551. #ifdef OPTIMIZED_SAMP_MESSAGE
  2552. /**
  2553. * target_if_spectral_get_num_fft_bins() - Get number of FFT bins from FFT size
  2554. * according to the Spectral report mode.
  2555. * @fft_size: FFT length
  2556. * @report_mode: Spectral report mode
  2557. *
  2558. * Get number of FFT bins from FFT size according to the Spectral
  2559. * report mode.
  2560. *
  2561. * Return: Number of FFT bins
  2562. */
  2563. static inline uint32_t
  2564. target_if_spectral_get_num_fft_bins(uint32_t fft_size,
  2565. enum spectral_report_mode report_mode)
  2566. {
  2567. switch (report_mode) {
  2568. case SPECTRAL_REPORT_MODE_0:
  2569. case SPECTRAL_REPORT_MODE_1:
  2570. return 0;
  2571. case SPECTRAL_REPORT_MODE_2:
  2572. return (1 << (fft_size - 1));
  2573. case SPECTRAL_REPORT_MODE_3:
  2574. return (1 << fft_size);
  2575. default:
  2576. return -EINVAL;
  2577. }
  2578. }
  2579. #endif /* OPTIMIZED_SAMP_MESSAGE */
  2580. #ifdef OPTIMIZED_SAMP_MESSAGE
  2581. /**
  2582. * target_if_get_detector_chwidth() - Get per-detector bandwidth
  2583. * based on channel width and fragmentation.
  2584. * @ch_width: Spectral scan channel width
  2585. * @fragmentation_160: Target type has fragmentation or not
  2586. *
  2587. * Get per-detector BW.
  2588. *
  2589. * Return: detector BW
  2590. */
  2591. static inline
  2592. enum phy_ch_width target_if_get_detector_chwidth(enum phy_ch_width ch_width,
  2593. bool fragmentation_160)
  2594. {
  2595. return ((ch_width == CH_WIDTH_160MHZ && fragmentation_160) ?
  2596. CH_WIDTH_80MHZ : ((ch_width == CH_WIDTH_80P80MHZ) ?
  2597. CH_WIDTH_80MHZ : ch_width));
  2598. }
  2599. /**
  2600. * target_if_spectral_set_start_end_freq() - Set start and end frequencies for
  2601. * a given center frequency
  2602. * @cfreq: Center frequency for which start and end freq need to be set
  2603. * @ch_width: Spectral scan Channel width
  2604. * @fragmentation_160: Target type has fragmentation or not
  2605. * @start_end_freq: Array containing start and end frequency of detector
  2606. *
  2607. * Set the start and end frequencies for given center frequency in destination
  2608. * detector info struct
  2609. *
  2610. * Return: void
  2611. */
  2612. static inline
  2613. void target_if_spectral_set_start_end_freq(uint32_t cfreq,
  2614. enum phy_ch_width ch_width,
  2615. bool fragmentation_160,
  2616. uint32_t *start_end_freq)
  2617. {
  2618. enum phy_ch_width det_ch_width;
  2619. det_ch_width = target_if_get_detector_chwidth(ch_width,
  2620. fragmentation_160);
  2621. start_end_freq[0] = cfreq - (wlan_reg_get_bw_value(det_ch_width) >> 1);
  2622. start_end_freq[1] = cfreq + (wlan_reg_get_bw_value(det_ch_width) >> 1);
  2623. }
  2624. #endif /* OPTIMIZED_SAMP_MESSAGE */
  2625. #ifdef DIRECT_BUF_RX_ENABLE
  2626. /**
  2627. * target_if_consume_sfft_report_gen3() - Process fft report for gen3
  2628. * @spectral: Pointer to spectral object
  2629. * @report: Pointer to spectral report
  2630. *
  2631. * Process fft report for gen3
  2632. *
  2633. * Return: Success/Failure
  2634. */
  2635. int
  2636. target_if_consume_spectral_report_gen3(
  2637. struct target_if_spectral *spectral,
  2638. struct spectral_report *report);
  2639. #endif
  2640. /**
  2641. * target_if_spectral_fw_hang() - Crash the FW from Spectral module
  2642. * @spectral: Pointer to Spectral LMAC object
  2643. *
  2644. * Return: QDF_STATUS of operation
  2645. */
  2646. QDF_STATUS target_if_spectral_fw_hang(struct target_if_spectral *spectral);
  2647. /**
  2648. * target_if_spectral_finite_scan_update() - Update scan count for finite scan
  2649. * and stop Spectral scan when required
  2650. * @spectral: Pointer to Spectral target_if internal private data
  2651. * @smode: Spectral scan mode
  2652. *
  2653. * This API decrements the number of Spectral reports expected from target for
  2654. * a finite Spectral scan. When expected number of reports are received from
  2655. * target Spectral scan is stopped.
  2656. *
  2657. * Return: QDF_STATUS on success
  2658. */
  2659. QDF_STATUS
  2660. target_if_spectral_finite_scan_update(struct target_if_spectral *spectral,
  2661. enum spectral_scan_mode smode);
  2662. /**
  2663. * target_if_spectral_is_finite_scan() - Check Spectral scan is finite/infinite
  2664. * @spectral: Pointer to Spectral target_if internal private data
  2665. * @smode: Spectral scan mode
  2666. *
  2667. * API to check whether Spectral scan is finite/infinite for the give mode.
  2668. * A non zero scan count indicates that scan is finite. Scan count of 0
  2669. * indicates an infinite Spectral scan.
  2670. *
  2671. * Return: QDF_STATUS on success
  2672. */
  2673. QDF_STATUS
  2674. target_if_spectral_is_finite_scan(struct target_if_spectral *spectral,
  2675. enum spectral_scan_mode smode,
  2676. bool *finite_spectral_scan);
  2677. #ifdef BIG_ENDIAN_HOST
  2678. /**
  2679. * target_if_byte_swap_spectral_headers_gen3() - Apply byte-swap on headers
  2680. * @spectral: Pointer to Spectral target_if internal private data
  2681. * @data: Pointer to the start of Spectral Scan Summary report
  2682. *
  2683. * This API is only required for Big-endian Host platforms.
  2684. * It applies 32-bit byte-swap on Spectral Scan Summary and Search FFT reports
  2685. * and copies them back to the source location.
  2686. * Padding bytes that lie between the reports won't be touched.
  2687. *
  2688. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2689. */
  2690. QDF_STATUS target_if_byte_swap_spectral_headers_gen3(
  2691. struct target_if_spectral *spectral,
  2692. void *data);
  2693. /**
  2694. * target_if_byte_swap_spectral_fft_bins_gen3() - Apply byte-swap on FFT bins
  2695. * @rparams: Pointer to Spectral report parameters
  2696. * @bin_pwr_data: Pointer to the start of FFT bins
  2697. * @num_fftbins: Number of FFT bins
  2698. *
  2699. * This API is only required for Big-endian Host platforms.
  2700. * It applies pack-mode-aware byte-swap on the FFT bins as below:
  2701. * 1. pack-mode 0 (i.e., 1 FFT bin per DWORD):
  2702. * Reads the least significant 2 bytes of each DWORD, applies 16-bit
  2703. * byte-swap on that value, and copies it back to the source location.
  2704. * 2. pack-mode 1 (i.e., 2 FFT bins per DWORD):
  2705. * Reads each FFT bin, applies 16-bit byte-swap on that value,
  2706. * and copies it back to the source location.
  2707. * 3. pack-mode 2 (4 FFT bins per DWORD):
  2708. * Nothing
  2709. *
  2710. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2711. */
  2712. QDF_STATUS target_if_byte_swap_spectral_fft_bins_gen3(
  2713. const struct spectral_report_params *rparams,
  2714. void *bin_pwr_data, size_t num_fftbins);
  2715. #endif /* BIG_ENDIAN_HOST */
  2716. #ifdef OPTIMIZED_SAMP_MESSAGE
  2717. /**
  2718. * target_if_populate_fft_bins_info() - Populate the start and end bin
  2719. * indices, on per-detector level.
  2720. * @spectral: Pointer to target_if spectral internal structure
  2721. * @smode: Spectral scan mode
  2722. *
  2723. * Populate the start and end bin indices, on per-detector level.
  2724. *
  2725. * Return: Success/Failure
  2726. */
  2727. QDF_STATUS
  2728. target_if_populate_fft_bins_info(struct target_if_spectral *spectral,
  2729. enum spectral_scan_mode smode);
  2730. #else
  2731. static inline QDF_STATUS
  2732. target_if_populate_fft_bins_info(struct target_if_spectral *spectral,
  2733. enum spectral_scan_mode smode)
  2734. {
  2735. return QDF_STATUS_SUCCESS;
  2736. }
  2737. #endif
  2738. /**
  2739. * spectral_is_session_info_expected_from_target() - Check if spectral scan
  2740. * session is expected from target
  2741. * @pdev: pdev pointer
  2742. * @is_session_info_expected: Pointer to caller variable
  2743. *
  2744. * Return: QDF_STATUS of operation
  2745. */
  2746. QDF_STATUS
  2747. spectral_is_session_info_expected_from_target(struct wlan_objmgr_pdev *pdev,
  2748. bool *is_session_info_expected);
  2749. #ifdef WIN32
  2750. #pragma pack(pop, target_if_spectral)
  2751. #endif
  2752. #ifdef __ATTRIB_PACK
  2753. #undef __ATTRIB_PACK
  2754. #endif
  2755. /**
  2756. * target_if_spectral_copy_fft_bins() - Copy FFT bins from source buffer to
  2757. * destination buffer
  2758. * @spectral: Pointer to Spectral LMAC object
  2759. * @src_fft_buf: Pointer to source FFT buffer
  2760. * @dest_fft_buf: Pointer to destination FFT buffer
  2761. * @fft_bin_count: Number of FFT bins to copy
  2762. * @bytes_copied: Number of bytes copied by this API
  2763. * @pwr_format: Spectral FFT bin format (linear/dBm mode)
  2764. *
  2765. * Different targets supports different FFT bin widths. This API encapsulates
  2766. * all those details and copies 8-bit FFT value into the destination buffer.
  2767. * Also, this API takes care of handling big-endian mode.
  2768. * In essence, it does the following.
  2769. * - Read DWORDs one by one
  2770. * - Extract individual FFT bins out of it
  2771. * - Copy the FFT bin to destination buffer
  2772. *
  2773. * Return: QDF_STATUS_SUCCESS in case of success, else QDF_STATUS_E_FAILURE
  2774. */
  2775. QDF_STATUS
  2776. target_if_spectral_copy_fft_bins(struct target_if_spectral *spectral,
  2777. const void *src_fft_buf,
  2778. void *dest_fft_buf,
  2779. uint32_t fft_bin_count,
  2780. uint32_t *bytes_copied,
  2781. uint16_t pwr_format);
  2782. #endif /* WLAN_CONV_SPECTRAL_ENABLE */
  2783. struct spectral_capabilities_event_params;
  2784. /**
  2785. * target_if_wmi_extract_spectral_caps_fixed_param() - Wrapper function to
  2786. * extract fixed params from Spectral capabilities WMI event
  2787. * @psoc: Pointer to psoc object
  2788. * @evt_buf: Event buffer
  2789. * @param: Spectral capabilities event parameters data structure to be filled
  2790. * by this API
  2791. *
  2792. * Return: QDF_STATUS of operation
  2793. */
  2794. QDF_STATUS target_if_wmi_extract_spectral_caps_fixed_param(
  2795. struct wlan_objmgr_psoc *psoc,
  2796. uint8_t *evt_buf,
  2797. struct spectral_capabilities_event_params *param);
  2798. struct spectral_scan_bw_capabilities;
  2799. /**
  2800. * target_if_wmi_extract_spectral_scan_bw_caps() - Wrapper function to
  2801. * extract bandwidth capabilities from Spectral capabilities WMI event
  2802. * @psoc: Pointer to psoc object
  2803. * @evt_buf: Event buffer
  2804. * @bw_caps: Data structure to be filled by this API after extraction
  2805. *
  2806. * Return: QDF_STATUS of operation
  2807. */
  2808. QDF_STATUS
  2809. target_if_wmi_extract_spectral_scan_bw_caps(
  2810. struct wlan_objmgr_psoc *psoc,
  2811. uint8_t *evt_buf,
  2812. struct spectral_scan_bw_capabilities *bw_caps);
  2813. struct spectral_fft_size_capabilities;
  2814. /**
  2815. * target_if_wmi_extract_spectral_fft_size_caps() - Wrapper function to
  2816. * extract fft size capabilities from Spectral capabilities WMI event
  2817. * @psoc: Pointer to psoc object
  2818. * @evt_buf: Event buffer
  2819. * @fft_size_caps: Data structure to be filled by this API after extraction
  2820. *
  2821. * Return: QDF_STATUS of operation
  2822. */
  2823. QDF_STATUS
  2824. target_if_wmi_extract_spectral_fft_size_caps(
  2825. struct wlan_objmgr_psoc *psoc,
  2826. uint8_t *evt_buf,
  2827. struct spectral_fft_size_capabilities *fft_size_caps);
  2828. #endif /* _TARGET_IF_SPECTRAL_H_ */