From patchwork Mon May 14 06:48:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 10396811 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4FD1960216 for ; Mon, 14 May 2018 06:49:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DE7428E11 for ; Mon, 14 May 2018 06:49:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31F7928E6C; Mon, 14 May 2018 06:49:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A563928E11 for ; Mon, 14 May 2018 06:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752026AbeENGtd (ORCPT ); Mon, 14 May 2018 02:49:33 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:37929 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751953AbeENGtc (ORCPT ); Mon, 14 May 2018 02:49:32 -0400 Received: by mail-lf0-f65.google.com with SMTP id z142-v6so16223875lff.5 for ; Sun, 13 May 2018 23:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CkKSpf8vz7RZuRbqy9JDr3iQx/KzCT6FKFwAtqL3Lck=; b=M0XSRFkNpP3i5xzbObsbTDKw9AMmPNQgTYBInUY1d6p92LxJ82AIBKhtemT28zu74H JEqy23aJXoAynK+ZFQPXp3VztSpPYlLEvLHPaitqUT5aDNqGKXZkRvN9RIqlk/bOnVFX DX9Tw06uLifp4EfEmu+ChOaDQeHjXq2AgkcKTQDaCEUhHVts/urpH31swqC8b6HvYPok mLIyYeeIUg9i1C/WWzrPjuhcIhiE7GMB8VxUhmhlTyVeM1Wc86r9T1TxcTalllb8mZDP gcvHfBs/ULlMoZdbn6gOZGCLUD5/zBwDTEzXlD2qMGtiGbbbsojpZtldk/1KBGPjyT0y 6O7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CkKSpf8vz7RZuRbqy9JDr3iQx/KzCT6FKFwAtqL3Lck=; b=lrCn8X6Cx+VtsrPfzslLKcmFzD/8rOZiRwY1YGyopislqtvCZUqApgC/0qD0e5cplM ktqYFyoaBuuaQagzCpbhA1tGhsu/sJWbCjUTgLJNJAWC5MbWitnAhGX7HVCA1gOvRcHc UgqQnxs8uiBufjCAsQVVH0nbLGaV0tEB1UYY6cIpQt09P+/Ziz2EmUdh5t7ioFbbKZc6 GPUcHPgebZaiHkLclTxU2cKixfeZRYlguRWz40ihsl4nY9IkGkSzXchmmjUruab7VRj4 slB6FF8Sqtb0DIF3cpgryAzTRiEOsv84GFkG53JiNg0IZcm4CHLQ01zuxEe4epf/vvmj 8o7A== X-Gm-Message-State: ALKqPwfLOevWk/1u6z2zUAB13g2envncu5qrbd1OzeQUw8CM+L2AxHUP cwy81IT0m+HSyjtORp2aNV8= X-Google-Smtp-Source: AB8JxZr4tYftCElLtOvarZRnD3T0kc+GZF7IL9bEvpRD+/On7JwBOE54zX5TpPhc+n46iVuQr3GpTw== X-Received: by 2002:a2e:7a0c:: with SMTP id v12-v6mr3615407ljc.79.1526280571216; Sun, 13 May 2018 23:49:31 -0700 (PDT) Received: from linux-veee.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id q7-v6sm2205280lfc.91.2018.05.13.23.49.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 13 May 2018 23:49:30 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Pieter-Paul Giesberts , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH V2] brcmfmac: add debugfs entry for reading firmware capabilities Date: Mon, 14 May 2018 08:48:20 +0200 Message-Id: <20180514064820.24305-1-zajec5@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180511101526.10734-1-zajec5@gmail.com> References: <20180511101526.10734-1-zajec5@gmail.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafał Miłecki 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 Reviewed-by: Arend van Spriel --- V2: Use "fwcap" as debugfs entry Rename function to the brcmf_feat_fwcap_debugfs_read() --- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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)