wifi: mt76: mt7921: support 5.9/6GHz channel config in acpi
The mtcl table, configured by platform vendor, provides regulatory information for 5.9/6 GHz channels. mt792x should work on corresponding channels supported by mtcl. This patch would parse the settings in mtcl table and apply the result into chip side. Signed-off-by: Rong Yan <rong.yan@mediatek.com> Co-developed-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
14cdeaf950
commit
ce18572b7b
@ -1260,12 +1260,14 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
|
||||
u8 alpha2[2];
|
||||
u8 type[2];
|
||||
u8 env_6g;
|
||||
u8 rsvd[63];
|
||||
u8 mtcl_conf;
|
||||
u8 rsvd[62];
|
||||
} __packed req = {
|
||||
.idx = idx,
|
||||
.env = env_cap,
|
||||
.env_6g = dev->phy.power_type,
|
||||
.acpi_conf = mt792x_acpi_get_flags(&dev->phy),
|
||||
.mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2),
|
||||
};
|
||||
int ret, valid_cnt = 0;
|
||||
u8 i, *pos;
|
||||
|
@ -382,6 +382,7 @@ int mt792xe_mcu_fw_pmctrl(struct mt792x_dev *dev);
|
||||
int mt792x_init_acpi_sar(struct mt792x_dev *dev);
|
||||
int mt792x_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default);
|
||||
u8 mt792x_acpi_get_flags(struct mt792x_phy *phy);
|
||||
u8 mt792x_acpi_get_mtcl_conf(struct mt792x_phy *phy, char *alpha2);
|
||||
#else
|
||||
static inline int mt792x_init_acpi_sar(struct mt792x_dev *dev)
|
||||
{
|
||||
@ -398,6 +399,11 @@ static inline u8 mt792x_acpi_get_flags(struct mt792x_phy *phy)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline u8 mt792x_acpi_get_mtcl_conf(struct mt792x_phy *phy, char *alpha2)
|
||||
{
|
||||
return 0xf;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MT7925_H */
|
||||
|
@ -348,3 +348,56 @@ u8 mt792x_acpi_get_flags(struct mt792x_phy *phy)
|
||||
return flags;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt792x_acpi_get_flags);
|
||||
|
||||
static u8
|
||||
mt792x_acpi_get_mtcl_map(int row, int column, struct mt792x_asar_cl *cl)
|
||||
{
|
||||
u8 config = 0;
|
||||
|
||||
if (cl->cl6g[row] & BIT(column))
|
||||
config |= (cl->mode_6g & 0x3) << 2;
|
||||
if (cl->version > 1 && cl->cl5g9[row] & BIT(column))
|
||||
config |= (cl->mode_5g9 & 0x3);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
u8 mt792x_acpi_get_mtcl_conf(struct mt792x_phy *phy, char *alpha2)
|
||||
{
|
||||
static const char * const cc_list_all[] = {
|
||||
"00", "EU", "AR", "AU", "AZ", "BY", "BO", "BR",
|
||||
"CA", "CL", "CN", "ID", "JP", "MY", "MX", "ME",
|
||||
"MA", "NZ", "NG", "PH", "RU", "RS", "SG", "KR",
|
||||
"TW", "TH", "UA", "GB", "US", "VN", "KH", "PY",
|
||||
};
|
||||
static const char * const cc_list_eu[] = {
|
||||
"AT", "BE", "BG", "CY", "CZ", "HR", "DK", "EE",
|
||||
"FI", "FR", "DE", "GR", "HU", "IS", "IE", "IT",
|
||||
"LV", "LI", "LT", "LU", "MT", "NL", "NO", "PL",
|
||||
"PT", "RO", "MT", "SK", "SI", "ES", "CH",
|
||||
};
|
||||
struct mt792x_acpi_sar *sar = phy->acpisar;
|
||||
struct mt792x_asar_cl *cl;
|
||||
int col, row, i;
|
||||
|
||||
if (!sar)
|
||||
return 0xf;
|
||||
|
||||
cl = sar->countrylist;
|
||||
if (!cl)
|
||||
return 0xc;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cc_list_all); i++) {
|
||||
col = 7 - i % 8;
|
||||
row = i / 8;
|
||||
if (!memcmp(cc_list_all[i], alpha2, 2))
|
||||
return mt792x_acpi_get_mtcl_map(row, col, cl);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cc_list_eu); i++)
|
||||
if (!memcmp(cc_list_eu[i], alpha2, 2))
|
||||
return mt792x_acpi_get_mtcl_map(0, 6, cl);
|
||||
|
||||
return mt792x_acpi_get_mtcl_map(0, 7, cl);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt792x_acpi_get_mtcl_conf);
|
||||
|
@ -77,6 +77,8 @@ struct mt792x_asar_cl {
|
||||
u8 version;
|
||||
u8 mode_6g;
|
||||
u8 cl6g[6];
|
||||
u8 mode_5g9;
|
||||
u8 cl5g9[6];
|
||||
} __packed;
|
||||
|
||||
struct mt792x_asar_fg {
|
||||
|
Loading…
x
Reference in New Issue
Block a user