1 From 88001968245c42c26416476bf0ef960442371605 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Mon, 14 May 2018 08:48:20 +0200
4 Subject: [PATCH] brcmfmac: add debugfs entry for reading firmware capabilities
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 This allows reading all capabilities as reported by a firmware. They are
10 printed using native (raw) names, just like developers like it the most.
11 It's how firmware reports support for various features, e.g. supported
12 modes, supported standards, power saving details, max BSS-es.
14 Access to all that info is useful for trying new firmwares, comparing
15 them and debugging features AKA bugs.
17 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
18 Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
19 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
21 .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++
22 1 file changed, 36 insertions(+)
24 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
25 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
26 @@ -138,6 +138,41 @@ static void brcmf_feat_firmware_capabili
31 + * brcmf_feat_fwcap_debugfs_read() - expose firmware capabilities to debugfs.
33 + * @seq: sequence for debugfs entry.
34 + * @data: raw data pointer.
36 +static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
38 + struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
39 + struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0);
40 + char caps[MAX_CAPS_BUFFER_SIZE + 1] = { };
44 + err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
46 + brcmf_err("could not get firmware cap (%d)\n", err);
50 + /* Put every capability in a new line */
51 + for (tmp = caps; *tmp; tmp++) {
56 + /* Usually there is a space at the end of capabilities string */
57 + seq_printf(seq, "%s", caps);
58 + /* So make sure we don't print two line breaks */
59 + if (tmp > caps && *(tmp - 1) != '\n')
60 + seq_printf(seq, "\n");
65 void brcmf_feat_attach(struct brcmf_pub *drvr)
67 struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
68 @@ -196,6 +231,7 @@ void brcmf_feat_attach(struct brcmf_pub
71 brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read);
72 + brcmf_debugfs_add_entry(drvr, "fwcap", brcmf_feat_fwcap_debugfs_read);
75 bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id)