From patchwork Tue Aug 30 04:30:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Bentley X-Patchwork-Id: 9304813 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 738CB607D2 for ; Tue, 30 Aug 2016 04:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C38528ABE for ; Tue, 30 Aug 2016 04:36:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50BF728AC1; Tue, 30 Aug 2016 04:36:55 +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=-6.9 required=2.0 tests=BAYES_00,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 CE1A628ABE for ; Tue, 30 Aug 2016 04:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751529AbcH3Egw (ORCPT ); Tue, 30 Aug 2016 00:36:52 -0400 Received: from webmail.lairdtech.com ([63.123.150.69]:61500 "EHLO webmail.lairdtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751372AbcH3Egw (ORCPT ); Tue, 30 Aug 2016 00:36:52 -0400 X-Greylist: delayed 334 seconds by postgrey-1.27 at vger.kernel.org; Tue, 30 Aug 2016 00:36:52 EDT Received: from localhost.localdomain (10.16.4.138) by USDC01CAS01.corp.lairdtech.com (10.16.5.171) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 29 Aug 2016 22:30:57 -0600 From: Eric Bentley To: CC: , Subject: [PATCH] Allow the radio to report 0 dbm txpower without timing out Date: Tue, 30 Aug 2016 00:30:50 -0400 Message-ID: <1472531450-19115-1-git-send-email-eric.bentley@lairdtech.com> X-Mailer: git-send-email 2.6.0.GIT MIME-Version: 1.0 X-Originating-IP: [10.16.4.138] 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 The ath6kl driver attempts to get the txpower from the radio by first clearing the existing stored value and then watching the value to become non-zero. However, this value is in dbm and 0 is a valid value. APs allow setting client power to values from -127..127. However, The radio is not capable of setting values less then 0 and so will report txpower as 0 for both negative and 0 client power. The 6004 defaults to 63dbm which is then limited by regulatory and hardware limits with max of 18dbm (6003 max is 16dbm), therefore we can use values larger then this to be able to determine when the value has been updated. Set the value to a nonsensical value (255) and wait for it to change. --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 72e2ec6..b7fe0af 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -1449,14 +1449,14 @@ static int ath6kl_cfg80211_get_txpower(struct wiphy *wiphy, return -EIO; if (test_bit(CONNECTED, &vif->flags)) { - ar->tx_pwr = 0; + ar->tx_pwr = 255; if (ath6kl_wmi_get_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx) != 0) { ath6kl_err("ath6kl_wmi_get_tx_pwr_cmd failed\n"); return -EIO; } - wait_event_interruptible_timeout(ar->event_wq, ar->tx_pwr != 0, + wait_event_interruptible_timeout(ar->event_wq, ar->tx_pwr != 255, 5 * HZ); if (signal_pending(current)) {