mt76: mt7615: wake device in mt7615_update_channel before access regmap
Introduce mt7615_update_survey utility routine in order to compute survey stats without waking up the device since it runs holding mt76 lock. Run mt7615_pm_wake directly in mt7615_update_channel since it can run with mt76.mutex held if called by mac80211 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:

committed by
Felix Fietkau

parent
de5ff3c9d1
commit
04414240ad
@@ -560,8 +560,7 @@ mt76_channel_state(struct mt76_phy *phy, struct ieee80211_channel *c)
|
||||
return &msband->chan[idx];
|
||||
}
|
||||
|
||||
static void
|
||||
mt76_update_survey_active_time(struct mt76_phy *phy, ktime_t time)
|
||||
void mt76_update_survey_active_time(struct mt76_phy *phy, ktime_t time)
|
||||
{
|
||||
struct mt76_channel_state *state = phy->chan_state;
|
||||
|
||||
@@ -569,6 +568,7 @@ mt76_update_survey_active_time(struct mt76_phy *phy, ktime_t time)
|
||||
phy->survey_time));
|
||||
phy->survey_time = time;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_update_survey_active_time);
|
||||
|
||||
void mt76_update_survey(struct mt76_dev *dev)
|
||||
{
|
||||
|
@@ -884,6 +884,7 @@ void mt76_release_buffered_frames(struct ieee80211_hw *hw,
|
||||
bool mt76_has_tx_pending(struct mt76_phy *phy);
|
||||
void mt76_set_channel(struct mt76_phy *phy);
|
||||
void mt76_update_survey(struct mt76_dev *dev);
|
||||
void mt76_update_survey_active_time(struct mt76_phy *phy, ktime_t time);
|
||||
int mt76_get_survey(struct ieee80211_hw *hw, int idx,
|
||||
struct survey_info *survey);
|
||||
void mt76_set_stream_caps(struct mt76_phy *phy, bool vht);
|
||||
|
@@ -1747,9 +1747,9 @@ mt7615_phy_update_channel(struct mt76_phy *mphy, int idx)
|
||||
state->noise = -(phy->noise >> 4);
|
||||
}
|
||||
|
||||
void mt7615_update_channel(struct mt76_dev *mdev)
|
||||
static void __mt7615_update_channel(struct mt7615_dev *dev)
|
||||
{
|
||||
struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
|
||||
struct mt76_dev *mdev = &dev->mt76;
|
||||
|
||||
mt7615_phy_update_channel(&mdev->phy, 0);
|
||||
if (mdev->phy2)
|
||||
@@ -1758,8 +1758,32 @@ void mt7615_update_channel(struct mt76_dev *mdev)
|
||||
/* reset obss airtime */
|
||||
mt76_set(dev, MT_WF_RMAC_MIB_TIME0, MT_WF_RMAC_MIB_RXTIME_CLR);
|
||||
}
|
||||
|
||||
void mt7615_update_channel(struct mt76_dev *mdev)
|
||||
{
|
||||
struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
|
||||
|
||||
if (mt7615_pm_wake(dev))
|
||||
return;
|
||||
|
||||
__mt7615_update_channel(dev);
|
||||
mt7615_pm_power_save_sched(dev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt7615_update_channel);
|
||||
|
||||
static void mt7615_update_survey(struct mt7615_dev *dev)
|
||||
{
|
||||
struct mt76_dev *mdev = &dev->mt76;
|
||||
ktime_t cur_time;
|
||||
|
||||
__mt7615_update_channel(dev);
|
||||
cur_time = ktime_get_boottime();
|
||||
|
||||
mt76_update_survey_active_time(&mdev->phy, cur_time);
|
||||
if (mdev->phy2)
|
||||
mt76_update_survey_active_time(mdev->phy2, cur_time);
|
||||
}
|
||||
|
||||
static void
|
||||
mt7615_mac_update_mib_stats(struct mt7615_phy *phy)
|
||||
{
|
||||
@@ -1889,7 +1913,7 @@ void mt7615_mac_work(struct work_struct *work)
|
||||
|
||||
mt7615_mutex_acquire(phy->dev);
|
||||
|
||||
mt76_update_survey(mdev);
|
||||
mt7615_update_survey(phy->dev);
|
||||
if (++phy->mac_work_count == 5) {
|
||||
phy->mac_work_count = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user