aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Bondar <alexander.bondar@intel.com>2013-02-03 14:26:44 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-04-03 16:49:13 -0400
commit83bdad52a3430d0f6c35b64012062ffc4e7ceb13 (patch)
treea67078099f612ee7a42f9e9fbfff9ce7d7642aec
parent9166b1eeb7f3e98d76ab735bf91d01a7516562da (diff)
iwlwifi: mvm: downgrade to old power management API
Current available FW still doesn't support new PM API. Therefore, to enable basic power management with the existing firmware, change the API in the driver back to the API used in the current firmware. Signed-off-by: Alexander Bondar <alexander.bondar@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw-api-power.h58
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c36
2 files changed, 27 insertions, 67 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h
index 127051891e9b..f77d823cbad0 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h
+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h
@@ -68,33 +68,29 @@
68 68
69/** 69/**
70 * enum iwl_scan_flags - masks for power table command flags 70 * enum iwl_scan_flags - masks for power table command flags
71 * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
72 * receiver and transmitter. '0' - does not allow.
71 * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management, 73 * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
72 * '1' Driver enables PM (use rest of parameters) 74 * '1' Driver enables PM (use rest of parameters)
73 * @POWER_FLAGS_SLEEP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM, 75 * @POWER_FLAGS_SLEEP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
74 * '1' PM could sleep over DTIM till listen Interval. 76 * '1' PM could sleep over DTIM till listen Interval.
75 * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
76 * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
77 * access categories are both delivery and trigger enabled.
78 * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
79 * PBW Snoozing enabled
80 * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask 77 * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
78 * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
81*/ 79*/
82enum iwl_power_flags { 80enum iwl_power_flags {
83 POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = BIT(0), 81 POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
84 POWER_FLAGS_SLEEP_OVER_DTIM_MSK = BIT(1), 82 POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = BIT(1),
85 POWER_FLAGS_LPRX_ENA_MSK = BIT(2), 83 POWER_FLAGS_SLEEP_OVER_DTIM_MSK = BIT(2),
86 POWER_FLAGS_SNOOZE_ENA_MSK = BIT(3), 84 POWER_FLAGS_ADVANCE_PM_ENA_MSK = BIT(9),
87 POWER_FLAGS_BT_SCO_ENA = BIT(4), 85 POWER_FLAGS_LPRX_ENA_MSK = BIT(11),
88 POWER_FLAGS_ADVANCE_PM_ENA_MSK = BIT(5)
89}; 86};
90 87
88#define IWL_POWER_VEC_SIZE 5
89
91/** 90/**
92 * struct iwl_powertable_cmd - Power Table Command 91 * struct iwl_powertable_cmd - Power Table Command
93 * POWER_TABLE_CMD = 0x77 (command, has simple generic response) 92 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
94 * 93 *
95 * @id_and_color: MAC contex identifier
96 * @action: Action on context - no action, add new,
97 * modify existent, remove
98 * @flags: Power table command flags from POWER_FLAGS_* 94 * @flags: Power table command flags from POWER_FLAGS_*
99 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec. 95 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
100 * Minimum allowed:- 3 * DTIM 96 * Minimum allowed:- 3 * DTIM
@@ -102,39 +98,21 @@ enum iwl_power_flags {
102 * PSM transition - legacy PM 98 * PSM transition - legacy PM
103 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to 99 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
104 * PSM transition - legacy PM 100 * PSM transition - legacy PM
105 * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to 101 * @sleep_interval: not in use
106 * PSM transition - uAPSD 102 * @keep_alive_beacons: not in use
107 * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
108 * PSM transition - uAPSD
109 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled. 103 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
110 * Default: 80dbm 104 * Default: 80dbm
111 * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set
112 * @snooze_interval: TBD
113 * @snooze_window: TBD
114 * @snooze_step: TBD
115 * @qndp_tid: TBD
116 * @uapsd_ac_flags: TBD
117 * @uapsd_max_sp: TBD
118 */ 105 */
119struct iwl_powertable_cmd { 106struct iwl_powertable_cmd {
120 /* COMMON_INDEX_HDR_API_S_VER_1 */ 107 /* PM_POWER_TABLE_CMD_API_S_VER_5 */
121 __le32 id_and_color;
122 __le32 action;
123 __le16 flags; 108 __le16 flags;
124 u8 reserved; 109 u8 keep_alive_seconds;
125 __le16 keep_alive_seconds; 110 u8 debug_flags;
126 __le32 rx_data_timeout; 111 __le32 rx_data_timeout;
127 __le32 tx_data_timeout; 112 __le32 tx_data_timeout;
128 __le32 rx_data_timeout_uapsd; 113 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
129 __le32 tx_data_timeout_uapsd; 114 __le32 keep_alive_beacons;
130 u8 lprx_rssi_threshold; 115 __le32 lprx_rssi_threshold;
131 u8 num_skip_dtim;
132 __le16 snooze_interval;
133 __le16 snooze_window;
134 u8 snooze_step;
135 u8 qndp_tid;
136 u8 uapsd_ac_flags;
137 u8 uapsd_max_sp;
138} __packed; 116} __packed;
139 117
140#endif 118#endif
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index efb9a6f3faac..55eee6e505d2 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -79,22 +79,18 @@ static void iwl_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
79 struct iwl_powertable_cmd *cmd) 79 struct iwl_powertable_cmd *cmd)
80{ 80{
81 struct ieee80211_hw *hw = mvm->hw; 81 struct ieee80211_hw *hw = mvm->hw;
82 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
83 struct ieee80211_chanctx_conf *chanctx_conf; 82 struct ieee80211_chanctx_conf *chanctx_conf;
84 struct ieee80211_channel *chan; 83 struct ieee80211_channel *chan;
85 int dtimper, dtimper_msec; 84 int dtimper, dtimper_msec;
86 int keep_alive; 85 int keep_alive;
87 bool radar_detect = false; 86 bool radar_detect = false;
88 87
89 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
90 mvmvif->color));
91 cmd->action = cpu_to_le32(FW_CTXT_ACTION_MODIFY);
92
93 if ((!vif->bss_conf.ps) || 88 if ((!vif->bss_conf.ps) ||
94 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM)) 89 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM))
95 return; 90 return;
96 91
97 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); 92 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK |
93 POWER_FLAGS_POWER_SAVE_ENA_MSK);
98 94
99 dtimper = hw->conf.ps_dtim_period ?: 1; 95 dtimper = hw->conf.ps_dtim_period ?: 1;
100 96
@@ -110,10 +106,8 @@ static void iwl_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
110 106
111 /* Check skip over DTIM conditions */ 107 /* Check skip over DTIM conditions */
112 if (!radar_detect && (dtimper <= 10) && 108 if (!radar_detect && (dtimper <= 10) &&
113 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP)) { 109 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP))
114 cmd->flags |= cpu_to_le16(POWER_FLAGS_SLEEP_OVER_DTIM_MSK); 110 cmd->flags |= cpu_to_le16(POWER_FLAGS_SLEEP_OVER_DTIM_MSK);
115 cmd->num_skip_dtim = 2;
116 }
117 111
118 /* Check that keep alive period is at least 3 * DTIM */ 112 /* Check that keep alive period is at least 3 * DTIM */
119 dtimper_msec = dtimper * vif->bss_conf.beacon_int; 113 dtimper_msec = dtimper * vif->bss_conf.beacon_int;
@@ -121,7 +115,7 @@ static void iwl_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
121 MSEC_PER_SEC * POWER_KEEP_ALIVE_PERIOD_SEC); 115 MSEC_PER_SEC * POWER_KEEP_ALIVE_PERIOD_SEC);
122 keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC); 116 keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC);
123 117
124 cmd->keep_alive_seconds = cpu_to_le16(keep_alive); 118 cmd->keep_alive_seconds = keep_alive;
125 119
126 if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP) { 120 if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP) {
127 /* TODO: Also for D3 (device sleep / WoWLAN) */ 121 /* TODO: Also for D3 (device sleep / WoWLAN) */
@@ -148,24 +142,18 @@ int iwl_mvm_power_update_mode(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
148 iwl_power_build_cmd(mvm, vif, &cmd); 142 iwl_power_build_cmd(mvm, vif, &cmd);
149 143
150 IWL_DEBUG_POWER(mvm, 144 IWL_DEBUG_POWER(mvm,
151 "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n", 145 "Sending power table command for power level %d, flags = 0x%X\n",
152 cmd.id_and_color, iwlmvm_mod_params.power_scheme, 146 iwlmvm_mod_params.power_scheme, le16_to_cpu(cmd.flags));
153 le16_to_cpu(cmd.flags));
154 147
155 if (cmd.flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)) { 148 if (cmd.flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)) {
156 IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n", 149 IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n",
157 le16_to_cpu(cmd.keep_alive_seconds)); 150 cmd.keep_alive_seconds);
158 IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n", 151 IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n",
159 le32_to_cpu(cmd.rx_data_timeout)); 152 le32_to_cpu(cmd.rx_data_timeout));
160 IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n", 153 IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n",
161 le32_to_cpu(cmd.tx_data_timeout)); 154 le32_to_cpu(cmd.tx_data_timeout));
162 IWL_DEBUG_POWER(mvm, "Rx timeout (uAPSD) = %u usec\n",
163 le32_to_cpu(cmd.rx_data_timeout_uapsd));
164 IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n",
165 le32_to_cpu(cmd.tx_data_timeout_uapsd));
166 IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n", 155 IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n",
167 cmd.lprx_rssi_threshold); 156 cmd.lprx_rssi_threshold);
168 IWL_DEBUG_POWER(mvm, "DTIMs to skip = %u\n", cmd.num_skip_dtim);
169 } 157 }
170 158
171 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC, 159 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC,
@@ -175,7 +163,6 @@ int iwl_mvm_power_update_mode(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
175int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 163int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
176{ 164{
177 struct iwl_powertable_cmd cmd = {}; 165 struct iwl_powertable_cmd cmd = {};
178 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
179 166
180 if (!iwlwifi_mod_params.power_save) { 167 if (!iwlwifi_mod_params.power_save) {
181 IWL_DEBUG_POWER(mvm, "Power management is not allowed\n"); 168 IWL_DEBUG_POWER(mvm, "Power management is not allowed\n");
@@ -185,14 +172,9 @@ int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
185 if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) 172 if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
186 return 0; 173 return 0;
187 174
188 cmd.id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
189 mvmvif->color));
190 cmd.action = cpu_to_le32(FW_CTXT_ACTION_MODIFY);
191
192 IWL_DEBUG_POWER(mvm, 175 IWL_DEBUG_POWER(mvm,
193 "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n", 176 "Sending power table command power level %d, flags = 0x%X\n",
194 cmd.id_and_color, iwlmvm_mod_params.power_scheme, 177 iwlmvm_mod_params.power_scheme, le16_to_cpu(cmd.flags));
195 le16_to_cpu(cmd.flags));
196 178
197 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_ASYNC, 179 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_ASYNC,
198 sizeof(cmd), &cmd); 180 sizeof(cmd), &cmd);