diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_debugfs.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 3 |
3 files changed, 61 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 94359b1a861..3bec6f3b1c7 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -276,6 +276,7 @@ struct wl1271_debugfs { | |||
276 | 276 | ||
277 | struct dentry *retry_count; | 277 | struct dentry *retry_count; |
278 | struct dentry *excessive_retries; | 278 | struct dentry *excessive_retries; |
279 | struct dentry *gpio_power; | ||
279 | }; | 280 | }; |
280 | 281 | ||
281 | #define NUM_TX_QUEUES 4 | 282 | #define NUM_TX_QUEUES 4 |
@@ -442,6 +443,8 @@ struct wl1271 { | |||
442 | struct conf_drv_settings conf; | 443 | struct conf_drv_settings conf; |
443 | 444 | ||
444 | struct list_head list; | 445 | struct list_head list; |
446 | |||
447 | bool gpio_power; | ||
445 | }; | 448 | }; |
446 | 449 | ||
447 | int wl1271_plt_start(struct wl1271 *wl); | 450 | int wl1271_plt_start(struct wl1271 *wl); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_debugfs.c b/drivers/net/wireless/wl12xx/wl1271_debugfs.c index c1805e5f896..4eaf40c5756 100644 --- a/drivers/net/wireless/wl12xx/wl1271_debugfs.c +++ b/drivers/net/wireless/wl12xx/wl1271_debugfs.c | |||
@@ -237,6 +237,57 @@ static const struct file_operations tx_queue_len_ops = { | |||
237 | .open = wl1271_open_file_generic, | 237 | .open = wl1271_open_file_generic, |
238 | }; | 238 | }; |
239 | 239 | ||
240 | static ssize_t gpio_power_read(struct file *file, char __user *user_buf, | ||
241 | size_t count, loff_t *ppos) | ||
242 | { | ||
243 | struct wl1271 *wl = file->private_data; | ||
244 | int res; | ||
245 | char buf[10]; | ||
246 | |||
247 | res = scnprintf(buf, sizeof(buf), "%d\n", wl->gpio_power); | ||
248 | |||
249 | return simple_read_from_buffer(user_buf, count, ppos, buf, res); | ||
250 | } | ||
251 | |||
252 | static ssize_t gpio_power_write(struct file *file, | ||
253 | const char __user *user_buf, | ||
254 | size_t count, loff_t *ppos) | ||
255 | { | ||
256 | struct wl1271 *wl = file->private_data; | ||
257 | char buf[10]; | ||
258 | size_t len; | ||
259 | unsigned long value; | ||
260 | int ret; | ||
261 | |||
262 | mutex_lock(&wl->mutex); | ||
263 | |||
264 | len = min(count, sizeof(buf) - 1); | ||
265 | if (copy_from_user(buf, user_buf, len)) { | ||
266 | ret = -EFAULT; | ||
267 | goto out; | ||
268 | } | ||
269 | buf[len] = '\0'; | ||
270 | |||
271 | ret = strict_strtoul(buf, 0, &value); | ||
272 | if (ret < 0) { | ||
273 | wl1271_warning("illegal value in gpio_power"); | ||
274 | goto out; | ||
275 | } | ||
276 | |||
277 | wl->set_power(!!value); | ||
278 | wl->gpio_power = !!value; | ||
279 | |||
280 | out: | ||
281 | mutex_unlock(&wl->mutex); | ||
282 | return count; | ||
283 | } | ||
284 | |||
285 | static const struct file_operations gpio_power_ops = { | ||
286 | .read = gpio_power_read, | ||
287 | .write = gpio_power_write, | ||
288 | .open = wl1271_open_file_generic | ||
289 | }; | ||
290 | |||
240 | static void wl1271_debugfs_delete_files(struct wl1271 *wl) | 291 | static void wl1271_debugfs_delete_files(struct wl1271 *wl) |
241 | { | 292 | { |
242 | DEBUGFS_FWSTATS_DEL(tx, internal_desc_overflow); | 293 | DEBUGFS_FWSTATS_DEL(tx, internal_desc_overflow); |
@@ -333,6 +384,8 @@ static void wl1271_debugfs_delete_files(struct wl1271 *wl) | |||
333 | DEBUGFS_DEL(tx_queue_len); | 384 | DEBUGFS_DEL(tx_queue_len); |
334 | DEBUGFS_DEL(retry_count); | 385 | DEBUGFS_DEL(retry_count); |
335 | DEBUGFS_DEL(excessive_retries); | 386 | DEBUGFS_DEL(excessive_retries); |
387 | |||
388 | DEBUGFS_DEL(gpio_power); | ||
336 | } | 389 | } |
337 | 390 | ||
338 | static int wl1271_debugfs_add_files(struct wl1271 *wl) | 391 | static int wl1271_debugfs_add_files(struct wl1271 *wl) |
@@ -434,6 +487,8 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl) | |||
434 | DEBUGFS_ADD(retry_count, wl->debugfs.rootdir); | 487 | DEBUGFS_ADD(retry_count, wl->debugfs.rootdir); |
435 | DEBUGFS_ADD(excessive_retries, wl->debugfs.rootdir); | 488 | DEBUGFS_ADD(excessive_retries, wl->debugfs.rootdir); |
436 | 489 | ||
490 | DEBUGFS_ADD(gpio_power, wl->debugfs.rootdir); | ||
491 | |||
437 | out: | 492 | out: |
438 | if (ret < 0) | 493 | if (ret < 0) |
439 | wl1271_debugfs_delete_files(wl); | 494 | wl1271_debugfs_delete_files(wl); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 147aab22235..b33bdcc1eb4 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -399,11 +399,13 @@ static void wl1271_disable_interrupts(struct wl1271 *wl) | |||
399 | static void wl1271_power_off(struct wl1271 *wl) | 399 | static void wl1271_power_off(struct wl1271 *wl) |
400 | { | 400 | { |
401 | wl->set_power(false); | 401 | wl->set_power(false); |
402 | wl->gpio_power = false; | ||
402 | } | 403 | } |
403 | 404 | ||
404 | static void wl1271_power_on(struct wl1271 *wl) | 405 | static void wl1271_power_on(struct wl1271 *wl) |
405 | { | 406 | { |
406 | wl->set_power(true); | 407 | wl->set_power(true); |
408 | wl->gpio_power = true; | ||
407 | } | 409 | } |
408 | 410 | ||
409 | static void wl1271_fw_status(struct wl1271 *wl, | 411 | static void wl1271_fw_status(struct wl1271 *wl, |
@@ -1923,6 +1925,7 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
1923 | wl->band = IEEE80211_BAND_2GHZ; | 1925 | wl->band = IEEE80211_BAND_2GHZ; |
1924 | wl->vif = NULL; | 1926 | wl->vif = NULL; |
1925 | wl->joined = false; | 1927 | wl->joined = false; |
1928 | wl->gpio_power = false; | ||
1926 | 1929 | ||
1927 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) | 1930 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) |
1928 | wl->tx_frames[i] = NULL; | 1931 | wl->tx_frames[i] = NULL; |