summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/broadcom
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2018-05-14 09:48:20 +0300
committerKalle Valo <kvalo@codeaurora.org>2018-05-23 11:01:35 +0300
commit88001968245c42c26416476bf0ef960442371605 (patch)
tree9f881a28019c437935237fe0525b5191553fb2f1 /drivers/net/wireless/broadcom
parent30bfce0b63fa68c14ae1613eb9d259fa18644074 (diff)
downloadlinux-88001968245c42c26416476bf0ef960442371605.tar.xz
brcmfmac: add debugfs entry for reading firmware capabilities
This allows reading all capabilities as reported by a firmware. They are printed using native (raw) names, just like developers like it the most. It's how firmware reports support for various features, e.g. supported modes, supported standards, power saving details, max BSS-es. Access to all that info is useful for trying new firmwares, comparing them and debugging features AKA bugs. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/broadcom')
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
index 876731c57bf5..800a423c7bc2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
@@ -165,6 +165,41 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)
}
}
+/**
+ * brcmf_feat_fwcap_debugfs_read() - expose firmware capabilities to debugfs.
+ *
+ * @seq: sequence for debugfs entry.
+ * @data: raw data pointer.
+ */
+static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
+{
+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
+ struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0);
+ char caps[MAX_CAPS_BUFFER_SIZE + 1] = { };
+ char *tmp;
+ int err;
+
+ err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
+ if (err) {
+ brcmf_err("could not get firmware cap (%d)\n", err);
+ return err;
+ }
+
+ /* Put every capability in a new line */
+ for (tmp = caps; *tmp; tmp++) {
+ if (*tmp == ' ')
+ *tmp = '\n';
+ }
+
+ /* Usually there is a space at the end of capabilities string */
+ seq_printf(seq, "%s", caps);
+ /* So make sure we don't print two line breaks */
+ if (tmp > caps && *(tmp - 1) != '\n')
+ seq_printf(seq, "\n");
+
+ return 0;
+}
+
void brcmf_feat_attach(struct brcmf_pub *drvr)
{
struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
@@ -233,6 +268,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
void brcmf_feat_debugfs_create(struct brcmf_pub *drvr)
{
brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read);
+ brcmf_debugfs_add_entry(drvr, "fwcap", brcmf_feat_fwcap_debugfs_read);
}
bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id)