1 /******************************************************************************
2 *
3 * Copyright(c) 2019 - 2020 Realtek Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 *****************************************************************************/
15 #include "phl_headers.h"
16
17 #ifdef CONFIG_CMD_DISP
18
19 /* START of sounding / beamform cmd_disp module */
20 void
_phl_snd_cmd_set_eng_busy(struct phl_info_t * phl_info,enum snd_cmd_disp_ctrl ctrl)21 _phl_snd_cmd_set_eng_busy(struct phl_info_t *phl_info, enum snd_cmd_disp_ctrl ctrl)
22 {
23 struct phl_sound_obj *snd = (struct phl_sound_obj *)phl_info->snd_obj;
24
25 if (snd != NULL) {
26 snd->msg_busy |= BIT(ctrl);
27 }
28 }
29
30 void
_phl_snd_cmd_set_eng_idle(struct phl_info_t * phl_info,enum snd_cmd_disp_ctrl ctrl)31 _phl_snd_cmd_set_eng_idle(struct phl_info_t *phl_info, enum snd_cmd_disp_ctrl ctrl)
32 {
33 struct phl_sound_obj *snd = (struct phl_sound_obj *)phl_info->snd_obj;
34
35 if (snd != NULL) {
36 snd->msg_busy &= ~(BIT(ctrl));
37 }
38 }
39
40 enum rtw_phl_status
_phl_snd_cmd_get_eng_status(struct phl_info_t * phl_info,enum snd_cmd_disp_ctrl ctrl)41 _phl_snd_cmd_get_eng_status(struct phl_info_t *phl_info, enum snd_cmd_disp_ctrl ctrl)
42 {
43 struct phl_sound_obj *snd = (struct phl_sound_obj *)phl_info->snd_obj;
44 enum rtw_phl_status pstatus = RTW_PHL_STATUS_FAILURE;
45
46 if (snd != NULL) {
47 if (0 != (snd->msg_busy & BIT(ctrl))) {
48 pstatus = RTW_PHL_STATUS_PENDING;
49 } else {
50 pstatus = RTW_PHL_STATUS_SUCCESS;
51 }
52 } else {
53 pstatus = RTW_PHL_STATUS_RESOURCE;
54 }
55 return pstatus;
56 }
57 enum rtw_phl_status
_phl_snd_aquire_eng(struct phl_info_t * phl_info,enum snd_cmd_disp_ctrl ctrl)58 _phl_snd_aquire_eng(struct phl_info_t *phl_info, enum snd_cmd_disp_ctrl ctrl)
59 {
60 struct phl_sound_obj *snd = (struct phl_sound_obj *)phl_info->snd_obj;
61 void *d = phl_to_drvpriv(phl_info);
62 enum rtw_phl_status pstatus = RTW_PHL_STATUS_SUCCESS;
63
64 if (snd == NULL)
65 return RTW_PHL_STATUS_FAILURE;
66
67 /* acuired cmd_disp_eng control */
68 _os_spinlock(d, &snd->cmd_lock, _bh, NULL);
69 pstatus = _phl_snd_cmd_get_eng_status(phl_info, ctrl);
70 if (pstatus != RTW_PHL_STATUS_SUCCESS) {
71 _os_spinunlock(d, &snd->cmd_lock, _bh, NULL);
72 return pstatus;
73 }
74 _phl_snd_cmd_set_eng_busy(phl_info, SND_CMD_DISP_CTRL_BFEE);
75 _os_spinunlock(d, &snd->cmd_lock, _bh, NULL);
76
77 return pstatus;
78 }
79
80 void
_phl_snd_free_eng(struct phl_info_t * phl_info,enum snd_cmd_disp_ctrl ctrl)81 _phl_snd_free_eng(struct phl_info_t *phl_info, enum snd_cmd_disp_ctrl ctrl)
82 {
83 struct phl_sound_obj *snd = (struct phl_sound_obj *)phl_info->snd_obj;
84 void *d = phl_to_drvpriv(phl_info);
85
86 if (snd != NULL) {
87 _os_spinlock(d, &snd->cmd_lock, _bh, NULL);
88 _phl_snd_cmd_set_eng_idle(phl_info, ctrl);
89 _os_spinunlock(d, &snd->cmd_lock, _bh, NULL);
90 }
91 }
92
93 static enum phl_mdl_ret_code
_phl_snd_cmd_module_init(void * phl,void * dispr,void ** priv)94 _phl_snd_cmd_module_init(void *phl, void *dispr, void **priv)
95 {
96 enum phl_mdl_ret_code ret = MDL_RET_SUCCESS;
97 #ifdef CONFIG_SND_CMD
98 struct phl_info_t *phl_info = (struct phl_info_t *)phl;
99 void *d = phl_to_drvpriv(phl_info);
100 struct phl_sound_obj *snd_obj = NULL;
101
102 PHL_INFO("--> %s\n", __func__);
103 if (NULL == phl_info->snd_obj) {
104 phl_info->snd_obj = _os_kmem_alloc(d, sizeof(struct phl_sound_obj));
105 }
106 snd_obj = phl_info->snd_obj;
107 if (snd_obj == NULL) {
108 ret = MDL_RET_FAIL;
109 } else {
110 /* Init the snd static resources here */
111 snd_obj->phl_info = (struct phl_info_t *)phl;
112 _os_spinlock_init(d, &snd_obj->snd_lock);
113 _os_spinlock_init(d, &snd_obj->cmd_lock);
114 }
115 #endif
116 *priv = (void *)phl;
117 return ret;
118 }
119
_phl_snd_cmd_module_deinit(void * dispr,void * priv)120 static void _phl_snd_cmd_module_deinit(void *dispr, void *priv)
121 {
122 #ifdef CONFIG_SND_CMD
123 struct phl_info_t *phl_info = (struct phl_info_t *)priv;
124 struct phl_sound_obj *snd_obj = (struct phl_sound_obj *)phl_info->snd_obj;
125 void *d = phl_to_drvpriv(phl_info);
126
127 PHL_INFO("--> %s\n", __func__);
128 if (NULL != snd_obj) {
129 _os_spinlock_free(d, &snd_obj->snd_lock);
130 _os_spinlock_free(d, &snd_obj->cmd_lock);
131 _os_kmem_free(d, snd_obj, sizeof(struct phl_sound_obj));
132 }
133 phl_info->snd_obj = NULL;
134 #endif
135 return;
136 }
137
_phl_snd_cmd_module_start(void * dispr,void * priv)138 static enum phl_mdl_ret_code _phl_snd_cmd_module_start(void *dispr, void *priv)
139 {
140 return MDL_RET_SUCCESS;
141 }
142
_phl_snd_cmd_module_stop(void * dispr,void * priv)143 static enum phl_mdl_ret_code _phl_snd_cmd_module_stop(void *dispr, void *priv)
144 {
145 return MDL_RET_SUCCESS;
146 }
147
148 static enum phl_mdl_ret_code
_phl_snd_cmd_module_set_info(void * dispr,void * priv,struct phl_module_op_info * info)149 _phl_snd_cmd_module_set_info(void *dispr, void *priv,
150 struct phl_module_op_info *info)
151 {
152 enum phl_mdl_ret_code mstatus = MDL_RET_IGNORE;
153 struct phl_info_t *phl = (struct phl_info_t *)priv;
154
155 PHL_INFO("[SND_CMD], %s(): opcode %d.\n", __func__, info->op_code);
156
157 switch (info->op_code) {
158 case SND_CMD_OP_SET_AID:
159 {
160 struct snd_cmd_set_aid *cmdbuf = (struct snd_cmd_set_aid *)info->inbuf;
161
162 if (NULL == cmdbuf) {
163 mstatus = MDL_RET_FAIL;
164 break;
165 }
166 if (NULL == cmdbuf->sta_info) {
167 mstatus = MDL_RET_FAIL;
168 cmdbuf->cmd_sts = MDL_RET_FAIL;
169 break;
170 }
171 if (RTW_HAL_STATUS_SUCCESS != rtw_hal_beamform_set_aid(
172 phl->hal, cmdbuf->sta_info, cmdbuf->aid)) {
173 mstatus = MDL_RET_FAIL;
174 cmdbuf->cmd_sts = MDL_RET_FAIL;
175 break;
176 }
177 #ifdef RTW_WKARD_BFEE_SET_AID
178 cmdbuf->sta_info->wrole->last_set_aid = cmdbuf->aid;
179 #endif
180 cmdbuf->cmd_sts = MDL_RET_SUCCESS;
181 mstatus = MDL_RET_SUCCESS;
182 }
183 break;
184 case SND_CMD_OP_NONE:
185 case SND_CMD_OP_MAX:
186 default:
187 break;
188 }
189
190 return mstatus;
191 }
192
193 static enum phl_mdl_ret_code
_phl_snd_cmd_module_query_info(void * dispr,void * priv,struct phl_module_op_info * info)194 _phl_snd_cmd_module_query_info(void *dispr, void *priv,
195 struct phl_module_op_info *info)
196 {
197 return MDL_RET_IGNORE;
198 }
199
200 static enum phl_mdl_ret_code
_phl_snd_cmd_module_msg_msg_hdlr_pre(struct phl_info_t * phl,struct phl_msg * msg)201 _phl_snd_cmd_module_msg_msg_hdlr_pre(struct phl_info_t *phl,
202 struct phl_msg *msg)
203 {
204 enum phl_mdl_ret_code mstatus = MDL_RET_IGNORE;
205 switch (MSG_EVT_ID_FIELD(msg->msg_id)) {
206 case MSG_EVT_SET_VHT_GID:
207 /* do nothing in pre phase */
208 break;
209 case MSG_EVT_SET_BFEE_AID:
210 /* do nothing in pre phase */
211 break;
212 default:
213 break;
214 }
215
216 return mstatus;
217 }
218
219 static enum phl_mdl_ret_code
_phl_snd_cmd_module_msg_msg_hdlr_post(struct phl_info_t * phl,struct phl_msg * msg)220 _phl_snd_cmd_module_msg_msg_hdlr_post(struct phl_info_t *phl,
221 struct phl_msg *msg)
222 {
223 enum phl_mdl_ret_code mstatus = MDL_RET_IGNORE;
224 switch (MSG_EVT_ID_FIELD(msg->msg_id)) {
225 case MSG_EVT_SET_VHT_GID:
226 {
227 struct rtw_phl_gid_pos_tbl *gid_tbl = (struct rtw_phl_gid_pos_tbl *)msg->inbuf;
228 if (msg->inlen != sizeof(struct rtw_phl_gid_pos_tbl)) {
229 PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_,
230 "%s() VHT-BFEE : Error, size mis-match \n", __func__);
231 mstatus = MDL_RET_FAIL;
232 break;
233 }
234 rtw_hal_beamform_set_vht_gid(phl->hal, msg->band_idx, gid_tbl);
235 mstatus = MDL_RET_SUCCESS;
236 }
237 break;
238 case MSG_EVT_SET_BFEE_AID:
239 {
240 struct snd_cmd_set_aid *cmdbuf = (struct snd_cmd_set_aid *)msg->inbuf;
241
242 if (NULL == cmdbuf) {
243 mstatus = MDL_RET_FAIL;
244 break;
245 }
246 if (NULL == cmdbuf->sta_info) {
247 mstatus = MDL_RET_FAIL;
248 cmdbuf->cmd_sts = MDL_RET_FAIL;
249 break;
250 }
251 if (RTW_HAL_STATUS_SUCCESS != rtw_hal_beamform_set_aid(
252 phl->hal, cmdbuf->sta_info, cmdbuf->aid)) {
253 mstatus = MDL_RET_FAIL;
254 cmdbuf->cmd_sts = MDL_RET_FAIL;
255 break;
256 }
257 cmdbuf->cmd_sts = MDL_RET_SUCCESS;
258 mstatus = MDL_RET_SUCCESS;
259 }
260 break;
261 default:
262 break;
263 }
264
265 return mstatus;
266 }
267
268 static enum phl_mdl_ret_code
_phl_snd_cmd_module_msg_hdlr(void * dispr,void * priv,struct phl_msg * msg)269 _phl_snd_cmd_module_msg_hdlr(void *dispr, void *priv,
270 struct phl_msg *msg)
271 {
272 struct phl_info_t *phl_info = (struct phl_info_t *)priv;
273 enum phl_mdl_ret_code mstatus = MDL_RET_IGNORE;
274
275 PHL_TRACE(COMP_PHL_SOUND, _PHL_INFO_,
276 "===> %s() event id : 0x%x \n", __func__, MSG_EVT_ID_FIELD(msg->msg_id));
277
278 if (IS_MSG_FAIL(msg->msg_id)) {
279 PHL_TRACE(COMP_PHL_DBG, _PHL_WARNING_,
280 "%s: cmd dispatcher notify cmd failure: 0x%x.\n",
281 __FUNCTION__, msg->msg_id);
282 mstatus = MDL_RET_FAIL;
283 return mstatus;
284 }
285
286 if (IS_MSG_IN_PRE_PHASE(msg->msg_id)) {
287 mstatus = _phl_snd_cmd_module_msg_msg_hdlr_pre(phl_info, msg);
288 } else {
289 mstatus = _phl_snd_cmd_module_msg_msg_hdlr_post(phl_info, msg);
290 }
291
292 return mstatus;
293 }
294
phl_snd_cmd_register_module(struct phl_info_t * phl_info)295 enum rtw_phl_status phl_snd_cmd_register_module(struct phl_info_t *phl_info)
296 {
297 enum rtw_phl_status phl_status = RTW_PHL_STATUS_FAILURE;
298 struct phl_bk_module_ops bk_ops;
299 struct phl_cmd_dispatch_engine *disp_eng = &(phl_info->disp_eng);
300 u8 i = 0;
301
302 bk_ops.init = _phl_snd_cmd_module_init;
303 bk_ops.deinit = _phl_snd_cmd_module_deinit;
304 bk_ops.start = _phl_snd_cmd_module_start;
305 bk_ops.stop = _phl_snd_cmd_module_stop;
306 bk_ops.msg_hdlr = _phl_snd_cmd_module_msg_hdlr;
307 bk_ops.set_info = _phl_snd_cmd_module_set_info;
308 bk_ops.query_info = _phl_snd_cmd_module_query_info;
309
310
311 for (i = 0; i < disp_eng->phy_num; i++) {
312 phl_status = phl_disp_eng_register_module(phl_info, i,
313 PHL_MDL_SOUND, &bk_ops);
314 if (phl_status != RTW_PHL_STATUS_SUCCESS) {
315 PHL_ERR("%s register SOUND module in cmd disp band[%d] failed\n",
316 __func__, i);
317 phl_status = RTW_PHL_STATUS_FAILURE;
318 break;
319 }
320 }
321
322 return phl_status;
323 }
324
325
326 /* Start of APIs for Core/OtherModule */
327
328 /* sub-functions */
329 /**
330 * _phl_snd_cmd_post_set_vht_gid(...)
331 * used by rtw_phl_snd_cmd_set_vht_gid(..)
332 **/
_phl_snd_cmd_post_set_vht_gid(void * priv,struct phl_msg * msg)333 void _phl_snd_cmd_post_set_vht_gid(void* priv, struct phl_msg* msg)
334 {
335 struct phl_info_t *phl_info = (struct phl_info_t *)priv;
336
337 PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "--> %s : release memeory \n", __func__);
338 if (msg->inbuf && msg->inlen){
339 _os_kmem_free(phl_to_drvpriv(phl_info), msg->inbuf, msg->inlen);
340 }
341 /* release cmd_disp_eng control */
342 _phl_snd_free_eng(phl_info, SND_CMD_DISP_CTRL_BFEE);
343 }
344 /* main-functions */
345 /**
346 * rtw_phl_snd_cmd_set_vht_gid (...)
347 * input : struct rtw_phl_gid_pos_tbl *tbl
348 * the received VHT GID management frame's GID / Position informaion.
349 **/
350 enum rtw_phl_status
rtw_phl_snd_cmd_set_vht_gid(void * phl,struct rtw_wifi_role_t * wrole,struct rtw_phl_gid_pos_tbl * tbl)351 rtw_phl_snd_cmd_set_vht_gid(void *phl,
352 struct rtw_wifi_role_t *wrole,
353 struct rtw_phl_gid_pos_tbl *tbl)
354 {
355 enum rtw_phl_status phl_status = RTW_PHL_STATUS_FAILURE;
356 struct phl_info_t *phl_info = (struct phl_info_t *)phl;
357 struct phl_msg msg = {0};
358 struct phl_msg_attribute attr = {0};
359 void *d = phl_to_drvpriv(phl_info);
360 struct rtw_phl_gid_pos_tbl *gid_tbl;
361
362 /* acuired cmd_disp_eng control */
363 if (RTW_PHL_STATUS_SUCCESS !=
364 _phl_snd_aquire_eng(phl_info, SND_CMD_DISP_CTRL_BFEE)) {
365 return RTW_PHL_STATUS_FAILURE;
366 }
367
368 SET_MSG_MDL_ID_FIELD(msg.msg_id, PHL_MDL_SOUND);
369 SET_MSG_EVT_ID_FIELD(msg.msg_id, MSG_EVT_SET_VHT_GID);
370
371 msg.band_idx = wrole->hw_band;
372
373 attr.completion.completion = _phl_snd_cmd_post_set_vht_gid;
374 attr.completion.priv = phl_info;
375 gid_tbl = (struct rtw_phl_gid_pos_tbl *)_os_kmem_alloc(d, sizeof(struct rtw_phl_gid_pos_tbl));
376 _os_mem_cpy(d, gid_tbl, tbl, sizeof(struct rtw_phl_gid_pos_tbl));
377
378 msg.inbuf = (u8 *)gid_tbl;
379 msg.inlen = sizeof(struct rtw_phl_gid_pos_tbl);
380
381 phl_status = phl_disp_eng_send_msg(phl_info, &msg, &attr, NULL);
382 if (phl_status != RTW_PHL_STATUS_SUCCESS) {
383 PHL_TRACE(COMP_PHL_DBG, _PHL_ERR_, "%s: Dispr send msg fail!\n",
384 __func__);
385 goto exit;
386 }
387
388 return phl_status;
389
390 exit:
391 _os_kmem_free(d, gid_tbl,
392 sizeof(struct rtw_phl_gid_pos_tbl));
393 /* release cmd_disp_eng control */
394 _phl_snd_free_eng(phl_info, SND_CMD_DISP_CTRL_BFEE);
395 return phl_status;
396
397 }
398
_phl_snd_cmd_post_set_aid(void * priv,struct phl_msg * msg)399 void _phl_snd_cmd_post_set_aid(void* priv, struct phl_msg* msg)
400 {
401 struct phl_info_t *phl_info = (struct phl_info_t *)priv;
402 #ifdef RTW_WKARD_BFEE_SET_AID
403 struct snd_cmd_set_aid *cmdbuf = NULL;
404 #endif
405
406 if (msg->inbuf && msg->inlen){
407 #ifdef RTW_WKARD_BFEE_SET_AID
408 cmdbuf = (struct snd_cmd_set_aid *)msg->inbuf;
409 /* backup aid */
410 if (MDL_RET_SUCCESS == cmdbuf->cmd_sts) {
411 cmdbuf->sta_info->wrole->last_set_aid = cmdbuf->aid;
412 PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_,
413 "%s : set aid (%d)\n",
414 __func__, cmdbuf->sta_info->wrole->last_set_aid);
415 }
416 #endif
417 _os_kmem_free(phl_to_drvpriv(phl_info), msg->inbuf, msg->inlen);
418 }
419 /* release cmd_disp_eng control */
420 _phl_snd_free_eng(phl_info, SND_CMD_DISP_CTRL_BFEE);
421 PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s : set aid complete\n", __func__);
422 }
423
424 enum rtw_phl_status
rtw_phl_snd_cmd_set_aid(void * phl,struct rtw_wifi_role_t * wrole,struct rtw_phl_stainfo_t * sta,u16 aid)425 rtw_phl_snd_cmd_set_aid(void *phl,
426 struct rtw_wifi_role_t *wrole,
427 struct rtw_phl_stainfo_t *sta,
428 u16 aid)
429 {
430 enum rtw_phl_status phl_status = RTW_PHL_STATUS_FAILURE;
431 struct phl_info_t *phl_info = (struct phl_info_t *)phl;
432 struct phl_msg msg = {0};
433 struct phl_msg_attribute attr = {0};
434 void *d = phl_to_drvpriv(phl_info);
435 struct snd_cmd_set_aid *cmdbuf = NULL;
436
437 /* acuired cmd_disp_eng control */
438 if (RTW_PHL_STATUS_SUCCESS !=
439 _phl_snd_aquire_eng(phl_info, SND_CMD_DISP_CTRL_BFEE)) {
440 return RTW_PHL_STATUS_FAILURE;
441 }
442
443 SET_MSG_MDL_ID_FIELD(msg.msg_id, PHL_MDL_SOUND);
444 SET_MSG_EVT_ID_FIELD(msg.msg_id, MSG_EVT_SET_BFEE_AID);
445
446 msg.band_idx = wrole->hw_band;
447
448 attr.completion.completion = _phl_snd_cmd_post_set_aid;
449 attr.completion.priv = phl_info;
450
451 cmdbuf = (struct snd_cmd_set_aid *)_os_kmem_alloc(d, sizeof(struct snd_cmd_set_aid));
452 cmdbuf->aid = aid;
453 cmdbuf->sta_info = sta;
454
455 msg.inbuf = (u8 *)cmdbuf;
456 msg.inlen = sizeof(struct snd_cmd_set_aid);
457
458 phl_status = phl_disp_eng_send_msg(phl_info, &msg, &attr, NULL);
459
460 if (phl_status != RTW_PHL_STATUS_SUCCESS) {
461 PHL_TRACE(COMP_PHL_DBG, _PHL_ERR_, "%s: Dispr send msg fail!\n",
462 __func__);
463 goto exit;
464 }
465
466 return phl_status;
467
468 exit:
469 _os_kmem_free(d, cmdbuf, sizeof(struct snd_cmd_set_aid));
470 /* release cmd_disp_eng control */
471 _phl_snd_free_eng(phl_info, SND_CMD_DISP_CTRL_BFEE);
472 return phl_status;
473
474 }
475
476 /**
477 * For other module, such as LPS, direct set aid.
478 **/
479 enum rtw_phl_status
phl_snd_cmd_set_aid_info(struct phl_info_t * phl,struct rtw_wifi_role_t * wrole,struct rtw_phl_stainfo_t * sta,u16 aid)480 phl_snd_cmd_set_aid_info(struct phl_info_t *phl,
481 struct rtw_wifi_role_t *wrole,
482 struct rtw_phl_stainfo_t *sta,
483 u16 aid)
484 {
485 enum rtw_phl_status phl_status = RTW_PHL_STATUS_FAILURE;
486 struct phl_module_op_info op_info = {0};
487 struct snd_cmd_set_aid cmdbuf = {0};
488 PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "--> %s\n", __func__);
489
490 cmdbuf.aid = aid;
491 cmdbuf.sta_info = sta;
492
493 op_info.op_code = SND_CMD_OP_SET_AID;
494 op_info.inbuf = (u8 *)&cmdbuf;
495 op_info.inlen = sizeof(struct snd_cmd_set_aid);
496
497 phl_status = phl_disp_eng_set_bk_module_info(phl, wrole->hw_band,
498 PHL_MDL_SOUND, &op_info);
499
500 PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "<-- %s\n", __func__);
501 return phl_status;
502 }
503
504 #ifdef RTW_WKARD_BFEE_SET_AID
505 enum rtw_phl_status
_phl_cmd_snd_restore_aid(struct phl_info_t * phl,struct rtw_wifi_role_t * wrole)506 _phl_cmd_snd_restore_aid(struct phl_info_t *phl,
507 struct rtw_wifi_role_t *wrole)
508 {
509 enum rtw_phl_status phl_status = RTW_PHL_STATUS_SUCCESS;
510 struct rtw_phl_stainfo_t *sta = NULL;
511
512 do {
513 if (MLME_NO_LINK == wrole->mstate)
514 break;
515
516 sta = rtw_phl_get_stainfo_self(phl, wrole);
517
518 if (NULL == sta)
519 break;
520
521 if (wrole->last_set_aid == sta->aid)
522 break;
523
524 phl_status = phl_snd_cmd_set_aid_info(phl, wrole, sta, sta->aid);
525
526 } while (0);
527
528 return phl_status;
529 }
530 #endif
531
532
533 enum rtw_phl_status
_phl_snd_cmd_ntfy_ps_enter(struct phl_info_t * phl,struct rtw_wifi_role_t * wrole)534 _phl_snd_cmd_ntfy_ps_enter(struct phl_info_t *phl,
535 struct rtw_wifi_role_t *wrole)
536 {
537 enum rtw_phl_status phl_status = RTW_PHL_STATUS_SUCCESS;
538
539 #ifdef RTW_WKARD_BFEE_SET_AID
540 phl->phl_com->is_in_lps = 1;
541
542 if (PHL_RTYPE_STATION == wrole->type) {
543 phl_status= _phl_cmd_snd_restore_aid(phl, wrole);
544 }
545 #endif
546
547 /* TODO: stop BFer period sounding if in progress */
548 return phl_status;
549 }
550
551 enum rtw_phl_status
_phl_snd_cmd_ntfy_ps_leave(struct phl_info_t * phl,struct rtw_wifi_role_t * wrole)552 _phl_snd_cmd_ntfy_ps_leave(struct phl_info_t *phl,
553 struct rtw_wifi_role_t *wrole)
554 {
555 enum rtw_phl_status phl_status = RTW_PHL_STATUS_SUCCESS;
556
557 #ifdef RTW_WKARD_BFEE_SET_AID
558 phl->phl_com->is_in_lps = 0;
559 #endif
560
561 /* TODO: restart BFer period sounding if sounding needed */
562 return phl_status;
563 }
564
565
566 enum rtw_phl_status
phl_snd_cmd_ntfy_ps(struct phl_info_t * phl,struct rtw_wifi_role_t * wrole,bool enter)567 phl_snd_cmd_ntfy_ps(struct phl_info_t *phl,
568 struct rtw_wifi_role_t *wrole,
569 bool enter)
570 {
571 enum rtw_phl_status phl_status = RTW_PHL_STATUS_SUCCESS;
572
573 if (true == enter)
574 phl_status = _phl_snd_cmd_ntfy_ps_enter(phl, wrole);
575 else
576 phl_status = _phl_snd_cmd_ntfy_ps_leave(phl, wrole);
577
578 return phl_status;
579 }
580
581 #endif