diff mbox

[1/4] libertas: remove auto_deep_sleep functionality

Message ID 20110717170310.CAD139D401C@zog.reactivated.net (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Daniel Drake July 17, 2011, 5:03 p.m. UTC
This is unused and I'm not really sure in what context it was designed to
be used.

Signed-off-by: Daniel Drake <dsd@laptop.org>
---
 drivers/net/wireless/libertas/cmd.c  |   14 ++-----
 drivers/net/wireless/libertas/decl.h |    3 --
 drivers/net/wireless/libertas/dev.h  |    3 --
 drivers/net/wireless/libertas/main.c |   64 ----------------------------------
 4 files changed, 4 insertions(+), 80 deletions(-)

Comments

Bing Zhao July 18, 2011, 7:25 p.m. UTC | #1
Hi Daniel,

> Subject: [PATCH 1/4] libertas: remove auto_deep_sleep functionality
> 
> This is unused and I'm not really sure in what context it was designed to
> be used.

The auto deep sleep feature was added with commit 4912545:
libertas: Add auto deep sleep support for SD8385/SD8686/SD8688

When auto deep sleep is enabled a timer will be started to monitor the activities. At timer expiry (no activity for configured time period) an enter_deep_sleep command will be sent to the card automatically to save power. Once an activity is detected station will exit from deep sleep mode for processing and restart the timer. After the event is processed and there is no new activity the timer will expire and then the deep sleep mode is entered automatically again.

As the auto deep sleep feature for SD8385/SD8686/SD8688 cards is very useful for many embedded platforms to handle enter/exit deep sleep mode automatically, please do not remove it from libertas driver. If you have any particular issue with this feature enabled, we can work on it and solve the problem.

Thanks,
Bing

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Drake July 19, 2011, 3:32 p.m. UTC | #2
On 18 July 2011 20:25, Bing Zhao <bzhao@marvell.com> wrote:
> As the auto deep sleep feature for SD8385/SD8686/SD8688 cards is very useful for many embedded platforms to handle enter/exit deep sleep mode automatically, please do not remove it from libertas driver. If you have any particular issue with this feature enabled, we can work on it and solve the problem.

The problem is that it can't actually be enabled. This is dead code.
Or if it can, please point out what I'm missing.

Or is this a work in progress?

Thanks,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bing Zhao July 19, 2011, 6:23 p.m. UTC | #3
Hi Daniel,

> > As the auto deep sleep feature for SD8385/SD8686/SD8688 cards is very useful for many embedded
> platforms to handle enter/exit deep sleep mode automatically, please do not remove it from libertas
> driver. If you have any particular issue with this feature enabled, we can work on it and solve the
> problem.
> 
> The problem is that it can't actually be enabled. This is dead code.
> Or if it can, please point out what I'm missing.

To enable deep sleep mode:
iwconfig wlan0 power period 0

To enable auto deep sleep mode with idle time period set to 5 seconds:
iwconfig wlan0 power period 5

To disable deep sleep/auto deep sleep mode:
iwconfig wlan0 power period -1

The iwconfig (from Wireless Tools version 30pre8 beta or newer) supports "power period" command.

Thanks,
Bing

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Drake July 19, 2011, 6:36 p.m. UTC | #4
On 19 July 2011 19:23, Bing Zhao <bzhao@marvell.com> wrote:
> To enable deep sleep mode:
> iwconfig wlan0 power period 0
>
> To enable auto deep sleep mode with idle time period set to 5 seconds:
> iwconfig wlan0 power period 5
>
> To disable deep sleep/auto deep sleep mode:
> iwconfig wlan0 power period -1

Paul pointed out that indeed, in old kernels, this functionality was
hooked up to the power wireless extension.

In recent kernels, this is not the case - its not hooked up to
anything. The commands you write above will fail.

Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index dbd24a4..627bdf4 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1024,10 +1024,6 @@  static void lbs_submit_command(struct lbs_private *priv,
 	}
 
 	if (command == CMD_802_11_DEEP_SLEEP) {
-		if (priv->is_auto_deep_sleep_enabled) {
-			priv->wakeup_dev_required = 1;
-			priv->dnld_sent = 0;
-		}
 		priv->is_deep_sleep = 1;
 		lbs_complete_command(priv, cmdnode, 0);
 	} else {
@@ -1614,12 +1610,10 @@  struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv,
 	/* No commands are allowed in Deep Sleep until we toggle the GPIO
 	 * to wake up the card and it has signaled that it's ready.
 	 */
-	if (!priv->is_auto_deep_sleep_enabled) {
-		if (priv->is_deep_sleep) {
-			lbs_deb_cmd("command not allowed in deep sleep\n");
-			cmdnode = ERR_PTR(-EBUSY);
-			goto done;
-		}
+	if (priv->is_deep_sleep) {
+		lbs_deb_cmd("command not allowed in deep sleep\n");
+		cmdnode = ERR_PTR(-EBUSY);
+		goto done;
 	}
 
 	cmdnode = lbs_get_free_cmd_node(priv);
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index da0b05b..cfe3272 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -54,9 +54,6 @@  int lbs_resume(struct lbs_private *priv);
 void lbs_queue_event(struct lbs_private *priv, u32 event);
 void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx);
 
-int lbs_enter_auto_deep_sleep(struct lbs_private *priv);
-int lbs_exit_auto_deep_sleep(struct lbs_private *priv);
-
 u32 lbs_fw_index_to_data_rate(u8 index);
 u8 lbs_data_rate_to_fw_index(u32 rate);
 
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 76d018b..094e1f2 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -74,12 +74,9 @@  struct lbs_private {
 	/* Deep sleep */
 	int is_deep_sleep;
 	int deep_sleep_required;
-	int is_auto_deep_sleep_enabled;
 	int wakeup_dev_required;
 	int is_activity_detected;
-	int auto_deep_sleep_timeout; /* in ms */
 	wait_queue_head_t ds_awake_q;
-	struct timer_list auto_deepsleep_timer;
 
 	/* Host sleep*/
 	int is_host_sleep_configured;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index c79aac4..4b086cd 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -520,7 +520,6 @@  static int lbs_thread(void *data)
 	}
 
 	del_timer(&priv->command_timer);
-	del_timer(&priv->auto_deepsleep_timer);
 
 	lbs_deb_leave(LBS_DEB_THREAD);
 	return 0;
@@ -653,64 +652,6 @@  out:
 	lbs_deb_leave(LBS_DEB_CMD);
 }
 
-/**
- * auto_deepsleep_timer_fn - put the device back to deep sleep mode when
- * timer expires and no activity (command, event, data etc.) is detected.
- * @data:	&struct lbs_private pointer
- * returns:	N/A
- */
-static void auto_deepsleep_timer_fn(unsigned long data)
-{
-	struct lbs_private *priv = (struct lbs_private *)data;
-
-	lbs_deb_enter(LBS_DEB_CMD);
-
-	if (priv->is_activity_detected) {
-		priv->is_activity_detected = 0;
-	} else {
-		if (priv->is_auto_deep_sleep_enabled &&
-		    (!priv->wakeup_dev_required) &&
-		    (priv->connect_status != LBS_CONNECTED)) {
-			struct cmd_header cmd;
-
-			lbs_deb_main("Entering auto deep sleep mode...\n");
-			memset(&cmd, 0, sizeof(cmd));
-			cmd.size = cpu_to_le16(sizeof(cmd));
-			lbs_cmd_async(priv, CMD_802_11_DEEP_SLEEP, &cmd,
-					sizeof(cmd));
-		}
-	}
-	mod_timer(&priv->auto_deepsleep_timer , jiffies +
-				(priv->auto_deep_sleep_timeout * HZ)/1000);
-	lbs_deb_leave(LBS_DEB_CMD);
-}
-
-int lbs_enter_auto_deep_sleep(struct lbs_private *priv)
-{
-	lbs_deb_enter(LBS_DEB_SDIO);
-
-	priv->is_auto_deep_sleep_enabled = 1;
-	if (priv->is_deep_sleep)
-		priv->wakeup_dev_required = 1;
-	mod_timer(&priv->auto_deepsleep_timer ,
-			jiffies + (priv->auto_deep_sleep_timeout * HZ)/1000);
-
-	lbs_deb_leave(LBS_DEB_SDIO);
-	return 0;
-}
-
-int lbs_exit_auto_deep_sleep(struct lbs_private *priv)
-{
-	lbs_deb_enter(LBS_DEB_SDIO);
-
-	priv->is_auto_deep_sleep_enabled = 0;
-	priv->auto_deep_sleep_timeout = 0;
-	del_timer(&priv->auto_deepsleep_timer);
-
-	lbs_deb_leave(LBS_DEB_SDIO);
-	return 0;
-}
-
 static int lbs_init_adapter(struct lbs_private *priv)
 {
 	int ret;
@@ -726,7 +667,6 @@  static int lbs_init_adapter(struct lbs_private *priv)
 	priv->psmode = LBS802_11POWERMODECAM;
 	priv->psstate = PS_STATE_FULL_POWER;
 	priv->is_deep_sleep = 0;
-	priv->is_auto_deep_sleep_enabled = 0;
 	priv->deep_sleep_required = 0;
 	priv->wakeup_dev_required = 0;
 	init_waitqueue_head(&priv->ds_awake_q);
@@ -739,8 +679,6 @@  static int lbs_init_adapter(struct lbs_private *priv)
 
 	setup_timer(&priv->command_timer, lbs_cmd_timeout_handler,
 		(unsigned long)priv);
-	setup_timer(&priv->auto_deepsleep_timer, auto_deepsleep_timer_fn,
-			(unsigned long)priv);
 
 	INIT_LIST_HEAD(&priv->cmdfreeq);
 	INIT_LIST_HEAD(&priv->cmdpendingq);
@@ -776,7 +714,6 @@  static void lbs_free_adapter(struct lbs_private *priv)
 	lbs_free_cmd_buffer(priv);
 	kfifo_free(&priv->event_fifo);
 	del_timer(&priv->command_timer);
-	del_timer(&priv->auto_deepsleep_timer);
 
 	lbs_deb_leave(LBS_DEB_MAIN);
 }
@@ -995,7 +932,6 @@  void lbs_stop_card(struct lbs_private *priv)
 
 	/* Delete the timeout of the currently processing command */
 	del_timer_sync(&priv->command_timer);
-	del_timer_sync(&priv->auto_deepsleep_timer);
 
 	/* Flush pending command nodes */
 	spin_lock_irqsave(&priv->driver_lock, flags);