diff options
author | Grazvydas Ignotas <notasas@gmail.com> | 2010-11-03 18:13:47 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-15 13:27:00 -0500 |
commit | cb7bbc7a5535ab2333915b83391e1d846a0914df (patch) | |
tree | 07d88b56c87b9a1ff2764b25d47c102169d665ca /drivers/net/wireless/wl1251 | |
parent | f81c1f48384d398dbe8f6c5b10377c7158086791 (diff) |
wl1251: add power callback to wl1251_if_operations
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>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl1251')
-rw-r--r-- | drivers/net/wireless/wl1251/main.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/wl1251/sdio.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/wl1251/spi.c | 9 | ||||
-rw-r--r-- | 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 7a8762553cdc..012e1a4016fe 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) | |||
52 | wl->if_ops->disable_irq(wl); | 52 | wl->if_ops->disable_irq(wl); |
53 | } | 53 | } |
54 | 54 | ||
55 | static void wl1251_power_off(struct wl1251 *wl) | 55 | static int wl1251_power_off(struct wl1251 *wl) |
56 | { | 56 | { |
57 | wl->set_power(false); | 57 | return wl->if_ops->power(wl, false); |
58 | } | 58 | } |
59 | 59 | ||
60 | static void wl1251_power_on(struct wl1251 *wl) | 60 | static int wl1251_power_on(struct wl1251 *wl) |
61 | { | 61 | { |
62 | wl->set_power(true); | 62 | return wl->if_ops->power(wl, true); |
63 | } | 63 | } |
64 | 64 | ||
65 | static int wl1251_fetch_firmware(struct wl1251 *wl) | 65 | static int wl1251_fetch_firmware(struct wl1251 *wl) |
@@ -152,9 +152,12 @@ static void wl1251_fw_wakeup(struct wl1251 *wl) | |||
152 | 152 | ||
153 | static int wl1251_chip_wakeup(struct wl1251 *wl) | 153 | static int wl1251_chip_wakeup(struct wl1251 *wl) |
154 | { | 154 | { |
155 | int ret = 0; | 155 | int ret; |
156 | |||
157 | ret = wl1251_power_on(wl); | ||
158 | if (ret < 0) | ||
159 | return ret; | ||
156 | 160 | ||
157 | wl1251_power_on(wl); | ||
158 | msleep(WL1251_POWER_ON_SLEEP); | 161 | msleep(WL1251_POWER_ON_SLEEP); |
159 | wl->if_ops->reset(wl); | 162 | wl->if_ops->reset(wl); |
160 | 163 | ||
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c index 74ba9ced5393..02851901677e 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) | |||
171 | return disable_irq(wl->irq); | 171 | return disable_irq(wl->irq); |
172 | } | 172 | } |
173 | 173 | ||
174 | static void wl1251_sdio_set_power(bool enable) | 174 | static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable) |
175 | { | 175 | { |
176 | if (wl->set_power) | ||
177 | wl->set_power(enable); | ||
178 | |||
179 | return 0; | ||
176 | } | 180 | } |
177 | 181 | ||
178 | static struct wl1251_if_operations wl1251_sdio_ops = { | 182 | static struct wl1251_if_operations wl1251_sdio_ops = { |
@@ -181,6 +185,7 @@ static struct wl1251_if_operations wl1251_sdio_ops = { | |||
181 | .write_elp = wl1251_sdio_write_elp, | 185 | .write_elp = wl1251_sdio_write_elp, |
182 | .read_elp = wl1251_sdio_read_elp, | 186 | .read_elp = wl1251_sdio_read_elp, |
183 | .reset = wl1251_sdio_reset, | 187 | .reset = wl1251_sdio_reset, |
188 | .power = wl1251_sdio_set_power, | ||
184 | }; | 189 | }; |
185 | 190 | ||
186 | static int wl1251_platform_probe(struct platform_device *pdev) | 191 | static int wl1251_platform_probe(struct platform_device *pdev) |
@@ -239,7 +244,6 @@ static int wl1251_sdio_probe(struct sdio_func *func, | |||
239 | wl_sdio->func = func; | 244 | wl_sdio->func = func; |
240 | wl->if_priv = wl_sdio; | 245 | wl->if_priv = wl_sdio; |
241 | wl->if_ops = &wl1251_sdio_ops; | 246 | wl->if_ops = &wl1251_sdio_ops; |
242 | wl->set_power = wl1251_sdio_set_power; | ||
243 | 247 | ||
244 | if (wl12xx_board_data != NULL) { | 248 | if (wl12xx_board_data != NULL) { |
245 | wl->set_power = wl12xx_board_data->set_power; | 249 | 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 88fa8e69d0d1..ac872b38960f 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) | |||
215 | return disable_irq(wl->irq); | 215 | return disable_irq(wl->irq); |
216 | } | 216 | } |
217 | 217 | ||
218 | static int wl1251_spi_set_power(struct wl1251 *wl, bool enable) | ||
219 | { | ||
220 | if (wl->set_power) | ||
221 | wl->set_power(enable); | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | |||
218 | static const struct wl1251_if_operations wl1251_spi_ops = { | 226 | static const struct wl1251_if_operations wl1251_spi_ops = { |
219 | .read = wl1251_spi_read, | 227 | .read = wl1251_spi_read, |
220 | .write = wl1251_spi_write, | 228 | .write = wl1251_spi_write, |
221 | .reset = wl1251_spi_reset_wake, | 229 | .reset = wl1251_spi_reset_wake, |
222 | .enable_irq = wl1251_spi_enable_irq, | 230 | .enable_irq = wl1251_spi_enable_irq, |
223 | .disable_irq = wl1251_spi_disable_irq, | 231 | .disable_irq = wl1251_spi_disable_irq, |
232 | .power = wl1251_spi_set_power, | ||
224 | }; | 233 | }; |
225 | 234 | ||
226 | static int __devinit wl1251_spi_probe(struct spi_device *spi) | 235 | 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 e113d4c1fb35..13fbeeccf609 100644 --- a/drivers/net/wireless/wl1251/wl1251.h +++ b/drivers/net/wireless/wl1251/wl1251.h | |||
@@ -256,6 +256,7 @@ struct wl1251_if_operations { | |||
256 | void (*write)(struct wl1251 *wl, int addr, void *buf, size_t len); | 256 | void (*write)(struct wl1251 *wl, int addr, void *buf, size_t len); |
257 | void (*read_elp)(struct wl1251 *wl, int addr, u32 *val); | 257 | void (*read_elp)(struct wl1251 *wl, int addr, u32 *val); |
258 | void (*write_elp)(struct wl1251 *wl, int addr, u32 val); | 258 | void (*write_elp)(struct wl1251 *wl, int addr, u32 val); |
259 | int (*power)(struct wl1251 *wl, bool enable); | ||
259 | void (*reset)(struct wl1251 *wl); | 260 | void (*reset)(struct wl1251 *wl); |
260 | void (*enable_irq)(struct wl1251 *wl); | 261 | void (*enable_irq)(struct wl1251 *wl); |
261 | void (*disable_irq)(struct wl1251 *wl); | 262 | void (*disable_irq)(struct wl1251 *wl); |