rtlwifi: fix tm_trigger usage
authorHans Ulli Kroll <ulli.kroll@googlemail.com>
Sun, 7 Jun 2015 11:19:16 +0000 (13:19 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 15 Jun 2015 09:30:20 +0000 (12:30 +0300)
While working on getting my rtl8821au driver in pretty shape for
inclusion, it is dicosvered that the tm_trigger flag is used only for
the first device using this driver.
This flag handles the thermal power management in the hardware.

To change this add a entry in sttruct rtl_dm, so each device can handle
is separately.

Signed-off-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rtlwifi/rtl8188ee/dm.c
drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
drivers/net/wireless/rtlwifi/rtl8192de/dm.c
drivers/net/wireless/rtlwifi/rtl8192se/dm.c
drivers/net/wireless/rtlwifi/rtl8723be/dm.c
drivers/net/wireless/rtlwifi/rtl8821ae/dm.c
drivers/net/wireless/rtlwifi/wifi.h

index d930c1f787219413f17dbaa436a719b02c91ab73..ce4da9d79fbd9e44d55eb298379c7de4a28c0eee 100644 (file)
@@ -1123,23 +1123,22 @@ static void rtl88e_dm_init_txpower_tracking(struct ieee80211_hw *hw)
 void rtl88e_dm_check_txpower_tracking(struct ieee80211_hw *hw)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       static u8 tm_trigger;
 
        if (!rtlpriv->dm.txpower_tracking)
                return;
 
-       if (!tm_trigger) {
+       if (!rtlpriv->dm.tm_trigger) {
                rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, BIT(17)|BIT(16),
                              0x03);
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Trigger 88E Thermal Meter!!\n");
-               tm_trigger = 1;
+               rtlpriv->dm.tm_trigger = 1;
                return;
        } else {
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Schedule TxPowerTracking !!\n");
                                dm_txpower_track_cb_therm(hw);
-               tm_trigger = 0;
+               rtlpriv->dm.tm_trigger = 0;
        }
 }
 
index f5ee67cda73a6920185d9a7241be988d8e6b126b..0aca6f47487c2fe293f082ec562f13172dc13c38 100644 (file)
@@ -1169,23 +1169,22 @@ static void rtl92c_dm_check_txpower_tracking_thermal_meter(
                                                struct ieee80211_hw *hw)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       static u8 tm_trigger;
 
        if (!rtlpriv->dm.txpower_tracking)
                return;
 
-       if (!tm_trigger) {
+       if (!rtlpriv->dm.tm_trigger) {
                rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, RFREG_OFFSET_MASK,
                              0x60);
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Trigger 92S Thermal Meter!!\n");
-               tm_trigger = 1;
+               rtlpriv->dm.tm_trigger = 1;
                return;
        } else {
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Schedule TxPowerTracking direct call!!\n");
                rtl92c_dm_txpower_tracking_directcall(hw);
-               tm_trigger = 0;
+               rtlpriv->dm.tm_trigger = 0;
        }
 }
 
index a1be5a68edfb4804b35c3747ad2e646b2d432ebc..587b8c505a7625e11b810fefc0b63af3367708e8 100644 (file)
@@ -1240,23 +1240,22 @@ static void rtl92d_dm_initialize_txpower_tracking(struct ieee80211_hw *hw)
 void rtl92d_dm_check_txpower_tracking_thermal_meter(struct ieee80211_hw *hw)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       static u8 tm_trigger;
 
        if (!rtlpriv->dm.txpower_tracking)
                return;
 
-       if (!tm_trigger) {
+       if (!rtlpriv->dm.tm_trigger) {
                rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, BIT(17) |
                              BIT(16), 0x03);
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Trigger 92S Thermal Meter!!\n");
-               tm_trigger = 1;
+               rtlpriv->dm.tm_trigger = 1;
                return;
        } else {
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Schedule TxPowerTracking direct call!!\n");
                rtl92d_dm_txpower_tracking_callback_thermalmeter(hw);
-               tm_trigger = 0;
+               rtlpriv->dm.tm_trigger = 0;
        }
 }
 
