wmi_unified_api.c 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  1. /*
  2. * Copyright (c) 2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #include "athdefs.h"
  27. #include "osapi_linux.h"
  28. #include "a_types.h"
  29. #include "a_debug.h"
  30. #include "ol_if_athvar.h"
  31. #include "ol_defines.h"
  32. #include "wmi.h"
  33. #include "wmi_unified_priv.h"
  34. #include "wma_api.h"
  35. #include "wmi_unified_param.h"
  36. /**
  37. * wmi_unified_vdev_create_send() - send VDEV create command to fw
  38. * @wmi_handle: wmi handle
  39. * @param: pointer to hold vdev create parameter
  40. * @macaddr: vdev mac address
  41. *
  42. * Return: 0 for success or error code
  43. */
  44. int32_t wmi_unified_vdev_create_send(void *wmi_hdl,
  45. uint8_t macaddr[IEEE80211_ADDR_LEN],
  46. struct vdev_create_params *param)
  47. {
  48. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  49. if (wmi_handle->ops->send_vdev_create_cmd)
  50. return wmi_handle->ops->send_vdev_create_cmd(wmi_handle,
  51. macaddr, param);
  52. return CDF_STATUS_E_FAILURE;
  53. }
  54. /**
  55. * wmi_unified_vdev_delete_send() - send VDEV delete command to fw
  56. * @wmi_handle: wmi handle
  57. * @if_id: vdev id
  58. *
  59. * Return: 0 for success or error code
  60. */
  61. int32_t wmi_unified_vdev_delete_send(void *wmi_hdl,
  62. uint8_t if_id)
  63. {
  64. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  65. if (wmi_handle->ops->send_vdev_delete_cmd)
  66. return wmi_handle->ops->send_vdev_delete_cmd(wmi_handle,
  67. if_id);
  68. return CDF_STATUS_E_FAILURE;
  69. }
  70. /**
  71. * wmi_unified_vdev_stop_send() - send vdev stop command to fw
  72. * @wmi: wmi handle
  73. * @vdev_id: vdev id
  74. *
  75. * Return: 0 for success or erro code
  76. */
  77. int32_t wmi_unified_vdev_stop_send(void *wmi_hdl,
  78. uint8_t vdev_id)
  79. {
  80. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  81. if (wmi_handle->ops->send_vdev_stop_cmd)
  82. return wmi_handle->ops->send_vdev_stop_cmd(wmi_handle,
  83. vdev_id);
  84. return CDF_STATUS_E_FAILURE;
  85. }
  86. /**
  87. * wmi_unified_vdev_down_send() - send vdev down command to fw
  88. * @wmi: wmi handle
  89. * @vdev_id: vdev id
  90. *
  91. * Return: 0 for success or error code
  92. */
  93. int32_t wmi_unified_vdev_down_send(void *wmi_hdl, uint8_t vdev_id)
  94. {
  95. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  96. if (wmi_handle->ops->send_vdev_down_cmd)
  97. return wmi_handle->ops->send_vdev_down_cmd(wmi_handle, vdev_id);
  98. return CDF_STATUS_E_FAILURE;
  99. }
  100. /**
  101. * wmi_unified_peer_flush_tids_send() - flush peer tids packets in fw
  102. * @wmi: wmi handle
  103. * @peer_addr: peer mac address
  104. * @param: pointer to hold peer flush tid parameter
  105. *
  106. * Return: 0 for sucess or error code
  107. */
  108. int32_t wmi_unified_peer_flush_tids_send(void *wmi_hdl,
  109. uint8_t peer_addr[IEEE80211_ADDR_LEN],
  110. struct peer_flush_params *param)
  111. {
  112. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  113. if (wmi_handle->ops->send_peer_flush_tids_cmd)
  114. return wmi_handle->ops->send_peer_flush_tids_cmd(wmi_handle,
  115. peer_addr, param);
  116. return CDF_STATUS_E_FAILURE;
  117. }
  118. /**
  119. * wmi_unified_peer_delete_send() - send PEER delete command to fw
  120. * @wmi: wmi handle
  121. * @peer_addr: peer mac addr
  122. * @vdev_id: vdev id
  123. *
  124. * Return: 0 for success or error code
  125. */
  126. int32_t wmi_unified_peer_delete_send(void *wmi_hdl,
  127. uint8_t
  128. peer_addr[IEEE80211_ADDR_LEN],
  129. uint8_t vdev_id)
  130. {
  131. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  132. if (wmi_handle->ops->send_peer_delete_cmd)
  133. return wmi_handle->ops->send_peer_delete_cmd(wmi_handle,
  134. peer_addr, vdev_id);
  135. return CDF_STATUS_E_FAILURE;
  136. }
  137. /**
  138. * wmi_set_peer_param() - set peer parameter in fw
  139. * @wmi_ctx: wmi handle
  140. * @peer_addr: peer mac address
  141. * @param : pointer to hold peer set parameter
  142. *
  143. * Return: 0 for success or error code
  144. */
  145. int32_t wmi_set_peer_param_send(void *wmi_hdl,
  146. uint8_t peer_addr[IEEE80211_ADDR_LEN],
  147. struct peer_set_params *param)
  148. {
  149. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  150. if (wmi_handle->ops->send_peer_param_cmd)
  151. return wmi_handle->ops->send_peer_param_cmd(wmi_handle,
  152. peer_addr, param);
  153. return CDF_STATUS_E_FAILURE;
  154. }
  155. /**
  156. * wmi_unified_vdev_up_send() - send vdev up command in fw
  157. * @wmi: wmi handle
  158. * @bssid: bssid
  159. * @vdev_up_params: pointer to hold vdev up parameter
  160. *
  161. * Return: 0 for success or error code
  162. */
  163. int32_t wmi_unified_vdev_up_send(void *wmi_hdl,
  164. uint8_t bssid[IEEE80211_ADDR_LEN],
  165. struct vdev_up_params *params)
  166. {
  167. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  168. if (wmi_handle->ops->send_vdev_up_cmd)
  169. return wmi_handle->ops->send_vdev_up_cmd(wmi_handle, bssid,
  170. params);
  171. return CDF_STATUS_E_FAILURE;
  172. }
  173. /**
  174. * wmi_unified_peer_create_send() - send peer create command to fw
  175. * @wmi: wmi handle
  176. * @peer_addr: peer mac address
  177. * @peer_type: peer type
  178. * @vdev_id: vdev id
  179. *
  180. * Return: 0 for success or error code
  181. */
  182. int32_t wmi_unified_peer_create_send(void *wmi_hdl,
  183. struct peer_create_params *param)
  184. {
  185. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  186. if (wmi_handle->ops->send_peer_create_cmd)
  187. return wmi_handle->ops->send_peer_create_cmd(wmi_handle, param);
  188. return CDF_STATUS_E_FAILURE;
  189. }
  190. #ifdef FEATURE_GREEN_AP
  191. /**
  192. * wmi_unified_green_ap_ps_send() - enable green ap powersave command
  193. * @wmi_handle: wmi handle
  194. * @value: value
  195. * @mac_id: mac id to have radio context
  196. *
  197. * Return: 0 for success or error code
  198. */
  199. int32_t wmi_unified_green_ap_ps_send(void *wmi_hdl,
  200. uint32_t value, uint8_t mac_id)
  201. {
  202. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  203. if (wmi_handle->ops->send_green_ap_ps_cmd)
  204. return wmi_handle->ops->send_green_ap_ps_cmd(wmi_handle, value,
  205. mac_id);
  206. return CDF_STATUS_E_FAILURE;
  207. }
  208. #else
  209. int32_t wmi_unified_green_ap_ps_send(void *wmi_hdl,
  210. uint32_t value, uint8_t mac_id)
  211. {
  212. return 0;
  213. }
  214. #endif /* FEATURE_GREEN_AP */
  215. /**
  216. * wmi_unified_pdev_utf_cmd() - send utf command to fw
  217. * @wmi_handle: wmi handle
  218. * @param: pointer to pdev_utf_params
  219. * @mac_id: mac id to have radio context
  220. *
  221. * Return: 0 for success or error code
  222. */
  223. int32_t
  224. wmi_unified_pdev_utf_cmd_send(void *wmi_hdl,
  225. struct pdev_utf_params *param,
  226. uint8_t mac_id)
  227. {
  228. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  229. if (wmi_handle->ops->send_pdev_utf_cmd)
  230. return wmi_handle->ops->send_pdev_utf_cmd(wmi_handle, param,
  231. mac_id);
  232. return CDF_STATUS_E_FAILURE;
  233. }
  234. /**
  235. * wmi_unified_pdev_set_param() - set pdev parameters
  236. * @wmi_handle: wmi handle
  237. * @param: pointer to pdev parameter
  238. * @mac_id: radio context
  239. *
  240. * Return: 0 on success, errno on failure
  241. */
  242. int32_t
  243. wmi_unified_pdev_param_send(void *wmi_hdl,
  244. struct pdev_params *param,
  245. uint8_t mac_id)
  246. {
  247. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  248. if (wmi_handle->ops->send_pdev_param_cmd)
  249. return wmi_handle->ops->send_pdev_param_cmd(wmi_handle, param,
  250. mac_id);
  251. return CDF_STATUS_E_FAILURE;
  252. }
  253. /**
  254. * wmi_unified_suspend_send() - WMI suspend function
  255. * @param wmi_handle : handle to WMI.
  256. * @param param : pointer to hold suspend parameter
  257. * @mac_id: radio context
  258. *
  259. * Return: 0 on success and -ve on failure.
  260. */
  261. int32_t wmi_unified_suspend_send(void *wmi_hdl,
  262. struct suspend_params *param,
  263. uint8_t mac_id)
  264. {
  265. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  266. if (wmi_handle->ops->send_suspend_cmd)
  267. return wmi_handle->ops->send_suspend_cmd(wmi_handle, param,
  268. mac_id);
  269. return CDF_STATUS_E_FAILURE;
  270. }
  271. /**
  272. * wmi_unified_resume_send - WMI resume function
  273. * @param wmi_handle : handle to WMI.
  274. * @mac_id: radio context
  275. *
  276. * Return: 0 on success and -ve on failure.
  277. */
  278. int32_t wmi_unified_resume_send(void *wmi_hdl,
  279. uint8_t mac_id)
  280. {
  281. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  282. if (wmi_handle->ops->send_resume_cmd)
  283. return wmi_handle->ops->send_resume_cmd(wmi_handle,
  284. mac_id);
  285. return CDF_STATUS_E_FAILURE;
  286. }
  287. /**
  288. * wmi_unified_wow_enable_send() - WMI wow enable function
  289. * @param wmi_handle : handle to WMI.
  290. * @param param : pointer to hold wow enable parameter
  291. * @mac_id: radio context
  292. *
  293. * Return: 0 on success and -ve on failure.
  294. */
  295. int32_t wmi_unified_wow_enable_send(void *wmi_hdl,
  296. struct wow_cmd_params *param,
  297. uint8_t mac_id)
  298. {
  299. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  300. if (wmi_handle->ops->send_wow_enable_cmd)
  301. return wmi_handle->ops->send_wow_enable_cmd(wmi_handle, param,
  302. mac_id);
  303. return CDF_STATUS_E_FAILURE;
  304. }
  305. /**
  306. * wmi_unified_ap_ps_cmd_send() - set ap powersave parameters
  307. * @wma_ctx: wma context
  308. * @peer_addr: peer mac address
  309. * @param: pointer to ap_ps parameter structure
  310. *
  311. * Return: 0 for success or error code
  312. */
  313. int32_t wmi_unified_ap_ps_cmd_send(void *wmi_hdl,
  314. uint8_t *peer_addr,
  315. struct ap_ps_params *param)
  316. {
  317. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  318. if (wmi_handle->ops->send_set_ap_ps_param_cmd)
  319. return wmi_handle->ops->send_set_ap_ps_param_cmd(wmi_handle,
  320. peer_addr,
  321. param);
  322. return CDF_STATUS_E_FAILURE;
  323. }
  324. /**
  325. * wmi_unified_sta_ps_cmd_send() - set sta powersave parameters
  326. * @wma_ctx: wma context
  327. * @peer_addr: peer mac address
  328. * @param: pointer to sta_ps parameter structure
  329. *
  330. * Return: 0 for success or error code
  331. */
  332. int32_t wmi_unified_sta_ps_cmd_send(void *wmi_hdl,
  333. struct sta_ps_params *param)
  334. {
  335. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  336. if (wmi_handle->ops->send_set_sta_ps_param_cmd)
  337. return wmi_handle->ops->send_set_sta_ps_param_cmd(wmi_handle,
  338. param);
  339. return CDF_STATUS_E_FAILURE;
  340. }
  341. /**
  342. * wmi_crash_inject() - inject fw crash
  343. * @wma_handle: wma handle
  344. * @param: ponirt to crash inject paramter structure
  345. *
  346. * Return: 0 for success or return error
  347. */
  348. int32_t wmi_crash_inject(void *wmi_hdl,
  349. struct crash_inject *param)
  350. {
  351. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  352. if (wmi_handle->ops->send_crash_inject_cmd)
  353. return wmi_handle->ops->send_crash_inject_cmd(wmi_handle,
  354. param);
  355. return CDF_STATUS_E_FAILURE;
  356. }
  357. /**
  358. * wmi_unified_dbglog_cmd_send() - set debug log level
  359. * @param wmi_handle : handle to WMI.
  360. * @param param : pointer to hold dbglog level parameter
  361. *
  362. * Return: 0 on success and -ve on failure.
  363. */
  364. int32_t
  365. wmi_unified_dbglog_cmd_send(void *wmi_hdl,
  366. struct dbglog_params *dbglog_param)
  367. {
  368. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  369. if (wmi_handle->ops->send_dbglog_cmd)
  370. return wmi_handle->ops->send_dbglog_cmd(wmi_handle,
  371. dbglog_param);
  372. return CDF_STATUS_E_FAILURE;
  373. }
  374. /**
  375. * wmi_unified_vdev_set_param_send() - WMI vdev set parameter function
  376. * @param wmi_handle : handle to WMI.
  377. * @param macaddr : MAC address
  378. * @param param : pointer to hold vdev set parameter
  379. *
  380. * Return: 0 on success and -ve on failure.
  381. */
  382. int32_t wmi_unified_vdev_set_param_send(void *wmi_hdl,
  383. struct vdev_set_params *param)
  384. {
  385. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  386. if (wmi_handle->ops->send_vdev_set_param_cmd)
  387. return wmi_handle->ops->send_vdev_set_param_cmd(wmi_handle,
  388. param);
  389. return CDF_STATUS_E_FAILURE;
  390. }
  391. /**
  392. * wmi_unified_stats_request_send() - WMI request stats function
  393. * @param wmi_handle : handle to WMI.
  394. * @param macaddr : MAC address
  395. * @param param : pointer to hold stats request parameter
  396. *
  397. * Return: 0 on success and -ve on failure.
  398. */
  399. int32_t wmi_unified_stats_request_send(void *wmi_hdl,
  400. uint8_t macaddr[IEEE80211_ADDR_LEN],
  401. struct stats_request_params *param)
  402. {
  403. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  404. if (wmi_handle->ops->send_stats_request_cmd)
  405. return wmi_handle->ops->send_stats_request_cmd(wmi_handle,
  406. macaddr, param);
  407. return CDF_STATUS_E_FAILURE;
  408. }
  409. /**
  410. * wmi_unified_stats_request_send() - WMI request stats function
  411. * @param wmi_handle : handle to WMI.
  412. * @param macaddr : MAC address
  413. * @param param : pointer to hold stats request parameter
  414. *
  415. * Return: 0 on success and -ve on failure.
  416. */
  417. int32_t wmi_unified_packet_log_enable_send(void *wmi_hdl,
  418. uint8_t macaddr[IEEE80211_ADDR_LEN],
  419. struct packet_enable_params *param)
  420. {
  421. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  422. if (wmi_handle->ops->send_packet_log_enable_cmd)
  423. return wmi_handle->ops->send_packet_log_enable_cmd(wmi_handle,
  424. macaddr, param);
  425. return CDF_STATUS_E_FAILURE;
  426. }
  427. /**
  428. * wmi_unified_beacon_send_cmd() - WMI beacon send function
  429. * @param wmi_handle : handle to WMI.
  430. * @param macaddr : MAC address
  431. * @param param : pointer to hold beacon send cmd parameter
  432. *
  433. * Return: 0 on success and -ve on failure.
  434. */
  435. int32_t wmi_unified_beacon_send_cmd(void *wmi_hdl,
  436. struct beacon_params *param)
  437. {
  438. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  439. if (wmi_handle->ops->send_beacon_send_cmd)
  440. return wmi_handle->ops->send_beacon_send_cmd(wmi_handle,
  441. param);
  442. return CDF_STATUS_E_FAILURE;
  443. }
  444. /**
  445. * wmi_unified_peer_assoc_send() - WMI peer assoc function
  446. * @param wmi_handle : handle to WMI.
  447. * @param macaddr : MAC address
  448. * @param param : pointer to peer assoc parameter
  449. *
  450. * Return: 0 on success and -ve on failure.
  451. */
  452. int32_t wmi_unified_peer_assoc_send(void *wmi_hdl,
  453. struct peer_assoc_params *param)
  454. {
  455. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  456. if (wmi_handle->ops->send_peer_assoc_cmd)
  457. return wmi_handle->ops->send_peer_assoc_cmd(wmi_handle,
  458. param);
  459. return CDF_STATUS_E_FAILURE;
  460. }
  461. /**
  462. * wmi_unified_scan_start_cmd_send() - WMI scan start function
  463. * @param wmi_handle : handle to WMI.
  464. * @param macaddr : MAC address
  465. * @param param : pointer to hold scan start cmd parameter
  466. *
  467. * Return: 0 on success and -ve on failure.
  468. */
  469. int32_t wmi_unified_scan_start_cmd_send(void *wmi_hdl,
  470. struct scan_start_params *param)
  471. {
  472. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  473. if (wmi_handle->ops->send_scan_start_cmd)
  474. return wmi_handle->ops->send_scan_start_cmd(wmi_handle,
  475. param);
  476. return CDF_STATUS_E_FAILURE;
  477. }
  478. /**
  479. * wmi_unified_scan_stop_cmd_send() - WMI scan start function
  480. * @param wmi_handle : handle to WMI.
  481. * @param macaddr : MAC address
  482. * @param param : pointer to hold scan start cmd parameter
  483. *
  484. * Return: 0 on success and -ve on failure.
  485. */
  486. int32_t wmi_unified_scan_stop_cmd_send(void *wmi_hdl,
  487. struct scan_stop_params *param)
  488. {
  489. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  490. if (wmi_handle->ops->send_scan_stop_cmd)
  491. return wmi_handle->ops->send_scan_stop_cmd(wmi_handle,
  492. param);
  493. return CDF_STATUS_E_FAILURE;
  494. }
  495. /**
  496. * wmi_unified_scan_chan_list_cmd_send() - WMI scan channel list function
  497. * @param wmi_handle : handle to WMI.
  498. * @param macaddr : MAC address
  499. * @param param : pointer to hold scan channel list parameter
  500. *
  501. * Return: 0 on success and -ve on failure.
  502. */
  503. int32_t wmi_unified_scan_chan_list_cmd_send(void *wmi_hdl,
  504. struct scan_chan_list_params *param)
  505. {
  506. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  507. if (wmi_handle->ops->send_scan_chan_list_cmd)
  508. return wmi_handle->ops->send_scan_chan_list_cmd(wmi_handle,
  509. param);
  510. return CDF_STATUS_E_FAILURE;
  511. }
  512. /**
  513. * wmi_mgmt_unified_cmd_send() - management cmd over wmi layer
  514. * @wmi_hdl : handle to WMI.
  515. * @param : pointer to hold mgmt cmd parameter
  516. *
  517. * Return: 0 on success and -ve on failure.
  518. */
  519. int32_t wmi_mgmt_unified_cmd_send(void *wmi_hdl,
  520. struct wmi_mgmt_params *param)
  521. {
  522. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  523. if (wmi_handle->ops->send_mgmt_cmd)
  524. return wmi_handle->ops->send_mgmt_cmd(wmi_handle,
  525. param);
  526. return CDF_STATUS_E_FAILURE;
  527. }
  528. /**
  529. * wmi_unified_modem_power_state() - set modem power state to fw
  530. * @wmi_hdl: wmi handle
  531. * @param_value: parameter value
  532. *
  533. * Return: 0 for success or error code
  534. */
  535. int32_t wmi_unified_modem_power_state(void *wmi_hdl,
  536. uint32_t param_value)
  537. {
  538. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  539. if (wmi_handle->ops->send_modem_power_state_cmd)
  540. return wmi_handle->ops->send_modem_power_state_cmd(wmi_handle,
  541. param_value);
  542. return CDF_STATUS_E_FAILURE;
  543. }
  544. /**
  545. * wmi_unified_set_sta_ps_mode() - set sta powersave params in fw
  546. * @wmi_hdl: wmi handle
  547. * @vdev_id: vdev id
  548. * @val: value
  549. *
  550. * Return: 0 for success or error code.
  551. */
  552. int32_t wmi_unified_set_sta_ps_mode(void *wmi_hdl,
  553. uint32_t vdev_id, uint8_t val)
  554. {
  555. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  556. if (wmi_handle->ops->send_set_sta_ps_mode_cmd)
  557. return wmi_handle->ops->send_set_sta_ps_mode_cmd(wmi_handle,
  558. vdev_id, val);
  559. return CDF_STATUS_E_FAILURE;
  560. }
  561. /**
  562. * wmi_set_mimops() - set MIMO powersave
  563. * @wmi_hdl: wmi handle
  564. * @vdev_id: vdev id
  565. * @value: value
  566. *
  567. * Return: CDF_STATUS_SUCCESS for success or error code.
  568. */
  569. int32_t wmi_unified_set_mimops(void *wmi_hdl, uint8_t vdev_id, int value)
  570. {
  571. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  572. if (wmi_handle->ops->send_set_mimops_cmd)
  573. return wmi_handle->ops->send_set_mimops_cmd(wmi_handle,
  574. vdev_id, value);
  575. return CDF_STATUS_E_FAILURE;
  576. }
  577. /**
  578. * wmi_set_smps_params() - set smps params
  579. * @wmi_hdl: wmi handle
  580. * @vdev_id: vdev id
  581. * @value: value
  582. *
  583. * Return: CDF_STATUS_SUCCESS for success or error code.
  584. */
  585. int32_t wmi_unified_set_smps_params(void *wmi_hdl, uint8_t vdev_id,
  586. int value)
  587. {
  588. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  589. if (wmi_handle->ops->send_set_smps_params_cmd)
  590. return wmi_handle->ops->send_set_smps_params_cmd(wmi_handle,
  591. vdev_id, value);
  592. return CDF_STATUS_E_FAILURE;
  593. }
  594. /**
  595. * wmi_set_p2pgo_oppps_req() - send p2p go opp power save request to fw
  596. * @wmi_hdl: wmi handle
  597. * @opps: p2p opp power save parameters
  598. *
  599. * Return: none
  600. */
  601. int32_t wmi_unified_set_p2pgo_oppps_req(void *wmi_hdl,
  602. struct p2p_ps_params *oppps)
  603. {
  604. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  605. if (wmi_handle->ops->send_set_p2pgo_oppps_req_cmd)
  606. return wmi_handle->ops->send_set_p2pgo_oppps_req_cmd(wmi_handle,
  607. oppps);
  608. return CDF_STATUS_E_FAILURE;
  609. }
  610. /**
  611. * wmi_unified_set_p2pgo_noa_req_cmd() - send p2p go noa request to fw
  612. * @wmi_hdl: wmi handle
  613. * @noa: p2p power save parameters
  614. *
  615. * Return: none
  616. */
  617. int32_t wmi_unified_set_p2pgo_noa_req_cmd(void *wmi_hdl,
  618. struct p2p_ps_params *noa)
  619. {
  620. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  621. if (wmi_handle->ops->send_set_p2pgo_noa_req_cmd)
  622. return wmi_handle->ops->send_set_p2pgo_noa_req_cmd(wmi_handle,
  623. noa);
  624. return CDF_STATUS_E_FAILURE;
  625. }
  626. /**
  627. * wmi_get_temperature() - get pdev temperature req
  628. * @wmi_hdl: wmi handle
  629. *
  630. * Return: CDF_STATUS_SUCCESS for success or error code.
  631. */
  632. int32_t wmi_unified_get_temperature(void *wmi_hdl)
  633. {
  634. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  635. if (wmi_handle->ops->send_get_temperature_cmd)
  636. return wmi_handle->ops->send_get_temperature_cmd(wmi_handle);
  637. return CDF_STATUS_E_FAILURE;
  638. }
  639. /**
  640. * wmi_unified_set_sta_uapsd_auto_trig_cmd() - set uapsd auto trigger command
  641. * @wmi_hdl: wmi handle
  642. * @end_set_sta_ps_mode_cmd: cmd paramter strcture
  643. *
  644. * This function sets the trigger
  645. * uapsd params such as service interval, delay interval
  646. * and suspend interval which will be used by the firmware
  647. * to send trigger frames periodically when there is no
  648. * traffic on the transmit side.
  649. *
  650. * Return: 0 for success or error code.
  651. */
  652. int32_t
  653. wmi_unified_set_sta_uapsd_auto_trig_cmd(void *wmi_hdl,
  654. struct sta_uapsd_trig_params *param)
  655. {
  656. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  657. if (wmi_handle->ops->send_set_sta_uapsd_auto_trig_cmd)
  658. return wmi_handle->ops->send_set_sta_uapsd_auto_trig_cmd(wmi_handle,
  659. param);
  660. return CDF_STATUS_E_FAILURE;
  661. }
  662. /**
  663. * wmi_unified_ocb_start_timing_advert() - start sending the timing advertisement
  664. * frames on a channel
  665. * @wmi_handle: pointer to the wmi handle
  666. * @timing_advert: pointer to the timing advertisement struct
  667. *
  668. * Return: 0 on succes
  669. */
  670. int32_t wmi_unified_ocb_start_timing_advert(void *wmi_hdl,
  671. struct ocb_timing_advert_param *timing_advert)
  672. {
  673. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  674. if (wmi_handle->ops->send_ocb_start_timing_advert_cmd)
  675. return wmi_handle->ops->send_ocb_start_timing_advert_cmd(wmi_handle,
  676. timing_advert);
  677. return CDF_STATUS_E_FAILURE;
  678. }
  679. /**
  680. * wmi_unified_ocb_stop_timing_advert() - stop sending the timing advertisement
  681. * frames on a channel
  682. * @wmi_handle: pointer to the wmi handle
  683. * @timing_advert: pointer to the timing advertisement struct
  684. *
  685. * Return: 0 on succes
  686. */
  687. int32_t wmi_unified_ocb_stop_timing_advert(void *wmi_hdl,
  688. struct ocb_timing_advert_param *timing_advert)
  689. {
  690. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  691. if (wmi_handle->ops->send_ocb_stop_timing_advert_cmd)
  692. return wmi_handle->ops->send_ocb_stop_timing_advert_cmd(wmi_handle,
  693. timing_advert);
  694. return CDF_STATUS_E_FAILURE;
  695. }
  696. /**
  697. * wmi_unified_ocb_set_utc_time_cmd() - get ocb tsf timer val
  698. * @wmi_handle: pointer to the wmi handle
  699. * @vdev_id: vdev id
  700. *
  701. * Return: 0 on succes
  702. */
  703. int32_t wmi_unified_ocb_set_utc_time_cmd(void *wmi_hdl,
  704. struct ocb_utc_param *utc)
  705. {
  706. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  707. if (wmi_handle->ops->send_ocb_set_utc_time_cmd)
  708. return wmi_handle->ops->send_ocb_set_utc_time_cmd(wmi_handle,
  709. utc);
  710. return CDF_STATUS_E_FAILURE;
  711. }
  712. /**
  713. * wmi_unified_ocb_get_tsf_timer() - get ocb tsf timer val
  714. * @wmi_handle: pointer to the wmi handle
  715. * @vdev_id: vdev id
  716. *
  717. * Return: 0 on succes
  718. */
  719. int32_t wmi_unified_ocb_get_tsf_timer(void *wmi_hdl,
  720. uint8_t vdev_id)
  721. {
  722. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  723. if (wmi_handle->ops->send_ocb_get_tsf_timer_cmd)
  724. return wmi_handle->ops->send_ocb_get_tsf_timer_cmd(wmi_handle,
  725. vdev_id);
  726. return CDF_STATUS_E_FAILURE;
  727. }
  728. /**
  729. * wmi_unified_dcc_get_stats_cmd() - get the DCC channel stats
  730. * @wmi_handle: pointer to the wmi handle
  731. * @get_stats_param: pointer to the dcc stats
  732. *
  733. * Return: 0 on succes
  734. */
  735. int32_t wmi_unified_dcc_get_stats_cmd(void *wmi_hdl,
  736. struct dcc_get_stats_param *get_stats_param)
  737. {
  738. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  739. if (wmi_handle->ops->send_dcc_get_stats_cmd)
  740. return wmi_handle->ops->send_dcc_get_stats_cmd(wmi_handle,
  741. get_stats_param);
  742. return CDF_STATUS_E_FAILURE;
  743. }
  744. /**
  745. * wmi_unified_dcc_clear_stats() - command to clear the DCC stats
  746. * @wmi_handle: pointer to the wmi handle
  747. * @clear_stats_param: parameters to the command
  748. *
  749. * Return: 0 on succes
  750. */
  751. int32_t wmi_unified_dcc_clear_stats(void *wmi_hdl,
  752. uint32_t vdev_id, uint32_t dcc_stats_bitmap)
  753. {
  754. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  755. if (wmi_handle->ops->send_dcc_clear_stats_cmd)
  756. return wmi_handle->ops->send_dcc_clear_stats_cmd(wmi_handle,
  757. vdev_id, dcc_stats_bitmap);
  758. return CDF_STATUS_E_FAILURE;
  759. }
  760. /**
  761. * wmi_unified_dcc_update_ndl() - command to update the NDL data
  762. * @wmi_handle: pointer to the wmi handle
  763. * @update_ndl_param: pointer to the request parameters
  764. *
  765. * Return: 0 on success
  766. */
  767. int32_t wmi_unified_dcc_update_ndl(void *wmi_hdl,
  768. struct dcc_update_ndl_param *update_ndl_param)
  769. {
  770. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  771. if (wmi_handle->ops->send_dcc_update_ndl_cmd)
  772. return wmi_handle->ops->send_dcc_update_ndl_cmd(wmi_handle,
  773. update_ndl_param);
  774. return CDF_STATUS_E_FAILURE;
  775. }
  776. /**
  777. * wmi_unified_ocb_set_config() - send the OCB config to the FW
  778. * @wmi_handle: pointer to the wmi handle
  779. * @config: the OCB configuration
  780. *
  781. * Return: 0 on success
  782. */
  783. int32_t wmi_unified_ocb_set_config(void *wmi_hdl,
  784. struct ocb_config_param *config, uint32_t *ch_mhz)
  785. {
  786. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  787. if (wmi_handle->ops->send_ocb_set_config_cmd)
  788. return wmi_handle->ops->send_ocb_set_config_cmd(wmi_handle,
  789. config, ch_mhz);
  790. return CDF_STATUS_E_FAILURE;
  791. }
  792. /**
  793. * wmi_unified_set_enable_disable_mcc_adaptive_scheduler_cmd() - control mcc scheduler
  794. * @wmi_handle: wmi handle
  795. * @mcc_adaptive_scheduler: enable/disable
  796. *
  797. * This function enable/disable mcc adaptive scheduler in fw.
  798. *
  799. * Return: CDF_STATUS_SUCCESS for sucess or error code
  800. */
  801. int32_t wmi_unified_set_enable_disable_mcc_adaptive_scheduler_cmd(
  802. void *wmi_hdl, uint32_t mcc_adaptive_scheduler)
  803. {
  804. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  805. if (wmi_handle->ops->send_set_enable_disable_mcc_adaptive_scheduler_cmd)
  806. return wmi_handle->ops->send_set_enable_disable_mcc_adaptive_scheduler_cmd(wmi_handle,
  807. mcc_adaptive_scheduler);
  808. return CDF_STATUS_E_FAILURE;
  809. }
  810. /**
  811. * wmi_unified_set_mcc_channel_time_latency_cmd() - set MCC channel time latency
  812. * @wmi: wmi handle
  813. * @mcc_channel: mcc channel
  814. * @mcc_channel_time_latency: MCC channel time latency.
  815. *
  816. * Currently used to set time latency for an MCC vdev/adapter using operating
  817. * channel of it and channel number. The info is provided run time using
  818. * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>.
  819. *
  820. * Return: CDF status
  821. */
  822. int32_t wmi_unified_set_mcc_channel_time_latency_cmd
  823. (void *wmi_hdl,
  824. uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency)
  825. {
  826. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  827. if (wmi_handle->ops->send_set_mcc_channel_time_latency_cmd)
  828. return wmi_handle->ops->send_set_mcc_channel_time_latency_cmd(wmi_handle,
  829. mcc_channel_freq,
  830. mcc_channel_time_latency);
  831. return CDF_STATUS_E_FAILURE;
  832. }
  833. /**
  834. * wmi_unified_set_mcc_channel_time_quota_cmd() - set MCC channel time quota
  835. * @wmi: wmi handle
  836. * @adapter_1_chan_number: adapter 1 channel number
  837. * @adapter_1_quota: adapter 1 quota
  838. * @adapter_2_chan_number: adapter 2 channel number
  839. *
  840. * Return: CDF status
  841. */
  842. int32_t wmi_unified_set_mcc_channel_time_quota_cmd
  843. (void *wmi_hdl,
  844. uint32_t adapter_1_chan_freq,
  845. uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq)
  846. {
  847. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  848. if (wmi_handle->ops->send_set_mcc_channel_time_quota_cmd)
  849. return wmi_handle->ops->send_set_mcc_channel_time_quota_cmd(wmi_handle,
  850. adapter_1_chan_freq,
  851. adapter_1_quota,
  852. adapter_2_chan_freq);
  853. return CDF_STATUS_E_FAILURE;
  854. }
  855. /**
  856. * wmi_unified_set_thermal_mgmt_cmd() - set thermal mgmt command to fw
  857. * @wmi_handle: Pointer to wmi handle
  858. * @thermal_info: Thermal command information
  859. *
  860. * This function sends the thermal management command
  861. * to the firmware
  862. *
  863. * Return: CDF_STATUS_SUCCESS for success otherwise failure
  864. */
  865. int32_t wmi_unified_set_thermal_mgmt_cmd(void *wmi_hdl,
  866. struct thermal_cmd_params *thermal_info)
  867. {
  868. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  869. if (wmi_handle->ops->send_set_thermal_mgmt_cmd)
  870. return wmi_handle->ops->send_set_thermal_mgmt_cmd(wmi_handle,
  871. thermal_info);
  872. return CDF_STATUS_E_FAILURE;
  873. }
  874. /**
  875. * wmi_unified_lro_config_cmd() - process the LRO config command
  876. * @wmi: Pointer to wmi handle
  877. * @wmi_lro_cmd: Pointer to LRO configuration parameters
  878. *
  879. * This function sends down the LRO configuration parameters to
  880. * the firmware to enable LRO, sets the TCP flags and sets the
  881. * seed values for the toeplitz hash generation
  882. *
  883. * Return: CDF_STATUS_SUCCESS for success otherwise failure
  884. */
  885. int32_t wmi_unified_lro_config_cmd(void *wmi_hdl,
  886. struct wmi_lro_config_cmd_t *wmi_lro_cmd)
  887. {
  888. wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
  889. if (wmi_handle->ops->send_lro_config_cmd)
  890. return wmi_handle->ops->send_lro_config_cmd(wmi_handle,
  891. wmi_lro_cmd);
  892. return CDF_STATUS_E_FAILURE;
  893. }