diff options
author | Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com> | 2010-03-18 06:26:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-23 16:50:18 -0400 |
commit | becd551cac0d6868819083c59fc32d1072ba1804 (patch) | |
tree | f99edc958ed4ca4553d6c3d7fb8d80ea7f572398 | |
parent | b43316dbf9c6b01f3ac6dc23bcb94ae66eb3a721 (diff) |
wl1271: Cleaned up wlan power on/off functions
Added method for wlan power control to io_ops struct and moved
wl1271_power_on and wl1271_power_off functions to wl1271_io.h.
Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_debugfs.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_io.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_sdio.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_spi.c | 7 |
6 files changed, 30 insertions, 25 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 0deb4fdf916b..7397999deb19 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -344,6 +344,7 @@ struct wl1271_if_operations { | |||
344 | bool fixed); | 344 | bool fixed); |
345 | void (*reset)(struct wl1271 *wl); | 345 | void (*reset)(struct wl1271 *wl); |
346 | void (*init)(struct wl1271 *wl); | 346 | void (*init)(struct wl1271 *wl); |
347 | void (*power)(struct wl1271 *wl, bool enable); | ||
347 | struct device* (*dev)(struct wl1271 *wl); | 348 | struct device* (*dev)(struct wl1271 *wl); |
348 | void (*enable_irq)(struct wl1271 *wl); | 349 | void (*enable_irq)(struct wl1271 *wl); |
349 | void (*disable_irq)(struct wl1271 *wl); | 350 | void (*disable_irq)(struct wl1271 *wl); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_debugfs.c b/drivers/net/wireless/wl12xx/wl1271_debugfs.c index 8d7588ca68fd..3c0f5b1ac272 100644 --- a/drivers/net/wireless/wl12xx/wl1271_debugfs.c +++ b/drivers/net/wireless/wl12xx/wl1271_debugfs.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "wl1271.h" | 28 | #include "wl1271.h" |
29 | #include "wl1271_acx.h" | 29 | #include "wl1271_acx.h" |
30 | #include "wl1271_ps.h" | 30 | #include "wl1271_ps.h" |
31 | #include "wl1271_io.h" | ||
31 | 32 | ||
32 | /* ms */ | 33 | /* ms */ |
33 | #define WL1271_DEBUGFS_STATS_LIFETIME 1000 | 34 | #define WL1271_DEBUGFS_STATS_LIFETIME 1000 |
@@ -276,13 +277,10 @@ static ssize_t gpio_power_write(struct file *file, | |||
276 | goto out; | 277 | goto out; |
277 | } | 278 | } |
278 | 279 | ||
279 | if (value) { | 280 | if (value) |
280 | wl->set_power(true); | 281 | wl1271_power_on(wl); |
281 | set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | 282 | else |
282 | } else { | 283 | wl1271_power_off(wl); |
283 | wl->set_power(false); | ||
284 | clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | ||
285 | } | ||
286 | 284 | ||
287 | out: | 285 | out: |
288 | mutex_unlock(&wl->mutex); | 286 | mutex_unlock(&wl->mutex); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h index 95d2168f8af4..3ff88d971308 100644 --- a/drivers/net/wireless/wl12xx/wl1271_io.h +++ b/drivers/net/wireless/wl12xx/wl1271_io.h | |||
@@ -138,6 +138,18 @@ static inline void wl1271_write32(struct wl1271 *wl, int addr, u32 val) | |||
138 | wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val); | 138 | wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val); |
139 | } | 139 | } |
140 | 140 | ||
141 | static inline void wl1271_power_off(struct wl1271 *wl) | ||
142 | { | ||
143 | wl->if_ops->power(wl, false); | ||
144 | clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | ||
145 | } | ||
146 | |||
147 | static inline void wl1271_power_on(struct wl1271 *wl) | ||
148 | { | ||
149 | wl->if_ops->power(wl, true); | ||
150 | set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | ||
151 | } | ||
152 | |||
141 | 153 | ||
142 | /* Top Register IO */ | 154 | /* Top Register IO */ |
143 | void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val); | 155 | void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 0de337f9e50f..b3abb455bd70 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -359,18 +359,6 @@ static int wl1271_plt_init(struct wl1271 *wl) | |||
359 | return ret; | 359 | return ret; |
360 | } | 360 | } |
361 | 361 | ||
362 | static void wl1271_power_off(struct wl1271 *wl) | ||
363 | { | ||
364 | wl->set_power(false); | ||
365 | clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | ||
366 | } | ||
367 | |||
368 | static void wl1271_power_on(struct wl1271 *wl) | ||
369 | { | ||
370 | wl->set_power(true); | ||
371 | set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); | ||
372 | } | ||
373 | |||
374 | static void wl1271_fw_status(struct wl1271 *wl, | 362 | static void wl1271_fw_status(struct wl1271 *wl, |
375 | struct wl1271_fw_status *status) | 363 | struct wl1271_fw_status *status) |
376 | { | 364 | { |
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c index 1f204db30c27..d43e0d41d439 100644 --- a/drivers/net/wireless/wl12xx/wl1271_sdio.c +++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c | |||
@@ -156,20 +156,21 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf, | |||
156 | sdio_release_host(func); | 156 | sdio_release_host(func); |
157 | } | 157 | } |
158 | 158 | ||
159 | static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable) | ||
160 | { | ||
161 | } | ||
162 | |||
159 | static struct wl1271_if_operations sdio_ops = { | 163 | static struct wl1271_if_operations sdio_ops = { |
160 | .read = wl1271_sdio_raw_read, | 164 | .read = wl1271_sdio_raw_read, |
161 | .write = wl1271_sdio_raw_write, | 165 | .write = wl1271_sdio_raw_write, |
162 | .reset = wl1271_sdio_reset, | 166 | .reset = wl1271_sdio_reset, |
163 | .init = wl1271_sdio_init, | 167 | .init = wl1271_sdio_init, |
168 | .power = wl1271_sdio_set_power, | ||
164 | .dev = wl1271_sdio_wl_to_dev, | 169 | .dev = wl1271_sdio_wl_to_dev, |
165 | .enable_irq = wl1271_sdio_enable_interrupts, | 170 | .enable_irq = wl1271_sdio_enable_interrupts, |
166 | .disable_irq = wl1271_sdio_disable_interrupts | 171 | .disable_irq = wl1271_sdio_disable_interrupts |
167 | }; | 172 | }; |
168 | 173 | ||
169 | static void wl1271_sdio_set_power(bool enable) | ||
170 | { | ||
171 | } | ||
172 | |||
173 | static int __devinit wl1271_probe(struct sdio_func *func, | 174 | static int __devinit wl1271_probe(struct sdio_func *func, |
174 | const struct sdio_device_id *id) | 175 | const struct sdio_device_id *id) |
175 | { | 176 | { |
@@ -190,8 +191,6 @@ static int __devinit wl1271_probe(struct sdio_func *func, | |||
190 | wl->if_priv = func; | 191 | wl->if_priv = func; |
191 | wl->if_ops = &sdio_ops; | 192 | wl->if_ops = &sdio_ops; |
192 | 193 | ||
193 | wl->set_power = wl1271_sdio_set_power; | ||
194 | |||
195 | /* Grab access to FN0 for ELP reg. */ | 194 | /* Grab access to FN0 for ELP reg. */ |
196 | func->card->quirks |= MMC_QUIRK_LENIENT_FN0; | 195 | func->card->quirks |= MMC_QUIRK_LENIENT_FN0; |
197 | 196 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c index ed285fec2a08..0eea73392ea3 100644 --- a/drivers/net/wireless/wl12xx/wl1271_spi.c +++ b/drivers/net/wireless/wl12xx/wl1271_spi.c | |||
@@ -347,11 +347,18 @@ static struct platform_device wl1271_device = { | |||
347 | }, | 347 | }, |
348 | }; | 348 | }; |
349 | 349 | ||
350 | static void wl1271_spi_set_power(struct wl1271 *wl, bool enable) | ||
351 | { | ||
352 | if (wl->set_power) | ||
353 | wl->set_power(enable); | ||
354 | } | ||
355 | |||
350 | static struct wl1271_if_operations spi_ops = { | 356 | static struct wl1271_if_operations spi_ops = { |
351 | .read = wl1271_spi_raw_read, | 357 | .read = wl1271_spi_raw_read, |
352 | .write = wl1271_spi_raw_write, | 358 | .write = wl1271_spi_raw_write, |
353 | .reset = wl1271_spi_reset, | 359 | .reset = wl1271_spi_reset, |
354 | .init = wl1271_spi_init, | 360 | .init = wl1271_spi_init, |
361 | .power = wl1271_spi_set_power, | ||
355 | .dev = wl1271_spi_wl_to_dev, | 362 | .dev = wl1271_spi_wl_to_dev, |
356 | .enable_irq = wl1271_spi_enable_interrupts, | 363 | .enable_irq = wl1271_spi_enable_interrupts, |
357 | .disable_irq = wl1271_spi_disable_interrupts | 364 | .disable_irq = wl1271_spi_disable_interrupts |