* [PATCH 0/3] introduce BIOS SAR support
@ 2022-05-19 6:38 ` Deren Wu
0 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 6:38 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Eric Liang,
Stella Chang, Evelyn Tsai, Ryder Lee, Shayne Chen,
linux-wireless, linux-mediatek, Deren Wu
From: Deren Wu <deren.wu@mediatek.com>
Introduce BIOS SAR support for mt7921 serials.
Deren Wu (3):
mt76: add 6G band support in mt76_sar_freq_ranges
mt76: mt7921: introduce BIOS SAR support
mt76: mt7921: introduce BIOS SAR config in tx power
drivers/net/wireless/mediatek/mt76/mac80211.c | 6 +
.../wireless/mediatek/mt76/mt7921/Makefile | 1 +
.../wireless/mediatek/mt76/mt7921/bios_sar.c | 281 ++++++++++++++++++
.../wireless/mediatek/mt76/mt7921/bios_sar.h | 93 ++++++
.../net/wireless/mediatek/mt76/mt7921/init.c | 5 +-
.../net/wireless/mediatek/mt76/mt7921/main.c | 32 +-
.../wireless/mediatek/mt76/mt7921/mt7921.h | 22 ++
7 files changed, 429 insertions(+), 11 deletions(-)
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h
--
2.18.0
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/3] introduce BIOS SAR support
@ 2022-05-19 6:38 ` Deren Wu
0 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 6:38 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Eric Liang,
Stella Chang, Evelyn Tsai, Ryder Lee, Shayne Chen,
linux-wireless, linux-mediatek, Deren Wu
From: Deren Wu <deren.wu@mediatek.com>
Introduce BIOS SAR support for mt7921 serials.
Deren Wu (3):
mt76: add 6G band support in mt76_sar_freq_ranges
mt76: mt7921: introduce BIOS SAR support
mt76: mt7921: introduce BIOS SAR config in tx power
drivers/net/wireless/mediatek/mt76/mac80211.c | 6 +
.../wireless/mediatek/mt76/mt7921/Makefile | 1 +
.../wireless/mediatek/mt76/mt7921/bios_sar.c | 281 ++++++++++++++++++
.../wireless/mediatek/mt76/mt7921/bios_sar.h | 93 ++++++
.../net/wireless/mediatek/mt76/mt7921/init.c | 5 +-
.../net/wireless/mediatek/mt76/mt7921/main.c | 32 +-
.../wireless/mediatek/mt76/mt7921/mt7921.h | 22 ++
7 files changed, 429 insertions(+), 11 deletions(-)
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/3] mt76: add 6G band support in mt76_sar_freq_ranges
2022-05-19 6:38 ` Deren Wu
@ 2022-05-19 6:38 ` Deren Wu
-1 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 6:38 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Eric Liang,
Stella Chang, Evelyn Tsai, Ryder Lee, Shayne Chen,
linux-wireless, linux-mediatek, Deren Wu
From: Deren Wu <deren.wu@mediatek.com>
Add new frequencies support in mt76_sar_freq_ranges[]
* 5945 - 6165
* 6165 - 6405
* 6405 - 6525
* 6525 - 6705
* 6705 - 6865
* 6865 - 7125
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mac80211.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 18b5de55334c..5515e1698b27 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -178,6 +178,12 @@ static const struct cfg80211_sar_freq_ranges mt76_sar_freq_ranges[] = {
{ .start_freq = 5350, .end_freq = 5470, },
{ .start_freq = 5470, .end_freq = 5725, },
{ .start_freq = 5725, .end_freq = 5950, },
+ { .start_freq = 5945, .end_freq = 6165, },
+ { .start_freq = 6165, .end_freq = 6405, },
+ { .start_freq = 6405, .end_freq = 6525, },
+ { .start_freq = 6525, .end_freq = 6705, },
+ { .start_freq = 6705, .end_freq = 6865, },
+ { .start_freq = 6865, .end_freq = 7125, },
};
static const struct cfg80211_sar_capa mt76_sar_capa = {
--
2.18.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 1/3] mt76: add 6G band support in mt76_sar_freq_ranges
@ 2022-05-19 6:38 ` Deren Wu
0 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 6:38 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Eric Liang,
Stella Chang, Evelyn Tsai, Ryder Lee, Shayne Chen,
linux-wireless, linux-mediatek, Deren Wu
From: Deren Wu <deren.wu@mediatek.com>
Add new frequencies support in mt76_sar_freq_ranges[]
* 5945 - 6165
* 6165 - 6405
* 6405 - 6525
* 6525 - 6705
* 6705 - 6865
* 6865 - 7125
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mac80211.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 18b5de55334c..5515e1698b27 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -178,6 +178,12 @@ static const struct cfg80211_sar_freq_ranges mt76_sar_freq_ranges[] = {
{ .start_freq = 5350, .end_freq = 5470, },
{ .start_freq = 5470, .end_freq = 5725, },
{ .start_freq = 5725, .end_freq = 5950, },
+ { .start_freq = 5945, .end_freq = 6165, },
+ { .start_freq = 6165, .end_freq = 6405, },
+ { .start_freq = 6405, .end_freq = 6525, },
+ { .start_freq = 6525, .end_freq = 6705, },
+ { .start_freq = 6705, .end_freq = 6865, },
+ { .start_freq = 6865, .end_freq = 7125, },
};
static const struct cfg80211_sar_capa mt76_sar_capa = {
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] mt76: mt7921: introduce BIOS SAR support
2022-05-19 6:38 ` Deren Wu
@ 2022-05-19 6:38 ` Deren Wu
-1 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 6:38 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Eric Liang,
Stella Chang, Evelyn Tsai, Ryder Lee, Shayne Chen,
linux-wireless, linux-mediatek, Deren Wu, Quan Zhou,
Ming Yen Hsieh
From: Deren Wu <deren.wu@mediatek.com>
In BIOS SAR enabled device, mt7921 should read power limit in BIOS config.
The limit value would be applied to regular tx power settings in mt76.
Two major functionalities added:
1. Get BIOS SAR power table through ACPI.
2. Read power in Dynamic/Geo SAR table for tx power limit.
Table note
MTDS: Dynamic BIOS SAR table
MTGS: Geo BIOS SAR table
MTCL: Country List table (for 6G support)
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Quan Zhou <quan.zhou@mediatek.com>
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
.../wireless/mediatek/mt76/mt7921/Makefile | 1 +
.../wireless/mediatek/mt76/mt7921/bios_sar.c | 281 ++++++++++++++++++
.../wireless/mediatek/mt76/mt7921/bios_sar.h | 93 ++++++
.../net/wireless/mediatek/mt76/mt7921/init.c | 2 +
.../wireless/mediatek/mt76/mt7921/mt7921.h | 20 ++
5 files changed, 397 insertions(+)
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/Makefile b/drivers/net/wireless/mediatek/mt76/mt7921/Makefile
index 0a146818c623..b33e34d17e1d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/Makefile
@@ -9,6 +9,7 @@ CFLAGS_trace.o := -I$(src)
mt7921-common-y := mac.o mcu.o main.o init.o debugfs.o trace.o
mt7921-common-$(CONFIG_NL80211_TESTMODE) += testmode.o
+mt7921-common-$(CONFIG_ACPI) += bios_sar.o
mt7921e-y := pci.o pci_mac.o pci_mcu.o dma.o
mt7921s-y := sdio.o sdio_mac.o sdio_mcu.o
mt7921u-y := usb.o usb_mac.o
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c b/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c
new file mode 100644
index 000000000000..166808e40c6b
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c
@@ -0,0 +1,281 @@
+// SPDX-License-Identifier: ISC
+/* Copyright (C) 2022 MediaTek Inc. */
+
+#include <linux/acpi.h>
+#include "mt7921.h"
+
+static int
+mt7921_bsar_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len)
+{
+ struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *sar_root, *sar_unit;
+ struct mt76_dev *mdev = &dev->mt76;
+ acpi_handle root, handle;
+ acpi_status status;
+ u32 i = 0;
+
+ root = ACPI_HANDLE(mdev->dev);
+ if (!root)
+ return -EOPNOTSUPP;
+
+ status = acpi_get_handle(root, method, &handle);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+ status = acpi_evaluate_object(handle, NULL, NULL, &buf);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+ sar_root = buf.pointer;
+ if (sar_root->type != ACPI_TYPE_PACKAGE ||
+ sar_root->package.count < 4 ||
+ sar_root->package.elements[0].type != ACPI_TYPE_INTEGER) {
+ dev_err(mdev->dev, "sar cnt = %d\n",
+ sar_root->package.count);
+ goto free;
+ }
+
+ if (!*tbl) {
+ *tbl = devm_kzalloc(mdev->dev, sar_root->package.count,
+ GFP_KERNEL);
+ if (!*tbl)
+ goto free;
+ }
+ if (len)
+ *len = sar_root->package.count;
+
+ for (i = 0; i < sar_root->package.count; i++) {
+ sar_unit = &sar_root->package.elements[i];
+
+ if (sar_unit->type != ACPI_TYPE_INTEGER)
+ break;
+ *(*tbl + i) = (u8)sar_unit->integer.value;
+ }
+free:
+ kfree(sar_root);
+
+ return (i == sar_root->package.count) ? 0 : -EINVAL;
+}
+
+/* MTCL : Country List Table for 6G band */
+static int
+mt7921_bsar_acpi_read_mtcl(struct mt7921_dev *dev, u8 **table, u8 *version)
+{
+ *version = (mt7921_bsar_acpi_read(dev, MT7921_ACPI_MTCL, table, 0) < 0)
+ ? 1 : 2;
+ return 0;
+}
+
+/* MTDS : Dynamic SAR Power Table */
+static int
+mt7921_bsar_acpi_read_mtds(struct mt7921_dev *dev, u8 **table, u8 version)
+{
+ int len, ret, sarlen, prelen, tblcnt;
+ bool enable;
+
+ ret = mt7921_bsar_acpi_read(dev, MT7921_ACPI_MTDS, table, &len);
+ if (ret)
+ return ret;
+
+ /* Table content validation */
+ switch (version) {
+ case 1:
+ enable = ((struct mt7921_bsar_dyn *)*table)->enable;
+ sarlen = sizeof(struct mt7921_bsar_dyn_limit);
+ prelen = offsetof(struct mt7921_bsar_dyn, tbl[0]);
+ break;
+ case 2:
+ enable = ((struct mt7921_bsar_dyn_v2 *)*table)->enable;
+ sarlen = sizeof(struct mt7921_bsar_dyn_limit_v2);
+ prelen = offsetof(struct mt7921_bsar_dyn_v2, tbl[0]);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ tblcnt = (len - prelen) / sarlen;
+ if (!enable ||
+ tblcnt > MT7921_BSAR_MAX_DYN || tblcnt < MT7921_BSAR_MIN_DYN)
+ ret = -EINVAL;
+
+ return ret;
+}
+
+/* MTGS : Geo SAR Power Table */
+static int
+mt7921_bsar_acpi_read_mtgs(struct mt7921_dev *dev, u8 **table, u8 version)
+{
+ int len, ret = 0, sarlen, prelen, tblcnt;
+
+ ret = mt7921_bsar_acpi_read(dev, MT7921_ACPI_MTGS, table, &len);
+ if (ret)
+ return ret;
+
+ /* Table content validation */
+ switch (version) {
+ case 1:
+ sarlen = sizeof(struct mt7921_bsar_geo_limit);
+ prelen = offsetof(struct mt7921_bsar_geo, tbl[0]);
+ break;
+ case 2:
+ sarlen = sizeof(struct mt7921_bsar_geo_limit_v2);
+ prelen = offsetof(struct mt7921_bsar_geo_v2, tbl[0]);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ tblcnt = (len - prelen) / sarlen;
+ if (tblcnt > MT7921_BSAR_MAX_GEO || tblcnt < MT7921_BSAR_MIN_GEO)
+ ret = -EINVAL;
+
+ return ret;
+}
+
+int mt7921_init_bios_sar(struct mt7921_dev *dev)
+{
+ struct mt7921_bios_sar *bsar;
+ int ret;
+
+ bsar = devm_kzalloc(dev->mt76.dev, sizeof(*bsar), GFP_KERNEL);
+ if (!bsar)
+ return -ENOMEM;
+
+ mt7921_bsar_acpi_read_mtcl(dev, (u8 **)&bsar->countrylist, &bsar->ver);
+
+ /* MTDS is mandatory. Return error if table is invalid */
+ ret = mt7921_bsar_acpi_read_mtds(dev, (u8 **)&bsar->dyn, bsar->ver);
+ if (ret) {
+ devm_kfree(dev->mt76.dev, bsar->dyn);
+ devm_kfree(dev->mt76.dev, bsar->countrylist);
+ devm_kfree(dev->mt76.dev, bsar);
+ return ret;
+ }
+
+ /* MTGS is optional */
+ ret = mt7921_bsar_acpi_read_mtgs(dev, (u8 **)&bsar->geo, bsar->ver);
+ if (ret) {
+ devm_kfree(dev->mt76.dev, bsar->geo);
+ bsar->geo = NULL;
+ }
+
+ dev->phy.biossar = bsar;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(mt7921_init_bios_sar);
+
+static s8
+mt7921_bsar_get_geo_pwr(struct mt7921_phy *phy,
+ enum nl80211_band band, s8 dyn_power)
+{
+ struct mt7921_bios_sar *bsar = phy->biossar;
+ struct mt7921_bsar_geo_band *band_pwr;
+ s8 geo_power;
+ u8 idx, max;
+
+ if (!bsar->geo)
+ return dyn_power;
+
+ switch (phy->mt76->dev->region) {
+ case NL80211_DFS_FCC:
+ idx = 0;
+ break;
+ case NL80211_DFS_ETSI:
+ idx = 1;
+ break;
+ default: /* WW */
+ idx = 2;
+ break;
+ }
+
+ if (bsar->ver == 1) {
+ band_pwr = &bsar->geo->tbl[idx].band[0];
+ max = ARRAY_SIZE(bsar->geo->tbl[idx].band);
+ } else {
+ band_pwr = &bsar->geo_v2->tbl[idx].band[0];
+ max = ARRAY_SIZE(bsar->geo_v2->tbl[idx].band);
+ }
+
+ switch (band) {
+ case NL80211_BAND_2GHZ:
+ idx = 0;
+ break;
+ case NL80211_BAND_5GHZ:
+ idx = 1;
+ break;
+ case NL80211_BAND_6GHZ:
+ idx = 2;
+ break;
+ default:
+ return dyn_power;
+ }
+
+ if (idx >= max)
+ return dyn_power;
+
+ geo_power = (band_pwr + idx)->pwr;
+ dyn_power += (band_pwr + idx)->offset;
+
+ return min(geo_power, dyn_power);
+}
+
+static s8
+mt7921_bsar_range_pwr(struct mt7921_phy *phy,
+ const struct cfg80211_sar_freq_ranges *range,
+ u8 idx)
+{
+ const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa;
+ struct mt7921_bios_sar *bsar = phy->biossar;
+ u8 *limit, band, max;
+
+ if (!capa)
+ return 127;
+
+ if (bsar->ver == 1) {
+ limit = &bsar->dyn->tbl[0].frp[0];
+ max = ARRAY_SIZE(bsar->dyn->tbl[0].frp);
+ } else {
+ limit = &bsar->dyn_v2->tbl[0].frp[0];
+ max = ARRAY_SIZE(bsar->dyn_v2->tbl[0].frp);
+ }
+
+ if (idx >= max)
+ return 127;
+
+ if (range->start_freq >= 5945)
+ band = NL80211_BAND_6GHZ;
+ else if (range->start_freq >= 5150)
+ band = NL80211_BAND_5GHZ;
+ else
+ band = NL80211_BAND_2GHZ;
+
+ return mt7921_bsar_get_geo_pwr(phy, band, limit[idx]);
+}
+
+int mt7921_init_bios_sar_power(struct mt7921_phy *phy, bool set_default)
+{
+ const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa;
+ int i;
+
+ if (!phy->biossar)
+ return 0;
+
+ /* When BIOS SAR enabled in HW, we should apply rules for .frp
+ * 1. w/o .sar_specs : set BIOS SAR power as the defatul value
+ * 2. w/ .sar_specs : set power with min(.sar_specs, BIOS_SAR)
+ */
+ for (i = 0; i < capa->num_freq_ranges; i++) {
+ struct mt76_freq_range_power *frp = &phy->mt76->frp[i];
+
+ frp->range = set_default ? &capa->freq_ranges[i] : frp->range;
+ if (!frp->range)
+ continue;
+
+ frp->power = min_t(s8, set_default ? 127 : frp->power,
+ mt7921_bsar_range_pwr(phy, frp->range, i));
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(mt7921_init_bios_sar_power);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h b/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h
new file mode 100644
index 000000000000..d1d1fbe6bc82
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: ISC */
+/* Copyright (C) 2022 MediaTek Inc. */
+
+#ifndef __MT7921_BIOS_SAR_H
+#define __MT7921_BIOS_SAR_H
+
+#define MT7921_BSAR_MIN_DYN 1
+#define MT7921_BSAR_MAX_DYN 8
+#define MT7921_BSAR_MIN_GEO 3
+#define MT7921_BSAR_MAX_GEO 8
+
+#define MT7921_ACPI_MTCL "MTCL"
+#define MT7921_ACPI_MTDS "MTDS"
+#define MT7921_ACPI_MTGS "MTGS"
+
+struct mt7921_bsar_dyn_limit {
+ u8 idx;
+ u8 frp[5];
+} __packed;
+
+struct mt7921_bsar_dyn {
+ u8 names[4];
+ u8 enable;
+ u8 nr_tbl;
+ struct mt7921_bsar_dyn_limit tbl[0];
+} __packed;
+
+struct mt7921_bsar_dyn_limit_v2 {
+ u8 idx;
+ u8 frp[11];
+} __packed;
+
+struct mt7921_bsar_dyn_v2 {
+ u8 names[4];
+ u8 enable;
+ u8 rsvd;
+ u8 nr_tbl;
+ struct mt7921_bsar_dyn_limit_v2 tbl[0];
+} __packed;
+
+struct mt7921_bsar_geo_band {
+ u8 pwr;
+ u8 offset;
+} __packed;
+
+struct mt7921_bsar_geo_limit {
+ u8 idx;
+ /* 0:2G, 1:5G */
+ struct mt7921_bsar_geo_band band[2];
+} __packed;
+
+struct mt7921_bsar_geo {
+ u8 names[4];
+ u8 version;
+ u8 nr_tbl;
+ struct mt7921_bsar_geo_limit tbl[0];
+} __packed;
+
+struct mt7921_bsar_geo_limit_v2 {
+ u8 idx;
+ /* 0:2G, 1:5G, 2:6G */
+ struct mt7921_bsar_geo_band band[3];
+} __packed;
+
+struct mt7921_bsar_geo_v2 {
+ u8 names[4];
+ u8 version;
+ u8 rsvd;
+ u8 nr_tbl;
+ struct mt7921_bsar_geo_limit_v2 tbl[0];
+} __packed;
+
+struct mt7921_bsar_cl {
+ u8 names[4];
+ u8 version;
+ u8 mode_6g;
+ u8 cl6g[6];
+} __packed;
+
+struct mt7921_bios_sar {
+ u8 ver;
+ union {
+ struct mt7921_bsar_dyn *dyn;
+ struct mt7921_bsar_dyn_v2 *dyn_v2;
+ };
+ union {
+ struct mt7921_bsar_geo *geo;
+ struct mt7921_bsar_geo_v2 *geo_v2;
+ };
+ struct mt7921_bsar_cl *countrylist;
+};
+
+#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index 4a8675634f80..ae406f1b31a0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -289,6 +289,8 @@ int mt7921_register_device(struct mt7921_dev *dev)
if (!mt76_is_mmio(&dev->mt76))
hw->extra_tx_headroom += MT_SDIO_TXD_SIZE + MT_SDIO_HDR_SIZE;
+ mt7921_init_bios_sar(dev);
+
ret = mt7921_init_wcid(dev);
if (ret)
return ret;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
index 5ca584bb2fc6..e5d541291919 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
@@ -8,6 +8,7 @@
#include <linux/ktime.h>
#include "../mt76_connac_mcu.h"
#include "regs.h"
+#include "bios_sar.h"
#define MT7921_MAX_INTERFACES 4
#define MT7921_MAX_WMM_SETS 4
@@ -171,6 +172,9 @@ struct mt7921_phy {
struct sk_buff_head scan_event_list;
struct delayed_work scan_work;
+#ifdef CONFIG_ACPI
+ struct mt7921_bios_sar *biossar;
+#endif
};
#define mt7921_init_reset(dev) ((dev)->hif_ops->init_reset(dev))
@@ -481,4 +485,20 @@ int mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,
struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
bool enable);
+#ifdef CONFIG_ACPI
+int mt7921_init_bios_sar(struct mt7921_dev *dev);
+int mt7921_init_bios_sar_power(struct mt7921_phy *phy, bool set_default);
+#else
+static inline int
+mt7921_init_bios_sar(struct mt7921_dev *dev)
+{
+ return 0;
+}
+
+static inline int
+mt7921_init_bios_sar_power(struct mt7921_phy *phy, bool set_default)
+{
+ return 0;
+}
+#endif
#endif
--
2.18.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] mt76: mt7921: introduce BIOS SAR support
@ 2022-05-19 6:38 ` Deren Wu
0 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 6:38 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Eric Liang,
Stella Chang, Evelyn Tsai, Ryder Lee, Shayne Chen,
linux-wireless, linux-mediatek, Deren Wu, Quan Zhou,
Ming Yen Hsieh
From: Deren Wu <deren.wu@mediatek.com>
In BIOS SAR enabled device, mt7921 should read power limit in BIOS config.
The limit value would be applied to regular tx power settings in mt76.
Two major functionalities added:
1. Get BIOS SAR power table through ACPI.
2. Read power in Dynamic/Geo SAR table for tx power limit.
Table note
MTDS: Dynamic BIOS SAR table
MTGS: Geo BIOS SAR table
MTCL: Country List table (for 6G support)
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Quan Zhou <quan.zhou@mediatek.com>
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
.../wireless/mediatek/mt76/mt7921/Makefile | 1 +
.../wireless/mediatek/mt76/mt7921/bios_sar.c | 281 ++++++++++++++++++
.../wireless/mediatek/mt76/mt7921/bios_sar.h | 93 ++++++
.../net/wireless/mediatek/mt76/mt7921/init.c | 2 +
.../wireless/mediatek/mt76/mt7921/mt7921.h | 20 ++
5 files changed, 397 insertions(+)
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/Makefile b/drivers/net/wireless/mediatek/mt76/mt7921/Makefile
index 0a146818c623..b33e34d17e1d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/Makefile
@@ -9,6 +9,7 @@ CFLAGS_trace.o := -I$(src)
mt7921-common-y := mac.o mcu.o main.o init.o debugfs.o trace.o
mt7921-common-$(CONFIG_NL80211_TESTMODE) += testmode.o
+mt7921-common-$(CONFIG_ACPI) += bios_sar.o
mt7921e-y := pci.o pci_mac.o pci_mcu.o dma.o
mt7921s-y := sdio.o sdio_mac.o sdio_mcu.o
mt7921u-y := usb.o usb_mac.o
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c b/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c
new file mode 100644
index 000000000000..166808e40c6b
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.c
@@ -0,0 +1,281 @@
+// SPDX-License-Identifier: ISC
+/* Copyright (C) 2022 MediaTek Inc. */
+
+#include <linux/acpi.h>
+#include "mt7921.h"
+
+static int
+mt7921_bsar_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len)
+{
+ struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *sar_root, *sar_unit;
+ struct mt76_dev *mdev = &dev->mt76;
+ acpi_handle root, handle;
+ acpi_status status;
+ u32 i = 0;
+
+ root = ACPI_HANDLE(mdev->dev);
+ if (!root)
+ return -EOPNOTSUPP;
+
+ status = acpi_get_handle(root, method, &handle);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+ status = acpi_evaluate_object(handle, NULL, NULL, &buf);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+ sar_root = buf.pointer;
+ if (sar_root->type != ACPI_TYPE_PACKAGE ||
+ sar_root->package.count < 4 ||
+ sar_root->package.elements[0].type != ACPI_TYPE_INTEGER) {
+ dev_err(mdev->dev, "sar cnt = %d\n",
+ sar_root->package.count);
+ goto free;
+ }
+
+ if (!*tbl) {
+ *tbl = devm_kzalloc(mdev->dev, sar_root->package.count,
+ GFP_KERNEL);
+ if (!*tbl)
+ goto free;
+ }
+ if (len)
+ *len = sar_root->package.count;
+
+ for (i = 0; i < sar_root->package.count; i++) {
+ sar_unit = &sar_root->package.elements[i];
+
+ if (sar_unit->type != ACPI_TYPE_INTEGER)
+ break;
+ *(*tbl + i) = (u8)sar_unit->integer.value;
+ }
+free:
+ kfree(sar_root);
+
+ return (i == sar_root->package.count) ? 0 : -EINVAL;
+}
+
+/* MTCL : Country List Table for 6G band */
+static int
+mt7921_bsar_acpi_read_mtcl(struct mt7921_dev *dev, u8 **table, u8 *version)
+{
+ *version = (mt7921_bsar_acpi_read(dev, MT7921_ACPI_MTCL, table, 0) < 0)
+ ? 1 : 2;
+ return 0;
+}
+
+/* MTDS : Dynamic SAR Power Table */
+static int
+mt7921_bsar_acpi_read_mtds(struct mt7921_dev *dev, u8 **table, u8 version)
+{
+ int len, ret, sarlen, prelen, tblcnt;
+ bool enable;
+
+ ret = mt7921_bsar_acpi_read(dev, MT7921_ACPI_MTDS, table, &len);
+ if (ret)
+ return ret;
+
+ /* Table content validation */
+ switch (version) {
+ case 1:
+ enable = ((struct mt7921_bsar_dyn *)*table)->enable;
+ sarlen = sizeof(struct mt7921_bsar_dyn_limit);
+ prelen = offsetof(struct mt7921_bsar_dyn, tbl[0]);
+ break;
+ case 2:
+ enable = ((struct mt7921_bsar_dyn_v2 *)*table)->enable;
+ sarlen = sizeof(struct mt7921_bsar_dyn_limit_v2);
+ prelen = offsetof(struct mt7921_bsar_dyn_v2, tbl[0]);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ tblcnt = (len - prelen) / sarlen;
+ if (!enable ||
+ tblcnt > MT7921_BSAR_MAX_DYN || tblcnt < MT7921_BSAR_MIN_DYN)
+ ret = -EINVAL;
+
+ return ret;
+}
+
+/* MTGS : Geo SAR Power Table */
+static int
+mt7921_bsar_acpi_read_mtgs(struct mt7921_dev *dev, u8 **table, u8 version)
+{
+ int len, ret = 0, sarlen, prelen, tblcnt;
+
+ ret = mt7921_bsar_acpi_read(dev, MT7921_ACPI_MTGS, table, &len);
+ if (ret)
+ return ret;
+
+ /* Table content validation */
+ switch (version) {
+ case 1:
+ sarlen = sizeof(struct mt7921_bsar_geo_limit);
+ prelen = offsetof(struct mt7921_bsar_geo, tbl[0]);
+ break;
+ case 2:
+ sarlen = sizeof(struct mt7921_bsar_geo_limit_v2);
+ prelen = offsetof(struct mt7921_bsar_geo_v2, tbl[0]);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ tblcnt = (len - prelen) / sarlen;
+ if (tblcnt > MT7921_BSAR_MAX_GEO || tblcnt < MT7921_BSAR_MIN_GEO)
+ ret = -EINVAL;
+
+ return ret;
+}
+
+int mt7921_init_bios_sar(struct mt7921_dev *dev)
+{
+ struct mt7921_bios_sar *bsar;
+ int ret;
+
+ bsar = devm_kzalloc(dev->mt76.dev, sizeof(*bsar), GFP_KERNEL);
+ if (!bsar)
+ return -ENOMEM;
+
+ mt7921_bsar_acpi_read_mtcl(dev, (u8 **)&bsar->countrylist, &bsar->ver);
+
+ /* MTDS is mandatory. Return error if table is invalid */
+ ret = mt7921_bsar_acpi_read_mtds(dev, (u8 **)&bsar->dyn, bsar->ver);
+ if (ret) {
+ devm_kfree(dev->mt76.dev, bsar->dyn);
+ devm_kfree(dev->mt76.dev, bsar->countrylist);
+ devm_kfree(dev->mt76.dev, bsar);
+ return ret;
+ }
+
+ /* MTGS is optional */
+ ret = mt7921_bsar_acpi_read_mtgs(dev, (u8 **)&bsar->geo, bsar->ver);
+ if (ret) {
+ devm_kfree(dev->mt76.dev, bsar->geo);
+ bsar->geo = NULL;
+ }
+
+ dev->phy.biossar = bsar;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(mt7921_init_bios_sar);
+
+static s8
+mt7921_bsar_get_geo_pwr(struct mt7921_phy *phy,
+ enum nl80211_band band, s8 dyn_power)
+{
+ struct mt7921_bios_sar *bsar = phy->biossar;
+ struct mt7921_bsar_geo_band *band_pwr;
+ s8 geo_power;
+ u8 idx, max;
+
+ if (!bsar->geo)
+ return dyn_power;
+
+ switch (phy->mt76->dev->region) {
+ case NL80211_DFS_FCC:
+ idx = 0;
+ break;
+ case NL80211_DFS_ETSI:
+ idx = 1;
+ break;
+ default: /* WW */
+ idx = 2;
+ break;
+ }
+
+ if (bsar->ver == 1) {
+ band_pwr = &bsar->geo->tbl[idx].band[0];
+ max = ARRAY_SIZE(bsar->geo->tbl[idx].band);
+ } else {
+ band_pwr = &bsar->geo_v2->tbl[idx].band[0];
+ max = ARRAY_SIZE(bsar->geo_v2->tbl[idx].band);
+ }
+
+ switch (band) {
+ case NL80211_BAND_2GHZ:
+ idx = 0;
+ break;
+ case NL80211_BAND_5GHZ:
+ idx = 1;
+ break;
+ case NL80211_BAND_6GHZ:
+ idx = 2;
+ break;
+ default:
+ return dyn_power;
+ }
+
+ if (idx >= max)
+ return dyn_power;
+
+ geo_power = (band_pwr + idx)->pwr;
+ dyn_power += (band_pwr + idx)->offset;
+
+ return min(geo_power, dyn_power);
+}
+
+static s8
+mt7921_bsar_range_pwr(struct mt7921_phy *phy,
+ const struct cfg80211_sar_freq_ranges *range,
+ u8 idx)
+{
+ const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa;
+ struct mt7921_bios_sar *bsar = phy->biossar;
+ u8 *limit, band, max;
+
+ if (!capa)
+ return 127;
+
+ if (bsar->ver == 1) {
+ limit = &bsar->dyn->tbl[0].frp[0];
+ max = ARRAY_SIZE(bsar->dyn->tbl[0].frp);
+ } else {
+ limit = &bsar->dyn_v2->tbl[0].frp[0];
+ max = ARRAY_SIZE(bsar->dyn_v2->tbl[0].frp);
+ }
+
+ if (idx >= max)
+ return 127;
+
+ if (range->start_freq >= 5945)
+ band = NL80211_BAND_6GHZ;
+ else if (range->start_freq >= 5150)
+ band = NL80211_BAND_5GHZ;
+ else
+ band = NL80211_BAND_2GHZ;
+
+ return mt7921_bsar_get_geo_pwr(phy, band, limit[idx]);
+}
+
+int mt7921_init_bios_sar_power(struct mt7921_phy *phy, bool set_default)
+{
+ const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa;
+ int i;
+
+ if (!phy->biossar)
+ return 0;
+
+ /* When BIOS SAR enabled in HW, we should apply rules for .frp
+ * 1. w/o .sar_specs : set BIOS SAR power as the defatul value
+ * 2. w/ .sar_specs : set power with min(.sar_specs, BIOS_SAR)
+ */
+ for (i = 0; i < capa->num_freq_ranges; i++) {
+ struct mt76_freq_range_power *frp = &phy->mt76->frp[i];
+
+ frp->range = set_default ? &capa->freq_ranges[i] : frp->range;
+ if (!frp->range)
+ continue;
+
+ frp->power = min_t(s8, set_default ? 127 : frp->power,
+ mt7921_bsar_range_pwr(phy, frp->range, i));
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(mt7921_init_bios_sar_power);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h b/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h
new file mode 100644
index 000000000000..d1d1fbe6bc82
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/bios_sar.h
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: ISC */
+/* Copyright (C) 2022 MediaTek Inc. */
+
+#ifndef __MT7921_BIOS_SAR_H
+#define __MT7921_BIOS_SAR_H
+
+#define MT7921_BSAR_MIN_DYN 1
+#define MT7921_BSAR_MAX_DYN 8
+#define MT7921_BSAR_MIN_GEO 3
+#define MT7921_BSAR_MAX_GEO 8
+
+#define MT7921_ACPI_MTCL "MTCL"
+#define MT7921_ACPI_MTDS "MTDS"
+#define MT7921_ACPI_MTGS "MTGS"
+
+struct mt7921_bsar_dyn_limit {
+ u8 idx;
+ u8 frp[5];
+} __packed;
+
+struct mt7921_bsar_dyn {
+ u8 names[4];
+ u8 enable;
+ u8 nr_tbl;
+ struct mt7921_bsar_dyn_limit tbl[0];
+} __packed;
+
+struct mt7921_bsar_dyn_limit_v2 {
+ u8 idx;
+ u8 frp[11];
+} __packed;
+
+struct mt7921_bsar_dyn_v2 {
+ u8 names[4];
+ u8 enable;
+ u8 rsvd;
+ u8 nr_tbl;
+ struct mt7921_bsar_dyn_limit_v2 tbl[0];
+} __packed;
+
+struct mt7921_bsar_geo_band {
+ u8 pwr;
+ u8 offset;
+} __packed;
+
+struct mt7921_bsar_geo_limit {
+ u8 idx;
+ /* 0:2G, 1:5G */
+ struct mt7921_bsar_geo_band band[2];
+} __packed;
+
+struct mt7921_bsar_geo {
+ u8 names[4];
+ u8 version;
+ u8 nr_tbl;
+ struct mt7921_bsar_geo_limit tbl[0];
+} __packed;
+
+struct mt7921_bsar_geo_limit_v2 {
+ u8 idx;
+ /* 0:2G, 1:5G, 2:6G */
+ struct mt7921_bsar_geo_band band[3];
+} __packed;
+
+struct mt7921_bsar_geo_v2 {
+ u8 names[4];
+ u8 version;
+ u8 rsvd;
+ u8 nr_tbl;
+ struct mt7921_bsar_geo_limit_v2 tbl[0];
+} __packed;
+
+struct mt7921_bsar_cl {
+ u8 names[4];
+ u8 version;
+ u8 mode_6g;
+ u8 cl6g[6];
+} __packed;
+
+struct mt7921_bios_sar {
+ u8 ver;
+ union {
+ struct mt7921_bsar_dyn *dyn;
+ struct mt7921_bsar_dyn_v2 *dyn_v2;
+ };
+ union {
+ struct mt7921_bsar_geo *geo;
+ struct mt7921_bsar_geo_v2 *geo_v2;
+ };
+ struct mt7921_bsar_cl *countrylist;
+};
+
+#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index 4a8675634f80..ae406f1b31a0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -289,6 +289,8 @@ int mt7921_register_device(struct mt7921_dev *dev)
if (!mt76_is_mmio(&dev->mt76))
hw->extra_tx_headroom += MT_SDIO_TXD_SIZE + MT_SDIO_HDR_SIZE;
+ mt7921_init_bios_sar(dev);
+
ret = mt7921_init_wcid(dev);
if (ret)
return ret;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
index 5ca584bb2fc6..e5d541291919 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
@@ -8,6 +8,7 @@
#include <linux/ktime.h>
#include "../mt76_connac_mcu.h"
#include "regs.h"
+#include "bios_sar.h"
#define MT7921_MAX_INTERFACES 4
#define MT7921_MAX_WMM_SETS 4
@@ -171,6 +172,9 @@ struct mt7921_phy {
struct sk_buff_head scan_event_list;
struct delayed_work scan_work;
+#ifdef CONFIG_ACPI
+ struct mt7921_bios_sar *biossar;
+#endif
};
#define mt7921_init_reset(dev) ((dev)->hif_ops->init_reset(dev))
@@ -481,4 +485,20 @@ int mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,
struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
bool enable);
+#ifdef CONFIG_ACPI
+int mt7921_init_bios_sar(struct mt7921_dev *dev);
+int mt7921_init_bios_sar_power(struct mt7921_phy *phy, bool set_default);
+#else
+static inline int
+mt7921_init_bios_sar(struct mt7921_dev *dev)
+{
+ return 0;
+}
+
+static inline int
+mt7921_init_bios_sar_power(struct mt7921_phy *phy, bool set_default)
+{
+ return 0;
+}
+#endif
#endif
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] mt76: mt7921: introduce BIOS SAR config in tx power
2022-05-19 6:38 ` Deren Wu
@ 2022-05-19 6:38 ` Deren Wu
-1 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 6:38 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Eric Liang,
Stella Chang, Evelyn Tsai, Ryder Lee, Shayne Chen,
linux-wireless, linux-mediatek, Deren Wu, Ming Yen Hsieh
From: Deren Wu <deren.wu@mediatek.com>
Add new function mt7921_set_tx_sar_pwr() to update SAR power from
.set_sar_specs and BIOS setting. Both settings would be merged into
mt76_freq_range_power for final tx power value.
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7921/init.c | 3 +-
.../net/wireless/mediatek/mt76/mt7921/main.c | 32 +++++++++++++------
.../wireless/mediatek/mt76/mt7921/mt7921.h | 2 ++
3 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index ae406f1b31a0..4043c81bfbca 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -34,14 +34,13 @@ mt7921_regd_notifier(struct wiphy *wiphy,
{
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct mt7921_dev *dev = mt7921_hw_dev(hw);
- struct mt7921_phy *phy = mt7921_hw_phy(hw);
memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2));
dev->mt76.region = request->dfs_region;
mt7921_mutex_acquire(dev);
mt76_connac_mcu_set_channel_domain(hw->priv);
- mt76_connac_mcu_set_rate_txpower(phy->mt76);
+ mt7921_set_tx_sar_pwr(hw, NULL);
mt7921_mutex_release(dev);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 80279f342109..c86d8805f291 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -257,7 +257,7 @@ int __mt7921_start(struct mt7921_phy *phy)
if (err)
return err;
- err = mt76_connac_mcu_set_rate_txpower(phy->mt76);
+ err = mt7921_set_tx_sar_pwr(mphy->hw, NULL);
if (err)
return err;
@@ -548,7 +548,7 @@ static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
mt7921_mutex_acquire(dev);
if (changed & IEEE80211_CONF_CHANGE_POWER) {
- ret = mt76_connac_mcu_set_rate_txpower(phy->mt76);
+ ret = mt7921_set_tx_sar_pwr(hw, NULL);
if (ret)
goto out;
}
@@ -1469,20 +1469,34 @@ static void mt7921_ipv6_addr_change(struct ieee80211_hw *hw,
}
#endif
+int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
+ const struct cfg80211_sar_specs *sar)
+{
+ struct mt76_phy *mphy = hw->priv;
+ int err;
+
+ if (sar) {
+ err = mt76_init_sar_power(hw, sar);
+ if (err)
+ return err;
+ }
+
+ mt7921_init_bios_sar_power(mt7921_hw_phy(hw), !sar);
+
+ err = mt76_connac_mcu_set_rate_txpower(mphy);
+
+ return err;
+}
+EXPORT_SYMBOL_GPL(mt7921_set_tx_sar_pwr);
+
static int mt7921_set_sar_specs(struct ieee80211_hw *hw,
const struct cfg80211_sar_specs *sar)
{
struct mt7921_dev *dev = mt7921_hw_dev(hw);
- struct mt76_phy *mphy = hw->priv;
int err;
mt7921_mutex_acquire(dev);
- err = mt76_init_sar_power(hw, sar);
- if (err)
- goto out;
-
- err = mt76_connac_mcu_set_rate_txpower(mphy);
-out:
+ err = mt7921_set_tx_sar_pwr(hw, sar);
mt7921_mutex_release(dev);
return err;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
index e5d541291919..a63c4848ced4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
@@ -501,4 +501,6 @@ mt7921_init_bios_sar_power(struct mt7921_phy *phy, bool set_default)
return 0;
}
#endif
+int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
+ const struct cfg80211_sar_specs *sar);
#endif
--
2.18.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] mt76: mt7921: introduce BIOS SAR config in tx power
@ 2022-05-19 6:38 ` Deren Wu
0 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 6:38 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Eric Liang,
Stella Chang, Evelyn Tsai, Ryder Lee, Shayne Chen,
linux-wireless, linux-mediatek, Deren Wu, Ming Yen Hsieh
From: Deren Wu <deren.wu@mediatek.com>
Add new function mt7921_set_tx_sar_pwr() to update SAR power from
.set_sar_specs and BIOS setting. Both settings would be merged into
mt76_freq_range_power for final tx power value.
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7921/init.c | 3 +-
.../net/wireless/mediatek/mt76/mt7921/main.c | 32 +++++++++++++------
.../wireless/mediatek/mt76/mt7921/mt7921.h | 2 ++
3 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index ae406f1b31a0..4043c81bfbca 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -34,14 +34,13 @@ mt7921_regd_notifier(struct wiphy *wiphy,
{
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct mt7921_dev *dev = mt7921_hw_dev(hw);
- struct mt7921_phy *phy = mt7921_hw_phy(hw);
memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2));
dev->mt76.region = request->dfs_region;
mt7921_mutex_acquire(dev);
mt76_connac_mcu_set_channel_domain(hw->priv);
- mt76_connac_mcu_set_rate_txpower(phy->mt76);
+ mt7921_set_tx_sar_pwr(hw, NULL);
mt7921_mutex_release(dev);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 80279f342109..c86d8805f291 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -257,7 +257,7 @@ int __mt7921_start(struct mt7921_phy *phy)
if (err)
return err;
- err = mt76_connac_mcu_set_rate_txpower(phy->mt76);
+ err = mt7921_set_tx_sar_pwr(mphy->hw, NULL);
if (err)
return err;
@@ -548,7 +548,7 @@ static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
mt7921_mutex_acquire(dev);
if (changed & IEEE80211_CONF_CHANGE_POWER) {
- ret = mt76_connac_mcu_set_rate_txpower(phy->mt76);
+ ret = mt7921_set_tx_sar_pwr(hw, NULL);
if (ret)
goto out;
}
@@ -1469,20 +1469,34 @@ static void mt7921_ipv6_addr_change(struct ieee80211_hw *hw,
}
#endif
+int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
+ const struct cfg80211_sar_specs *sar)
+{
+ struct mt76_phy *mphy = hw->priv;
+ int err;
+
+ if (sar) {
+ err = mt76_init_sar_power(hw, sar);
+ if (err)
+ return err;
+ }
+
+ mt7921_init_bios_sar_power(mt7921_hw_phy(hw), !sar);
+
+ err = mt76_connac_mcu_set_rate_txpower(mphy);
+
+ return err;
+}
+EXPORT_SYMBOL_GPL(mt7921_set_tx_sar_pwr);
+
static int mt7921_set_sar_specs(struct ieee80211_hw *hw,
const struct cfg80211_sar_specs *sar)
{
struct mt7921_dev *dev = mt7921_hw_dev(hw);
- struct mt76_phy *mphy = hw->priv;
int err;
mt7921_mutex_acquire(dev);
- err = mt76_init_sar_power(hw, sar);
- if (err)
- goto out;
-
- err = mt76_connac_mcu_set_rate_txpower(mphy);
-out:
+ err = mt7921_set_tx_sar_pwr(hw, sar);
mt7921_mutex_release(dev);
return err;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
index e5d541291919..a63c4848ced4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
@@ -501,4 +501,6 @@ mt7921_init_bios_sar_power(struct mt7921_phy *phy, bool set_default)
return 0;
}
#endif
+int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
+ const struct cfg80211_sar_specs *sar);
#endif
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] introduce BIOS SAR support
2022-05-19 6:38 ` Deren Wu
@ 2022-05-19 15:32 ` Felix Fietkau
-1 siblings, 0 replies; 16+ messages in thread
From: Felix Fietkau @ 2022-05-19 15:32 UTC (permalink / raw)
To: Deren Wu, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Eric Liang, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek
On 19.05.22 08:38, Deren Wu wrote:
> From: Deren Wu <deren.wu@mediatek.com>
>
> Introduce BIOS SAR support for mt7921 serials.
>
> Deren Wu (3):
> mt76: add 6G band support in mt76_sar_freq_ranges
> mt76: mt7921: introduce BIOS SAR support
> mt76: mt7921: introduce BIOS SAR config in tx power
Please replace BIOS with ACPI throughout the patch.
Thanks,
- Felix
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] introduce BIOS SAR support
@ 2022-05-19 15:32 ` Felix Fietkau
0 siblings, 0 replies; 16+ messages in thread
From: Felix Fietkau @ 2022-05-19 15:32 UTC (permalink / raw)
To: Deren Wu, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Eric Liang, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek
On 19.05.22 08:38, Deren Wu wrote:
> From: Deren Wu <deren.wu@mediatek.com>
>
> Introduce BIOS SAR support for mt7921 serials.
>
> Deren Wu (3):
> mt76: add 6G band support in mt76_sar_freq_ranges
> mt76: mt7921: introduce BIOS SAR support
> mt76: mt7921: introduce BIOS SAR config in tx power
Please replace BIOS with ACPI throughout the patch.
Thanks,
- Felix
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] mt76: mt7921: introduce BIOS SAR config in tx power
2022-05-19 6:38 ` Deren Wu
@ 2022-05-19 15:33 ` Felix Fietkau
-1 siblings, 0 replies; 16+ messages in thread
From: Felix Fietkau @ 2022-05-19 15:33 UTC (permalink / raw)
To: Deren Wu, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Eric Liang, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek, Ming Yen Hsieh
On 19.05.22 08:38, Deren Wu wrote:
> From: Deren Wu <deren.wu@mediatek.com>
>
> Add new function mt7921_set_tx_sar_pwr() to update SAR power from
> .set_sar_specs and BIOS setting. Both settings would be merged into
> mt76_freq_range_power for final tx power value.
>
> Reviewed-by: Sean Wang <sean.wang@mediatek.com>
> Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> ---
> .../net/wireless/mediatek/mt76/mt7921/init.c | 3 +-
> .../net/wireless/mediatek/mt76/mt7921/main.c | 32 +++++++++++++------
> .../wireless/mediatek/mt76/mt7921/mt7921.h | 2 ++
> 3 files changed, 26 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 80279f342109..c86d8805f291 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> @@ -1469,20 +1469,34 @@ static void mt7921_ipv6_addr_change(struct ieee80211_hw *hw,
> }
> #endif
>
> +int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
> + const struct cfg80211_sar_specs *sar)
> +{
> + struct mt76_phy *mphy = hw->priv;
> + int err;
> +
> + if (sar) {
> + err = mt76_init_sar_power(hw, sar);
> + if (err)
> + return err;
> + }
> +
> + mt7921_init_bios_sar_power(mt7921_hw_phy(hw), !sar);
> +
> + err = mt76_connac_mcu_set_rate_txpower(mphy);
> +
> + return err;
> +}
> +EXPORT_SYMBOL_GPL(mt7921_set_tx_sar_pwr);
Why is this exported?
- Felix
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] mt76: mt7921: introduce BIOS SAR config in tx power
@ 2022-05-19 15:33 ` Felix Fietkau
0 siblings, 0 replies; 16+ messages in thread
From: Felix Fietkau @ 2022-05-19 15:33 UTC (permalink / raw)
To: Deren Wu, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Eric Liang, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek, Ming Yen Hsieh
On 19.05.22 08:38, Deren Wu wrote:
> From: Deren Wu <deren.wu@mediatek.com>
>
> Add new function mt7921_set_tx_sar_pwr() to update SAR power from
> .set_sar_specs and BIOS setting. Both settings would be merged into
> mt76_freq_range_power for final tx power value.
>
> Reviewed-by: Sean Wang <sean.wang@mediatek.com>
> Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> ---
> .../net/wireless/mediatek/mt76/mt7921/init.c | 3 +-
> .../net/wireless/mediatek/mt76/mt7921/main.c | 32 +++++++++++++------
> .../wireless/mediatek/mt76/mt7921/mt7921.h | 2 ++
> 3 files changed, 26 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 80279f342109..c86d8805f291 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> @@ -1469,20 +1469,34 @@ static void mt7921_ipv6_addr_change(struct ieee80211_hw *hw,
> }
> #endif
>
> +int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
> + const struct cfg80211_sar_specs *sar)
> +{
> + struct mt76_phy *mphy = hw->priv;
> + int err;
> +
> + if (sar) {
> + err = mt76_init_sar_power(hw, sar);
> + if (err)
> + return err;
> + }
> +
> + mt7921_init_bios_sar_power(mt7921_hw_phy(hw), !sar);
> +
> + err = mt76_connac_mcu_set_rate_txpower(mphy);
> +
> + return err;
> +}
> +EXPORT_SYMBOL_GPL(mt7921_set_tx_sar_pwr);
Why is this exported?
- Felix
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] mt76: add 6G band support in mt76_sar_freq_ranges
2022-05-19 6:38 ` Deren Wu
@ 2022-05-19 15:50 ` Jeff Johnson
-1 siblings, 0 replies; 16+ messages in thread
From: Jeff Johnson @ 2022-05-19 15:50 UTC (permalink / raw)
To: Deren Wu, Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Eric Liang, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek
suggest you s/6G/6 GHz/ in the patch subject to avoid confusion between
"gigahertz" and "generation"
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] mt76: add 6G band support in mt76_sar_freq_ranges
@ 2022-05-19 15:50 ` Jeff Johnson
0 siblings, 0 replies; 16+ messages in thread
From: Jeff Johnson @ 2022-05-19 15:50 UTC (permalink / raw)
To: Deren Wu, Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Eric Liang, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek
suggest you s/6G/6 GHz/ in the patch subject to avoid confusion between
"gigahertz" and "generation"
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] mt76: mt7921: introduce BIOS SAR config in tx power
2022-05-19 15:33 ` Felix Fietkau
@ 2022-05-19 16:22 ` Deren Wu
-1 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 16:22 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Eric Liang, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek, Ming Yen Hsieh
Hi Felix,
On Thu, 2022-05-19 at 17:33 +0200, Felix Fietkau wrote:
> On 19.05.22 08:38, Deren Wu wrote:
> > From: Deren Wu <deren.wu@mediatek.com>
> >
> > Add new function mt7921_set_tx_sar_pwr() to update SAR power from
> > .set_sar_specs and BIOS setting. Both settings would be merged into
> > mt76_freq_range_power for final tx power value.
> >
> > Reviewed-by: Sean Wang <sean.wang@mediatek.com>
> > Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> > Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> > Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> > ---
> > .../net/wireless/mediatek/mt76/mt7921/init.c | 3 +-
> > .../net/wireless/mediatek/mt76/mt7921/main.c | 32 +++++++++++++-
> > -----
> > .../wireless/mediatek/mt76/mt7921/mt7921.h | 2 ++
> > 3 files changed, 26 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > index 80279f342109..c86d8805f291 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > @@ -1469,20 +1469,34 @@ static void mt7921_ipv6_addr_change(struct
> > ieee80211_hw *hw,
> > }
> > #endif
> >
> > +int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
> > + const struct cfg80211_sar_specs *sar)
> > +{
> > + struct mt76_phy *mphy = hw->priv;
> > + int err;
> > +
> > + if (sar) {
> > + err = mt76_init_sar_power(hw, sar);
> > + if (err)
> > + return err;
> > + }
> > +
> > + mt7921_init_bios_sar_power(mt7921_hw_phy(hw), !sar);
> > +
> > + err = mt76_connac_mcu_set_rate_txpower(mphy);
> > +
> > + return err;
> > +}
> > +EXPORT_SYMBOL_GPL(mt7921_set_tx_sar_pwr);
>
> Why is this exported?
Thanks for pointing out. I will remove unnecessary export in next
version.
Regards,
Deren
>
> - Felix
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] mt76: mt7921: introduce BIOS SAR config in tx power
@ 2022-05-19 16:22 ` Deren Wu
0 siblings, 0 replies; 16+ messages in thread
From: Deren Wu @ 2022-05-19 16:22 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Eric Liang, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek, Ming Yen Hsieh
Hi Felix,
On Thu, 2022-05-19 at 17:33 +0200, Felix Fietkau wrote:
> On 19.05.22 08:38, Deren Wu wrote:
> > From: Deren Wu <deren.wu@mediatek.com>
> >
> > Add new function mt7921_set_tx_sar_pwr() to update SAR power from
> > .set_sar_specs and BIOS setting. Both settings would be merged into
> > mt76_freq_range_power for final tx power value.
> >
> > Reviewed-by: Sean Wang <sean.wang@mediatek.com>
> > Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> > Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> > Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> > ---
> > .../net/wireless/mediatek/mt76/mt7921/init.c | 3 +-
> > .../net/wireless/mediatek/mt76/mt7921/main.c | 32 +++++++++++++-
> > -----
> > .../wireless/mediatek/mt76/mt7921/mt7921.h | 2 ++
> > 3 files changed, 26 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > index 80279f342109..c86d8805f291 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > @@ -1469,20 +1469,34 @@ static void mt7921_ipv6_addr_change(struct
> > ieee80211_hw *hw,
> > }
> > #endif
> >
> > +int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
> > + const struct cfg80211_sar_specs *sar)
> > +{
> > + struct mt76_phy *mphy = hw->priv;
> > + int err;
> > +
> > + if (sar) {
> > + err = mt76_init_sar_power(hw, sar);
> > + if (err)
> > + return err;
> > + }
> > +
> > + mt7921_init_bios_sar_power(mt7921_hw_phy(hw), !sar);
> > +
> > + err = mt76_connac_mcu_set_rate_txpower(mphy);
> > +
> > + return err;
> > +}
> > +EXPORT_SYMBOL_GPL(mt7921_set_tx_sar_pwr);
>
> Why is this exported?
Thanks for pointing out. I will remove unnecessary export in next
version.
Regards,
Deren
>
> - Felix
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2022-05-19 16:22 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 6:38 [PATCH 0/3] introduce BIOS SAR support Deren Wu
2022-05-19 6:38 ` Deren Wu
2022-05-19 6:38 ` [PATCH 1/3] mt76: add 6G band support in mt76_sar_freq_ranges Deren Wu
2022-05-19 6:38 ` Deren Wu
2022-05-19 15:50 ` Jeff Johnson
2022-05-19 15:50 ` Jeff Johnson
2022-05-19 6:38 ` [PATCH 2/3] mt76: mt7921: introduce BIOS SAR support Deren Wu
2022-05-19 6:38 ` Deren Wu
2022-05-19 6:38 ` [PATCH 3/3] mt76: mt7921: introduce BIOS SAR config in tx power Deren Wu
2022-05-19 6:38 ` Deren Wu
2022-05-19 15:33 ` Felix Fietkau
2022-05-19 15:33 ` Felix Fietkau
2022-05-19 16:22 ` Deren Wu
2022-05-19 16:22 ` Deren Wu
2022-05-19 15:32 ` [PATCH 0/3] introduce BIOS SAR support Felix Fietkau
2022-05-19 15:32 ` Felix Fietkau
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.