diff mbox series

[4/4] UBUNTU: SAUCE: Redpine: resolve power save issue after S4 resume

Message ID 1519913599-30203-5-git-send-email-amitkarwar@gmail.com
State New
Headers show
Series Redpine: wowlan enhancements | expand

Commit Message

Amitkumar Karwar March 1, 2018, 2:13 p.m. UTC
From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1742090
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1742094

We are redownloading the firmware after S4 resume. We observed in
stress test that mac80211 sometimes gives power save request after
resume which causes the firmware in bad state.
mac_ops_resumed flag is added to skip that request until initialisation
is done.

Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
---
 ubuntu/rsi/rsi_91x_mac80211.c | 7 ++++++-
 ubuntu/rsi/rsi_91x_sdio.c     | 1 +
 ubuntu/rsi/rsi_main.h         | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ubuntu/rsi/rsi_91x_mac80211.c b/ubuntu/rsi/rsi_91x_mac80211.c
index 36c0cfd..129859a 100644
--- a/ubuntu/rsi/rsi_91x_mac80211.c
+++ b/ubuntu/rsi/rsi_91x_mac80211.c
@@ -359,6 +359,7 @@  static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw,
 	int ii =0;
 
 	ven_rsi_dbg(INFO_ZONE, "***** Hardware scan start *****\n");
+	common->mac_ops_resumed = false;
 
 	if (common->fsm_state != FSM_MAC_INIT_DONE)
 		return -ENODEV;
@@ -566,6 +567,8 @@  static void rsi_mac80211_tx(struct ieee80211_hw *hw,
 	    (adapter->ps_state == PS_ENABLED) &&
 	    (vif->type == NL80211_IFTYPE_STATION))
 		rsi_disable_ps(adapter);
+	if (ieee80211_is_auth(wlh->frame_control))
+		common->mac_ops_resumed = false;
 
   if ((common->coex_mode == 4) &&
       (vif->type == NL80211_IFTYPE_STATION) &&
@@ -1078,7 +1081,8 @@  static int rsi_mac80211_config(struct ieee80211_hw *hw,
 
 	/* Power save parameters */
 	if ((changed & IEEE80211_CONF_CHANGE_PS) &&
-	    (vif->type == NL80211_IFTYPE_STATION)) {
+	    (vif->type == NL80211_IFTYPE_STATION) &&
+	     !common->mac_ops_resumed) {
 		unsigned long flags;
 
 		spin_lock_irqsave(&adapter->ps_lock, flags);
@@ -2466,6 +2470,7 @@  static int rsi_mac80211_resume(struct ieee80211_hw *hw)
 	ven_rsi_dbg(INFO_ZONE, "%s: mac80211 resume\n", __func__);
 
 	if (common->hibernate_resume) {
+		common->mac_ops_resumed = true;
 		if (common->reinit_hw)
 			wait_for_completion(&common->wlan_init_completion);
 		/* Device need a complete restart of all MAC operations.
diff --git a/ubuntu/rsi/rsi_91x_sdio.c b/ubuntu/rsi/rsi_91x_sdio.c
index 49d46af..06ebae8 100644
--- a/ubuntu/rsi/rsi_91x_sdio.c
+++ b/ubuntu/rsi/rsi_91x_sdio.c
@@ -1506,6 +1506,7 @@  int rsi_restore(struct device *dev)
 	adapter->priv->iface_down = true;
 
 	adapter->sc_nvifs = 0;
+	adapter->ps_state = PS_NONE;
 	flush_workqueue(adapter->priv->scan_workqueue);
 	ieee80211_stop_queues(adapter->hw);
 
diff --git a/ubuntu/rsi/rsi_main.h b/ubuntu/rsi/rsi_main.h
index 53b9245..2aad124 100644
--- a/ubuntu/rsi/rsi_main.h
+++ b/ubuntu/rsi/rsi_main.h
@@ -381,6 +381,7 @@  struct rsi_common {
 	struct timer_list scan_timer;
 	bool hw_scan_cancel;
 #endif
+	bool mac_ops_resumed;
 };
 
 enum host_intf {