1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3 *
4 * Copyright(c) 2016 - 2017 Realtek Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 *****************************************************************************/
16 #include "mp_precomp.h"
17
18
19 VOID
ex_hal8822b_wifi_only_hw_config(IN struct wifi_only_cfg * pwifionlycfg)20 ex_hal8822b_wifi_only_hw_config(
21 IN struct wifi_only_cfg *pwifionlycfg
22 )
23 {
24 /*BB control*/
25 halwifionly_phy_set_bb_reg(pwifionlycfg, 0x4c, 0x01800000, 0x2);
26 /*SW control*/
27 halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0xff, 0x77);
28 /*antenna mux switch */
29 halwifionly_phy_set_bb_reg(pwifionlycfg, 0x974, 0x300, 0x3);
30
31 halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1990, 0x300, 0x0);
32
33 halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x80000, 0x0);
34 /*switch to WL side controller and gnt_wl gnt_bt debug signal */
35 halwifionly_phy_set_bb_reg(pwifionlycfg, 0x70, 0xff000000, 0x0e);
36 /*gnt_wl=1 , gnt_bt=0*/
37 halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1704, 0xffffffff, 0x7700);
38 halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
39 }
40
41 VOID
ex_hal8822b_wifi_only_scannotify(IN struct wifi_only_cfg * pwifionlycfg,IN u1Byte is_5g)42 ex_hal8822b_wifi_only_scannotify(
43 IN struct wifi_only_cfg *pwifionlycfg,
44 IN u1Byte is_5g
45 )
46 {
47 hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
48 }
49
50 VOID
ex_hal8822b_wifi_only_switchbandnotify(IN struct wifi_only_cfg * pwifionlycfg,IN u1Byte is_5g)51 ex_hal8822b_wifi_only_switchbandnotify(
52 IN struct wifi_only_cfg *pwifionlycfg,
53 IN u1Byte is_5g
54 )
55 {
56 hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
57 }
58
59 VOID
hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg * pwifionlycfg,IN u1Byte is_5g)60 hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg *pwifionlycfg,
61 IN u1Byte is_5g
62 )
63 {
64
65 if (is_5g)
66 halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x300, 0x1);
67 else
68 halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x300, 0x2);
69 }
70