]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: move disabling dynamic mechanism functions to core
authorZong-Zhe Yang <kevin_yang@realtek.com>
Tue, 10 Mar 2026 08:01:38 +0000 (16:01 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 16 Mar 2026 06:14:54 +0000 (14:14 +0800)
Some dynamic mechanism (DM) may need to be disabled during some normal
processes rather than debugging. For example, should not do MLSR switch
during SCAN/ROC or even MCC. So, move the disabling DM functions to core
for impending uses.

No logic changes.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260310080146.31113-6-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/debug.c

index 9d9b915709893a139d3682e972ff18a84eecab73..81004ef18168c3d33ddcd222ff5e947935b83a01 100644 (file)
@@ -4713,6 +4713,35 @@ static void rtw89_track_work(struct wiphy *wiphy, struct wiphy_work *work)
                rtw89_enter_lps_track(rtwdev);
 }
 
+void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new)
+{
+       struct rtw89_hal *hal = &rtwdev->hal;
+       u32 old = hal->disabled_dm_bitmap;
+
+       if (new == old)
+               return;
+
+       hal->disabled_dm_bitmap = new;
+
+       rtw89_debug(rtwdev, RTW89_DBG_STATE, "Disable DM: 0x%x -> 0x%x\n", old, new);
+}
+
+void rtw89_core_dm_disable_set(struct rtw89_dev *rtwdev, enum rtw89_dm_type type)
+{
+       struct rtw89_hal *hal = &rtwdev->hal;
+       u32 cur = hal->disabled_dm_bitmap;
+
+       rtw89_core_dm_disable_cfg(rtwdev, cur | BIT(type));
+}
+
+void rtw89_core_dm_disable_clr(struct rtw89_dev *rtwdev, enum rtw89_dm_type type)
+{
+       struct rtw89_hal *hal = &rtwdev->hal;
+       u32 cur = hal->disabled_dm_bitmap;
+
+       rtw89_core_dm_disable_cfg(rtwdev, cur & ~BIT(type));
+}
+
 u8 rtw89_core_acquire_bit_map(unsigned long *addr, unsigned long size)
 {
        unsigned long bit;
index cf0cc718f41cc8883a06db9ae528edd9a148f4c0..05f8ad6d30347e1b36104962c5935539d0d372a5 100644 (file)
@@ -7862,5 +7862,8 @@ void rtw89_core_update_p2p_ps(struct rtw89_dev *rtwdev,
 void rtw89_core_ntfy_btc_event(struct rtw89_dev *rtwdev, enum rtw89_btc_hmsg event);
 int rtw89_core_mlsr_switch(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
                           unsigned int link_id);
+void rtw89_core_dm_disable_cfg(struct rtw89_dev *rtwdev, u32 new);
+void rtw89_core_dm_disable_set(struct rtw89_dev *rtwdev, enum rtw89_dm_type type);
+void rtw89_core_dm_disable_clr(struct rtw89_dev *rtwdev, enum rtw89_dm_type type);
 
 #endif
index 3e16ed2c4570d54c25cf039829ce6c68c6706e64..aee0f25e036a261f348f64566e1fe40fd6d4e29d 100644 (file)
@@ -4333,35 +4333,6 @@ static ssize_t rtw89_debug_priv_stations_get(struct rtw89_dev *rtwdev,
        return p - buf;
 }
 
-static void rtw89_debug_disable_dm_cfg_bmap(struct rtw89_dev *rtwdev, u32 new)
-{
-       struct rtw89_hal *hal = &rtwdev->hal;
-       u32 old = hal->disabled_dm_bitmap;
-
-       if (new == old)
-               return;
-
-       hal->disabled_dm_bitmap = new;
-
-       rtw89_debug(rtwdev, RTW89_DBG_STATE, "Disable DM: 0x%x -> 0x%x\n", old, new);
-}
-
-static void rtw89_debug_disable_dm_set_flag(struct rtw89_dev *rtwdev, u8 flag)
-{
-       struct rtw89_hal *hal = &rtwdev->hal;
-       u32 cur = hal->disabled_dm_bitmap;
-
-       rtw89_debug_disable_dm_cfg_bmap(rtwdev, cur | BIT(flag));
-}
-
-static void rtw89_debug_disable_dm_clr_flag(struct rtw89_dev *rtwdev, u8 flag)
-{
-       struct rtw89_hal *hal = &rtwdev->hal;
-       u32 cur = hal->disabled_dm_bitmap;
-
-       rtw89_debug_disable_dm_cfg_bmap(rtwdev, cur & ~BIT(flag));
-}
-
 #define DM_INFO(type) {RTW89_DM_ ## type, #type}
 
 static const struct rtw89_disabled_dm_info {
@@ -4412,7 +4383,7 @@ rtw89_debug_priv_disable_dm_set(struct rtw89_dev *rtwdev,
        if (ret)
                return -EINVAL;
 
-       rtw89_debug_disable_dm_cfg_bmap(rtwdev, conf);
+       rtw89_core_dm_disable_cfg(rtwdev, conf);
 
        return count;
 }
@@ -4475,7 +4446,7 @@ rtw89_debug_priv_mlo_mode_set(struct rtw89_dev *rtwdev,
        if (num != 2)
                return -EINVAL;
 
-       rtw89_debug_disable_dm_set_flag(rtwdev, RTW89_DM_MLO);
+       rtw89_core_dm_disable_set(rtwdev, RTW89_DM_MLO);
 
        rtw89_debug(rtwdev, RTW89_DBG_STATE, "Set MLO mode to %x\n", mlo_mode);
 
@@ -4485,7 +4456,7 @@ rtw89_debug_priv_mlo_mode_set(struct rtw89_dev *rtwdev,
                break;
        default:
                rtw89_debug(rtwdev, RTW89_DBG_STATE, "Unsupported MLO mode\n");
-               rtw89_debug_disable_dm_clr_flag(rtwdev, RTW89_DM_MLO);
+               rtw89_core_dm_disable_clr(rtwdev, RTW89_DM_MLO);
 
                return -EOPNOTSUPP;
        }