wmi_unified_api.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  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. }