1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2016-2017  Realtek Corporation.*/
3 
4 #include "halbt_precomp.h"
5 
6 void ex_hal8822b_wifi_only_hw_config(struct wifi_only_cfg *wifionlycfg)
7 {
8 	/*BB control*/
9 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x4c, 0x01800000, 0x2);
10 	/*SW control*/
11 	halwifionly_phy_set_bb_reg(wifionlycfg, 0xcb4, 0xff, 0x77);
12 	/*antenna mux switch */
13 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x974, 0x300, 0x3);
14 
15 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x1990, 0x300, 0x0);
16 
17 	halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x80000, 0x0);
18 	/*switch to WL side controller and gnt_wl gnt_bt debug signal */
19 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x70, 0xff000000, 0x0e);
20 	/*gnt_wl=1 , gnt_bt=0*/
21 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x1704, 0xffffffff, 0x7700);
22 	halwifionly_phy_set_bb_reg(wifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
23 }
24 
25 void ex_hal8822b_wifi_only_scannotify(struct wifi_only_cfg *wifionlycfg,
26 				      u8 is_5g)
27 {
28 	hal8822b_wifi_only_switch_antenna(wifionlycfg, is_5g);
29 }
30 
31 void ex_hal8822b_wifi_only_switchbandnotify(struct wifi_only_cfg *wifionlycfg,
32 					    u8 is_5g)
33 {
34 	hal8822b_wifi_only_switch_antenna(wifionlycfg, is_5g);
35 }
36 
37 void hal8822b_wifi_only_switch_antenna(struct wifi_only_cfg *wifionlycfg,
38 				       u8 is_5g)
39 {
40 	if (is_5g)
41 		halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x300, 0x1);
42 	else
43 		halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x300, 0x2);
44 }
45