-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mvl8787: add debugfs for reading from scratch register
- Loading branch information
Showing
6 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include <linux/debugfs.h> | ||
#include "mwl8787.h" | ||
#include "sdio.h" | ||
|
||
static ssize_t | ||
mwl8787_scratch_read(struct file *file, char __user *ubuf, | ||
size_t count, loff_t *ppos) | ||
{ | ||
struct mwl8787_priv *priv = | ||
(struct mwl8787_priv *) file->private_data; | ||
|
||
char buf[17] = {}; | ||
int pos = 0, ret = 0; | ||
u64 reg_value; | ||
|
||
/* read scratch reg */ | ||
ret = mwl8787_read_scratch_area(priv, ®_value); | ||
|
||
if (ret) { | ||
ret = -EINVAL; | ||
goto done; | ||
} | ||
|
||
pos += snprintf(buf, sizeof(buf), "%016llx\n", reg_value); | ||
|
||
ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); | ||
done: | ||
return ret; | ||
} | ||
|
||
#define MWL8787_DFS_ADD_FILE(name) \ | ||
debugfs_create_file(#name, 0644, priv->dfs_dev_dir, \ | ||
priv, &mwl8787_dfs_##name##_fops); \ | ||
|
||
|
||
#define MWL8787_DFS_FILE_READ_OPS(name) \ | ||
static const struct file_operations mwl8787_dfs_##name##_fops = { \ | ||
.read = mwl8787_##name##_read, \ | ||
.open = simple_open, \ | ||
}; | ||
|
||
MWL8787_DFS_FILE_READ_OPS(scratch); | ||
|
||
/* | ||
* This function creates the debugfs directory and files. | ||
*/ | ||
void | ||
mwl8787_dev_debugfs_init(struct mwl8787_priv *priv) | ||
{ | ||
if (!priv) | ||
return; | ||
|
||
priv->dfs_dev_dir = debugfs_create_dir("mwl8787", | ||
priv->hw->wiphy->debugfsdir); | ||
|
||
MWL8787_DFS_ADD_FILE(scratch); | ||
} | ||
|
||
/* | ||
* This function removes the debugfs directory and files | ||
*/ | ||
void | ||
mwl8787_dev_debugfs_remove(struct mwl8787_priv *priv) | ||
{ | ||
if (!priv) | ||
return; | ||
|
||
debugfs_remove_recursive(priv->dfs_dev_dir); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
#include "mwl8787.h" | ||
#include "fw.h" | ||
#include "sdio.h" | ||
|
||
#define CREATE_TRACE_POINTS | ||
#include "trace.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters