aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index 7d18f466fbb3..d98ee109c5e9 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -6,6 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 12 * it under the terms of version 2 of the GNU General Public License as
@@ -31,6 +32,7 @@
31 * BSD LICENSE 32 * BSD LICENSE
32 * 33 *
33 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 34 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
34 * All rights reserved. 36 * All rights reserved.
35 * 37 *
36 * Redistribution and use in source and binary forms, with or without 38 * Redistribution and use in source and binary forms, with or without
@@ -257,6 +259,70 @@ static ssize_t iwl_dbgfs_sram_write(struct iwl_mvm *mvm, char *buf,
257 return count; 259 return count;
258} 260}
259 261
262static ssize_t iwl_dbgfs_set_nic_temperature_read(struct file *file,
263 char __user *user_buf,
264 size_t count, loff_t *ppos)
265{
266 struct iwl_mvm *mvm = file->private_data;
267 char buf[16];
268 int pos;
269
270 if (!mvm->temperature_test)
271 pos = scnprintf(buf , sizeof(buf), "disabled\n");
272 else
273 pos = scnprintf(buf , sizeof(buf), "%d\n", mvm->temperature);
274
275 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
276}
277
278/*
279 * Set NIC Temperature
280 * Cause the driver to ignore the actual NIC temperature reported by the FW
281 * Enable: any value between IWL_MVM_DEBUG_SET_TEMPERATURE_MIN -
282 * IWL_MVM_DEBUG_SET_TEMPERATURE_MAX
283 * Disable: IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE
284 */
285static ssize_t iwl_dbgfs_set_nic_temperature_write(struct iwl_mvm *mvm,
286 char *buf, size_t count,
287 loff_t *ppos)
288{
289 int temperature;
290
291 if (kstrtoint(buf, 10, &temperature))
292 return -EINVAL;
293 /* not a legal temperature */
294 if ((temperature > IWL_MVM_DEBUG_SET_TEMPERATURE_MAX &&
295 temperature != IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE) ||
296 temperature < IWL_MVM_DEBUG_SET_TEMPERATURE_MIN)
297 return -EINVAL;
298
299 mutex_lock(&mvm->mutex);
300 if (temperature == IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE) {
301 if (!mvm->temperature_test)
302 goto out;
303
304 mvm->temperature_test = false;
305 /* Since we can't read the temp while awake, just set
306 * it to zero until we get the next RX stats from the
307 * firmware.
308 */
309 mvm->temperature = 0;
310 } else {
311 mvm->temperature_test = true;
312 mvm->temperature = temperature;
313 }
314 IWL_DEBUG_TEMP(mvm, "%sabling debug set temperature (temp = %d)\n",
315 mvm->temperature_test ? "En" : "Dis" ,
316 mvm->temperature);
317 /* handle the temperature change */
318 iwl_mvm_tt_handler(mvm);
319
320out:
321 mutex_unlock(&mvm->mutex);
322
323 return count;
324}
325
260static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, 326static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
261 size_t count, loff_t *ppos) 327 size_t count, loff_t *ppos)
262{ 328{
@@ -1296,6 +1362,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64);
1296MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16); 1362MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16);
1297MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8); 1363MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8);
1298MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram, 64); 1364MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram, 64);
1365MVM_DEBUGFS_READ_WRITE_FILE_OPS(set_nic_temperature, 64);
1299MVM_DEBUGFS_READ_FILE_OPS(stations); 1366MVM_DEBUGFS_READ_FILE_OPS(stations);
1300MVM_DEBUGFS_READ_FILE_OPS(bt_notif); 1367MVM_DEBUGFS_READ_FILE_OPS(bt_notif);
1301MVM_DEBUGFS_READ_FILE_OPS(bt_cmd); 1368MVM_DEBUGFS_READ_FILE_OPS(bt_cmd);
@@ -1336,6 +1403,8 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
1336 MVM_DEBUGFS_ADD_FILE(tx_flush, mvm->debugfs_dir, S_IWUSR); 1403 MVM_DEBUGFS_ADD_FILE(tx_flush, mvm->debugfs_dir, S_IWUSR);
1337 MVM_DEBUGFS_ADD_FILE(sta_drain, mvm->debugfs_dir, S_IWUSR); 1404 MVM_DEBUGFS_ADD_FILE(sta_drain, mvm->debugfs_dir, S_IWUSR);
1338 MVM_DEBUGFS_ADD_FILE(sram, mvm->debugfs_dir, S_IWUSR | S_IRUSR); 1405 MVM_DEBUGFS_ADD_FILE(sram, mvm->debugfs_dir, S_IWUSR | S_IRUSR);
1406 MVM_DEBUGFS_ADD_FILE(set_nic_temperature, mvm->debugfs_dir,
1407 S_IWUSR | S_IRUSR);
1339 MVM_DEBUGFS_ADD_FILE(stations, dbgfs_dir, S_IRUSR); 1408 MVM_DEBUGFS_ADD_FILE(stations, dbgfs_dir, S_IRUSR);
1340 MVM_DEBUGFS_ADD_FILE(fw_error_dump, dbgfs_dir, S_IRUSR); 1409 MVM_DEBUGFS_ADD_FILE(fw_error_dump, dbgfs_dir, S_IRUSR);
1341 MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, S_IRUSR); 1410 MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, S_IRUSR);
@@ -1380,6 +1449,13 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
1380 goto err; 1449 goto err;
1381#endif 1450#endif
1382 1451
1452 if (!debugfs_create_u8("low_latency_agg_frame_limit", S_IRUSR | S_IWUSR,
1453 mvm->debugfs_dir,
1454 &mvm->low_latency_agg_frame_limit))
1455 goto err;
1456 if (!debugfs_create_u8("ps_disabled", S_IRUSR,
1457 mvm->debugfs_dir, &mvm->ps_disabled))
1458 goto err;
1383 if (!debugfs_create_blob("nvm_hw", S_IRUSR, 1459 if (!debugfs_create_blob("nvm_hw", S_IRUSR,
1384 mvm->debugfs_dir, &mvm->nvm_hw_blob)) 1460 mvm->debugfs_dir, &mvm->nvm_hw_blob))
1385 goto err; 1461 goto err;