From: Vasily Khoruzhick <anarsoul@gmail.com>
To: libertas-dev@lists.infradead.org, Daniel Drake <dsd@laptop.org>,
linville@tuxdriver.com, dcbw@redhat.com,
linux-wireless@vger.kernel.org
Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Subject: [PATCH 1/2] libertas: add ability to power off card on suspend
Date: Tue, 2 Aug 2011 13:27:11 +0300 [thread overview]
Message-ID: <1312280832-27675-1-git-send-email-anarsoul@gmail.com> (raw)
In-Reply-To: <201108021312.23153.anarsoul@gmail.com>
Could be usefull if it's not possible to keep power on the card
when host goes into suspend.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/net/wireless/libertas/dev.h | 3 ++-
drivers/net/wireless/libertas/main.c | 22 +++++++++++++++-------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index f526633..563a8b0 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -86,9 +86,10 @@ struct lbs_private {
/* Hardware access */
void *card;
bool iface_running;
+ bool suspend_iface_status;
u8 fw_ready;
u8 surpriseremoved;
- u8 setup_fw_on_resume;
+ u8 disable_on_suspend;
int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
void (*reset_card) (struct lbs_private *priv);
int (*power_save) (struct lbs_private *priv);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 208e4d9..5522202 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -644,7 +644,7 @@ done:
int lbs_suspend(struct lbs_private *priv)
{
- int ret;
+ int ret = 0;
lbs_deb_enter(LBS_DEB_FW);
@@ -658,7 +658,13 @@ int lbs_suspend(struct lbs_private *priv)
priv->deep_sleep_required = 1;
}
- ret = lbs_set_host_sleep(priv, 1);
+ if (priv->disable_on_suspend) {
+ /* Disable card */
+ priv->suspend_iface_status = priv->iface_running;
+ if (priv->iface_running)
+ lbs_stop_iface(priv);
+ } else
+ ret = lbs_set_host_sleep(priv, 1);
netif_device_detach(priv->dev);
if (priv->mesh_dev)
@@ -671,11 +677,16 @@ EXPORT_SYMBOL_GPL(lbs_suspend);
int lbs_resume(struct lbs_private *priv)
{
- int ret;
+ int ret = 0;
lbs_deb_enter(LBS_DEB_FW);
- ret = lbs_set_host_sleep(priv, 0);
+ if (priv->disable_on_suspend) {
+ /* Enable card */
+ if (priv->suspend_iface_status)
+ lbs_start_iface(priv);
+ } else
+ ret = lbs_set_host_sleep(priv, 0);
netif_device_attach(priv->dev);
if (priv->mesh_dev)
@@ -689,9 +700,6 @@ int lbs_resume(struct lbs_private *priv)
"deep sleep activation failed: %d\n", ret);
}
- if (priv->setup_fw_on_resume)
- ret = lbs_setup_firmware(priv);
-
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
return ret;
}
--
1.7.5.rc3
next prev parent reply other threads:[~2011-08-02 10:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 15:43 [PATCH 1/2] libertas: disable functionality when interface is down Daniel Drake
2011-08-01 17:38 ` Vasily Khoruzhick
2011-08-01 17:50 ` Daniel Drake
2011-08-01 19:13 ` Vasily Khoruzhick
2011-08-01 19:19 ` Daniel Drake
2011-08-01 19:38 ` Vasily Khoruzhick
2011-08-02 9:02 ` Vasily Khoruzhick
2011-08-02 10:12 ` Vasily Khoruzhick
2011-08-02 10:27 ` Vasily Khoruzhick [this message]
2011-08-02 10:27 ` [PATCH 2/2] libertas: implement if_spi runtime power management Vasily Khoruzhick
2011-08-02 10:54 ` [PATCH 1/2] libertas: add ability to power off card on suspend Daniel Drake
2011-08-02 20:09 ` Vasily Khoruzhick
2011-08-02 20:32 ` Daniel Drake
2011-08-02 21:12 ` Vasily Khoruzhick
2011-08-02 22:32 ` Daniel Drake
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=1312280832-27675-1-git-send-email-anarsoul@gmail.com \
--to=anarsoul@gmail.com \
--cc=dcbw@redhat.com \
--cc=dsd@laptop.org \
--cc=libertas-dev@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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).