aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2013-11-29 06:25:24 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-12-02 14:25:26 -0500
commit7d68849f40cd9169088249cc889d95c8998c3fb8 (patch)
tree9bee52a5f83b717e27acb6d055c6bbd737cec76b
parent01376a07bcf72fdad1ed5ed906025ca786d333dc (diff)
brcmfmac: expose chip information through debugfs
Adding the debugfs file <debugfs_mnt>/brcmfmac/<devid>/chipinfo which contains the chip number and revision. Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
index 0f9e9057e7dd..03fe8aca4d32 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
@@ -22,7 +22,6 @@
22#include "dhd.h" 22#include "dhd.h"
23#include "dhd_bus.h" 23#include "dhd_bus.h"
24#include "dhd_dbg.h" 24#include "dhd_dbg.h"
25#include "tracepoint.h"
26 25
27static struct dentry *root_folder; 26static struct dentry *root_folder;
28 27
@@ -42,6 +41,40 @@ void brcmf_debugfs_exit(void)
42 root_folder = NULL; 41 root_folder = NULL;
43} 42}
44 43
44static
45ssize_t brcmf_debugfs_chipinfo_read(struct file *f, char __user *data,
46 size_t count, loff_t *ppos)
47{
48 struct brcmf_pub *drvr = f->private_data;
49 struct brcmf_bus *bus = drvr->bus_if;
50 char buf[40];
51 int res;
52
53 /* only allow read from start */
54 if (*ppos > 0)
55 return 0;
56
57 res = scnprintf(buf, sizeof(buf), "chip: %x(%u) rev %u\n",
58 bus->chip, bus->chip, bus->chiprev);
59 return simple_read_from_buffer(data, count, ppos, buf, res);
60}
61
62static const struct file_operations brcmf_debugfs_chipinfo_ops = {
63 .owner = THIS_MODULE,
64 .open = simple_open,
65 .read = brcmf_debugfs_chipinfo_read
66};
67
68static int brcmf_debugfs_create_chipinfo(struct brcmf_pub *drvr)
69{
70 struct dentry *dentry = drvr->dbgfs_dir;
71
72 if (!IS_ERR_OR_NULL(dentry))
73 debugfs_create_file("chipinfo", S_IRUGO, dentry, drvr,
74 &brcmf_debugfs_chipinfo_ops);
75 return 0;
76}
77
45int brcmf_debugfs_attach(struct brcmf_pub *drvr) 78int brcmf_debugfs_attach(struct brcmf_pub *drvr)
46{ 79{
47 struct device *dev = drvr->bus_if->dev; 80 struct device *dev = drvr->bus_if->dev;
@@ -50,6 +83,7 @@ int brcmf_debugfs_attach(struct brcmf_pub *drvr)
50 return -ENODEV; 83 return -ENODEV;
51 84
52 drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder); 85 drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
86 brcmf_debugfs_create_chipinfo(drvr);
53 return PTR_ERR_OR_ZERO(drvr->dbgfs_dir); 87 return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
54} 88}
55 89