[PATCH v5 19/21] wifi: mt76: mt792x: enable CNM ops for MT7927

Sean Wang
2026-04-25T19:51:58Z

Enable CNM support for MT7927 so mac80211 keeps remain-on-channel callbacks
available. MT7927 needs them at runtime even when the capability is not
advertised through the normal firmware feature path.

Co-developed-by: Javier Tia <floss@jetm.me>
Signed-off-by: Javier Tia <floss@jetm.me>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt792x_core.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index 152cfcca2f90..3fdcd0599ff2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -759,6 +759,13 @@ mt792x_get_offload_capability(struct device *dev, const char *fw_wm)
return offload_caps;
}

+static bool mt792x_needs_cnm_runtime(const void *drv_data)
+{
+ const char *fw_wm = drv_data;
+
+ return fw_wm && !strcmp(fw_wm, MT7927_FIRMWARE_WM);
+}
+
struct ieee80211_ops *
mt792x_get_mac80211_ops(struct device *dev,
const struct ieee80211_ops *mac80211_ops,
@@ -772,6 +779,10 @@ mt792x_get_mac80211_ops(struct device *dev,
return NULL;

*fw_features = mt792x_get_offload_capability(dev, drv_data);
+
+ if (mt792x_needs_cnm_runtime(drv_data))
+ *fw_features |= MT792x_FW_CAP_CNM;
+
if (!(*fw_features & MT792x_FW_CAP_CNM)) {
ops->remain_on_channel = NULL;
ops->cancel_remain_on_channel = NULL;
--
2.43.0