1 /******************************************************************************
2 *
3 * Copyright(c) 2016-2017 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 *****************************************************************************/
15 #include "halbt_precomp.h"
16
ex_hal8822b_wifi_only_hw_config(struct wifi_only_cfg * wifionlycfg)17 void ex_hal8822b_wifi_only_hw_config(struct wifi_only_cfg *wifionlycfg)
18 {
19 /*BB control*/
20 halwifionly_phy_set_bb_reg(wifionlycfg, 0x4c, 0x01800000, 0x2);
21 /*SW control*/
22 halwifionly_phy_set_bb_reg(wifionlycfg, 0xcb4, 0xff, 0x77);
23 /*antenna mux switch */
24 halwifionly_phy_set_bb_reg(wifionlycfg, 0x974, 0x300, 0x3);
25
26 halwifionly_phy_set_bb_reg(wifionlycfg, 0x1990, 0x300, 0x0);
27
28 halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x80000, 0x0);
29 /*switch to WL side controller and gnt_wl gnt_bt debug signal */
30 halwifionly_phy_set_bb_reg(wifionlycfg, 0x70, 0xff000000, 0x0e);
31 /*gnt_wl=1 , gnt_bt=0*/
32 halwifionly_phy_set_bb_reg(wifionlycfg, 0x1704, 0xffffffff, 0x7700);
33 halwifionly_phy_set_bb_reg(wifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
34 }
35
ex_hal8822b_wifi_only_scannotify(struct wifi_only_cfg * wifionlycfg,u8 is_5g)36 void ex_hal8822b_wifi_only_scannotify(struct wifi_only_cfg *wifionlycfg,
37 u8 is_5g)
38 {
39 hal8822b_wifi_only_switch_antenna(wifionlycfg, is_5g);
40 }
41
ex_hal8822b_wifi_only_switchbandnotify(struct wifi_only_cfg * wifionlycfg,u8 is_5g)42 void ex_hal8822b_wifi_only_switchbandnotify(struct wifi_only_cfg *wifionlycfg,
43 u8 is_5g)
44 {
45 hal8822b_wifi_only_switch_antenna(wifionlycfg, is_5g);
46 }
47
hal8822b_wifi_only_switch_antenna(struct wifi_only_cfg * wifionlycfg,u8 is_5g)48 void hal8822b_wifi_only_switch_antenna(struct wifi_only_cfg *wifionlycfg,
49 u8 is_5g)
50 {
51 if (is_5g)
52 halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x300, 0x1);
53 else
54 halwifionly_phy_set_bb_reg(wifionlycfg, 0xcbc, 0x300, 0x2);
55 }
56