| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | Copyright (C) 2010 Willow Garage <http://www.willowgarage.com> |
|---|
| 3 | 4 | Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com> |
|---|
| 4 | 5 | Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com> |
|---|
| 5 | 6 | <http://rt2x00.serialmonkey.com> |
|---|
| 6 | 7 | |
|---|
| 7 | | - This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | | - (at your option) any later version. |
|---|
| 11 | | - |
|---|
| 12 | | - This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - GNU General Public License for more details. |
|---|
| 16 | | - |
|---|
| 17 | | - You should have received a copy of the GNU General Public License |
|---|
| 18 | | - along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 19 | 8 | */ |
|---|
| 20 | 9 | |
|---|
| 21 | 10 | /* |
|---|
| .. | .. |
|---|
| 34 | 23 | #include <linux/leds.h> |
|---|
| 35 | 24 | #include <linux/mutex.h> |
|---|
| 36 | 25 | #include <linux/etherdevice.h> |
|---|
| 37 | | -#include <linux/input-polldev.h> |
|---|
| 38 | 26 | #include <linux/kfifo.h> |
|---|
| 39 | 27 | #include <linux/hrtimer.h> |
|---|
| 40 | 28 | #include <linux/average.h> |
|---|
| .. | .. |
|---|
| 69 | 57 | printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt, \ |
|---|
| 70 | 58 | __func__, ##__VA_ARGS__) |
|---|
| 71 | 59 | #define rt2x00_err(dev, fmt, ...) \ |
|---|
| 72 | | - wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt, \ |
|---|
| 60 | + wiphy_err_ratelimited((dev)->hw->wiphy, "%s: Error - " fmt, \ |
|---|
| 73 | 61 | __func__, ##__VA_ARGS__) |
|---|
| 74 | 62 | #define rt2x00_warn(dev, fmt, ...) \ |
|---|
| 75 | | - wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt, \ |
|---|
| 63 | + wiphy_warn_ratelimited((dev)->hw->wiphy, "%s: Warning - " fmt, \ |
|---|
| 76 | 64 | __func__, ##__VA_ARGS__) |
|---|
| 77 | 65 | #define rt2x00_info(dev, fmt, ...) \ |
|---|
| 78 | 66 | wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt, \ |
|---|
| .. | .. |
|---|
| 336 | 324 | * to bring the device/driver back into the desired state. |
|---|
| 337 | 325 | */ |
|---|
| 338 | 326 | struct delayed_work watchdog_work; |
|---|
| 327 | + unsigned int watchdog_interval; |
|---|
| 328 | + bool watchdog_disabled; |
|---|
| 339 | 329 | |
|---|
| 340 | 330 | /* |
|---|
| 341 | 331 | * Work structure for scheduling periodic AGC adjustments. |
|---|
| .. | .. |
|---|
| 528 | 518 | /* |
|---|
| 529 | 519 | * TX status tasklet handler. |
|---|
| 530 | 520 | */ |
|---|
| 531 | | - void (*txstatus_tasklet) (unsigned long data); |
|---|
| 532 | | - void (*pretbtt_tasklet) (unsigned long data); |
|---|
| 533 | | - void (*tbtt_tasklet) (unsigned long data); |
|---|
| 534 | | - void (*rxdone_tasklet) (unsigned long data); |
|---|
| 535 | | - void (*autowake_tasklet) (unsigned long data); |
|---|
| 521 | + void (*txstatus_tasklet) (struct tasklet_struct *t); |
|---|
| 522 | + void (*pretbtt_tasklet) (struct tasklet_struct *t); |
|---|
| 523 | + void (*tbtt_tasklet) (struct tasklet_struct *t); |
|---|
| 524 | + void (*rxdone_tasklet) (struct tasklet_struct *t); |
|---|
| 525 | + void (*autowake_tasklet) (struct tasklet_struct *t); |
|---|
| 536 | 526 | |
|---|
| 537 | 527 | /* |
|---|
| 538 | 528 | * Device init handlers. |
|---|
| .. | .. |
|---|
| 626 | 616 | void (*config) (struct rt2x00_dev *rt2x00dev, |
|---|
| 627 | 617 | struct rt2x00lib_conf *libconf, |
|---|
| 628 | 618 | const unsigned int changed_flags); |
|---|
| 619 | + void (*pre_reset_hw) (struct rt2x00_dev *rt2x00dev); |
|---|
| 629 | 620 | int (*sta_add) (struct rt2x00_dev *rt2x00dev, |
|---|
| 630 | 621 | struct ieee80211_vif *vif, |
|---|
| 631 | 622 | struct ieee80211_sta *sta); |
|---|
| .. | .. |
|---|
| 665 | 656 | DEVICE_STATE_STARTED, |
|---|
| 666 | 657 | DEVICE_STATE_ENABLED_RADIO, |
|---|
| 667 | 658 | DEVICE_STATE_SCANNING, |
|---|
| 659 | + DEVICE_STATE_FLUSHING, |
|---|
| 660 | + DEVICE_STATE_RESET, |
|---|
| 668 | 661 | |
|---|
| 669 | 662 | /* |
|---|
| 670 | 663 | * Driver configuration |
|---|
| .. | .. |
|---|
| 720 | 713 | CAPABILITY_VCO_RECALIBRATION, |
|---|
| 721 | 714 | CAPABILITY_EXTERNAL_PA_TX0, |
|---|
| 722 | 715 | CAPABILITY_EXTERNAL_PA_TX1, |
|---|
| 716 | + CAPABILITY_RESTART_HW, |
|---|
| 723 | 717 | }; |
|---|
| 724 | 718 | |
|---|
| 725 | 719 | /* |
|---|
| .. | .. |
|---|
| 1013 | 1007 | unsigned int extra_tx_headroom; |
|---|
| 1014 | 1008 | |
|---|
| 1015 | 1009 | struct usb_anchor *anchor; |
|---|
| 1010 | + unsigned int num_proto_errs; |
|---|
| 1016 | 1011 | |
|---|
| 1017 | 1012 | /* Clock for System On Chip devices. */ |
|---|
| 1018 | 1013 | struct clk *clk; |
|---|
| .. | .. |
|---|
| 1275 | 1270 | return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_VCO_RECALIBRATION); |
|---|
| 1276 | 1271 | } |
|---|
| 1277 | 1272 | |
|---|
| 1273 | +static inline bool |
|---|
| 1274 | +rt2x00_has_cap_restart_hw(struct rt2x00_dev *rt2x00dev) |
|---|
| 1275 | +{ |
|---|
| 1276 | + return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_RESTART_HW); |
|---|
| 1277 | +} |
|---|
| 1278 | + |
|---|
| 1278 | 1279 | /** |
|---|
| 1279 | 1280 | * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. |
|---|
| 1280 | 1281 | * @entry: Pointer to &struct queue_entry |
|---|
| .. | .. |
|---|
| 1438 | 1439 | struct sk_buff *skb); |
|---|
| 1439 | 1440 | int rt2x00mac_start(struct ieee80211_hw *hw); |
|---|
| 1440 | 1441 | void rt2x00mac_stop(struct ieee80211_hw *hw); |
|---|
| 1442 | +void rt2x00mac_reconfig_complete(struct ieee80211_hw *hw, |
|---|
| 1443 | + enum ieee80211_reconfig_type reconfig_type); |
|---|
| 1441 | 1444 | int rt2x00mac_add_interface(struct ieee80211_hw *hw, |
|---|
| 1442 | 1445 | struct ieee80211_vif *vif); |
|---|
| 1443 | 1446 | void rt2x00mac_remove_interface(struct ieee80211_hw *hw, |
|---|
| .. | .. |
|---|
| 1484 | 1487 | */ |
|---|
| 1485 | 1488 | int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev); |
|---|
| 1486 | 1489 | void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev); |
|---|
| 1487 | | -#ifdef CONFIG_PM |
|---|
| 1488 | | -int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state); |
|---|
| 1490 | + |
|---|
| 1491 | +int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev); |
|---|
| 1489 | 1492 | int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev); |
|---|
| 1490 | | -#endif /* CONFIG_PM */ |
|---|
| 1491 | 1493 | |
|---|
| 1492 | 1494 | #endif /* RT2X00_H */ |
|---|