Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4536871imm; Mon, 17 Sep 2018 16:04:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYZj9Mzz9a/YNomITstNIutZFQA/w0y2zqjgf1vpd7jCx4tl0b8ya8q1L0IW3VYnwCH3B+e X-Received: by 2002:a17:902:304:: with SMTP id 4-v6mr26889961pld.39.1537225493204; Mon, 17 Sep 2018 16:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537225493; cv=none; d=google.com; s=arc-20160816; b=SAQQQhyrTwS9YOnvbBfGRr9iG6nsh0AiZCBFRIkFUsqbfnvq9xmjFsway4W3LcyRC5 nl9ZFZmNYzvbMcgPkLuRVNuS6vmvILH6raS/bLxsa26P4TocL2pxaXUTNXtG1dYPdb6I XLHMDulWF1xXm4xAMroThXN3d/lmdlsaRIwe1seZAkWfnfhPmmMUfVVllYi02n0ypXUd zVRmSu7v8bNgVedNh68o4of0ZmGSrZRifeYyIHNi51qeN/uEavRXj9izYFBN4dhwZ+7R pKHisYAXVGnHbtXdISpHYCjFqcNsozUBE9iZ04tg2KHs65yi5HHfOO977t7j13v5a3XS gYdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=N/cx3HmbkBc8WRapFdbQqvgwKJe2Q/Tv8Lg97ZbTts0=; b=NTDGcoS6izgnARz70URNqLboPWp761NVDs3cFiQmAQHr7srMeSyeB4zPU03+NCADBK PkDaMaJLChMRmAWI/hRoqqjaxSnqv4RSVNu8i+BmlsULSXUwpuRXWbYb1gYRJUq5KWNK b6BMmYDRb0/CqlKcDzXTTf3HSiy4hbxpUqjBA+Z3ftsmGZRVs2qkc+gHg5X2vE/8L6LD aZnVZLkISLdHQ660tzQ9XWkW17fhcf9xkPdCiED/La2Ha4P3mMD7js7IUYg+goDYW64r s/uzAJHiNm12bWMasuyAsGzJSsxVxS7QOcJ1mfo2w77zbPYW9U6F7pVT6eSeqGYc1s9c KAIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d128-v6si18095846pfc.211.2018.09.17.16.04.37; Mon, 17 Sep 2018 16:04:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730202AbeIREdh (ORCPT + 99 others); Tue, 18 Sep 2018 00:33:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49070 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727202AbeIREdh (ORCPT ); Tue, 18 Sep 2018 00:33:37 -0400 Received: from localhost (li1825-44.members.linode.com [172.104.248.44]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 37850C49; Mon, 17 Sep 2018 23:04:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 052/126] ath9k_hw: fix channel maximum power level test Date: Tue, 18 Sep 2018 00:41:40 +0200 Message-Id: <20180917211707.958952943@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917211703.481236999@linuxfoundation.org> References: <20180917211703.481236999@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felix Fietkau [ Upstream commit 461d8a6bb9879b0e619752d040292e67aa06f1d2 ] The tx power applied by set_txpower is limited by the CTL (conformance test limit) entries in the EEPROM. These can change based on the user configured regulatory domain. Depending on the EEPROM data this can cause the tx power to become too limited, if the original regdomain CTLs impose lower limits than the CTLs of the user configured regdomain. To fix this issue, set the initial channel limits without any CTL restrictions and only apply the CTL at run time when setting the channel and the real tx power. Signed-off-by: Felix Fietkau Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/ath9k/hw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -2915,16 +2915,19 @@ void ath9k_hw_apply_txpower(struct ath_h struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ieee80211_channel *channel; int chan_pwr, new_pwr; + u16 ctl = NO_CTL; if (!chan) return; + if (!test) + ctl = ath9k_regd_get_ctl(reg, chan); + channel = chan->chan; chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); new_pwr = min_t(int, chan_pwr, reg->power_limit); - ah->eep_ops->set_txpower(ah, chan, - ath9k_regd_get_ctl(reg, chan), + ah->eep_ops->set_txpower(ah, chan, ctl, get_antenna_gain(ah, chan), new_pwr, test); }