All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] wireless:libertas: enable auto deep sleep
@ 2016-01-20  7:41 Andreas Kemnade
  2016-01-20 12:42 ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Kemnade @ 2016-01-20  7:41 UTC (permalink / raw)
  To: kvalo, libertas-dev, linux-wireless, linux-kernel, hns; +Cc: Andreas Kemnade

Enables auto deep sleep whenever the interface is up and
power managament is enabled, so there is also power management
when there is no connection
That reduces power consumption between scanning
intervals. Deep sleep mode is entered when there is
no activity for 1s.

The code looks a bit different to how things were done
with the wext interface in earlier times.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/net/wireless/libertas/cfg.c  |  3 +++
 drivers/net/wireless/libertas/main.c | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index fd18d03..bb6d8fd 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -2066,6 +2066,7 @@ int lbs_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 			lbs_set_ps_mode(priv,
 					PS_MODE_ACTION_EXIT_PS,
 					true);
+		lbs_exit_auto_deep_sleep(priv);
 		return 0;
 	}
 	if (priv->psmode != LBS802_11POWERMODECAM)
@@ -2073,6 +2074,8 @@ int lbs_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 	priv->psmode = LBS802_11POWERMODEMAX_PSP;
 	if (priv->connect_status == LBS_CONNECTED)
 		lbs_set_ps_mode(priv, PS_MODE_ACTION_ENTER_PS, true);
+	priv->auto_deep_sleep_timeout = 1000; /* 1000ms */
+	lbs_enter_auto_deep_sleep(priv);
 	return 0;
 }
 
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index b35b8bc..82e69ca 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -161,6 +161,11 @@ int lbs_start_iface(struct lbs_private *priv)
 	lbs_update_channel(priv);
 
 	priv->iface_running = true;
+	/* if deep sleep was enabled before
+	 * the interface was brought down, reenable it
+	 */
+	if (priv->is_auto_deep_sleep_enabled)
+		lbs_enter_auto_deep_sleep(priv);
 	return 0;
 
 err:
@@ -227,6 +232,10 @@ int lbs_stop_iface(struct lbs_private *priv)
 
 	cancel_work_sync(&priv->mcast_work);
 	del_timer_sync(&priv->tx_lockup_timer);
+	/* autosleep should not mess with commands
+	 * when the interface is powered down
+	 */
+	del_timer_sync(&priv->auto_deepsleep_timer);
 
 	/* Disable command processing, and wait for all commands to complete */
 	lbs_deb_main("waiting for commands to complete\n");
@@ -824,7 +833,8 @@ static void auto_deepsleep_timer_fn(unsigned long data)
 	} else {
 		if (priv->is_auto_deep_sleep_enabled &&
 		    (!priv->wakeup_dev_required) &&
-		    (priv->connect_status != LBS_CONNECTED)) {
+		    (priv->connect_status != LBS_CONNECTED) &&
+		    priv->iface_running) {
 			struct cmd_header cmd;
 
 			lbs_deb_main("Entering auto deep sleep mode...\n");
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] wireless:libertas: enable auto deep sleep
  2016-01-20  7:41 [PATCH RFC] wireless:libertas: enable auto deep sleep Andreas Kemnade
@ 2016-01-20 12:42 ` Kalle Valo
  2016-01-20 16:43   ` Andreas Kemnade
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2016-01-20 12:42 UTC (permalink / raw)
  To: Andreas Kemnade; +Cc: libertas-dev, linux-wireless, linux-kernel, hns

Andreas Kemnade <andreas@kemnade.info> writes:

> Enables auto deep sleep whenever the interface is up and
> power managament is enabled, so there is also power management
> when there is no connection
> That reduces power consumption between scanning
> intervals. Deep sleep mode is entered when there is
> no activity for 1s.
>
> The code looks a bit different to how things were done
> with the wext interface in earlier times.
>
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>

Please use just "libertas: " as the prefix and drop the "wireless:".

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] wireless:libertas: enable auto deep sleep
  2016-01-20 12:42 ` Kalle Valo
@ 2016-01-20 16:43   ` Andreas Kemnade
  2016-01-20 17:55     ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Kemnade @ 2016-01-20 16:43 UTC (permalink / raw)
  To: Kalle Valo; +Cc: libertas-dev, linux-wireless, linux-kernel, hns

[-- Attachment #1: Type: text/plain, Size: 964 bytes --]

On Wed, 20 Jan 2016 14:42:47 +0200
Kalle Valo <kvalo@codeaurora.org> wrote:

> Andreas Kemnade <andreas@kemnade.info> writes:
> 
> > Enables auto deep sleep whenever the interface is up and
> > power managament is enabled, so there is also power management
> > when there is no connection
> > That reduces power consumption between scanning
> > intervals. Deep sleep mode is entered when there is
> > no activity for 1s.
> >
> > The code looks a bit different to how things were done
> > with the wext interface in earlier times.
> >
> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> 
> Please use just "libertas: " as the prefix and drop the "wireless:".
> 
Hmm, is there any rule for that or do I just find that out
by analysing git log output?

BTW: That patch depends on my ieee80211 powersave mode series where I sent
a second version today. Has that series found the way into your review queue?

Regards,
Andreas Kemnade

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] wireless:libertas: enable auto deep sleep
  2016-01-20 16:43   ` Andreas Kemnade
@ 2016-01-20 17:55     ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2016-01-20 17:55 UTC (permalink / raw)
  To: Andreas Kemnade; +Cc: libertas-dev, linux-wireless, linux-kernel, hns

Andreas Kemnade <andreas@kemnade.info> writes:

> On Wed, 20 Jan 2016 14:42:47 +0200
> Kalle Valo <kvalo@codeaurora.org> wrote:
>
>> Andreas Kemnade <andreas@kemnade.info> writes:
>> 
>> > Enables auto deep sleep whenever the interface is up and
>> > power managament is enabled, so there is also power management
>> > when there is no connection
>> > That reduces power consumption between scanning
>> > intervals. Deep sleep mode is entered when there is
>> > no activity for 1s.
>> >
>> > The code looks a bit different to how things were done
>> > with the wext interface in earlier times.
>> >
>> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
>> 
>> Please use just "libertas: " as the prefix and drop the "wireless:".
>> 
> Hmm, is there any rule for that or do I just find that out
> by analysing git log output?

No generic rule as far as I know. I recommend to use git log to see the
most common prefix:

git log --oneline --follow --no-merges -- drivers/net/wireless/libertas

> BTW: That patch depends on my ieee80211 powersave mode series where I sent
> a second version today.

It's a good idea to document that in the patch, for example after "---"
line.

> Has that series found the way into your review queue?

You can check the status from patchwork:

https://patchwork.kernel.org/project/linux-wireless/list/?state=*

I haven't opened wireless-drivers-next yet due to the merge window, I
will do that after -rc1 is released.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-20 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20  7:41 [PATCH RFC] wireless:libertas: enable auto deep sleep Andreas Kemnade
2016-01-20 12:42 ` Kalle Valo
2016-01-20 16:43   ` Andreas Kemnade
2016-01-20 17:55     ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.