diff mbox

[v2,1/8] rsi: add support for rf-kill functionality

Message ID 1501770544-6746-2-git-send-email-amitkarwar@gmail.com (mailing list archive)
State Accepted
Commit edba3532c6522302e1cfa9625e096d9e6fbb4d36
Delegated to: Kalle Valo
Headers show

Commit Message

Amitkumar Karwar Aug. 3, 2017, 2:28 p.m. UTC
From: Pavani Muthyala <pavani.muthyala@redpinesignals.com>

This patch implements rfkill_poll handler. Also, necessary changes
are done in interface up and down handler to support rfkill
functionality.

Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Comments

Kalle Valo Aug. 8, 2017, 11:46 a.m. UTC | #1
Amitkumar Karwar <amitkarwar@gmail.com> wrote:

> From: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
> 
> This patch implements rfkill_poll handler. Also, necessary changes
> are done in interface up and down handler to support rfkill
> functionality.
> 
> Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
> Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>

8 patches applied to wireless-drivers-next.git, thanks.

edba3532c652 rsi: add support for rf-kill functionality
588349a1fe3b rsi: update set_antenna command frame
ce86893fa8d8 rsi: add support for legacy power save
db07971d085f rsi: add support for U-APSD power save
23e414cca1f7 rsi: rename sdio_read_buffer_status_register
d64dd2a172d8 rsi: buffer full check optimization
67c52a4dafce rsi: buffer available interrupt handling
80a88ecf3bcc rsi: RTS threshold configuration
diff mbox

Patch

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index c91d6ef..193f922 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -279,11 +279,12 @@  static int rsi_mac80211_start(struct ieee80211_hw *hw)
 	struct rsi_hw *adapter = hw->priv;
 	struct rsi_common *common = adapter->priv;
 
+	rsi_dbg(ERR_ZONE, "===> Interface UP <===\n");
 	mutex_lock(&common->mutex);
 	common->iface_down = false;
-	mutex_unlock(&common->mutex);
-
+	wiphy_rfkill_start_polling(hw->wiphy);
 	rsi_send_rx_filter_frame(common, 0);
+	mutex_unlock(&common->mutex);
 
 	return 0;
 }
@@ -299,8 +300,10 @@  static void rsi_mac80211_stop(struct ieee80211_hw *hw)
 	struct rsi_hw *adapter = hw->priv;
 	struct rsi_common *common = adapter->priv;
 
+	rsi_dbg(ERR_ZONE, "===> Interface DOWN <===\n");
 	mutex_lock(&common->mutex);
 	common->iface_down = true;
+	wiphy_rfkill_stop_polling(hw->wiphy);
 
 	/* Block all rx frames */
 	rsi_send_rx_filter_frame(common, 0xffff);
@@ -1214,6 +1217,19 @@  static void rsi_reg_notify(struct wiphy *wiphy,
 	mutex_unlock(&common->mutex);
 }
 
+static void rsi_mac80211_rfkill_poll(struct ieee80211_hw *hw)
+{
+	struct rsi_hw *adapter = hw->priv;
+	struct rsi_common *common = adapter->priv;
+
+	mutex_lock(&common->mutex);
+	if (common->fsm_state != FSM_MAC_INIT_DONE)
+		wiphy_rfkill_set_hw_state(hw->wiphy, true);
+	else
+		wiphy_rfkill_set_hw_state(hw->wiphy, false);
+	mutex_unlock(&common->mutex);
+}
+
 static struct ieee80211_ops mac80211_ops = {
 	.tx = rsi_mac80211_tx,
 	.start = rsi_mac80211_start,
@@ -1232,6 +1248,7 @@  static struct ieee80211_ops mac80211_ops = {
 	.sta_remove = rsi_mac80211_sta_remove,
 	.set_antenna = rsi_mac80211_set_antenna,
 	.get_antenna = rsi_mac80211_get_antenna,
+	.rfkill_poll = rsi_mac80211_rfkill_poll,
 };
 
 /**