1 // SPDX-License-Identifier: GPL-2.0
2 /******************************************************************************
3  *
4  * Copyright(c) 2016  Realtek Corporation.
5  *
6  * Contact Information:
7  * wlanfae <wlanfae@realtek.com>
8  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
9  * Hsinchu 300, Taiwan.
10  *
11  * Larry Finger <Larry.Finger@lwfinger.net>
12  *
13  *****************************************************************************/
14 #include "halbt_precomp.h"
15 
ex_hal8822b_wifi_only_hw_config(struct wifi_only_cfg * wifionlycfg)16 void ex_hal8822b_wifi_only_hw_config(struct wifi_only_cfg *wifionlycfg)
17 {
18 	/*BB control*/
19 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x4c, 0x01800000, 0x2);
20 	/*SW control*/
21 	halwifionly_phy_set_bb_reg(wifionlycfg, 0xcb4, 0xff, 0x77);
22 	/*antenna mux switch */
23 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x974, 0x300, 0x3);
24 
25 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x1990, 0x300, 0x0);
26 
27 	halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x80000, 0x0);
28 	/*switch to WL side controller and gnt_wl gnt_bt debug signal */
29 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x70, 0xff000000, 0x0e);
30 	/*gnt_wl=1 , gnt_bt=0*/
31 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x1704, 0xffffffff, 0x7700);
32 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
33 }
34 
ex_hal8822b_wifi_only_scannotify(struct wifi_only_cfg * wifionlycfg,u8 is_5g)35 void ex_hal8822b_wifi_only_scannotify(struct wifi_only_cfg *wifionlycfg,
36 				      u8 is_5g)
37 {
38 	hal8822b_wifi_only_switch_antenna(wifionlycfg, is_5g);
39 }
40 
ex_hal8822b_wifi_only_switchbandnotify(struct wifi_only_cfg * wifionlycfg,u8 is_5g)41 void ex_hal8822b_wifi_only_switchbandnotify(struct wifi_only_cfg *wifionlycfg,
42 					    u8 is_5g)
43 {
44 	hal8822b_wifi_only_switch_antenna(wifionlycfg, is_5g);
45 }
46 
hal8822b_wifi_only_switch_antenna(struct wifi_only_cfg * wifionlycfg,u8 is_5g)47 void hal8822b_wifi_only_switch_antenna(struct wifi_only_cfg *wifionlycfg,
48 				       u8 is_5g)
49 {
50 	if (is_5g)
51 		halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x300, 0x1);
52 	else
53 		halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x300, 0x2);
54 }
55