aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.c127
1 files changed, 117 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 301081db1ef6..8fa606a9c4dd 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -124,10 +124,14 @@ EXPORT_SYMBOL(ath10k_info);
124 124
125void ath10k_print_driver_info(struct ath10k *ar) 125void ath10k_print_driver_info(struct ath10k *ar)
126{ 126{
127 ath10k_info(ar, "%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d wmi %d cal %s max_sta %d\n", 127 ath10k_info(ar, "%s (0x%08x, 0x%08x%s%s%s) fw %s api %d htt %d.%d wmi %d cal %s max_sta %d\n",
128 ar->hw_params.name, 128 ar->hw_params.name,
129 ar->target_version, 129 ar->target_version,
130 ar->chip_id, 130 ar->chip_id,
131 (strlen(ar->spec_board_id) > 0 ? ", " : ""),
132 ar->spec_board_id,
133 (strlen(ar->spec_board_id) > 0 && !ar->spec_board_loaded
134 ? " fallback" : ""),
131 ar->hw->wiphy->fw_version, 135 ar->hw->wiphy->fw_version,
132 ar->fw_api, 136 ar->fw_api,
133 ar->htt.target_version_major, 137 ar->htt.target_version_major,
@@ -380,12 +384,12 @@ unlock:
380 384
381static int ath10k_debug_fw_stats_request(struct ath10k *ar) 385static int ath10k_debug_fw_stats_request(struct ath10k *ar)
382{ 386{
383 unsigned long timeout; 387 unsigned long timeout, time_left;
384 int ret; 388 int ret;
385 389
386 lockdep_assert_held(&ar->conf_mutex); 390 lockdep_assert_held(&ar->conf_mutex);
387 391
388 timeout = jiffies + msecs_to_jiffies(1*HZ); 392 timeout = jiffies + msecs_to_jiffies(1 * HZ);
389 393
390 ath10k_debug_fw_stats_reset(ar); 394 ath10k_debug_fw_stats_reset(ar);
391 395
@@ -395,18 +399,16 @@ static int ath10k_debug_fw_stats_request(struct ath10k *ar)
395 399
396 reinit_completion(&ar->debug.fw_stats_complete); 400 reinit_completion(&ar->debug.fw_stats_complete);
397 401
398 ret = ath10k_wmi_request_stats(ar, 402 ret = ath10k_wmi_request_stats(ar, ar->fw_stats_req_mask);
399 WMI_STAT_PDEV |
400 WMI_STAT_VDEV |
401 WMI_STAT_PEER);
402 if (ret) { 403 if (ret) {
403 ath10k_warn(ar, "could not request stats (%d)\n", ret); 404 ath10k_warn(ar, "could not request stats (%d)\n", ret);
404 return ret; 405 return ret;
405 } 406 }
406 407
407 ret = wait_for_completion_timeout(&ar->debug.fw_stats_complete, 408 time_left =
408 1*HZ); 409 wait_for_completion_timeout(&ar->debug.fw_stats_complete,
409 if (ret == 0) 410 1 * HZ);
411 if (!time_left)
410 return -ETIMEDOUT; 412 return -ETIMEDOUT;
411 413
412 spin_lock_bh(&ar->data_lock); 414 spin_lock_bh(&ar->data_lock);
@@ -1708,6 +1710,61 @@ static int ath10k_debug_cal_data_release(struct inode *inode,
1708 return 0; 1710 return 0;
1709} 1711}
1710 1712
1713static ssize_t ath10k_write_ani_enable(struct file *file,
1714 const char __user *user_buf,
1715 size_t count, loff_t *ppos)
1716{
1717 struct ath10k *ar = file->private_data;
1718 int ret;
1719 u8 enable;
1720
1721 if (kstrtou8_from_user(user_buf, count, 0, &enable))
1722 return -EINVAL;
1723
1724 mutex_lock(&ar->conf_mutex);
1725
1726 if (ar->ani_enabled == enable) {
1727 ret = count;
1728 goto exit;
1729 }
1730
1731 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->ani_enable,
1732 enable);
1733 if (ret) {
1734 ath10k_warn(ar, "ani_enable failed from debugfs: %d\n", ret);
1735 goto exit;
1736 }
1737 ar->ani_enabled = enable;
1738
1739 ret = count;
1740
1741exit:
1742 mutex_unlock(&ar->conf_mutex);
1743
1744 return ret;
1745}
1746
1747static ssize_t ath10k_read_ani_enable(struct file *file, char __user *user_buf,
1748 size_t count, loff_t *ppos)
1749{
1750 struct ath10k *ar = file->private_data;
1751 int len = 0;
1752 char buf[32];
1753
1754 len = scnprintf(buf, sizeof(buf) - len, "%d\n",
1755 ar->ani_enabled);
1756
1757 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1758}
1759
1760static const struct file_operations fops_ani_enable = {
1761 .read = ath10k_read_ani_enable,
1762 .write = ath10k_write_ani_enable,
1763 .open = simple_open,
1764 .owner = THIS_MODULE,
1765 .llseek = default_llseek,
1766};
1767
1711static const struct file_operations fops_cal_data = { 1768static const struct file_operations fops_cal_data = {
1712 .open = ath10k_debug_cal_data_open, 1769 .open = ath10k_debug_cal_data_open,
1713 .read = ath10k_debug_cal_data_read, 1770 .read = ath10k_debug_cal_data_read,
@@ -1991,6 +2048,50 @@ static const struct file_operations fops_pktlog_filter = {
1991 .open = simple_open 2048 .open = simple_open
1992}; 2049};
1993 2050
2051static ssize_t ath10k_write_quiet_period(struct file *file,
2052 const char __user *ubuf,
2053 size_t count, loff_t *ppos)
2054{
2055 struct ath10k *ar = file->private_data;
2056 u32 period;
2057
2058 if (kstrtouint_from_user(ubuf, count, 0, &period))
2059 return -EINVAL;
2060
2061 if (period < ATH10K_QUIET_PERIOD_MIN) {
2062 ath10k_warn(ar, "Quiet period %u can not be lesser than 25ms\n",
2063 period);
2064 return -EINVAL;
2065 }
2066 mutex_lock(&ar->conf_mutex);
2067 ar->thermal.quiet_period = period;
2068 ath10k_thermal_set_throttling(ar);
2069 mutex_unlock(&ar->conf_mutex);
2070
2071 return count;
2072}
2073
2074static ssize_t ath10k_read_quiet_period(struct file *file, char __user *ubuf,
2075 size_t count, loff_t *ppos)
2076{
2077 char buf[32];
2078 struct ath10k *ar = file->private_data;
2079 int len = 0;
2080
2081 mutex_lock(&ar->conf_mutex);
2082 len = scnprintf(buf, sizeof(buf) - len, "%d\n",
2083 ar->thermal.quiet_period);
2084 mutex_unlock(&ar->conf_mutex);
2085
2086 return simple_read_from_buffer(ubuf, count, ppos, buf, len);
2087}
2088
2089static const struct file_operations fops_quiet_period = {
2090 .read = ath10k_read_quiet_period,
2091 .write = ath10k_write_quiet_period,
2092 .open = simple_open
2093};
2094
1994int ath10k_debug_create(struct ath10k *ar) 2095int ath10k_debug_create(struct ath10k *ar)
1995{ 2096{
1996 ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data)); 2097 ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data));
@@ -2068,6 +2169,9 @@ int ath10k_debug_register(struct ath10k *ar)
2068 debugfs_create_file("cal_data", S_IRUSR, ar->debug.debugfs_phy, 2169 debugfs_create_file("cal_data", S_IRUSR, ar->debug.debugfs_phy,
2069 ar, &fops_cal_data); 2170 ar, &fops_cal_data);
2070 2171
2172 debugfs_create_file("ani_enable", S_IRUSR | S_IWUSR,
2173 ar->debug.debugfs_phy, ar, &fops_ani_enable);
2174
2071 debugfs_create_file("nf_cal_period", S_IRUSR | S_IWUSR, 2175 debugfs_create_file("nf_cal_period", S_IRUSR | S_IWUSR,
2072 ar->debug.debugfs_phy, ar, &fops_nf_cal_period); 2176 ar->debug.debugfs_phy, ar, &fops_nf_cal_period);
2073 2177
@@ -2088,6 +2192,9 @@ int ath10k_debug_register(struct ath10k *ar)
2088 debugfs_create_file("pktlog_filter", S_IRUGO | S_IWUSR, 2192 debugfs_create_file("pktlog_filter", S_IRUGO | S_IWUSR,
2089 ar->debug.debugfs_phy, ar, &fops_pktlog_filter); 2193 ar->debug.debugfs_phy, ar, &fops_pktlog_filter);
2090 2194
2195 debugfs_create_file("quiet_period", S_IRUGO | S_IWUSR,
2196 ar->debug.debugfs_phy, ar, &fops_quiet_period);
2197
2091 return 0; 2198 return 0;
2092} 2199}
2093 2200