Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2371677ybi; Thu, 4 Jul 2019 09:44:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJix3Qhpv3ej5t+Hud8IDHgI7uYu/hDAegjDXApFFtqtIXUrRRVTija3To2+1PUSwG1eA4 X-Received: by 2002:a65:64cf:: with SMTP id t15mr36316613pgv.88.1562258689668; Thu, 04 Jul 2019 09:44:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562258689; cv=none; d=google.com; s=arc-20160816; b=PsEeA+hg+zAO5ZRoIy0zbfZlIBRRkLi1q6+jrCiLj3ofFrawLIMU3EtRVfJH7BKKiy tD7LvhxrdVIWtoHFz9AnzjBkpxMgkguaUbSXcb+pluNI2HAZN/v2xQxaa4WTMio7sQEW UwkuH4HnOjV1wXuZYCAA6zIaX1/DDyKrdsTu/vVyNT1k+FqIN6LRhWE33pCT8TgYHrtZ VEwRCDwOOXmfhDTMDKvx0Yicn5dOPnX0RPeCmQvqI7dnE9Anr0ShoC/cyT2KCShsvpF2 JV01wR6ISJ0spWEhKvhcX4HxSveHH1ilXCfpbYILA+ntf3xiFaEUexd+N9vHASmCFI+1 AYGA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:dkim-signature; bh=IS/wJFcvJJc/obs4u52ESPK6iZNHDaKuJQrwIU9Br5M=; b=fSAMMxT0ki4bTX2Lg/SkSo/VVykRFO8HPVHWIJ/ySG3zIxnEAgUvQuXUr29DS2xDaf DvDjhriGEqDW1/KYQBYlnQxszcN23qdtjxkswzc21P/EnATcpVWee9EoMmcfd/1YY4xe 6knt4w2KpF06crY+ppypneDtVMpQm4ELSw0rVPRFsLNiACPWWiM/Nm+UgLvqYMPPWQyh 9+nSqV5S6yeqrxeDLemuJ6DAI5R2ESE/dsgaayN8/hIUOVlXtmaZJtffS8DAtZQY+SRy yfB/du6qwYNrZWo7Ejsl3dkNzhLVKjrjPc4OcmqR5Nbbrp7+85kpq/0iZXv4JbjpetMF 7grQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ex6kfypx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si5690497pgq.405.2019.07.04.09.44.33; Thu, 04 Jul 2019 09:44:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ex6kfypx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbfGDQnX (ORCPT + 99 others); Thu, 4 Jul 2019 12:43:23 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:41894 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbfGDQnX (ORCPT ); Thu, 4 Jul 2019 12:43:23 -0400 Received: by mail-qt1-f194.google.com with SMTP id d17so7154056qtj.8; Thu, 04 Jul 2019 09:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=IS/wJFcvJJc/obs4u52ESPK6iZNHDaKuJQrwIU9Br5M=; b=Ex6kfypx3IqkZHIv1Ib6WARx4LDKQYudillIowR7AmhNuQNU9Aj0W8SszQ4nwNcEHC sDxVtU0reCVq3UOMNrS15qW1r55uYNZZ0WFpttUkG3CUQGxWOgtrMuF51KVR6JlXkbnu ftlBimI3h5vnm/A79jHjAWhpadB5AvxDBR/gPcnjuaEbqHnmn5nv6wuRv+Lzs6d7pcyp Y6vSsAyY2qYdEB/mYWESl76qxz1bLpn6rRuqLq5LrD6OVJsbNTCjxfOmczeCPEStbliW tZ1YDaJwAcNdDgZCayBZiM3CHFV1Tj+tBGbWoKq0HBYLWIHNyCxXcsE8yONlGOlrDKHW m6sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IS/wJFcvJJc/obs4u52ESPK6iZNHDaKuJQrwIU9Br5M=; b=C+3g45VmGh3XcBLy/FkJFqb9HgsY6p4if46z/XoDhB/HSUJj7t+ewYgthy33WhI1g0 WGG/K5bhC33zdCnoI23UcIyFZ/hY/Ig5U16ETR65FtyrrMvRzHMo3IUYzXTMkLrDEY0+ YMpCdtYRZdu4Kd1p0/E/snyddprDwuuZ9q0Ff0H7zMLXIrGxSGpY9WfYNgyJOVHcsLWA SKraYZu4KdL0JECh+UM6gMNW5C1vwHLGfar0oPOdeMJBv9dCI1gjop+w7Ky6IK3St8p0 fYPnWuYXR0cfUMvzhxMQxDZwPmzE/uhddsP2UtSNgUQJDK13PvsmUzO+g2rNhxxc4CA8 yNSg== X-Gm-Message-State: APjAAAVUEceRoouX1z+3sDqVJQHWBASta8hvBrRuyoOLkU+ZYRZ1HkER 9k7G45vvoeiSGvt+ssSw7Ps= X-Received: by 2002:ac8:689a:: with SMTP id m26mr36117104qtq.192.1562258601813; Thu, 04 Jul 2019 09:43:21 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a8:11c1::109b? ([2620:10d:c091:480::f2b4]) by smtp.gmail.com with ESMTPSA id l6sm2591529qkf.83.2019.07.04.09.43.20 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jul 2019 09:43:20 -0700 (PDT) From: Jes Sorensen X-Google-Original-From: Jes Sorensen Subject: Re: [PATCH v2] rtl8xxxu: Fix wifi low signal strength issue of RTL8723BU To: Chris Chiu , kvalo@codeaurora.org, davem@davemloft.net Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessm.com References: <20190704105528.74028-1-chiu@endlessm.com> Message-ID: <8f1454ca-4610-03d0-82c4-06174083d463@gmail.com> Date: Thu, 4 Jul 2019 12:43:18 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190704105528.74028-1-chiu@endlessm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/4/19 6:55 AM, Chris Chiu wrote: > The WiFi tx power of RTL8723BU is extremely low after booting. So > the WiFi scan gives very limited AP list and it always fails to > connect to the selected AP. This module only supports 1x1 antenna > and the antenna is switched to bluetooth due to some incorrect > register settings. > > Compare with the vendor driver https://github.com/lwfinger/rtl8723bu, > we realized that the 8723bu's enable_rf() does the same thing as > rtw_btcoex_HAL_Initialize() in vendor driver. And it by default > sets the antenna path to BTC_ANT_PATH_BT which we verified it's > the cause of the wifi weak tx power. The vendor driver will set > the antenna path to BTC_ANT_PATH_PTA in the consequent btcoexist > mechanism, by the function halbtc8723b1ant_PsTdma. > > This commit hand over the antenna control to PTA(Packet Traffic > Arbitration), which compares the weight of bluetooth/wifi traffic > then determine whether to continue current wifi traffic or not. > After PTA take control, The wifi signal will be back to normal and > the bluetooth scan can also work at the same time. However, the > btcoexist still needs to be handled under different circumstances. > If there's a BT connection established, the wifi still fails to > connect until BT disconnected. > > Signed-off-by: Chris Chiu > --- > > > Note: > v2: > - Replace BIT(11) with the descriptive definition > - Meaningful comment for the REG_S0S1_PATH_SWITCH setting > > > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 11 ++++++++--- > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- > 2 files changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c > index 3adb1d3d47ac..ceffe05bd65b 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c > @@ -1525,7 +1525,7 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv) > /* > * WLAN action by PTA > */ > - rtl8xxxu_write8(priv, REG_WLAN_ACT_CONTROL_8723B, 0x04); > + rtl8xxxu_write8(priv, REG_WLAN_ACT_CONTROL_8723B, 0x0c); > > /* > * BT select S0/S1 controlled by WiFi > @@ -1568,9 +1568,14 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv) > rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.ant_sel_rsv)); > > /* > - * 0x280, 0x00, 0x200, 0x80 - not clear > + * Different settings per different antenna position. > + * Antenna Position: | Normal Inverse > + * -------------------------------------------------- > + * Antenna switch to BT: | 0x280, 0x00 > + * Antenna switch to WiFi: | 0x0, 0x280 > + * Antenna switch to PTA: | 0x200, 0x80 > */ > - rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x00); > + rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x80); Per the documentation, shouldn't this be set to 0x200 then rather than 0x80? We may need to put in place some code to detect whether we have normal or inverse configuration of the dongle otherwise? I really appreciate you're digging into this! Cheers, Jes