]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: mt7925: introduce thermal protection
authorLeon Yen <leon.yen@mediatek.com>
Fri, 9 May 2025 08:21:17 +0000 (16:21 +0800)
committerFelix Fietkau <nbd@nbd.name>
Wed, 21 May 2025 12:49:38 +0000 (14:49 +0200)
Add thermal protection to prevent the chip from possible overheating
due to prolonged high traffic and adverse operating conditions.

Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250509082117.453819-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/init.c
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
drivers/net/wireless/mediatek/mt76/mt7925/mcu.h

index 79639be0d29aca7801f5482b9e483a4d15401183..2a83ff59a968c9fab16f4d2aa82fe9dad79228ae 100644 (file)
@@ -322,6 +322,12 @@ static void mt7925_init_work(struct work_struct *work)
                return;
        }
 
+       ret = mt7925_mcu_set_thermal_protect(dev);
+       if (ret) {
+               dev_err(dev->mt76.dev, "thermal protection enable failed\n");
+               return;
+       }
+
        /* we support chip reset now */
        dev->hw_init_done = true;
 
index 286f602623c00e156189713b7f2bdabbd78def91..63076171df3b94e7f8da505d4ddf959ac78de973 100644 (file)
@@ -974,6 +974,23 @@ int mt7925_mcu_set_deep_sleep(struct mt792x_dev *dev, bool enable)
 }
 EXPORT_SYMBOL_GPL(mt7925_mcu_set_deep_sleep);
 
+int mt7925_mcu_set_thermal_protect(struct mt792x_dev *dev)
+{
+       char cmd[64];
+       int ret = 0;
+
+       snprintf(cmd, sizeof(cmd), "ThermalProtGband %d %d %d %d %d %d %d %d %d %d",
+                0, 100, 90, 80, 30, 1, 1, 115, 105, 5);
+       ret = mt7925_mcu_chip_config(dev, cmd);
+
+       snprintf(cmd, sizeof(cmd), "ThermalProtAband %d %d %d %d %d %d %d %d %d %d",
+                1, 100, 90, 80, 30, 1, 1, 115, 105, 5);
+       ret |= mt7925_mcu_chip_config(dev, cmd);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(mt7925_mcu_set_thermal_protect);
+
 int mt7925_run_firmware(struct mt792x_dev *dev)
 {
        int err;
@@ -3339,7 +3356,8 @@ int mt7925_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,
                else
                        uni_txd->option = MCU_CMD_UNI_EXT_ACK;
 
-               if (cmd == MCU_UNI_CMD(HIF_CTRL))
+               if (cmd == MCU_UNI_CMD(HIF_CTRL) ||
+                   cmd == MCU_UNI_CMD(CHIP_CONFIG))
                        uni_txd->option &= ~MCU_CMD_ACK;
 
                goto exit;
index d55ea59bda7da704318e761f0aaa8449dd9b78d1..b1882944807e6e504c2f446d8686737f621515aa 100644 (file)
@@ -650,6 +650,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
 int mt7925_mcu_set_timing(struct mt792x_phy *phy,
                          struct ieee80211_bss_conf *link_conf);
 int mt7925_mcu_set_deep_sleep(struct mt792x_dev *dev, bool enable);
+int mt7925_mcu_set_thermal_protect(struct mt792x_dev *dev);
 int mt7925_mcu_set_channel_domain(struct mt76_phy *phy);
 int mt7925_mcu_set_radio_en(struct mt792x_phy *phy, bool enable);
 int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif_link *mvif,