wifi: mt76: mt792x: fix a potential loading failure of the 6Ghz channel config from ACPI
[ Upstream commit 07ce1d46372489d90f9cccebb3277d1af801c4b9 ] In some case, the MTCL table will exist, but MTDS table will not. So the SAR will init fail. This patch make MTCL and MTDS can exist with no dependence. Fixes: f965333e491e ("mt76: mt7921: introduce ACPI SAR support") Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Signed-off-by: Leon Yen <leon.yen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c7dd42fbeb
commit
9d5d48d9fe
@ -66,13 +66,15 @@ free:
|
||||
}
|
||||
|
||||
/* MTCL : Country List Table for 6G band */
|
||||
static void
|
||||
static int
|
||||
mt792x_asar_acpi_read_mtcl(struct mt792x_dev *dev, u8 **table, u8 *version)
|
||||
{
|
||||
if (mt792x_acpi_read(dev, MT792x_ACPI_MTCL, table, NULL) < 0)
|
||||
*version = 1;
|
||||
else
|
||||
*version = 2;
|
||||
int ret;
|
||||
|
||||
*version = ((ret = mt792x_acpi_read(dev, MT792x_ACPI_MTCL, table, NULL)) < 0)
|
||||
? 1 : 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MTDS : Dynamic SAR Power Table */
|
||||
@ -166,16 +168,16 @@ int mt792x_init_acpi_sar(struct mt792x_dev *dev)
|
||||
if (!asar)
|
||||
return -ENOMEM;
|
||||
|
||||
mt792x_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver);
|
||||
ret = mt792x_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver);
|
||||
if (ret) {
|
||||
devm_kfree(dev->mt76.dev, asar->countrylist);
|
||||
asar->countrylist = NULL;
|
||||
}
|
||||
|
||||
/* MTDS is mandatory. Return error if table is invalid */
|
||||
ret = mt792x_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver);
|
||||
if (ret) {
|
||||
devm_kfree(dev->mt76.dev, asar->dyn);
|
||||
devm_kfree(dev->mt76.dev, asar->countrylist);
|
||||
devm_kfree(dev->mt76.dev, asar);
|
||||
|
||||
return ret;
|
||||
asar->dyn = NULL;
|
||||
}
|
||||
|
||||
/* MTGS is optional */
|
||||
@ -290,7 +292,7 @@ int mt792x_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default)
|
||||
const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa;
|
||||
int i;
|
||||
|
||||
if (!phy->acpisar)
|
||||
if (!phy->acpisar || !((struct mt792x_acpi_sar *)phy->acpisar)->dyn)
|
||||
return 0;
|
||||
|
||||
/* When ACPI SAR enabled in HW, we should apply rules for .frp
|
||||
|
Loading…
x
Reference in New Issue
Block a user