aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2014-02-28 16:16:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-03-04 13:19:38 -0500
commit57d9d9630a6b3f289ae87b1fc00e83ae44636766 (patch)
tree93c638ca278eb9b669eab8688f5a6dae8e4cb854 /drivers/net/wireless/rtlwifi
parentcbd0c8512f3b06c86849c554eb092862c46885d5 (diff)
rtlwifi: rtl8723ae: rtl8723-common: Copy common dynamic power management code
The drivers for RTL8723AE and RTL8723BE have some code in common. This commit copies the common power management routines into the shared code. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/dm.c42
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/dm.h1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/hw.c5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723com/Makefile1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723com/dm_common.c65
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723com/dm_common.h33
6 files changed, 106 insertions, 41 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/dm.c b/drivers/net/wireless/rtlwifi/rtl8723ae/dm.c
index a36eee28f9e7..863ddb3e2888 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/dm.c
@@ -35,6 +35,7 @@
35#include "def.h" 35#include "def.h"
36#include "phy.h" 36#include "phy.h"
37#include "dm.h" 37#include "dm.h"
38#include "../rtl8723com/dm_common.h"
38#include "fw.h" 39#include "fw.h"
39#include "hal_btc.h" 40#include "hal_btc.h"
40 41
@@ -483,16 +484,6 @@ static void rtl8723ae_dm_dig(struct ieee80211_hw *hw)
483 rtl8723ae_dm_ctrl_initgain_by_twoport(hw); 484 rtl8723ae_dm_ctrl_initgain_by_twoport(hw);
484} 485}
485 486
486static void rtl8723ae_dm_init_dynamic_txpower(struct ieee80211_hw *hw)
487{
488 struct rtl_priv *rtlpriv = rtl_priv(hw);
489
490 rtlpriv->dm.dynamic_txpower_enable = false;
491
492 rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL;
493 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
494}
495
496static void rtl8723ae_dm_dynamic_txpower(struct ieee80211_hw *hw) 487static void rtl8723ae_dm_dynamic_txpower(struct ieee80211_hw *hw)
497{ 488{
498 struct rtl_priv *rtlpriv = rtl_priv(hw); 489 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -585,19 +576,6 @@ void rtl8723ae_dm_write_dig(struct ieee80211_hw *hw)
585 } 576 }
586} 577}
587 578
588static void rtl8723ae_dm_pwdmonitor(struct ieee80211_hw *hw)
589{
590}
591
592void rtl8723ae_dm_init_edca_turbo(struct ieee80211_hw *hw)
593{
594 struct rtl_priv *rtlpriv = rtl_priv(hw);
595
596 rtlpriv->dm.current_turbo_edca = false;
597 rtlpriv->dm.is_any_nonbepkts = false;
598 rtlpriv->dm.is_cur_rdlstate = false;
599}
600
601static void rtl8723ae_dm_check_edca_turbo(struct ieee80211_hw *hw) 579static void rtl8723ae_dm_check_edca_turbo(struct ieee80211_hw *hw)
602{ 580{
603 struct rtl_priv *rtlpriv = rtl_priv(hw); 581 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -778,17 +756,6 @@ static void rtl8723ae_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw)
778 } 756 }
779} 757}
780 758
781static void rtl8723ae_dm_init_dynamic_bpowersaving(struct ieee80211_hw *hw)
782{
783 struct rtl_priv *rtlpriv = rtl_priv(hw);
784
785 rtlpriv->dm_pstable.pre_ccastate = CCA_MAX;
786 rtlpriv->dm_pstable.cur_ccasate = CCA_MAX;
787 rtlpriv->dm_pstable.pre_rfstate = RF_MAX;
788 rtlpriv->dm_pstable.cur_rfstate = RF_MAX;
789 rtlpriv->dm_pstable.rssi_val_min = 0;
790}
791
792void rtl8723ae_dm_rf_saving(struct ieee80211_hw *hw, u8 force_in_normal) 759void rtl8723ae_dm_rf_saving(struct ieee80211_hw *hw, u8 force_in_normal)
793{ 760{
794 struct rtl_priv *rtlpriv = rtl_priv(hw); 761 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -905,11 +872,11 @@ void rtl8723ae_dm_init(struct ieee80211_hw *hw)
905 872
906 rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; 873 rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER;
907 rtl8723ae_dm_diginit(hw); 874 rtl8723ae_dm_diginit(hw);
908 rtl8723ae_dm_init_dynamic_txpower(hw); 875 rtl8723_dm_init_dynamic_txpower(hw);
909 rtl8723ae_dm_init_edca_turbo(hw); 876 rtl8723_dm_init_edca_turbo(hw);
910 rtl8723ae_dm_init_rate_adaptive_mask(hw); 877 rtl8723ae_dm_init_rate_adaptive_mask(hw);
911 rtl8723ae_dm_initialize_txpower_tracking(hw); 878 rtl8723ae_dm_initialize_txpower_tracking(hw);
912 rtl8723ae_dm_init_dynamic_bpowersaving(hw); 879 rtl8723_dm_init_dynamic_bb_powersaving(hw);
913} 880}
914 881
915void rtl8723ae_dm_watchdog(struct ieee80211_hw *hw) 882void rtl8723ae_dm_watchdog(struct ieee80211_hw *hw)
@@ -930,7 +897,6 @@ void rtl8723ae_dm_watchdog(struct ieee80211_hw *hw)
930 if ((ppsc->rfpwr_state == ERFON) && 897 if ((ppsc->rfpwr_state == ERFON) &&
931 ((!fw_current_inpsmode) && fw_ps_awake) && 898 ((!fw_current_inpsmode) && fw_ps_awake) &&
932 (!ppsc->rfchange_inprogress)) { 899 (!ppsc->rfchange_inprogress)) {
933 rtl8723ae_dm_pwdmonitor(hw);
934 rtl8723ae_dm_dig(hw); 900 rtl8723ae_dm_dig(hw);
935 rtl8723ae_dm_false_alarm_counter_statistics(hw); 901 rtl8723ae_dm_false_alarm_counter_statistics(hw);
936 rtl8723ae_dm_dynamic_bpowersaving(hw); 902 rtl8723ae_dm_dynamic_bpowersaving(hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/dm.h b/drivers/net/wireless/rtlwifi/rtl8723ae/dm.h
index a372b0204456..d253bb53d03e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/dm.h
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/dm.h
@@ -147,7 +147,6 @@ enum dm_dig_connect_e {
147void rtl8723ae_dm_init(struct ieee80211_hw *hw); 147void rtl8723ae_dm_init(struct ieee80211_hw *hw);
148void rtl8723ae_dm_watchdog(struct ieee80211_hw *hw); 148void rtl8723ae_dm_watchdog(struct ieee80211_hw *hw);
149void rtl8723ae_dm_write_dig(struct ieee80211_hw *hw); 149void rtl8723ae_dm_write_dig(struct ieee80211_hw *hw);
150void rtl8723ae_dm_init_edca_turbo(struct ieee80211_hw *hw);
151void rtl8723ae_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); 150void rtl8723ae_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw);
152void rtl8723ae_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal); 151void rtl8723ae_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal);
153void rtl8723ae_dm_bt_coexist(struct ieee80211_hw *hw); 152void rtl8723ae_dm_bt_coexist(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c
index 7eff1c51539c..8a8577a1783b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c
@@ -38,6 +38,7 @@
38#include "def.h" 38#include "def.h"
39#include "phy.h" 39#include "phy.h"
40#include "dm.h" 40#include "dm.h"
41#include "../rtl8723com/dm_common.h"
41#include "fw.h" 42#include "fw.h"
42#include "../rtl8723com/fw_common.h" 43#include "../rtl8723com/fw_common.h"
43#include "led.h" 44#include "led.h"
@@ -305,7 +306,7 @@ void rtl8723ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
305 break; } 306 break; }
306 case HW_VAR_AC_PARAM:{ 307 case HW_VAR_AC_PARAM:{
307 u8 e_aci = *((u8 *) val); 308 u8 e_aci = *((u8 *) val);
308 rtl8723ae_dm_init_edca_turbo(hw); 309 rtl8723_dm_init_edca_turbo(hw);
309 310
310 if (rtlpci->acm_method != EACMWAY2_SW) 311 if (rtlpci->acm_method != EACMWAY2_SW)
311 rtlpriv->cfg->ops->set_hw_reg(hw, 312 rtlpriv->cfg->ops->set_hw_reg(hw,
@@ -1155,7 +1156,7 @@ void rtl8723ae_set_qos(struct ieee80211_hw *hw, int aci)
1155{ 1156{
1156 struct rtl_priv *rtlpriv = rtl_priv(hw); 1157 struct rtl_priv *rtlpriv = rtl_priv(hw);
1157 1158
1158 rtl8723ae_dm_init_edca_turbo(hw); 1159 rtl8723_dm_init_edca_turbo(hw);
1159 switch (aci) { 1160 switch (aci) {
1160 case AC1_BK: 1161 case AC1_BK:
1161 rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0xa44f); 1162 rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0xa44f);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723com/Makefile b/drivers/net/wireless/rtlwifi/rtl8723com/Makefile
index 97c7eaceb430..345a68adcf38 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723com/Makefile
+++ b/drivers/net/wireless/rtlwifi/rtl8723com/Makefile
@@ -1,5 +1,6 @@
1rtl8723-common-objs := \ 1rtl8723-common-objs := \
2 main.o \ 2 main.o \
3 dm_common.o \
3 fw_common.o \ 4 fw_common.o \
4 phy_common.o 5 phy_common.o
5 6
diff --git a/drivers/net/wireless/rtlwifi/rtl8723com/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8723com/dm_common.c
new file mode 100644
index 000000000000..4e254b72bf45
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8723com/dm_common.c
@@ -0,0 +1,65 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2009-2014 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#include "../wifi.h"
27#include "dm_common.h"
28#include "../rtl8723ae/dm.h"
29#include <linux/module.h>
30
31/* These routines are common to RTL8723AE and RTL8723bE */
32
33void rtl8723_dm_init_dynamic_txpower(struct ieee80211_hw *hw)
34{
35 struct rtl_priv *rtlpriv = rtl_priv(hw);
36
37 rtlpriv->dm.dynamic_txpower_enable = false;
38
39 rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL;
40 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
41}
42EXPORT_SYMBOL_GPL(rtl8723_dm_init_dynamic_txpower);
43
44void rtl8723_dm_init_edca_turbo(struct ieee80211_hw *hw)
45{
46 struct rtl_priv *rtlpriv = rtl_priv(hw);
47
48 rtlpriv->dm.current_turbo_edca = false;
49 rtlpriv->dm.is_any_nonbepkts = false;
50 rtlpriv->dm.is_cur_rdlstate = false;
51}
52EXPORT_SYMBOL_GPL(rtl8723_dm_init_edca_turbo);
53
54void rtl8723_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw)
55{
56 struct rtl_priv *rtlpriv = rtl_priv(hw);
57
58 rtlpriv->dm_pstable.pre_ccastate = CCA_MAX;
59 rtlpriv->dm_pstable.cur_ccasate = CCA_MAX;
60 rtlpriv->dm_pstable.pre_rfstate = RF_MAX;
61 rtlpriv->dm_pstable.cur_rfstate = RF_MAX;
62 rtlpriv->dm_pstable.rssi_val_min = 0;
63 rtlpriv->dm_pstable.initialize = 0;
64}
65EXPORT_SYMBOL_GPL(rtl8723_dm_init_dynamic_bb_powersaving);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723com/dm_common.h b/drivers/net/wireless/rtlwifi/rtl8723com/dm_common.h
new file mode 100644
index 000000000000..5c1b94ce2f86
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8723com/dm_common.h
@@ -0,0 +1,33 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2009-2014 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#ifndef __DM_COMMON_H__
27#define __DM_COMMON_H__
28
29void rtl8723_dm_init_dynamic_txpower(struct ieee80211_hw *hw);
30void rtl8723_dm_init_edca_turbo(struct ieee80211_hw *hw);
31void rtl8723_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw);
32
33#endif