From: Grazvydas Ignotas <notasas@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Kalle Valo <kvalo@adurom.com>,
"John W. Linville" <linville@tuxdriver.com>,
Grazvydas Ignotas <notasas@gmail.com>
Subject: [PATCH 1/3] wl1251: add power callback to wl1251_if_operations
Date: Thu, 4 Nov 2010 00:13:47 +0200 [thread overview]
Message-ID: <1288822429-24541-2-git-send-email-notasas@gmail.com> (raw)
In-Reply-To: <1288822429-24541-1-git-send-email-notasas@gmail.com>
Call interface specific power callback before calling board specific
one. Also allow that callback to fail. This is how it's done for
wl1271 and will be used for runtime_pm support.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
drivers/net/wireless/wl1251/main.c | 15 +++++++++------
drivers/net/wireless/wl1251/sdio.c | 8 ++++++--
drivers/net/wireless/wl1251/spi.c | 9 +++++++++
drivers/net/wireless/wl1251/wl1251.h | 1 +
4 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c
index 7a87625..012e1a4 100644
--- a/drivers/net/wireless/wl1251/main.c
+++ b/drivers/net/wireless/wl1251/main.c
@@ -52,14 +52,14 @@ void wl1251_disable_interrupts(struct wl1251 *wl)
wl->if_ops->disable_irq(wl);
}
-static void wl1251_power_off(struct wl1251 *wl)
+static int wl1251_power_off(struct wl1251 *wl)
{
- wl->set_power(false);
+ return wl->if_ops->power(wl, false);
}
-static void wl1251_power_on(struct wl1251 *wl)
+static int wl1251_power_on(struct wl1251 *wl)
{
- wl->set_power(true);
+ return wl->if_ops->power(wl, true);
}
static int wl1251_fetch_firmware(struct wl1251 *wl)
@@ -152,9 +152,12 @@ static void wl1251_fw_wakeup(struct wl1251 *wl)
static int wl1251_chip_wakeup(struct wl1251 *wl)
{
- int ret = 0;
+ int ret;
+
+ ret = wl1251_power_on(wl);
+ if (ret < 0)
+ return ret;
- wl1251_power_on(wl);
msleep(WL1251_POWER_ON_SLEEP);
wl->if_ops->reset(wl);
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c
index 74ba9ce..0285190 100644
--- a/drivers/net/wireless/wl1251/sdio.c
+++ b/drivers/net/wireless/wl1251/sdio.c
@@ -171,8 +171,12 @@ static void wl1251_disable_line_irq(struct wl1251 *wl)
return disable_irq(wl->irq);
}
-static void wl1251_sdio_set_power(bool enable)
+static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable)
{
+ if (wl->set_power)
+ wl->set_power(enable);
+
+ return 0;
}
static struct wl1251_if_operations wl1251_sdio_ops = {
@@ -181,6 +185,7 @@ static struct wl1251_if_operations wl1251_sdio_ops = {
.write_elp = wl1251_sdio_write_elp,
.read_elp = wl1251_sdio_read_elp,
.reset = wl1251_sdio_reset,
+ .power = wl1251_sdio_set_power,
};
static int wl1251_platform_probe(struct platform_device *pdev)
@@ -239,7 +244,6 @@ static int wl1251_sdio_probe(struct sdio_func *func,
wl_sdio->func = func;
wl->if_priv = wl_sdio;
wl->if_ops = &wl1251_sdio_ops;
- wl->set_power = wl1251_sdio_set_power;
if (wl12xx_board_data != NULL) {
wl->set_power = wl12xx_board_data->set_power;
diff --git a/drivers/net/wireless/wl1251/spi.c b/drivers/net/wireless/wl1251/spi.c
index 88fa8e6..ac872b3 100644
--- a/drivers/net/wireless/wl1251/spi.c
+++ b/drivers/net/wireless/wl1251/spi.c
@@ -215,12 +215,21 @@ static void wl1251_spi_disable_irq(struct wl1251 *wl)
return disable_irq(wl->irq);
}
+static int wl1251_spi_set_power(struct wl1251 *wl, bool enable)
+{
+ if (wl->set_power)
+ wl->set_power(enable);
+
+ return 0;
+}
+
static const struct wl1251_if_operations wl1251_spi_ops = {
.read = wl1251_spi_read,
.write = wl1251_spi_write,
.reset = wl1251_spi_reset_wake,
.enable_irq = wl1251_spi_enable_irq,
.disable_irq = wl1251_spi_disable_irq,
+ .power = wl1251_spi_set_power,
};
static int __devinit wl1251_spi_probe(struct spi_device *spi)
diff --git a/drivers/net/wireless/wl1251/wl1251.h b/drivers/net/wireless/wl1251/wl1251.h
index e113d4c..13fbeec 100644
--- a/drivers/net/wireless/wl1251/wl1251.h
+++ b/drivers/net/wireless/wl1251/wl1251.h
@@ -256,6 +256,7 @@ struct wl1251_if_operations {
void (*write)(struct wl1251 *wl, int addr, void *buf, size_t len);
void (*read_elp)(struct wl1251 *wl, int addr, u32 *val);
void (*write_elp)(struct wl1251 *wl, int addr, u32 val);
+ int (*power)(struct wl1251 *wl, bool enable);
void (*reset)(struct wl1251 *wl);
void (*enable_irq)(struct wl1251 *wl);
void (*disable_irq)(struct wl1251 *wl);
--
1.6.3.3
next prev parent reply other threads:[~2010-11-03 22:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-03 22:13 [PATCH 0/3] wl1251 SDIO patches Grazvydas Ignotas
2010-11-03 22:13 ` Grazvydas Ignotas [this message]
2010-11-07 10:15 ` [PATCH 1/3] wl1251: add power callback to wl1251_if_operations Kalle Valo
2010-11-03 22:13 ` [PATCH 2/3] wl1251: add runtime PM support for SDIO Grazvydas Ignotas
2010-11-04 13:51 ` Ohad Ben-Cohen
2010-11-04 14:37 ` Grazvydas Ignotas
2010-11-04 22:04 ` Ohad Ben-Cohen
2010-11-07 10:20 ` Kalle Valo
2010-11-07 10:23 ` Ohad Ben-Cohen
2010-11-07 10:18 ` Kalle Valo
2010-11-07 10:25 ` Ohad Ben-Cohen
2010-11-07 10:31 ` Kalle Valo
2010-11-08 13:26 ` Grazvydas Ignotas
2010-11-03 22:13 ` [PATCH 3/3] wl1251: use wl12xx_platform_data to pass data Grazvydas Ignotas
2010-11-07 10:28 ` Kalle Valo
2010-11-08 9:14 ` Luciano Coelho
2010-11-08 15:19 ` Tony Lindgren
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=1288822429-24541-2-git-send-email-notasas@gmail.com \
--to=notasas@gmail.com \
--cc=kvalo@adurom.com \
--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).