From patchwork Thu May 19 11:02:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9126391 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F87FBF29F for ; Thu, 19 May 2016 11:04:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C809820221 for ; Thu, 19 May 2016 11:04:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D354A2021F for ; Thu, 19 May 2016 11:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754324AbcESLDd (ORCPT ); Thu, 19 May 2016 07:03:33 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33937 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932183AbcESLD3 (ORCPT ); Thu, 19 May 2016 07:03:29 -0400 Received: by mail-lf0-f66.google.com with SMTP id m101so5360748lfi.1; Thu, 19 May 2016 04:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qQIb61+M/YclnDh/4wOm9pJTSAVseYKgh+Atfl6R808=; b=x/yO15vLv8o/jJH5AppriqCsm/biyV+fNMPcRceADFCn5742CZFy3Dx/OLt0wZRybJ +eVrmZNvezu3gUQKOvLyRb6+2nulXlHDymR4xm3PZAEU6Ss14Qvv1MFtHSlNe053VSoG ORUYCaG4kyowy4fyPtVIr96LHGzLaJRzibn2bBZf/aV+Zb7bsM9WDrWp9uJ96mn+KM07 FDl88EjEOtp08TUeOXT2agHqw7Jw30xqN3TYwUQ6FizPGPlDbGNB8hWnAvjJazBDww/I KUr47hIq7m2o3nPyHiIfPcqcYTkYZpSVAdG6emnrrA1YYBXtgEc1JTVpR/0aXnHDwH1T P+lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qQIb61+M/YclnDh/4wOm9pJTSAVseYKgh+Atfl6R808=; b=cPplUIH9PIY0krlSIQSEqHaIU0sVUuWoxu3hE+29CmRMP2gvvMZASdBGYmTeyf9xsU C6bkL6KXn/4ETpp2i+B6DdyFyt5Kx2neiDtJHwWGW5eyBihoGZCqkzTlRPpeHh7BEqX9 fe2lx2Q0bqVFSLV+aJZYuLXLL8A7H/fqNVE6z3aQ3DKjsZmioHjEDzZtkHBmJ6Xz41+I wbETr9Lx2cWDuwo5m/iMW786nhnShY6i6FF4jOACBOPr68Ks3JPjGwRqa4j/mhoc8DK3 R92RNe//ddzrCgI1MUNo8SirAUJupwC9Jd/TjTm229UuplmBP1v6hWjx5giBmkskMy3A 3hFA== X-Gm-Message-State: AOPr4FWvhdSNSPRVso3hi/KlMZaaeU4P+3CVWED9RgqXv9/UTDiL3h9NaAzBiHfMns8x5Q== X-Received: by 10.25.20.196 with SMTP id 65mr3577652lfu.149.1463655807164; Thu, 19 May 2016 04:03:27 -0700 (PDT) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id wc3sm174309lbb.27.2016.05.19.04.03.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 04:03:26 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Brett Rudley , Arend van Spriel , "Franky (Zhenhui) Lin" , Hante Meuleman , Pieter-Paul Giesberts , linux-wireless@vger.kernel.org (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), brcm80211-dev-list@broadcom.com (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 4.8 2/2] brcmfmac: support get_channel cfg80211 callback Date: Thu, 19 May 2016 13:02:22 +0200 Message-Id: <1463655770-22467-2-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1463655770-22467-1-git-send-email-zajec5@gmail.com> References: <1463655770-22467-1-git-send-email-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-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is important for brcmfmac as the firmware may pick different channel than requested. This has been tested with BCM4366B1 (in D-Link DIR-885L). Signed-off-by: Rafa? Mi?ecki --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 597495d..4fb9e3a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -4892,6 +4892,64 @@ exit: return err; } +static int brcmf_cfg80211_get_channel(struct wiphy *wiphy, + struct wireless_dev *wdev, + struct cfg80211_chan_def *chandef) +{ + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct net_device *ndev = wdev->netdev; + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmu_chan ch; + enum nl80211_band band = 0; + enum nl80211_chan_width width = 0; + u32 chanspec; + int freq, err; + + err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec); + if (err) { + brcmf_err("chanspec failed (%d)\n", err); + return err; + } + + ch.chspec = chanspec; + cfg->d11inf.decchspec(&ch); + + switch (ch.band) { + case BRCMU_CHAN_BAND_2G: + band = NL80211_BAND_2GHZ; + break; + case BRCMU_CHAN_BAND_5G: + band = NL80211_BAND_5GHZ; + break; + } + + switch (ch.bw) { + case BRCMU_CHAN_BW_80: + width = NL80211_CHAN_WIDTH_80; + break; + case BRCMU_CHAN_BW_40: + width = NL80211_CHAN_WIDTH_40; + break; + case BRCMU_CHAN_BW_20: + width = NL80211_CHAN_WIDTH_20; + break; + case BRCMU_CHAN_BW_80P80: + width = NL80211_CHAN_WIDTH_80P80; + break; + case BRCMU_CHAN_BW_160: + width = NL80211_CHAN_WIDTH_160; + break; + } + + freq = ieee80211_channel_to_frequency(ch.control_ch_num, band); + chandef->chan = ieee80211_get_channel(wiphy, freq); + chandef->width = width; + chandef->center_freq1 = ieee80211_channel_to_frequency(ch.chnum, band); + chandef->center_freq2 = 0; + + return 0; +} + static int brcmf_cfg80211_crit_proto_start(struct wiphy *wiphy, struct wireless_dev *wdev, enum nl80211_crit_proto_id proto, @@ -5054,6 +5112,7 @@ static struct cfg80211_ops brcmf_cfg80211_ops = { .mgmt_tx = brcmf_cfg80211_mgmt_tx, .remain_on_channel = brcmf_p2p_remain_on_channel, .cancel_remain_on_channel = brcmf_cfg80211_cancel_remain_on_channel, + .get_channel = brcmf_cfg80211_get_channel, .start_p2p_device = brcmf_p2p_start_device, .stop_p2p_device = brcmf_p2p_stop_device, .crit_proto_start = brcmf_cfg80211_crit_proto_start,