iwlwifi: prepare for higher API/CAPA bits
[cascardo/linux.git] / drivers / net / wireless / iwlwifi / mvm / debugfs.c
index 82c09d8..ffb4b5c 100644 (file)
@@ -6,7 +6,7 @@
  * GPL LICENSE SUMMARY
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -32,7 +32,7 @@
  * BSD LICENSE
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -493,7 +493,8 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
 
        mutex_lock(&mvm->mutex);
 
-       if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
+       if (!fw_has_api(&mvm->fw->ucode_capa,
+                       IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
                struct iwl_bt_coex_profile_notif_old *notif =
                        &mvm->last_bt_notif_old;
 
@@ -550,7 +551,8 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
 
        mutex_lock(&mvm->mutex);
 
-       if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
+       if (!fw_has_api(&mvm->fw->ucode_capa,
+                       IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
                struct iwl_bt_coex_ci_cmd_old *cmd = &mvm->last_bt_ci_cmd_old;
 
                pos += scnprintf(buf+pos, bufsz-pos,
@@ -562,11 +564,12 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
                               "\tSecondary Channel Bitmap 0x%016llx\n",
                               le64_to_cpu(cmd->bt_secondary_ci));
 
-               pos += scnprintf(buf+pos, bufsz-pos, "BT Configuration CMD\n");
-               pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill Mask 0x%08x\n",
-                                iwl_bt_ctl_kill_msk[mvm->bt_ack_kill_msk[0]]);
-               pos += scnprintf(buf+pos, bufsz-pos, "\tCTS Kill Mask 0x%08x\n",
-                                iwl_bt_ctl_kill_msk[mvm->bt_cts_kill_msk[0]]);
+               pos += scnprintf(buf+pos, bufsz-pos,
+                                "BT Configuration CMD - 0=default, 1=never, 2=always\n");
+               pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill msk idx %d\n",
+                                mvm->bt_ack_kill_msk[0]);
+               pos += scnprintf(buf+pos, bufsz-pos, "\tCTS Kill msk idx %d\n",
+                                mvm->bt_cts_kill_msk[0]);
 
        } else {
                struct iwl_bt_coex_ci_cmd *cmd = &mvm->last_bt_ci_cmd;
@@ -579,21 +582,6 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
                pos += scnprintf(buf+pos, bufsz-pos,
                               "\tSecondary Channel Bitmap 0x%016llx\n",
                               le64_to_cpu(cmd->bt_secondary_ci));
-
-               pos += scnprintf(buf+pos, bufsz-pos, "BT Configuration CMD\n");
-               pos += scnprintf(buf+pos, bufsz-pos,
-                                "\tPrimary: ACK Kill Mask 0x%08x\n",
-                                iwl_bt_ctl_kill_msk[mvm->bt_ack_kill_msk[0]]);
-               pos += scnprintf(buf+pos, bufsz-pos,
-                                "\tPrimary: CTS Kill Mask 0x%08x\n",
-                                iwl_bt_ctl_kill_msk[mvm->bt_cts_kill_msk[0]]);
-               pos += scnprintf(buf+pos, bufsz-pos,
-                                "\tSecondary: ACK Kill Mask 0x%08x\n",
-                                iwl_bt_ctl_kill_msk[mvm->bt_ack_kill_msk[1]]);
-               pos += scnprintf(buf+pos, bufsz-pos,
-                                "\tSecondary: CTS Kill Mask 0x%08x\n",
-                                iwl_bt_ctl_kill_msk[mvm->bt_cts_kill_msk[1]]);
-
        }
 
        mutex_unlock(&mvm->mutex);
@@ -930,7 +918,8 @@ iwl_dbgfs_scan_ant_rxchain_write(struct iwl_mvm *mvm, char *buf,
 
        if (mvm->scan_rx_ant != scan_rx_ant) {
                mvm->scan_rx_ant = scan_rx_ant;
-               if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)
+               if (fw_has_capa(&mvm->fw->ucode_capa,
+                               IWL_UCODE_TLV_CAPA_UMAC_SCAN))
                        iwl_mvm_config_scan(mvm);
        }
 
@@ -942,7 +931,7 @@ static ssize_t iwl_dbgfs_fw_dbg_conf_read(struct file *file,
                                          size_t count, loff_t *ppos)
 {
        struct iwl_mvm *mvm = file->private_data;
-       enum iwl_fw_dbg_conf conf;
+       int conf;
        char buf[8];
        const size_t bufsz = sizeof(buf);
        int pos = 0;
@@ -966,7 +955,7 @@ static ssize_t iwl_dbgfs_fw_dbg_conf_write(struct iwl_mvm *mvm,
        if (ret)
                return ret;
 
-       if (WARN_ON(conf_id >= FW_DBG_MAX))
+       if (WARN_ON(conf_id >= FW_DBG_CONF_MAX))
                return -EINVAL;
 
        mutex_lock(&mvm->mutex);
@@ -985,7 +974,7 @@ static ssize_t iwl_dbgfs_fw_dbg_collect_write(struct iwl_mvm *mvm,
        if (ret)
                return ret;
 
-       iwl_mvm_fw_dbg_collect(mvm);
+       iwl_mvm_fw_dbg_collect(mvm, FW_DBG_TRIGGER_USER, NULL, 0, 0);
 
        iwl_mvm_unref(mvm, IWL_MVM_REF_PRPH_WRITE);
 
@@ -1370,6 +1359,7 @@ static ssize_t iwl_dbgfs_d0i3_refs_read(struct file *file,
        PRINT_MVM_REF(IWL_MVM_REF_UCODE_DOWN);
        PRINT_MVM_REF(IWL_MVM_REF_SCAN);
        PRINT_MVM_REF(IWL_MVM_REF_ROC);
+       PRINT_MVM_REF(IWL_MVM_REF_ROC_AUX);
        PRINT_MVM_REF(IWL_MVM_REF_P2P_CLIENT);
        PRINT_MVM_REF(IWL_MVM_REF_AP_IBSS);
        PRINT_MVM_REF(IWL_MVM_REF_USER);
@@ -1487,26 +1477,6 @@ out:
        return count;
 }
 
-static ssize_t iwl_dbgfs_enable_scan_iteration_notif_write(struct iwl_mvm *mvm,
-                                                          char *buf,
-                                                          size_t count,
-                                                          loff_t *ppos)
-{
-       int val;
-
-       mutex_lock(&mvm->mutex);
-
-       if (kstrtoint(buf, 10, &val)) {
-               mutex_unlock(&mvm->mutex);
-               return -EINVAL;
-       }
-
-       mvm->scan_iter_notif_enabled = val;
-       mutex_unlock(&mvm->mutex);
-
-       return count;
-}
-
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64);
 
 /* Device wide debugfs entries */
@@ -1529,7 +1499,6 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain, 8);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(d0i3_refs, 8);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(fw_dbg_conf, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(fw_dbg_collect, 8);
-MVM_DEBUGFS_WRITE_FILE_OPS(enable_scan_iteration_notif, 8);
 
 #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters, 256);
@@ -1573,8 +1542,11 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
        MVM_DEBUGFS_ADD_FILE(d0i3_refs, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(fw_dbg_conf, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(fw_dbg_collect, mvm->debugfs_dir, S_IWUSR);
-       MVM_DEBUGFS_ADD_FILE(enable_scan_iteration_notif, mvm->debugfs_dir,
-                            S_IWUSR);
+       if (!debugfs_create_bool("enable_scan_iteration_notif",
+                                S_IRUSR | S_IWUSR,
+                                mvm->debugfs_dir,
+                                &mvm->scan_iter_notif_enabled))
+               goto err;
 
 #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
        if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING) {
@@ -1601,6 +1573,9 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
        if (!debugfs_create_bool("d3_wake_sysassert", S_IRUSR | S_IWUSR,
                                 mvm->debugfs_dir, &mvm->d3_wake_sysassert))
                goto err;
+       if (!debugfs_create_u32("last_netdetect_scans", S_IRUSR,
+                               mvm->debugfs_dir, &mvm->last_netdetect_scans))
+               goto err;
        MVM_DEBUGFS_ADD_FILE(netdetect, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
 #endif