From patchwork Fri Mar 13 03:43:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 6001611 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 55A939F318 for ; Fri, 13 Mar 2015 03:39:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 32AC320266 for ; Fri, 13 Mar 2015 03:39:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47D682028D for ; Fri, 13 Mar 2015 03:39:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755816AbbCMDjb (ORCPT ); Thu, 12 Mar 2015 23:39:31 -0400 Received: from s72.web-hosting.com ([198.187.29.22]:42414 "EHLO s72.web-hosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755373AbbCMDj1 (ORCPT ); Thu, 12 Mar 2015 23:39:27 -0400 Received: from [117.222.157.77] (port=12042 helo=sujith-pixel.qualcomm.com) by server72.web-hosting.com with esmtpsa (UNKNOWN:AES128-SHA256:128) (Exim 4.82) (envelope-from ) id 1YWGRZ-003sm1-QS; Thu, 12 Mar 2015 23:39:26 -0400 From: Sujith Manoharan To: linux-wireless@vger.kernel.org Cc: ath9k-devel@lists.ath9k.org Subject: [PATCH 3/4] ath9k: Handle MCI_STATE_AIC_CAL Date: Fri, 13 Mar 2015 09:13:09 +0530 Message-Id: <1426218190-19888-4-git-send-email-sujith@msujith.org> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1426218190-19888-1-git-send-email-sujith@msujith.org> References: <1426218190-19888-1-git-send-email-sujith@msujith.org> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server72.web-hosting.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - msujith.org X-Get-Message-Sender-Via: server72.web-hosting.com: authenticated_id: sujith@msujith.org X-Source: X-Source-Args: X-Source-Dir: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: Sujith Manoharan Add the main AIC calibration function to handle MCI_STATE_AIC_CAL. Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath9k/ar9003_aic.c | 28 ++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath9k/ar9003_aic.h | 1 + drivers/net/wireless/ath/ath9k/ar9003_mci.c | 4 ++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_aic.c b/drivers/net/wireless/ath/ath9k/ar9003_aic.c index 5b4f818..1db119d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_aic.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_aic.c @@ -162,7 +162,7 @@ static void ar9003_aic_gain_table(struct ath_hw *ah) } } -static void ar9003_aic_cal_start(struct ath_hw *ah, u8 min_valid_count) +static u8 ar9003_aic_cal_start(struct ath_hw *ah, u8 min_valid_count) { struct ath9k_hw_aic *aic = &ah->btcoex_hw.aic; int i; @@ -257,6 +257,8 @@ static void ar9003_aic_cal_start(struct ath_hw *ah, u8 min_valid_count) aic->aic_caled_chan = 0; aic->aic_cal_state = AIC_CAL_STATE_STARTED; + + return aic->aic_cal_state; } static bool ar9003_aic_cal_post_process(struct ath_hw *ah) @@ -513,6 +515,28 @@ exit: } +u8 ar9003_aic_calibration(struct ath_hw *ah) +{ + struct ath9k_hw_aic *aic = &ah->btcoex_hw.aic; + u8 cal_ret = AIC_CAL_STATE_ERROR; + + switch (aic->aic_cal_state) { + case AIC_CAL_STATE_IDLE: + cal_ret = ar9003_aic_cal_start(ah, 1); + break; + case AIC_CAL_STATE_STARTED: + cal_ret = ar9003_aic_cal_continue(ah, false); + break; + case AIC_CAL_STATE_DONE: + cal_ret = AIC_CAL_STATE_DONE; + break; + default: + break; + } + + return cal_ret; +} + u8 ar9003_aic_start_normal(struct ath_hw *ah) { struct ath9k_hw_aic *aic = &ah->btcoex_hw.aic; @@ -561,7 +585,7 @@ u8 ar9003_aic_calibration_single(struct ath_hw *ah) num_chan = MS(mci_hw->config, ATH_MCI_CONFIG_AIC_CAL_NUM_CHAN); - ar9003_aic_cal_start(ah, num_chan); + (void) ar9003_aic_cal_start(ah, num_chan); cal_ret = ar9003_aic_cal_continue(ah, true); return cal_ret; diff --git a/drivers/net/wireless/ath/ath9k/ar9003_aic.h b/drivers/net/wireless/ath/ath9k/ar9003_aic.h index 1ee5a8c..509d1f5 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_aic.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_aic.h @@ -53,6 +53,7 @@ struct ath_aic_out_info { struct ath_aic_sram_info sram; }; +u8 ar9003_aic_calibration(struct ath_hw *ah); u8 ar9003_aic_start_normal(struct ath_hw *ah); u8 ar9003_aic_cal_reset(struct ath_hw *ah); u8 ar9003_aic_calibration_single(struct ath_hw *ah); diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c b/drivers/net/wireless/ath/ath9k/ar9003_mci.c index b559d75..cdd83d4 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c @@ -1363,6 +1363,10 @@ u32 ar9003_mci_state(struct ath_hw *ah, u32 state_type) value = (!mci->unhalt_bt_gpm && mci->need_flush_btinfo) ? 1 : 0; mci->need_flush_btinfo = false; break; + case MCI_STATE_AIC_CAL: + if (ath9k_hw_is_aic_enabled(ah)) + value = ar9003_aic_calibration(ah); + break; case MCI_STATE_AIC_START: if (ath9k_hw_is_aic_enabled(ah)) ar9003_aic_start_normal(ah);