From patchwork Thu May 11 19:01:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9722751 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 C8C1060364 for ; Thu, 11 May 2017 19:01:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD409286EC for ; Thu, 11 May 2017 19:01:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1928286E2; Thu, 11 May 2017 19:01:32 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 46D2D286E2 for ; Thu, 11 May 2017 19:01:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934312AbdEKTBb (ORCPT ); Thu, 11 May 2017 15:01:31 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:35416 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932948AbdEKTB3 (ORCPT ); Thu, 11 May 2017 15:01:29 -0400 Received: by mail-oi0-f67.google.com with SMTP id m17so5519659oik.2 for ; Thu, 11 May 2017 12:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=8MLbAjYUSPWicA9KNEMdeKsfHPMsx5WP/hyRNKMPvJw=; b=nz3j4fX6XC/JrVv118/sZMvXqnL+C35pnUzr36aG9WHH2wxDsZtEAP0qvqYgqaNKAW zJHYU/sMdkupREGVlW8POjxOVUwe6J14tZV+QvCItTPNcz6EHgQpwZ1J27LyYitTBqIv GbDr4ZsSEg/xVZ4+LdISjlVlrTXimEW5MNL3oQ1eos3A8yelUN5Qk7jWw3IURahoZcc/ MXOXzvcJCFb3jdqP0hZrf/t1WyxNoKblPafAyG8RAsGLDlmz/3H4uR1S2U66vgexvV0u /zatj8HxD/f9Bnzyg61ldqzfsm3rMJ7a0yY2w4t0EzntBmoyb0y6Iuf5TtC/Mfkwi427 w9ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=8MLbAjYUSPWicA9KNEMdeKsfHPMsx5WP/hyRNKMPvJw=; b=cz3YUZUG20eLS9NyaPmyhUkf+8gJOkFP3niSfjthny/kIEN9ZB84GaKnD8m1bQ/qWh q8GeweI8jbR/xpHmS5+72KWF0aECaV7fRzmqg1zmCcmwUPY6ul+J7v/i+AmaJYu8EYeP O4ILOtsniTg2nk7BB3cytmIS8xySkeajoo4RBJy0qdNbhs4gcTmNvKgOrWd5wOPnSiZA uWuIzdZ7USOUWAYzUZ1GpZRafOlfIkfitsxtXPskPl1elglnxRdW+7Q6rd5wcPWOC2Vn 7fj0qwq5epYiblVMUXIAbBZVpHwEXJGWjXSdjioNfaRLDZSOHnJbMrBIjAD24vFHEzpQ A6fw== X-Gm-Message-State: AODbwcCqfSQ1aMTp+egIQycrEqsG6RoFtv1tU3TKiskuCO7Nrt8hHBQv fT1XfOmGCfNQiA== X-Received: by 10.157.17.29 with SMTP id g29mr39490ote.86.1494529289030; Thu, 11 May 2017 12:01:29 -0700 (PDT) Received: from linux-4v1g.suse (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id s64sm472123oif.14.2017.05.11.12.01.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 May 2017 12:01:28 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Yan-Hsuan Chuang , Larry Finger , Pkshih , Birming Chiu , Shaofu , Steven Ting Subject: [PATCH v3 03/10] rtlwifi: btcoex: 21a 2ant: set wifi standby when halting of entering ips Date: Thu, 11 May 2017 14:01:12 -0500 Message-Id: <20170511190119.23426-4-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170511190119.23426-1-Larry.Finger@lwfinger.net> References: <20170511190119.23426-1-Larry.Finger@lwfinger.net> 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 From: Yan-Hsuan Chuang If the wifi is going to halt or entering power saving, set it standby and allocate resource to bt. Routine btc8821a2ant_wifi_off_hw_cfg() restored. Signed-off-by: Yan-Hsuan Chuang Signed-off-by: Larry Finger Cc: Pkshih Cc: Birming Chiu Cc: Shaofu Cc: Steven Ting --- v2 - resubmit after removal of BT_AUTO_REPORT_XXXX symbols. v3 - no changes --- .../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c index 60386c7571e8..162d40ddf06d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c @@ -3555,6 +3555,26 @@ static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist) } } +static void btc8821a2ant_wifi_off_hw_cfg(struct btc_coexist *btcoexist) +{ + u8 h2c_parameter[2] = {0}; + u32 fw_ver = 0; + + /* set wlan_act to low */ + btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); + + /* WiFi goto standby while GNT_BT 0-->1 */ + btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); + btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver); + if (fw_ver >= 0x180000) { + /* Use H2C to set GNT_BT to HIGH */ + h2c_parameter[0] = 1; + btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1, h2c_parameter); + } else { + btcoexist->btc_write_1byte(btcoexist, 0x765, 0x18); + } +} + /************************************************************** * extern function start with ex_btc8821a2ant_ **************************************************************/ @@ -3841,6 +3861,7 @@ void ex_btc8821a2ant_ips_notify(struct btc_coexist *btcoexist, u8 type) RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, "[BTCoex], IPS ENTER notify\n"); coex_sta->under_ips = true; + btc8821a2ant_wifi_off_hw_cfg(btcoexist); btc8821a2ant_coex_all_off(btcoexist); } else if (BTC_IPS_LEAVE == type) { RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, @@ -4084,6 +4105,7 @@ void ex_btc8821a2ant_halt_notify(struct btc_coexist *btcoexist) RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, "[BTCoex], Halt notify\n"); + btc8821a2ant_wifi_off_hw_cfg(btcoexist); btc8821a2ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true); ex_btc8821a2ant_media_status_notify(btcoexist, BTC_MEDIA_DISCONNECT); }