iwlwifi: mvm: allow firmware crashes to wake system for debug
authorJohannes Berg <johannes.berg@intel.com>
Wed, 12 Jun 2013 12:55:40 +0000 (14:55 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 18 Jun 2013 09:51:51 +0000 (11:51 +0200)
When the D3 firmware crashes, it can be helpful for debugging to
resume the system to get the SRAM snapshot to see why it crashed.
Allow enabling this with a debugfs option.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/d3.c
drivers/net/wireless/iwlwifi/mvm/debugfs.c
drivers/net/wireless/iwlwifi/mvm/mvm.h

index 8c49db02c9c15969149687d576b891f3f5a9cd76..7e5e5c2f9f87316f5319605b1d9c6814c2940dc0 100644 (file)
@@ -1026,6 +1026,12 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
        if (ret)
                goto out;
 
+#ifdef CONFIG_IWLWIFI_DEBUGFS
+       if (mvm->d3_wake_sysassert)
+               d3_cfg_cmd_data.wakeup_flags |=
+                       cpu_to_le32(IWL_WAKEUP_D3_CONFIG_FW_ERROR);
+#endif
+
        /* must be last -- this switches firmware state */
        ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd);
        if (ret)
index b7643c16201f67ca44779c3d040fef0184824f9b..63d19d94b018ffa29db6ef99649c5093e107502d 100644 (file)
@@ -939,6 +939,9 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
 #ifdef CONFIG_PM_SLEEP
        MVM_DEBUGFS_ADD_FILE(d3_sram, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(d3_test, mvm->debugfs_dir, S_IRUSR);
+       if (!debugfs_create_bool("d3_wake_sysassert", S_IRUSR | S_IWUSR,
+                                mvm->debugfs_dir, &mvm->d3_wake_sysassert))
+               goto err;
 #endif
 
        /*
index ad39a22f79fa7776c8c94172dd83b5b14a22c1a9..fbc0acb521919fbbfe9d0d35a334360216e911b6 100644 (file)
@@ -460,6 +460,7 @@ struct iwl_mvm {
 #ifdef CONFIG_PM_SLEEP
        int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen;
 #ifdef CONFIG_IWLWIFI_DEBUGFS
+       u32 d3_wake_sysassert; /* must be u32 for debugfs_create_bool */
        bool d3_test_active;
        bool store_d3_resume_sram;
        void *d3_resume_sram;