aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-01-28 02:13:04 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-02-03 15:43:55 -0500
commit474b50c30864a342d47e5d4a4a69df5750fa4254 (patch)
tree7d33a74978e931b8dad951c22bcd547dffbe38ec
parent06280a2ba9050cd8bc15a03aa22b24698a3ea742 (diff)
iwlwifi: mvm: store latest power command for debugfs read
Instead of re-building the power command upon debugfs read, store the latest command sent to the firmware. This reduces the code complexity by reducing the number of entries in the power code. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Alexander Bondar <alexander.bondar@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 93e6c18537e1..2d76e228c1cb 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -347,6 +347,7 @@ struct iwl_mvm_vif {
347 struct dentry *dbgfs_slink; 347 struct dentry *dbgfs_slink;
348 struct iwl_dbgfs_pm dbgfs_pm; 348 struct iwl_dbgfs_pm dbgfs_pm;
349 struct iwl_dbgfs_bf dbgfs_bf; 349 struct iwl_dbgfs_bf dbgfs_bf;
350 struct iwl_mac_power_cmd mac_pwr_cmd;
350#endif 351#endif
351 352
352 enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ]; 353 enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ];
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index 15c9c780323b..ac6d2c86e75c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -431,6 +431,9 @@ static int _iwl_mvm_power_mac_update_mode(struct iwl_mvm *mvm,
431 431
432 iwl_mvm_power_build_cmd(mvm, vif, &cmd); 432 iwl_mvm_power_build_cmd(mvm, vif, &cmd);
433 iwl_mvm_power_log(mvm, &cmd); 433 iwl_mvm_power_log(mvm, &cmd);
434#ifdef CONFIG_IWLWIFI_DEBUGFS
435 memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd));
436#endif
434 437
435 return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, CMD_SYNC, 438 return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, CMD_SYNC,
436 sizeof(cmd), &cmd); 439 sizeof(cmd), &cmd);
@@ -475,6 +478,7 @@ static int iwl_mvm_power_mac_disable(struct iwl_mvm *mvm,
475 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_DISABLE_POWER_OFF && 478 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_DISABLE_POWER_OFF &&
476 mvmvif->dbgfs_pm.disable_power_off) 479 mvmvif->dbgfs_pm.disable_power_off)
477 cmd.flags &= cpu_to_le16(~POWER_FLAGS_POWER_SAVE_ENA_MSK); 480 cmd.flags &= cpu_to_le16(~POWER_FLAGS_POWER_SAVE_ENA_MSK);
481 memcpy(&mvmvif->mac_pwr_cmd, &cmd, sizeof(cmd));
478#endif 482#endif
479 iwl_mvm_power_log(mvm, &cmd); 483 iwl_mvm_power_log(mvm, &cmd);
480 484
@@ -615,10 +619,13 @@ static int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm,
615 struct ieee80211_vif *vif, char *buf, 619 struct ieee80211_vif *vif, char *buf,
616 int bufsz) 620 int bufsz)
617{ 621{
622 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
618 struct iwl_mac_power_cmd cmd = {}; 623 struct iwl_mac_power_cmd cmd = {};
619 int pos = 0; 624 int pos = 0;
620 625
621 iwl_mvm_power_build_cmd(mvm, vif, &cmd); 626 mutex_lock(&mvm->mutex);
627 memcpy(&cmd, &mvmvif->mac_pwr_cmd, sizeof(cmd));
628 mutex_unlock(&mvm->mutex);
622 629
623 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD)) 630 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD))
624 pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off = %d\n", 631 pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off = %d\n",
@@ -807,6 +814,9 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
807 cmd.skip_dtim_periods = 300 / dtimper_msec; 814 cmd.skip_dtim_periods = 300 / dtimper_msec;
808 } 815 }
809 iwl_mvm_power_log(mvm, &cmd); 816 iwl_mvm_power_log(mvm, &cmd);
817#ifdef CONFIG_IWLWIFI_DEBUGFS
818 memcpy(&mvmvif->mac_pwr_cmd, &cmd, sizeof(cmd));
819#endif
810 ret = iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, flags, 820 ret = iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, flags,
811 sizeof(cmd), &cmd); 821 sizeof(cmd), &cmd);
812 if (ret) 822 if (ret)