From 83bdad52a3430d0f6c35b64012062ffc4e7ceb13 Mon Sep 17 00:00:00 2001 From: Alexander Bondar Date: Sun, 3 Feb 2013 21:26:44 +0200 Subject: 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 Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- drivers/net/wireless/iwlwifi/mvm/power.c | 36 ++++++++------------------------ 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/mvm/power.c') 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, struct iwl_powertable_cmd *cmd) { struct ieee80211_hw *hw = mvm->hw; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct ieee80211_chanctx_conf *chanctx_conf; struct ieee80211_channel *chan; int dtimper, dtimper_msec; int keep_alive; bool radar_detect = false; - cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, - mvmvif->color)); - cmd->action = cpu_to_le32(FW_CTXT_ACTION_MODIFY); - if ((!vif->bss_conf.ps) || (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM)) return; - cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); + cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK | + POWER_FLAGS_POWER_SAVE_ENA_MSK); dtimper = hw->conf.ps_dtim_period ?: 1; @@ -110,10 +106,8 @@ static void iwl_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, /* Check skip over DTIM conditions */ if (!radar_detect && (dtimper <= 10) && - (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP)) { + (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP)) cmd->flags |= cpu_to_le16(POWER_FLAGS_SLEEP_OVER_DTIM_MSK); - cmd->num_skip_dtim = 2; - } /* Check that keep alive period is at least 3 * DTIM */ 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, MSEC_PER_SEC * POWER_KEEP_ALIVE_PERIOD_SEC); keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC); - cmd->keep_alive_seconds = cpu_to_le16(keep_alive); + cmd->keep_alive_seconds = keep_alive; if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP) { /* 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) iwl_power_build_cmd(mvm, vif, &cmd); IWL_DEBUG_POWER(mvm, - "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n", - cmd.id_and_color, iwlmvm_mod_params.power_scheme, - le16_to_cpu(cmd.flags)); + "Sending power table command for power level %d, flags = 0x%X\n", + iwlmvm_mod_params.power_scheme, le16_to_cpu(cmd.flags)); if (cmd.flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)) { IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n", - le16_to_cpu(cmd.keep_alive_seconds)); + cmd.keep_alive_seconds); IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n", le32_to_cpu(cmd.rx_data_timeout)); IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n", le32_to_cpu(cmd.tx_data_timeout)); - IWL_DEBUG_POWER(mvm, "Rx timeout (uAPSD) = %u usec\n", - le32_to_cpu(cmd.rx_data_timeout_uapsd)); - IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n", - le32_to_cpu(cmd.tx_data_timeout_uapsd)); IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n", cmd.lprx_rssi_threshold); - IWL_DEBUG_POWER(mvm, "DTIMs to skip = %u\n", cmd.num_skip_dtim); } 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) int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif) { struct iwl_powertable_cmd cmd = {}; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); if (!iwlwifi_mod_params.power_save) { 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) if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) return 0; - cmd.id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, - mvmvif->color)); - cmd.action = cpu_to_le32(FW_CTXT_ACTION_MODIFY); - IWL_DEBUG_POWER(mvm, - "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n", - cmd.id_and_color, iwlmvm_mod_params.power_scheme, - le16_to_cpu(cmd.flags)); + "Sending power table command power level %d, flags = 0x%X\n", + iwlmvm_mod_params.power_scheme, le16_to_cpu(cmd.flags)); return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_ASYNC, sizeof(cmd), &cmd); -- cgit v1.2.1