xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852bs/phl/hal_g6/hal_notify.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2019 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 #define _HAL_NOTIFY_C_
16 #include "hal_headers.h"
17 
rtw_hal_notification(void * hal,enum phl_msg_evt_id event,u8 hw_idx)18 void rtw_hal_notification(void *hal, enum phl_msg_evt_id event, u8 hw_idx)
19 {
20 	struct hal_info_t *hal_info = (struct hal_info_t *)hal;
21 	u8 idx = 0;
22 
23 	PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s: event(%d), hw_idx(%d)\n",
24 	          __func__, event, hw_idx);
25 	if (!hal_info->hal_com->is_hal_init) {
26 		PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s:hal is not started!\n",
27 				__func__);
28 		return;
29 	}
30 
31 	if (hw_idx == HW_BAND_MAX) {
32 		for (idx = 0; idx < hw_idx; idx++) {
33 			rtw_hal_bb_notification(hal_info, event, idx);
34 			rtw_hal_mac_notification(hal_info, event, idx);
35 			rtw_hal_rf_notification(hal_info, event, idx);
36 		}
37 	} else {
38 		rtw_hal_bb_notification(hal_info, event, hw_idx);
39 		rtw_hal_mac_notification(hal_info, event, hw_idx);
40 		rtw_hal_rf_notification(hal_info, event, idx);
41 	}
42 }
43 
44 
rtw_hal_cmd_notification(void * hal,enum phl_msg_evt_id event,void * hal_cmd,u8 hw_idx)45 void rtw_hal_cmd_notification(void *hal,
46                                enum phl_msg_evt_id event,
47                                void *hal_cmd,
48                                u8 hw_idx)
49 {
50 	struct hal_info_t *hal_info = (struct hal_info_t *)hal;
51 
52 	if (event == MSG_EVT_NOTIFY_BB)
53 		rtw_hal_bb_cmd_notification(hal_info, hal_cmd, hw_idx);
54 	else if (event == MSG_EVT_NOTIFY_RF)
55 		rtw_hal_rf_cmd_notification(hal_info, hal_cmd, hw_idx);
56 	else if (event == MSG_EVT_NOTIFY_MAC)
57 		rtw_hal_mac_cmd_notification(hal_info, hal_cmd, hw_idx);
58 	else
59 		PHL_ERR("%s unexpect eve id = 0x%x\n", __func__, event);
60 
61 }
62 
63 enum rtw_phl_status
rtw_hal_cmd_notify(struct rtw_phl_com_t * phl_com,enum phl_msg_evt_id event,void * hal_cmd,u8 hw_idx)64 rtw_hal_cmd_notify(struct rtw_phl_com_t *phl_com,
65                    enum phl_msg_evt_id event,
66                    void *hal_cmd,
67                    u8 hw_idx)
68 {
69 #ifdef CONFIG_CMD_DISP
70 	return rtw_phl_cmd_notify(phl_com, event, hal_cmd, hw_idx);
71 #else
72 	PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s: not support cmd notify\n",
73 	          __func__);
74 
75 	return RTW_PHL_STATUS_FAILURE;
76 #endif /* CONFIG_CMD_DISP */
77 }
78