ath9k: Add open loop power control support for AR9287.
[pandora-kernel.git] / drivers / net / wireless / rt2x00 / rt2x00.h
index a498dde..99e8959 100644 (file)
 #define SHORT_EIFS             ( SIFS + SHORT_DIFS + \
                                  GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
 
+/*
+ * Structure for average calculation
+ * The avg field contains the actual average value,
+ * but avg_weight is internally used during calculations
+ * to prevent rounding errors.
+ */
+struct avg_val {
+       int avg;
+       int avg_weight;
+};
+
 /*
  * Chipset identification
  * The chipset on the device is composed of a RT and RF chip.
@@ -245,21 +256,18 @@ struct link_ant {
        struct antenna_setup active;
 
        /*
-        * RSSI information for the different antenna's.
-        * These statistics are used to determine when
-        * to switch antenna when using software diversity.
-        *
-        *        rssi[0] -> Antenna A RSSI
-        *        rssi[1] -> Antenna B RSSI
+        * RSSI history information for the antenna.
+        * Used to determine when to switch antenna
+        * when using software diversity.
         */
-       int rssi_history[2];
+       int rssi_history;
 
        /*
         * Current RSSI average of the currently active antenna.
         * Similar to the avg_rssi in the link_qual structure
         * this value is updated by using the walking average.
         */
-       int rssi_ant;
+       struct avg_val rssi_ant;
 };
 
 /*
@@ -288,7 +296,7 @@ struct link {
        /*
         * Currently active average RSSI value
         */
-       int avg_rssi;
+       struct avg_val avg_rssi;
 
        /*
         * Currently precalculated percentages of successful
@@ -325,6 +333,11 @@ struct rt2x00_intf {
         */
        u8 bssid[ETH_ALEN];
 
+       /*
+        * beacon->skb must be protected with the mutex.
+        */
+       struct mutex beacon_skb_mutex;
+
        /*
         * Entry in the beacon queue which belongs to
         * this interface. Each interface has its own
@@ -594,7 +607,6 @@ enum rt2x00_flags {
        DEVICE_STATE_INITIALIZED,
        DEVICE_STATE_STARTED,
        DEVICE_STATE_ENABLED_RADIO,
-       DEVICE_STATE_DISABLED_RADIO_HW,
 
        /*
         * Driver requirements
@@ -612,6 +624,8 @@ enum rt2x00_flags {
         */
        CONFIG_SUPPORT_HW_BUTTON,
        CONFIG_SUPPORT_HW_CRYPTO,
+       DRIVER_SUPPORT_CONTROL_FILTERS,
+       DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL,
 
        /*
         * Driver configuration
@@ -634,7 +648,7 @@ struct rt2x00_dev {
         * The structure stored in here depends on the
         * system bus (PCI or USB).
         * When accessing this variable, the rt2x00dev_{pci,usb}
-        * macro's should be used for correct typecasting.
+        * macros should be used for correct typecasting.
         */
        struct device *dev;
 
@@ -650,18 +664,6 @@ struct rt2x00_dev {
        struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
        enum ieee80211_band curr_band;
 
-       /*
-        * rfkill structure for RF state switching support.
-        * This will only be compiled in when required.
-        */
-#ifdef CONFIG_RT2X00_LIB_RFKILL
-       unsigned long rfkill_state;
-#define RFKILL_STATE_ALLOCATED         1
-#define RFKILL_STATE_REGISTERED                2
-#define RFKILL_STATE_BLOCKED           3
-       struct input_polled_dev *rfkill_poll_dev;
-#endif /* CONFIG_RT2X00_LIB_RFKILL */
-
        /*
         * If enabled, the debugfs interface structures
         * required for deregistration of debugfs.
@@ -849,13 +851,15 @@ struct rt2x00_dev {
 static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
                                  const unsigned int word, u32 *data)
 {
-       *data = rt2x00dev->rf[word];
+       BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
+       *data = rt2x00dev->rf[word - 1];
 }
 
 static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev,
                                   const unsigned int word, u32 data)
 {
-       rt2x00dev->rf[word] = data;
+       BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
+       rt2x00dev->rf[word - 1] = data;
 }
 
 /*
@@ -975,6 +979,8 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
                                unsigned int changed_flags,
                                unsigned int *total_flags,
                                int mc_count, struct dev_addr_list *mc_list);
+int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
+                     bool set);
 #ifdef CONFIG_RT2X00_LIB_CRYPTO
 int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                      struct ieee80211_vif *vif, struct ieee80211_sta *sta,
@@ -992,6 +998,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
                                u32 changes);
 int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
                      const struct ieee80211_tx_queue_params *params);
+void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw);
 
 /*
  * Driver allocation handlers.