From patchwork Mon Feb 20 05:06:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: c_traja@qti.qualcomm.com X-Patchwork-Id: 9581985 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 9AEEA6047C for ; Mon, 20 Feb 2017 05:07:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DF9526E5D for ; Mon, 20 Feb 2017 05:07:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8203C27F9A; Mon, 20 Feb 2017 05:07:06 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD0B426E5D for ; Mon, 20 Feb 2017 05:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=PigtH4AEUgrrblrfmEH9EoxL08BBxj92girY4vvWUzU=; b=uJRoTkqeHBoqnV Hb8ZHTHq3R0/oSGIqQjC/2qnhQ3ehBv6Fy9wMdwch/1su6x6RRLWB7ozqASM6BKf2nX1tVq6npBKr x9n1UhDtlELrOIrWfqe7FCYHzRhd7k5pot7WvsYzdrTY0nsjWsl2GFXgg5O4uck2yA+2IBfDW4Kef wM6hTtV/cAWp4PQQQo2F2Jhz8mi77NqmpbU5lqLFjtNm8o1SXljQslG1G/Bd+G9jS+mFRYmo5eXuJ 6cpljyDXdb3Q0zPaN5/0W8029nDTvqYxFURsVLBTjPFtUECFbJIXZRA3BNu98xhQh9oCJcug2tl4s /vQ8yE20tz34HMvSgAzw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cfgBZ-000288-JC; Mon, 20 Feb 2017 05:06:53 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cfgBT-00026b-84 for ath10k@lists.infradead.org; Mon, 20 Feb 2017 05:06:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1487567207; x=1519103207; h=from:to:cc:subject:date:message-id:mime-version; bh=Esp0/WTosDVT9nqBAyVt2SAOY0+4+jwHE0OqLiL5VGM=; b=vnADRWw1PjwZGTE8Ytui0OoUkzIsp6CspOeQNmeL54tmhAdpr1Q4lOuX k+X0kHGsA3Szaqo5zr7iPBJkRwR7K2KT4vgUs2nrU8UeCJ0/uIXaHzFuC D0NYlQbdKB6bN1e+YWeUHf6lfDOir6mNYFmyM6lX/aC1XZdaSy0jMwE5W w=; X-IronPort-AV: E=Sophos;i="5.35,184,1484035200"; d="scan'208";a="359654213" Received: from unknown (HELO Ironmsg04-L.qualcomm.com) ([10.53.140.111]) by wolverine02.qualcomm.com with ESMTP; 19 Feb 2017 21:06:22 -0800 X-IronPort-AV: E=McAfee;i="5800,7501,8444"; a="1294015871" Received: from nasanexm01f.na.qualcomm.com ([10.85.0.32]) by Ironmsg04-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 19 Feb 2017 21:06:22 -0800 Received: from aphydexm01f.ap.qualcomm.com (10.252.127.15) by NASANEXM01F.na.qualcomm.com (10.85.0.32) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Sun, 19 Feb 2017 21:06:20 -0800 Received: from localhost (10.80.80.8) by aphydexm01f.ap.qualcomm.com (10.252.127.15) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Mon, 20 Feb 2017 10:36:15 +0530 From: To: Subject: [PATCHv2] ath10k: Update available channel list for 5G radio Date: Mon, 20 Feb 2017 10:36:30 +0530 Message-ID: <1487567190-18243-1-git-send-email-c_traja@qti.qualcomm.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01E.na.qualcomm.com (10.85.0.31) To aphydexm01f.ap.qualcomm.com (10.252.127.15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170219_210647_566861_AAFDAB4D X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tamizh chelvam , linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tamizh chelvam If a 5 GHz radio is calibrated for operation in both the low band (channels 36 to 64) and high band(channels 100 to 169), hardware allows operations in all the listed channels. However, if the chip has been calibrated only for the low/high band and a high/low band channel is configured, due to lack of calibration there will be potentially invalid signal on those non calibrated channels. To avoid this problem this patch introduces ath10k_low_5ghz_channel and ath10k_high_5ghz_channel lists as separate arrays. The channel list will be initialized depending on the low_5ghz_chan and high_5ghz_chan values which we get from target through wmi service ready event. Signed-off-by: Tamizh chelvam --- v2: * Addressed Jouni and Kalle's comments drivers/net/wireless/ath/ath10k/core.h | 2 ++ drivers/net/wireless/ath/ath10k/mac.c | 55 +++++++++++++++++++++++++++++--- drivers/net/wireless/ath/ath10k/wmi.c | 6 ++++ drivers/net/wireless/ath/ath10k/wmi.h | 2 ++ 4 files changed, 61 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 88d14be..d07d567 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -774,6 +774,8 @@ struct ath10k { u32 vht_cap_info; u32 num_rf_chains; u32 max_spatial_stream; + u32 low_5ghz_chan; + u32 high_5ghz_chan; /* protected by conf_mutex */ bool ani_enabled; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 3029f25..0840efb 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -7623,6 +7623,38 @@ static void ath10k_mac_op_sta_pre_rcu_remove(struct ieee80211_hw *hw, CHAN2G(14, 2484, 0), }; +static const struct ieee80211_channel ath10k_low_5ghz_channels[] = { + CHAN5G(36, 5180, 0), + CHAN5G(40, 5200, 0), + CHAN5G(44, 5220, 0), + CHAN5G(48, 5240, 0), + CHAN5G(52, 5260, 0), + CHAN5G(56, 5280, 0), + CHAN5G(60, 5300, 0), + CHAN5G(64, 5320, 0), +}; + +static const struct ieee80211_channel ath10k_high_5ghz_channels[] = { + CHAN5G(100, 5500, 0), + CHAN5G(104, 5520, 0), + CHAN5G(108, 5540, 0), + CHAN5G(112, 5560, 0), + CHAN5G(116, 5580, 0), + CHAN5G(120, 5600, 0), + CHAN5G(124, 5620, 0), + CHAN5G(128, 5640, 0), + CHAN5G(132, 5660, 0), + CHAN5G(136, 5680, 0), + CHAN5G(140, 5700, 0), + CHAN5G(144, 5720, 0), + CHAN5G(149, 5745, 0), + CHAN5G(153, 5765, 0), + CHAN5G(157, 5785, 0), + CHAN5G(161, 5805, 0), + CHAN5G(165, 5825, 0), + CHAN5G(169, 5845, 0), +}; + static const struct ieee80211_channel ath10k_5ghz_channels[] = { CHAN5G(36, 5180, 0), CHAN5G(40, 5200, 0), @@ -8014,6 +8046,7 @@ int ath10k_mac_register(struct ath10k *ar) }; struct ieee80211_supported_band *band; void *channels; + int n_channels; int ret; SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); @@ -8049,16 +8082,30 @@ int ath10k_mac_register(struct ath10k *ar) } if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { - channels = kmemdup(ath10k_5ghz_channels, - sizeof(ath10k_5ghz_channels), - GFP_KERNEL); + if (ar->high_5ghz_chan <= 5350) { + channels = kmemdup(ath10k_low_5ghz_channels, + sizeof(ath10k_low_5ghz_channels), + GFP_KERNEL); + n_channels = ARRAY_SIZE(ath10k_low_5ghz_channels); + } else if (ar->low_5ghz_chan >= 5490 && + ar->high_5ghz_chan <= 5885) { + channels = kmemdup(ath10k_high_5ghz_channels, + sizeof(ath10k_high_5ghz_channels), + GFP_KERNEL); + n_channels = ARRAY_SIZE(ath10k_high_5ghz_channels); + } else { + channels = kmemdup(ath10k_5ghz_channels, + sizeof(ath10k_5ghz_channels), + GFP_KERNEL); + n_channels = ARRAY_SIZE(ath10k_5ghz_channels); + } if (!channels) { ret = -ENOMEM; goto err_free; } band = &ar->mac.sbands[NL80211_BAND_5GHZ]; - band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels); + band->n_channels = n_channels; band->channels = channels; band->n_bitrates = ath10k_a_rates_size; band->bitrates = ath10k_a_rates; diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 2f1743e..b31c4f7 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -4593,6 +4593,8 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id, arg->phy_capab = ev->phy_capability; arg->num_rf_chains = ev->num_rf_chains; arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd; + arg->low_5ghz_chan = ev->hal_reg_capabilities.low_5ghz_chan; + arg->high_5ghz_chan = ev->hal_reg_capabilities.high_5ghz_chan; arg->num_mem_reqs = ev->num_mem_reqs; arg->service_map = ev->wmi_service_bitmap; arg->service_map_len = sizeof(ev->wmi_service_bitmap); @@ -4629,6 +4631,8 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id, arg->phy_capab = ev->phy_capability; arg->num_rf_chains = ev->num_rf_chains; arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd; + arg->low_5ghz_chan = ev->hal_reg_capabilities.low_5ghz_chan; + arg->high_5ghz_chan = ev->hal_reg_capabilities.high_5ghz_chan; arg->num_mem_reqs = ev->num_mem_reqs; arg->service_map = ev->wmi_service_bitmap; arg->service_map_len = sizeof(ev->wmi_service_bitmap); @@ -4682,6 +4686,8 @@ static void ath10k_wmi_event_service_ready_work(struct work_struct *work) ar->phy_capability = __le32_to_cpu(arg.phy_capab); ar->num_rf_chains = __le32_to_cpu(arg.num_rf_chains); ar->hw_eeprom_rd = __le32_to_cpu(arg.eeprom_rd); + ar->low_5ghz_chan = __le32_to_cpu(arg.low_5ghz_chan); + ar->high_5ghz_chan = __le32_to_cpu(arg.high_5ghz_chan); ath10k_dbg_dump(ar, ATH10K_DBG_WMI, NULL, "wmi svc: ", arg.service_map, arg.service_map_len); diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 386aa51..78350d4 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -6335,6 +6335,8 @@ struct wmi_svc_rdy_ev_arg { __le32 num_rf_chains; __le32 eeprom_rd; __le32 num_mem_reqs; + __le32 low_5ghz_chan; + __le32 high_5ghz_chan; const __le32 *service_map; size_t service_map_len; const struct wlan_host_mem_req *mem_reqs[WMI_MAX_MEM_REQS];