GNU Linux-libre 4.14.257-gnu1
[releases.git] / drivers / staging / rtlwifi / phydm / phydm_antdiv.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2016  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  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25
26 /* ************************************************************
27  * include files
28  * *************************************************************/
29
30 #include "mp_precomp.h"
31 #include "phydm_precomp.h"
32
33 /* ******************************************************
34  * when antenna test utility is on or some testing need to disable antenna
35  * diversity, call this function to disable all ODM related mechanisms which
36  * will switch antenna.
37  * *******************************************************/
38 void odm_stop_antenna_switch_dm(void *dm_void)
39 {
40         struct phy_dm_struct *dm = (struct phy_dm_struct *)dm_void;
41
42         /* disable ODM antenna diversity */
43         dm->support_ability &= ~ODM_BB_ANT_DIV;
44         ODM_RT_TRACE(dm, ODM_COMP_ANT_DIV, "STOP Antenna Diversity\n");
45 }
46
47 void phydm_enable_antenna_diversity(void *dm_void)
48 {
49         struct phy_dm_struct *dm = (struct phy_dm_struct *)dm_void;
50
51         dm->support_ability |= ODM_BB_ANT_DIV;
52         ODM_RT_TRACE(dm, ODM_COMP_ANT_DIV,
53                      "AntDiv is enabled & Re-Init AntDiv\n");
54         odm_antenna_diversity_init(dm);
55 }
56
57 void odm_set_ant_config(void *dm_void, u8 ant_setting /* 0=A, 1=B, 2=C, .... */
58                         )
59 {
60         struct phy_dm_struct *dm = (struct phy_dm_struct *)dm_void;
61
62         if (dm->support_ic_type == ODM_RTL8723B) {
63                 if (ant_setting == 0) /* ant A*/
64                         odm_set_bb_reg(dm, 0x948, MASKDWORD, 0x00000000);
65                 else if (ant_setting == 1)
66                         odm_set_bb_reg(dm, 0x948, MASKDWORD, 0x00000280);
67         } else if (dm->support_ic_type == ODM_RTL8723D) {
68                 if (ant_setting == 0) /* ant A*/
69                         odm_set_bb_reg(dm, 0x948, MASKLWORD, 0x0000);
70                 else if (ant_setting == 1)
71                         odm_set_bb_reg(dm, 0x948, MASKLWORD, 0x0280);
72         }
73 }
74
75 /* ****************************************************** */
76
77 void odm_sw_ant_div_rest_after_link(void *dm_void) {}
78
79 void odm_ant_div_reset(void *dm_void) {}
80
81 void odm_antenna_diversity_init(void *dm_void) {}
82
83 void odm_antenna_diversity(void *dm_void) {}