GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / staging / rtl8188eu / hal / hal_intf.c
1 // SPDX-License-Identifier: GPL-2.0
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7
8 #define _HAL_INTF_C_
9 #include <hal_intf.h>
10
11 uint rtw_hal_init(struct adapter *adapt)
12 {
13         uint status = _SUCCESS;
14
15         adapt->hw_init_completed = false;
16
17         status = rtl8188eu_hal_init(adapt);
18
19         if (status == _SUCCESS) {
20                 adapt->hw_init_completed = true;
21
22                 if (adapt->registrypriv.notch_filter == 1)
23                         rtw_hal_notch_filter(adapt, 1);
24         } else {
25                 adapt->hw_init_completed = false;
26                 DBG_88E("rtw_hal_init: hal__init fail\n");
27         }
28
29         RT_TRACE(_module_hal_init_c_, _drv_err_,
30                  ("-rtl871x_hal_init:status=0x%x\n", status));
31
32         return status;
33 }
34
35 uint rtw_hal_deinit(struct adapter *adapt)
36 {
37         uint status = _SUCCESS;
38
39         status = rtl8188eu_hal_deinit(adapt);
40
41         if (status == _SUCCESS)
42                 adapt->hw_init_completed = false;
43         else
44                 DBG_88E("\n rtw_hal_deinit: hal_init fail\n");
45
46         return status;
47 }
48
49 void rtw_hal_update_ra_mask(struct adapter *adapt, u32 mac_id, u8 rssi_level)
50 {
51         struct mlme_priv *pmlmepriv = &adapt->mlmepriv;
52
53         if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
54 #ifdef CONFIG_88EU_AP_MODE
55                 struct sta_info *psta = NULL;
56                 struct sta_priv *pstapriv = &adapt->stapriv;
57
58                 if (mac_id - 1 > 0)
59                         psta = pstapriv->sta_aid[mac_id - 2];
60                 if (psta)
61                         add_RATid(adapt, psta, 0);/* todo: based on rssi_level*/
62 #endif
63         } else {
64                 UpdateHalRAMask8188EUsb(adapt, mac_id, rssi_level);
65         }
66 }