Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp285652rwl; Tue, 11 Apr 2023 18:35:34 -0700 (PDT) X-Google-Smtp-Source: AKy350az7ZTegP7NYtb6tZp4jAYJUKsvYX+TExW9/PpaYvL7rdnN0iVJu2b30fBUSmfWe4l4qDV5 X-Received: by 2002:a17:90b:4a0d:b0:246:5968:43f0 with SMTP id kk13-20020a17090b4a0d00b00246596843f0mr6886206pjb.10.1681263334096; Tue, 11 Apr 2023 18:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681263334; cv=none; d=google.com; s=arc-20160816; b=rAzq1CbiLGJYY6xDteUm0tQPza0K8UXKcOJ3cOPXmFxUg9LlhEPI76YdWYcJD+zkoE 23pVhRrK+lL/42FLsOmyNBlxAMYwcj5llzJIowhJT6JxKnMUjdX7pgDXig79rZA2v9pJ HLNt7eezMvAYYFizFP4BKQmOKg2omPiwejtqWE+s33JfhbUbB4O65mF5BKahIFX7vCfv v8okZ5Y+zzkf8VSsDY9LmXx0ISDBu7epk5kaDhKdHyVieQFvddvSuwMjU/SlGJNgC4RN xmCP1PtOx/mKhc6ueXL2wIgw3McjaW2HA2UhNGWx2nd42Hpstbf6c8YnXjAsKq/hnCX/ /RHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :authenticated-by; bh=K7XMt8CarOE/okaH3z4Jq2BLrqi68GeOmoO9IM25awE=; b=TN2Hi/zGQE99dttv2+AzKz7W+Hjisq27VA/51RxSL/rOGL0YSDz0P+iBHFMpE4WTZ5 fV91enzU7CB/NF1pl3NF1rfgRDP2kpDzIANy/90UBoNJcWszXpEeYm1QpVuTAqDD5CoL IXI8kc8b/CEpJieov0HJPmcmAwn/iv16yqODWMcGczoYyOyHy/sWwITPee8T9h3xMFrT m3ar4JRkF8h2UyQerBVCISjTK0kEDP3TvERUPiPldOnGTygohkK5/D+uj+wPFhvm7gL1 wV5KGEKQyUbap9/pdSMUENmUMBp7KOqfXrD2UcCblm2ewLmp0e6Hz1dS1ElLsxY/agl9 cC5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g3-20020a63fa43000000b00507806546e7si15254978pgk.501.2023.04.11.18.35.26; Tue, 11 Apr 2023 18:35:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229602AbjDLB24 (ORCPT + 61 others); Tue, 11 Apr 2023 21:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjDLB2x (ORCPT ); Tue, 11 Apr 2023 21:28:53 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D29D63C2F for ; Tue, 11 Apr 2023 18:28:52 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33C1SOZT0009283, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 33C1SOZT0009283 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Wed, 12 Apr 2023 09:28:24 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Wed, 12 Apr 2023 09:28:46 +0800 Received: from localhost (172.21.69.188) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 12 Apr 2023 09:28:46 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH 3/4] wifi: rtw89: coex: Update function to get BT RSSI and hardware counter Date: Wed, 12 Apr 2023 09:28:30 +0800 Message-ID: <20230412012831.10519-4-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230412012831.10519-1-pkshih@realtek.com> References: <20230412012831.10519-1-pkshih@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.69.188] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ching-Te Ku Correct Bluetooth RSSI count method. The 6dB is the gap between hardware packet sampled value and real RSSI value. Signed-off-by: Ching-Te Ku Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/rtw8852a.c | 3 ++- drivers/net/wireless/realtek/rtw89/rtw8852b.c | 3 ++- drivers/net/wireless/realtek/rtw89/rtw8852c.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c index 46907748778bd..a0c02ff39e750 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c @@ -1827,7 +1827,8 @@ rtw8852a_btc_set_wl_txpwr_ctrl(struct rtw89_dev *rtwdev, u32 txpwr_val) static s8 rtw8852a_btc_get_bt_rssi(struct rtw89_dev *rtwdev, s8 val) { - return clamp_t(s8, val, -100, 0) + 100; + /* +6 for compensate offset */ + return clamp_t(s8, val + 6, -100, 0) + 100; } static struct rtw89_btc_rf_trx_para rtw89_btc_8852a_rf_ul[] = { diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c index a7f69d105fbbc..4cbe4c277a73f 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c @@ -2269,7 +2269,8 @@ do { \ static s8 rtw8852b_btc_get_bt_rssi(struct rtw89_dev *rtwdev, s8 val) { - return clamp_t(s8, val, -100, 0) + 100; + /* +6 for compensate offset */ + return clamp_t(s8, val + 6, -100, 0) + 100; } static diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c index 1db1298ca9863..4b66ed0cb3bbe 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c @@ -2527,7 +2527,8 @@ do { \ static s8 rtw8852c_btc_get_bt_rssi(struct rtw89_dev *rtwdev, s8 val) { - return clamp_t(s8, val, -100, 0) + 100; + /* +6 for compensate offset */ + return clamp_t(s8, val + 6, -100, 0) + 100; } static const struct rtw89_btc_rf_trx_para rtw89_btc_8852c_rf_ul[] = { -- 2.25.1