aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorRoee Zamir <roee.zamir@intel.com>2016-08-02 06:55:13 -0400
committerLuca Coelho <luciano.coelho@intel.com>2016-09-19 04:29:28 -0400
commitb3bee580b1e200e4fc14091e3e118ae8280dc06c (patch)
treef60fd745403e395d9d5689c46e84c6e89e50b87c /drivers/net/wireless
parent5a41a86c525a53d31a229dd358f70d6b4b5a7bbc (diff)
iwlwifi: mvm: Add debugfs function for clocks diff
New function, reveals the diff between gp2 and host time. Signed-off-by: Roee Zamir <roee.zamir@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c26
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/utils.c22
3 files changed, 49 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
index b23271755daf..8ff19210ef1e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
@@ -504,6 +504,28 @@ static inline char *iwl_dbgfs_is_match(char *name, char *buf)
504 return !strncmp(name, buf, len) ? buf + len : NULL; 504 return !strncmp(name, buf, len) ? buf + len : NULL;
505} 505}
506 506
507static ssize_t iwl_dbgfs_os_device_timediff_read(struct file *file,
508 char __user *user_buf,
509 size_t count, loff_t *ppos)
510{
511 struct ieee80211_vif *vif = file->private_data;
512 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
513 struct iwl_mvm *mvm = mvmvif->mvm;
514 u32 curr_gp2;
515 u64 curr_os;
516 s64 diff;
517 char buf[64];
518 const size_t bufsz = sizeof(buf);
519 int pos = 0;
520
521 iwl_mvm_get_sync_time(mvm, &curr_gp2, &curr_os);
522 do_div(curr_os, NSEC_PER_USEC);
523 diff = curr_os - curr_gp2;
524 pos += scnprintf(buf + pos, bufsz - pos, "diff=%lld\n", diff);
525
526 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
527}
528
507static ssize_t iwl_dbgfs_tof_enable_write(struct ieee80211_vif *vif, 529static ssize_t iwl_dbgfs_tof_enable_write(struct ieee80211_vif *vif,
508 char *buf, 530 char *buf,
509 size_t count, loff_t *ppos) 531 size_t count, loff_t *ppos)
@@ -1530,6 +1552,8 @@ MVM_DEBUGFS_READ_FILE_OPS(tof_range_response);
1530MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_responder_params, 32); 1552MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_responder_params, 32);
1531MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32); 1553MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32);
1532MVM_DEBUGFS_WRITE_FILE_OPS(lqm_send_cmd, 64); 1554MVM_DEBUGFS_WRITE_FILE_OPS(lqm_send_cmd, 64);
1555MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff);
1556
1533 1557
1534void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 1558void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
1535{ 1559{
@@ -1570,6 +1594,8 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
1570 MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir, 1594 MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir,
1571 S_IRUSR | S_IWUSR); 1595 S_IRUSR | S_IWUSR);
1572 MVM_DEBUGFS_ADD_FILE_VIF(lqm_send_cmd, mvmvif->dbgfs_dir, S_IWUSR); 1596 MVM_DEBUGFS_ADD_FILE_VIF(lqm_send_cmd, mvmvif->dbgfs_dir, S_IWUSR);
1597 MVM_DEBUGFS_ADD_FILE_VIF(os_device_timediff,
1598 mvmvif->dbgfs_dir, S_IRUSR);
1573 1599
1574 if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && 1600 if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
1575 mvmvif == mvm->bf_allowed_vif) 1601 mvmvif == mvm->bf_allowed_vif)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index e68a2bdc84ed..b7cfdcbcf95b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1268,6 +1268,7 @@ u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
1268void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm); 1268void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
1269u8 first_antenna(u8 mask); 1269u8 first_antenna(u8 mask);
1270u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx); 1270u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx);
1271void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime);
1271 1272
1272/* Tx / Host Commands */ 1273/* Tx / Host Commands */
1273int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm, 1274int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
index 7c138fedcb19..9e366e28c983 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
@@ -1225,6 +1225,28 @@ void iwl_mvm_inactivity_check(struct iwl_mvm *mvm)
1225 rcu_read_unlock(); 1225 rcu_read_unlock();
1226} 1226}
1227 1227
1228void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime)
1229{
1230 bool ps_disabled;
1231
1232 lockdep_assert_held(&mvm->mutex);
1233
1234 /* Disable power save when reading GP2 */
1235 ps_disabled = mvm->ps_disabled;
1236 if (!ps_disabled) {
1237 mvm->ps_disabled = true;
1238 iwl_mvm_power_update_device(mvm);
1239 }
1240
1241 *gp2 = iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG);
1242 *boottime = ktime_get_boot_ns();
1243
1244 if (!ps_disabled) {
1245 mvm->ps_disabled = ps_disabled;
1246 iwl_mvm_power_update_device(mvm);
1247 }
1248}
1249
1228int iwl_mvm_send_lqm_cmd(struct ieee80211_vif *vif, 1250int iwl_mvm_send_lqm_cmd(struct ieee80211_vif *vif,
1229 enum iwl_lqm_cmd_operatrions operation, 1251 enum iwl_lqm_cmd_operatrions operation,
1230 u32 duration, u32 timeout) 1252 u32 duration, u32 timeout)