Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp510970pxf; Wed, 17 Mar 2021 09:30:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBggDakQ8MuaK98UVhpmoS+T9nbzNqCKovN3uNAOU4phDZwzklFJf+saPiQuUH1sIExWD5 X-Received: by 2002:a17:906:78d:: with SMTP id l13mr35404959ejc.97.1615998651782; Wed, 17 Mar 2021 09:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615998651; cv=none; d=google.com; s=arc-20160816; b=t4aFpTrx/+tPJ3SdbdDcAkN1gBPZmsCltC+YRrUJuwbSm0SSa1ENGrnrhEYvwwaPU+ bB2DiLo0O05EQq5AsN3HB8HA0A3Dg0A+/17YfJwE8fQstXbhZ1AfUHsgLjNf6cw9rQd7 0Hh3DVrNG4DmZC+lUDoraXPOlhcFYo8rGsRQ5yEiMJXwiouDgxI4GMtq/glrImI8gBR3 eqh/RFmCks6JtxH9itAaMNjb4LeVpJy9z9kzVkvVi/8hCyRQ5A33Z0XE0xKiIwZO53m7 vI4OhVijj9GM3oZcLBHKKinW/kTvARbNMa8sgxVLoQojPheu35qV+oLbH9vDk3XKenmF MbPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=/kjxMXnRhxkA81bXhu/hZroLWKXlqfZn8nfUo3wIvGc=; b=hP8Tk/XkwWnG/kz5HfDTvgWTu8TVltKkL970vVWoapF2yp3UuONYb0x62UsTqBFOiU 5PSLsbIhFVbh2dod6C1/SW4C+IekzaUUz0jw5aCbxA+zN82jLJX4htsy09P9bK1Sq5eP wUFjs5NrzRjPX4ENlNO0j+XGo0aCuKBoxXBFXg0duNOwef4hqUfvoQjwj7IgcZOvLUx0 17bvrWGE8DI8n8O9T5q+MG9rIKnMBfRwix+aV+tUISnPFlBFwyhiyBFdnEYRgamSnyDE 4HgnExResCg7Dd2c8VIvYmQlcBpaEvGiMB6donYMtDKdWuph6ShpSaW++kW/O3g2PwQD v0Tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si8386020eji.701.2021.03.17.09.30.24; Wed, 17 Mar 2021 09:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232527AbhCQQ2H (ORCPT + 99 others); Wed, 17 Mar 2021 12:28:07 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:36730 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232547AbhCQQ1o (ORCPT ); Wed, 17 Mar 2021 12:27:44 -0400 X-UUID: cab759e53d7a4d7099d82dd2afcc5c96-20210318 X-UUID: cab759e53d7a4d7099d82dd2afcc5c96-20210318 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 378509917; Thu, 18 Mar 2021 00:27:39 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 18 Mar 2021 00:27:37 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 18 Mar 2021 00:27:37 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , , , Ryder Lee Subject: [PATCH] mt76: mt7622: add ePA/eLNA support Date: Thu, 18 Mar 2021 00:27:36 +0800 Message-ID: <1fb0ff65cb7d8c4f3197a87b43c26c5925e973ea.1615997929.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 7D846F657E33A424517F43A1E3D6A28EA76700F69B8EB68FF761DD751EA164682000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Switch pinmux to enable ePA/eLNA support. Signed-off-by: Ryder Lee --- .../wireless/mediatek/mt76/mt7615/eeprom.c | 29 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7615/eeprom.h | 4 +++ 2 files changed, 33 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c index 6dbaaf95ee38..d3182573163c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c @@ -6,6 +6,7 @@ */ #include +#include #include "mt7615.h" #include "eeprom.h" @@ -136,12 +137,40 @@ mt7615_eeprom_parse_hw_band_cap(struct mt7615_dev *dev) } } +static void mt7615_eeprom_parse_hw_epa_cap(struct mt7615_dev *dev) +{ + struct pinctrl_state *state; + struct pinctrl *pinctrl; + u8 i, *eeprom = dev->mt76.eeprom.data; + + if (!is_mt7622(&dev->mt76)) + return; + + i = FIELD_GET(MT_EE_NIC_WIFI_CONF_BAND_PALNA, eeprom[MT_EE_WIFI_CONF]); + if (i != MT_EE_NIC_WIFI_CONF_EPA_ELNA && + i != MT_EE_NIC_WIFI_CONF_IPA_ELNA) + return; + + pinctrl = devm_pinctrl_get(dev->mt76.dev); + if (IS_ERR(pinctrl)) + return; + + state = pinctrl_lookup_state(pinctrl, "epa-state"); + if (IS_ERR(state)) + goto out; + + pinctrl_select_state(pinctrl, state); +out: + devm_pinctrl_put(pinctrl); +} + static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev) { u8 *eeprom = dev->mt76.eeprom.data; u8 tx_mask, max_nss; mt7615_eeprom_parse_hw_band_cap(dev); + mt7615_eeprom_parse_hw_epa_cap(dev); if (is_mt7663(&dev->mt76)) { max_nss = 2; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h index a024dee10362..a609c4bb108c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h @@ -64,7 +64,11 @@ enum mt7615_eeprom_field { #define MT_EE_NIC_CONF_TSSI_2G BIT(5) #define MT_EE_NIC_CONF_TSSI_5G BIT(6) +#define MT_EE_NIC_WIFI_CONF_BAND_PALNA GENMASK(3, 2) +#define MT_EE_NIC_WIFI_CONF_IPA_ELNA 0x1 +#define MT_EE_NIC_WIFI_CONF_EPA_ELNA 0x2 #define MT_EE_NIC_WIFI_CONF_BAND_SEL GENMASK(5, 4) + enum mt7615_eeprom_band { MT_EE_DUAL_BAND, MT_EE_5GHZ, -- 2.18.0