linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: nbd@nbd.name
Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com,
	ryder.lee@mediatek.com, sean.wang@mediatek.com,
	linux-mediatek@lists.infradead.org
Subject: [PATCH v2 10/22] mt76: mt7615: wake device before performing freq scan
Date: Fri,  3 Jul 2020 10:15:49 +0200	[thread overview]
Message-ID: <5a2efad230b8fe371fa03a1c07ea948bb3475b6d.1593763584.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1593763584.git.lorenzo@kernel.org>

Set device in full power before performing hw scan or hw scheduled scan

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../net/wireless/mediatek/mt76/mt7615/main.c  | 34 ++++++++++++++++---
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index d1ddd5b15955..eb56cd7cb429 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -915,17 +915,26 @@ static int
 mt7615_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	       struct ieee80211_scan_request *req)
 {
+	struct mt7615_dev *dev = mt7615_hw_dev(hw);
 	struct mt76_phy *mphy = hw->priv;
+	int err;
 
-	return mt7615_mcu_hw_scan(mphy->priv, vif, req);
+	mt7615_mutex_acquire(dev);
+	err = mt7615_mcu_hw_scan(mphy->priv, vif, req);
+	mt7615_mutex_release(dev);
+
+	return err;
 }
 
 static void
 mt7615_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
+	struct mt7615_dev *dev = mt7615_hw_dev(hw);
 	struct mt76_phy *mphy = hw->priv;
 
+	mt7615_mutex_acquire(dev);
 	mt7615_mcu_cancel_hw_scan(mphy->priv, vif);
+	mt7615_mutex_release(dev);
 }
 
 static int
@@ -933,22 +942,35 @@ mt7615_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			struct cfg80211_sched_scan_request *req,
 			struct ieee80211_scan_ies *ies)
 {
+	struct mt7615_dev *dev = mt7615_hw_dev(hw);
 	struct mt76_phy *mphy = hw->priv;
 	int err;
 
+	mt7615_mutex_acquire(dev);
+
 	err = mt7615_mcu_sched_scan_req(mphy->priv, vif, req);
 	if (err < 0)
-		return err;
+		goto out;
 
-	return mt7615_mcu_sched_scan_enable(mphy->priv, vif, true);
+	err = mt7615_mcu_sched_scan_enable(mphy->priv, vif, true);
+out:
+	mt7615_mutex_release(dev);
+
+	return err;
 }
 
 static int
 mt7615_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
+	struct mt7615_dev *dev = mt7615_hw_dev(hw);
 	struct mt76_phy *mphy = hw->priv;
+	int err;
+
+	mt7615_mutex_acquire(dev);
+	err = mt7615_mcu_sched_scan_enable(mphy->priv, vif, false);
+	mt7615_mutex_release(dev);
 
-	return mt7615_mcu_sched_scan_enable(mphy->priv, vif, false);
+	return err;
 }
 
 static int mt7615_remain_on_channel(struct ieee80211_hw *hw,
@@ -1074,7 +1096,11 @@ static void mt7615_set_rekey_data(struct ieee80211_hw *hw,
 				  struct ieee80211_vif *vif,
 				  struct cfg80211_gtk_rekey_data *data)
 {
+	struct mt7615_dev *dev = mt7615_hw_dev(hw);
+
+	mt7615_mutex_acquire(dev);
 	mt7615_mcu_update_gtk_rekey(hw, vif, data);
+	mt7615_mutex_release(dev);
 }
 #endif /* CONFIG_PM */
 
-- 
2.26.2


  parent reply	other threads:[~2020-07-03  8:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03  8:15 [PATCH v2 00/22] add runtime-pm support to mt7663 driver Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 01/22] mt76: mt7615: avoid polling in fw_own for mt7663 Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 02/22] mt76: move mt76 worqueue in common code Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 03/22] mt76: mt7615: add mt7615_pm_wake utility routine Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 04/22] mt76: mt7615: introduce mt7615_mutex_{acquire,release} utilities Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 05/22] mt76: mt7615: wake device before accessing regmap in debugfs Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 06/22] mt76: mt7615: wake device before configuring hw keys Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 07/22] mt76: mt7615: introduce pm_power_save delayed work Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 08/22] mt76: mt7615: wake device in mt7615_update_channel before access regmap Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 09/22] mt76: mt7615: acquire driver_own before configuring device for suspend Lorenzo Bianconi
2020-07-03  8:15 ` Lorenzo Bianconi [this message]
2020-07-03  8:15 ` [PATCH v2 11/22] mt76: mt7615: add missing lock in mt7615_regd_notifier Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 12/22] mt76: mt7615: run mt7615_mcu_set_wmm holding mt76 mutex Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 13/22] mt76: mt7615: run mt7615_mcu_set_roc " Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 14/22] mt76: mt7615: wake device before pulling packets from mac80211 queues Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 15/22] mt76: mt7615: wake device before pushing frames in mt7615_tx Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 16/22] mt76: mt7615: run mt7615_pm_wake in mt7615_mac_sta_{add,remove} Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 17/22] mt76: mt7615: check MT76_STATE_PM flag before accessing the device Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 18/22] mt76: mt7615: do not request {driver,fw}_own if already granted Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 19/22] mt76: mt7615: add runtime-pm knob in mt7615 debugfs Lorenzo Bianconi
2020-07-03  8:15 ` [PATCH v2 20/22] mt76: mt7615: enable beacon hw filter for runtime-pm Lorenzo Bianconi
2020-07-03  8:16 ` [PATCH v2 21/22] mt76: mt7615: add idle-timeout knob in mt7615 debugfs Lorenzo Bianconi
2020-07-03  8:16 ` [PATCH v2 22/22] mt76: mt7615: improve mt7615_driver_own reliability Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a2efad230b8fe371fa03a1c07ea948bb3475b6d.1593763584.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).