Linux-libre 4.14.145-gnu
[librecmc/linux-libre.git] / drivers / staging / rtl8188eu / hal / hal_intf.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
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
16 #define _HAL_INTF_C_
17 #include <osdep_service.h>
18 #include <drv_types.h>
19 #include <hal_intf.h>
20
21 uint     rtw_hal_init(struct adapter *adapt)
22 {
23         uint    status = _SUCCESS;
24
25         adapt->hw_init_completed = false;
26
27         status = rtl8188eu_hal_init(adapt);
28
29         if (status == _SUCCESS) {
30                 adapt->hw_init_completed = true;
31
32                 if (adapt->registrypriv.notch_filter == 1)
33                         rtw_hal_notch_filter(adapt, 1);
34         } else {
35                 adapt->hw_init_completed = false;
36                 DBG_88E("rtw_hal_init: hal__init fail\n");
37         }
38
39         RT_TRACE(_module_hal_init_c_, _drv_err_,
40                  ("-rtl871x_hal_init:status=0x%x\n", status));
41
42         return status;
43 }
44
45 uint rtw_hal_deinit(struct adapter *adapt)
46 {
47         uint    status = _SUCCESS;
48
49         status = rtl8188eu_hal_deinit(adapt);
50
51         if (status == _SUCCESS)
52                 adapt->hw_init_completed = false;
53         else
54                 DBG_88E("\n rtw_hal_deinit: hal_init fail\n");
55
56         return status;
57 }
58
59 void rtw_hal_update_ra_mask(struct adapter *adapt, u32 mac_id, u8 rssi_level)
60 {
61         struct mlme_priv *pmlmepriv = &(adapt->mlmepriv);
62
63         if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
64 #ifdef CONFIG_88EU_AP_MODE
65                 struct sta_info *psta = NULL;
66                 struct sta_priv *pstapriv = &adapt->stapriv;
67
68                 if ((mac_id-1) > 0)
69                         psta = pstapriv->sta_aid[(mac_id-1) - 1];
70                 if (psta)
71                         add_RATid(adapt, psta, 0);/* todo: based on rssi_level*/
72 #endif
73         } else {
74                 UpdateHalRAMask8188EUsb(adapt, mac_id, rssi_level);
75         }
76 }