60cfd31e855ae9b6f084351fb143e2cab77b8ecc
[linux-2.6-microblaze.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         }
27
28         RT_TRACE(_module_hal_init_c_, _drv_err_,
29                  ("-rtl871x_hal_init:status=0x%x\n", status));
30
31         return status;
32 }
33
34 uint rtw_hal_deinit(struct adapter *adapt)
35 {
36         uint status = _SUCCESS;
37
38         status = rtl8188eu_hal_deinit(adapt);
39
40         if (status == _SUCCESS)
41                 adapt->hw_init_completed = false;
42
43         return status;
44 }
45
46 void rtw_hal_update_ra_mask(struct adapter *adapt, u32 mac_id, u8 rssi_level)
47 {
48         struct mlme_priv *pmlmepriv = &adapt->mlmepriv;
49
50         if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
51 #ifdef CONFIG_88EU_AP_MODE
52                 struct sta_info *psta = NULL;
53                 struct sta_priv *pstapriv = &adapt->stapriv;
54
55                 if (mac_id - 1 > 0)
56                         psta = pstapriv->sta_aid[mac_id - 2];
57                 if (psta)
58                         add_RATid(adapt, psta, 0);/* todo: based on rssi_level*/
59 #endif
60         } else {
61                 UpdateHalRAMask8188EUsb(adapt, mac_id, rssi_level);
62         }
63 }