aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2018-08-16 11:26:10 +0200
committerRafał Miłecki <rafal@milecki.pl>2018-08-16 13:15:06 +0200
commit9d8940c5b92fda3385112264c808127b8047f159 (patch)
tree25358ef78f73ba8af7e4e8969c3a88ddec37f297 /package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch
parent84ef414bd422f0725e8b9416de53da07ed889fd0 (diff)
downloadupstream-9d8940c5b92fda3385112264c808127b8047f159.tar.gz
upstream-9d8940c5b92fda3385112264c808127b8047f159.tar.bz2
upstream-9d8940c5b92fda3385112264c808127b8047f159.zip
mac80211: brcmfmac: backport important changes from the 4.18
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch')
-rw-r--r--package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch b/package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch
new file mode 100644
index 0000000000..71ed06786d
--- /dev/null
+++ b/package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch
@@ -0,0 +1,75 @@
+From 88001968245c42c26416476bf0ef960442371605 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Mon, 14 May 2018 08:48:20 +0200
+Subject: [PATCH] brcmfmac: add debugfs entry for reading firmware capabilities
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+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>
+---
+ .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++
+ 1 file changed, 36 insertions(+)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+@@ -138,6 +138,41 @@ static void brcmf_feat_firmware_capabili
+ }
+ }
+
++/**
++ * 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);
+@@ -196,6 +231,7 @@ void brcmf_feat_attach(struct brcmf_pub
+ }
+
+ 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)