index 575980b88658aeebacfc8646c79a445c83d30a06..9bae5a92e30fba4b50f2d67408882d1e4b61720d 100644 (file)
@@ -200,7 +200,6 @@ static void _rtl92s_dm_check_txpowertracking_thermalmeter(
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_phy *rtlphy = &(rtlpriv->phy);
-       static u8 tm_trigger;
        u8 tx_power_checkcnt = 5;
 
        /* 2T2R TP issue */
@@ -215,13 +214,13 @@ static void _rtl92s_dm_check_txpowertracking_thermalmeter(
                return;
        }
 
-       if (!tm_trigger) {
+       if (!rtlpriv->dm.tm_trigger) {
                rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER,
                              RFREG_OFFSET_MASK, 0x60);
-               tm_trigger = 1;
+               rtlpriv->dm.tm_trigger = 1;
        } else {
                _rtl92s_dm_txpowertracking_callback_thermalmeter(hw);
-               tm_trigger = 0;
+               rtlpriv->dm.tm_trigger = 0;
        }
 }
 
index e77c3a46c94a65ff0bad9578fdf22b725a50320f..3a81cdba8ca3ef1316d093db9137e779b24fdc04 100644 (file)
@@ -909,23 +909,22 @@ static void rtl8723be_dm_txpower_tracking_callback_thermalmeter(
 void rtl8723be_dm_check_txpower_tracking(struct ieee80211_hw *hw)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       static u8 tm_trigger;
 
        if (!rtlpriv->dm.txpower_tracking)
                return;
 
-       if (!tm_trigger) {
+       if (!rtlpriv->dm.tm_trigger) {
                rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, BIT(17) | BIT(16),
                              0x03);
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Trigger 8723be Thermal Meter!!\n");
-               tm_trigger = 1;
+               rtlpriv->dm.tm_trigger = 1;
                return;
        } else {
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Schedule TxPowerTracking !!\n");
                rtl8723be_dm_txpower_tracking_callback_thermalmeter(hw);
-               tm_trigger = 0;
+               rtlpriv->dm.tm_trigger = 0;
        }
 }
 
index 342678d2ed427d8549d446f5cb5ec0bbc5f3c41d..b57cfd9651968a51e2e77ae31b86712e824057fb 100644 (file)
@@ -1068,20 +1068,18 @@ static void rtl8812ae_dm_check_txpower_tracking_thermalmeter(
                struct ieee80211_hw *hw)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       static u8 tm_trigger;
 
-       if (!tm_trigger) {
+       if (!rtlpriv->dm.tm_trigger) {
                rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER_88E,
                              BIT(17) | BIT(16), 0x03);
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Trigger 8812 Thermal Meter!!\n");
-               tm_trigger = 1;
+               rtlpriv->dm.tm_trigger = 1;
                return;
        }
        RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                 "Schedule TxPowerTracking direct call!!\n");
        rtl8812ae_dm_txpower_tracking_callback_thermalmeter(hw);
-       tm_trigger = 0;
 }
 
 static void rtl8821ae_dm_iq_calibrate(struct ieee80211_hw *hw)
@@ -2519,21 +2517,19 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter(
 void rtl8821ae_dm_check_txpower_tracking_thermalmeter(struct ieee80211_hw *hw)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       static u8 tm_trigger;
-
-       if (!tm_trigger) {
+       if (!rtlpriv->dm.tm_trigger) {
                rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER_88E, BIT(17)|BIT(16),
                              0x03);
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Trigger 8821ae Thermal Meter!!\n");
-               tm_trigger = 1;
+               rtlpriv->dm.tm_trigger = 1;
                return;
        } else {
                RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
                         "Schedule TxPowerTracking !!\n");
 
                rtl8821ae_dm_txpower_tracking_callback_thermalmeter(hw);
-               tm_trigger = 0;
+               rtlpriv->dm.tm_trigger = 0;
        }
 }
 
index 51572912c53dc27794038d04623c0435e62384e9..2b770b5e2620fc629ea2eca7ef1b499b300eaf8d 100644 (file)
@@ -1665,6 +1665,7 @@ struct rtl_dm {
        u8 last_dtp_lvl;
        u8 thermalvalue_avg[AVG_THERMAL_NUM];
        u8 thermalvalue_avg_index;
+       u8 tm_trigger;
        bool done_txpower;
        u8 dynamic_txhighpower_lvl;     /*Tx high power level */
        u8 dm_flag;             /*Indicate each dynamic mechanism's status. */