@@ -4,6 +4,9 @@
#include "mt7921.h"
#include "eeprom.h"
+extern bool mt7921_disable_pm;
+extern bool mt7921_disable_deep_sleep;
+
static int
mt7921_reg_set(void *data, u64 val)
{
@@ -272,7 +275,7 @@ mt7921_pm_set(void *data, u64 val)
mutex_lock(&dev->mt76.mutex);
- if (val == pm->enable_user)
+ if (val == pm->enable_user && val == pm->enable)
goto out;
if (!pm->enable_user) {
@@ -318,11 +321,11 @@ mt7921_deep_sleep_set(void *data, u64 val)
return -EOPNOTSUPP;
mt7921_mutex_acquire(dev);
- if (pm->ds_enable_user == enable)
+ if (pm->ds_enable_user == enable && pm->ds_enable == enable)
goto out;
pm->ds_enable_user = enable;
- pm->ds_enable = enable && !monitor;
+ pm->ds_enable = enable && !monitor && !mt7921_disable_deep_sleep;
mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable);
out:
mt7921_mutex_release(dev);
@@ -362,6 +365,13 @@ mt7921_pm_stats(struct seq_file *s, void *data)
jiffies_to_msecs(doze_time));
seq_printf(s, "low power wakes: %9d\n", pm->stats.lp_wake);
+ seq_printf(s, "\nlast-beacon-filter-setting: %d\n", dev->beacon_filter_setting);
+ seq_printf(s, "pm.enable: %d\n", pm->enable);
+ seq_printf(s, "pm.user_enable: %d\n", pm->enable_user);
+ seq_printf(s, "pm.deep_sleep_enable: %d\n", pm->ds_enable);
+ seq_printf(s, "pm.user_deep_sleep_enable: %d\n", pm->ds_enable_user);
+ seq_printf(s, "modparm-disable-pm: %d\n", mt7921_disable_pm);
+ seq_printf(s, "modparm-disable-deep-sleep-pm: %d\n", mt7921_disable_deep_sleep);
return 0;
}
@@ -7,6 +7,9 @@
#include "mcu.h"
#include "eeprom.h"
+extern bool mt7921_disable_pm;
+extern bool mt7921_disable_deep_sleep;
+
static const struct ieee80211_iface_limit if_limits[] = {
{
.max = MT7921_MAX_INTERFACES,
@@ -98,7 +101,6 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
ieee80211_hw_set(hw, SUPPORTS_PS);
ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
- ieee80211_hw_set(hw, CONNECTION_MONITOR);
if (dev->pm.enable)
ieee80211_hw_set(hw, CONNECTION_MONITOR);
@@ -158,6 +160,8 @@ static int __mt7921_init_hardware(struct mt7921_dev *dev)
{
int ret;
+ dev->beacon_filter_setting = -1; /* initialize to un-set */
+
/* force firmware operation mode into normal state,
* which should be set before firmware download stage.
*/
@@ -286,9 +290,9 @@ int mt7921_register_device(struct mt7921_dev *dev)
dev->pm.stats.last_doze_event = jiffies;
if (!mt76_is_usb(&dev->mt76)) {
dev->pm.enable_user = true;
- dev->pm.enable = true;
+ dev->pm.enable = !mt7921_disable_pm;
dev->pm.ds_enable_user = true;
- dev->pm.ds_enable = true;
+ dev->pm.ds_enable = !mt7921_disable_deep_sleep;
}
if (!mt76_is_mmio(&dev->mt76))
@@ -9,6 +9,15 @@
#include "mt7921.h"
#include "mcu.h"
+bool mt7921_disable_pm;
+module_param_named(disable_pm, mt7921_disable_pm, bool, 0644);
+MODULE_PARM_DESC(disable_pm, "disable runtime-pm");
+
+bool mt7921_disable_deep_sleep;
+module_param_named(disable_deep_sleep, mt7921_disable_deep_sleep, bool, 0644);
+MODULE_PARM_DESC(disable_deep_sleep, "disable runtime deep-sleep");
+
+
static void
mt7921_gen_ppe_thresh(u8 *he_ppet, int nss)
{
@@ -352,7 +361,8 @@ static int mt7921_add_interface(struct ieee80211_hw *hw,
mtxq->wcid = idx;
}
- vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
+ if (dev->pm.enable)
+ vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
out:
mt7921_mutex_release(dev);
@@ -522,13 +532,12 @@ mt7921_sniffer_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
bool monitor = !!(hw->conf.flags & IEEE80211_CONF_MONITOR);
mt7921_mcu_set_sniffer(dev, vif, monitor);
- pm->enable = pm->enable_user && !monitor;
- pm->ds_enable = pm->ds_enable_user && !monitor;
+ pm->enable = pm->enable_user && !monitor && !mt7921_disable_pm;
+ pm->ds_enable = pm->ds_enable_user && !monitor && !mt7921_disable_deep_sleep;
mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable);
- if (monitor)
- mt7921_mcu_set_beacon_filter(dev, vif, false);
+ mt7921_mcu_set_beacon_filter(dev, vif, pm->enable);
}
void mt7921_set_runtime_pm(struct mt7921_dev *dev)
@@ -537,11 +546,11 @@ void mt7921_set_runtime_pm(struct mt7921_dev *dev)
struct mt76_connac_pm *pm = &dev->pm;
bool monitor = !!(hw->conf.flags & IEEE80211_CONF_MONITOR);
- pm->enable = pm->enable_user && !monitor;
+ pm->enable = pm->enable_user && !monitor && !mt7921_disable_pm;
ieee80211_iterate_active_interfaces(hw,
IEEE80211_IFACE_ITER_RESUME_ALL,
mt7921_pm_interface_iter, dev);
- pm->ds_enable = pm->ds_enable_user && !monitor;
+ pm->ds_enable = pm->ds_enable_user && !monitor && !mt7921_disable_deep_sleep;
mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable);
}
@@ -682,7 +691,7 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_ASSOC) {
mt7921_mcu_sta_update(dev, NULL, vif, true,
MT76_STA_INFO_STATE_ASSOC);
- mt7921_mcu_set_beacon_filter(dev, vif, info->assoc);
+ mt7921_mcu_set_beacon_filter(dev, vif, info->assoc && dev->pm.enable);
}
if (changed & BSS_CHANGED_ARP_FILTER) {
@@ -812,6 +812,8 @@ int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
{
int err;
+ dev->beacon_filter_setting = enable;
+
if (enable) {
err = mt7921_mcu_uni_bss_bcnft(dev, vif, true);
if (err)
@@ -232,6 +232,7 @@ struct mt7921_dev {
struct work_struct init_work;
u8 fw_debug;
+ s8 beacon_filter_setting; /* -1 not set, 0 disabled, 1 enabled */
struct mt76_connac_pm pm;
struct mt76_connac_coredump coredump;