Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4031786rwe; Mon, 17 Apr 2023 07:07:12 -0700 (PDT) X-Google-Smtp-Source: AKy350Z7qY4L+b1qgcZDGMZ5t76EndyxanOp1ANTCrycSDvSb9F2QVnAD0BZcq6PpOwlEEE21S3i X-Received: by 2002:a05:6a00:14d4:b0:63d:2333:84e6 with SMTP id w20-20020a056a0014d400b0063d233384e6mr4545445pfu.33.1681740431896; Mon, 17 Apr 2023 07:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681740431; cv=none; d=google.com; s=arc-20160816; b=Kp2n7fRXWiqQnyzYl+pQh+be5mKCs1fDMbF82Rtqf6DQ1VqePeDxg5mvg6w4VgxZpw inOXA9kK49S6AjeMTPuSC4WiRbkuSgll4YxoQxkwDLGCez993XQsxE105JSVPDS0jiJs 0bsTI9ERFnlyHgpYdFmjezF/llVoyOVGIeO6TTlu3rneEnBY3viiy7ue/nllrIAPsm5f JWou07Mm+h7Ao26NX61+cM1KO3iLlMHqpnEHYRE7Bg+C6snnLj4BSPOTM4BWpK6BtVRH AsJvj3plxULT5JROab0NX+04Pfdpqt/lSEgwebl8O0RrEx7SXN7H1TbcZ0mW5lHz5on+ +lAQ== 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; bh=pum0J8gn8UfPs8lO7uLeKCpMQcKBjq22vQtHA/ZtXW4=; b=oeJq0VCGKVB+0cykZfnTBE8vh0BWAiOWif9byA36zUVefzK1hG8yJUmRX3t93ZSbvS Q2JGN6LEHPwOAEIDGib0VeADJWbTMq1eF5exMypYos171W9sha+7U8jHFoXFGocJLDlV WeZftxm7Ay8D7SRzo2F7ZqgnzMc+OxUPzdfG3HdJN5YpfczFHKt2ZUB9hIOSyEKEnoLj hLRale0PUVZV5+5LUS4n++kSgvCqSksck0eLOwbNQHe8RNilLCgDAJDkVbtJPrIbLNKA 00iQyyMNBb26PiSQmpROsvQfBh4gKjxz3FmrU3c/o9HkNAgb6OCs+EutgxRRu1aAYHYX Xrjg== 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 z24-20020aa79f98000000b0063b87f60f7bsi4845170pfr.48.2023.04.17.07.07.00; Mon, 17 Apr 2023 07:07:11 -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 S230098AbjDQOEi (ORCPT + 63 others); Mon, 17 Apr 2023 10:04:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230305AbjDQOEf (ORCPT ); Mon, 17 Apr 2023 10:04:35 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6C1F86BE for ; Mon, 17 Apr 2023 07:04:04 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1poPSb-000484-IY; Mon, 17 Apr 2023 16:04:01 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1poPSa-00BtJy-UT; Mon, 17 Apr 2023 16:04:00 +0200 Received: from sha by dude02.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1poPSZ-009OrL-Nf; Mon, 17 Apr 2023 16:03:59 +0200 From: Sascha Hauer To: linux-wireless Cc: Hans Ulli Kroll , Larry Finger , Pkshih , Tim K , "Alex G ." , Nick Morrow , Viktor Petrenko , Andreas Henriksson , ValdikSS , kernel@pengutronix.de, Sascha Hauer Subject: [PATCH v3 4/4] wifi: rtw88: call rtw8821c_switch_rf_set() according to chip variant Date: Mon, 17 Apr 2023 16:03:58 +0200 Message-Id: <20230417140358.2240429-5-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417140358.2240429-1-s.hauer@pengutronix.de> References: <20230417140358.2240429-1-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 We have to call rtw8821c_switch_rf_set() with SWITCH_TO_WLG or SWITCH_TO_BTG according to the chip variant as denoted in rfe_option. The information which argument to use for which variant has been taken from the vendor driver. Signed-off-by: Sascha Hauer --- drivers/net/wireless/realtek/rtw88/main.h | 1 + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h index 9946aca7a72ce..462f69547be03 100644 --- a/drivers/net/wireless/realtek/rtw88/main.h +++ b/drivers/net/wireless/realtek/rtw88/main.h @@ -1892,6 +1892,7 @@ struct rtw_hal { u8 oem_id; u8 pkg_type; struct rtw_phy_cond phy_cond; + bool rfe_btg; u8 ps_mode; u8 current_channel; diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c index 94c582a27b9ff..a50753ae235b5 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c @@ -67,6 +67,17 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) hal->pkg_type = map->rfe_option & BIT(5) ? 1 : 0; + switch (efuse->rfe_option) { + case 0x2: + case 0x4: + case 0x7: + case 0xa: + case 0xc: + case 0xf: + hal->rfe_btg = true; + break; + } + for (i = 0; i < 4; i++) efuse->txpwr_idx_table[i] = map->txpwr_idx_table[i]; @@ -289,6 +300,7 @@ static void rtw8821c_switch_rf_set(struct rtw_dev *rtwdev, u8 rf_set) static void rtw8821c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw) { + struct rtw_hal *hal = &rtwdev->hal; u32 rf_reg18; rf_reg18 = rtw_read_rf(rtwdev, RF_PATH_A, 0x18, RFREG_MASK); @@ -320,11 +332,10 @@ static void rtw8821c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw) } if (channel <= 14) { - if (rtwdev->efuse.rfe_option == 0) - rtw8821c_switch_rf_set(rtwdev, SWITCH_TO_WLG); - else if (rtwdev->efuse.rfe_option == 2 || - rtwdev->efuse.rfe_option == 4) + if (hal->rfe_btg) rtw8821c_switch_rf_set(rtwdev, SWITCH_TO_BTG); + else + rtw8821c_switch_rf_set(rtwdev, SWITCH_TO_WLG); rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTDBG, BIT(6), 0x1); rtw_write_rf(rtwdev, RF_PATH_A, 0x64, 0xf, 0xf); } else { -- 2.39.2