mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7921: get regulatory information from the clc event
The clc event can report the radio configuration for the corresponding country and the driver would take it as regulatory information of a certain platform device. This patch would change the clc commnad from no-waiting to waiting for event. For backward compatible, we also add a new nic capability tag to indicate the firmware did support this new clc event from now on. Signed-off-by: Ming Yen Hsieh <[email protected]> Co-developed-by: Deren Wu <[email protected]> Signed-off-by: Deren Wu <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
581449ac52
commit
9bfd669e94
+22
-4
@@ -557,6 +557,9 @@ static int mt7921_mcu_get_nic_capability(struct mt792x_phy *mphy)
|
||||
mt7921_mcu_parse_tx_resource(phy->dev,
|
||||
skb);
|
||||
break;
|
||||
case MT_NIC_CAP_CHIP_CAP:
|
||||
memcpy(&mphy->chip_cap, (void *)skb->data, sizeof(u64));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1243,7 +1246,8 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
|
||||
struct mt7921_clc *clc,
|
||||
u8 idx)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
#define CLC_CAP_EVT_EN BIT(0)
|
||||
struct sk_buff *skb, *ret_skb = NULL;
|
||||
struct {
|
||||
u8 ver;
|
||||
u8 pad0;
|
||||
@@ -1251,7 +1255,7 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
|
||||
u8 idx;
|
||||
u8 env;
|
||||
u8 acpi_conf;
|
||||
u8 pad1;
|
||||
u8 cap;
|
||||
u8 alpha2[2];
|
||||
u8 type[2];
|
||||
u8 env_6g;
|
||||
@@ -1268,6 +1272,9 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
|
||||
if (!clc)
|
||||
return 0;
|
||||
|
||||
if (dev->phy.chip_cap & MT792x_CHIP_CAP_CLC_EVT_EN)
|
||||
req.cap |= CLC_CAP_EVT_EN;
|
||||
|
||||
pos = clc->data;
|
||||
for (i = 0; i < clc->nr_country; i++) {
|
||||
struct mt7921_clc_rule *rule = (struct mt7921_clc_rule *)pos;
|
||||
@@ -1289,10 +1296,21 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
|
||||
return -ENOMEM;
|
||||
skb_put_data(skb, rule->data, len);
|
||||
|
||||
ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
|
||||
MCU_CE_CMD(SET_CLC), false);
|
||||
ret = mt76_mcu_skb_send_and_get_msg(&dev->mt76, skb,
|
||||
MCU_CE_CMD(SET_CLC),
|
||||
!!(req.cap & CLC_CAP_EVT_EN),
|
||||
&ret_skb);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (ret_skb) {
|
||||
struct mt7921_clc_info_tlv *info;
|
||||
|
||||
info = (struct mt7921_clc_info_tlv *)(ret_skb->data + 4);
|
||||
dev->phy.clc_chan_conf = info->chan_conf;
|
||||
dev_kfree_skb(ret_skb);
|
||||
}
|
||||
|
||||
valid_cnt++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user