Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-core.h
index 954ecc2..d47f3a8 100644 (file)
@@ -120,6 +120,14 @@ struct iwl_apm_ops {
        void (*config)(struct iwl_priv *priv);
 };
 
+struct iwl_isr_ops {
+       irqreturn_t (*isr) (int irq, void *data);
+       void (*free)(struct iwl_priv *priv);
+       int (*alloc)(struct iwl_priv *priv);
+       int (*reset)(struct iwl_priv *priv);
+       void (*disable)(struct iwl_priv *priv);
+};
+
 struct iwl_debugfs_ops {
        ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf,
                                 size_t count, loff_t *ppos);
@@ -193,28 +201,16 @@ struct iwl_lib_ops {
        /* power */
        int (*send_tx_power) (struct iwl_priv *priv);
        void (*update_chain_flags)(struct iwl_priv *priv);
-       void (*post_associate)(struct iwl_priv *priv,
-                              struct ieee80211_vif *vif);
-       void (*config_ap)(struct iwl_priv *priv, struct ieee80211_vif *vif);
-       irqreturn_t (*isr) (int irq, void *data);
+
+       /* isr */
+       struct iwl_isr_ops isr_ops;
 
        /* eeprom operations (as defined in iwl-eeprom.h) */
        struct iwl_eeprom_ops eeprom_ops;
 
        /* temperature */
        struct iwl_temp_ops temp_ops;
-       /* station management */
-       int (*manage_ibss_station)(struct iwl_priv *priv,
-                                  struct ieee80211_vif *vif, bool add);
-       int (*update_bcast_stations)(struct iwl_priv *priv);
-       /* recover from tx queue stall */
-       void (*recover_from_tx_stall)(unsigned long data);
-       /* check for plcp health */
-       bool (*check_plcp_health)(struct iwl_priv *priv,
-                                       struct iwl_rx_packet *pkt);
-       /* check for ack health */
-       bool (*check_ack_health)(struct iwl_priv *priv,
-                                       struct iwl_rx_packet *pkt);
+
        int (*txfifo_flush)(struct iwl_priv *priv, u16 flush_control);
        void (*dev_txfifo_flush)(struct iwl_priv *priv, u16 flush_control);
 
@@ -226,8 +222,6 @@ struct iwl_lib_ops {
 
 struct iwl_led_ops {
        int (*cmd)(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd);
-       int (*on)(struct iwl_priv *priv);
-       int (*off)(struct iwl_priv *priv);
 };
 
 /* NIC specific ops */
@@ -235,12 +229,23 @@ struct iwl_nic_ops {
        void (*additional_nic_config)(struct iwl_priv *priv);
 };
 
+struct iwl_legacy_ops {
+       void (*post_associate)(struct iwl_priv *priv);
+       void (*config_ap)(struct iwl_priv *priv);
+       /* station management */
+       int (*update_bcast_stations)(struct iwl_priv *priv);
+       int (*manage_ibss_station)(struct iwl_priv *priv,
+                                  struct ieee80211_vif *vif, bool add);
+};
+
 struct iwl_ops {
        const struct iwl_lib_ops *lib;
        const struct iwl_hcmd_ops *hcmd;
        const struct iwl_hcmd_utils_ops *utils;
        const struct iwl_led_ops *led;
        const struct iwl_nic_ops *nic;
+       const struct iwl_legacy_ops *legacy;
+       const struct ieee80211_ops *ieee80211_ops;
 };
 
 struct iwl_mod_params {
@@ -251,6 +256,8 @@ struct iwl_mod_params {
        int amsdu_size_8K;      /* def: 1 = enable 8K amsdu size */
        int antenna;            /* def: 0 = both antennas (use diversity) */
        int restart_fw;         /* def: 1 = restart firmware */
+       bool plcp_check;        /* def: true = enable plcp health check */
+       bool ack_check;         /* def: false = disable ack health check */
 };
 
 /*
@@ -266,7 +273,7 @@ struct iwl_mod_params {
  * @plcp_delta_threshold: plcp error rate threshold used to trigger
  *     radio tuning when there is a high receiving plcp error rate
  * @chain_noise_scale: default chain noise scale used for gain computation
- * @monitor_recover_period: default timer used to check stuck queues
+ * @wd_timeout: TX queues watchdog timeout
  * @temperature_kelvin: temperature report by uCode in kelvin
  * @max_event_log_size: size of event log buffer size for ucode event logging
  * @tx_power_by_driver: tx power calibration performed by driver
@@ -276,7 +283,10 @@ struct iwl_mod_params {
  *     sensitivity calibration operation
  * @chain_noise_calib_by_driver: driver has the capability to perform
  *     chain noise calibration operation
-*/
+ * @shadow_reg_enable: HW shadhow register bit
+ * @no_agg_framecnt_info: uCode do not provide aggregation frame count
+ *     information
+ */
 struct iwl_base_params {
        int eeprom_size;
        int num_of_queues;      /* def: HW dependent */
@@ -292,20 +302,20 @@ struct iwl_base_params {
        u16 led_compensation;
        const bool broken_powersave;
        int chain_noise_num_beacons;
-       const bool supports_idle;
        bool adv_thermal_throttle;
        bool support_ct_kill_exit;
        const bool support_wimax_coexist;
        u8 plcp_delta_threshold;
        s32 chain_noise_scale;
-       /* timer period for monitor the driver queues */
-       u32 monitor_recover_period;
+       unsigned int wd_timeout;
        bool temperature_kelvin;
        u32 max_event_log_size;
        const bool tx_power_by_driver;
        const bool ucode_tracing;
        const bool sensitivity_calib_by_driver;
        const bool chain_noise_calib_by_driver;
+       const bool shadow_reg_enable;
+       const bool no_agg_framecnt_info;
 };
 /*
  * @advanced_bt_coexist: support advanced bt coexist
@@ -315,6 +325,7 @@ struct iwl_base_params {
  * @agg_time_limit: maximum number of uSec in aggregation
  * @ampdu_factor: Maximum A-MPDU length factor
  * @ampdu_density: Minimum A-MPDU spacing
+ * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
 */
 struct iwl_bt_params {
        bool advanced_bt_coexist;
@@ -324,6 +335,8 @@ struct iwl_bt_params {
        u16 agg_time_limit;
        u8 ampdu_factor;
        u8 ampdu_density;
+       bool bt_sco_disable;
+       bool bt_session_2;
 };
 /*
  * @use_rts_for_aggregation: use rts/cts protection for HT traffic
@@ -344,6 +357,11 @@ struct iwl_ht_params {
  * @need_dc_calib: need to perform init dc calibration
  * @need_temp_offset_calib: need to perform temperature offset calibration
  * @scan_antennas: available antenna for scan operation
+ * @led_mode: 0=blinking, 1=On(RF On)/Off(RF Off)
+ * @adv_pm: advance power management
+ * @rx_with_siso_diversity: 1x1 device with rx antenna diversity
+ * @internal_wimax_coex: internal wifi/wimax combo device
+ * @iq_invert: I/Q inversion
  *
  * We enable the driver to be backward compatible wrt API version. The
  * driver specifies which APIs it supports (with @ucode_api_max being the
@@ -389,16 +407,18 @@ struct iwl_cfg {
        const bool need_dc_calib;         /* if used set to true */
        const bool need_temp_offset_calib; /* if used set to true */
        u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
-       u8 scan_tx_antennas[IEEE80211_NUM_BANDS];
-       const bool use_new_eeprom_reading; /* temporary, remove later */
+       enum iwl_led_mode led_mode;
+       const bool adv_pm;
+       const bool rx_with_siso_diversity;
+       const bool internal_wimax_coex;
+       const bool iq_invert;
 };
 
 /***************************
  *   L i b                 *
  ***************************/
 
-struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
-               struct ieee80211_ops *hw_ops);
+struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg);
 int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
                    const struct ieee80211_tx_queue_params *params);
 int iwl_mac_tx_last_beacon(struct ieee80211_hw *hw);
@@ -426,23 +446,16 @@ int iwl_set_decrypted_flag(struct iwl_priv *priv,
                           u32 decrypt_res,
                           struct ieee80211_rx_status *stats);
 void iwl_irq_handle_error(struct iwl_priv *priv);
-void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif);
-void iwl_bss_info_changed(struct ieee80211_hw *hw,
-                                    struct ieee80211_vif *vif,
-                                    struct ieee80211_bss_conf *bss_conf,
-                                    u32 changes);
 int iwl_mac_add_interface(struct ieee80211_hw *hw,
                          struct ieee80211_vif *vif);
 void iwl_mac_remove_interface(struct ieee80211_hw *hw,
                              struct ieee80211_vif *vif);
-int iwl_mac_config(struct ieee80211_hw *hw, u32 changed);
-void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif);
-void iwl_mac_reset_tsf(struct ieee80211_hw *hw);
+int iwl_mac_change_interface(struct ieee80211_hw *hw,
+                            struct ieee80211_vif *vif,
+                            enum nl80211_iftype newtype, bool newp2p);
 int iwl_alloc_txq_mem(struct iwl_priv *priv);
 void iwl_free_txq_mem(struct iwl_priv *priv);
-void iwlcore_tx_cmd_protection(struct iwl_priv *priv,
-                              struct ieee80211_tx_info *info,
-                              __le16 fc, __le32 *tx_flags);
+
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 int iwl_alloc_traffic_mem(struct iwl_priv *priv);
 void iwl_free_traffic_mem(struct iwl_priv *priv);
@@ -478,18 +491,6 @@ static inline void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv,
 static inline void iwl_update_stats(struct iwl_priv *priv, bool is_tx,
                                    __le16 fc, u16 len)
 {
-       struct traffic_stats    *stats;
-
-       if (is_tx)
-               stats = &priv->tx_stats;
-       else
-               stats = &priv->rx_stats;
-
-       if (ieee80211_is_data(fc)) {
-               /* data */
-               stats->data_bytes += len;
-       }
-       iwl_leds_background(priv);
 }
 #endif
 /*****************************************************
@@ -506,6 +507,7 @@ void iwl_rx_reply_error(struct iwl_priv *priv,
 * RX
 ******************************************************/
 void iwl_cmd_queue_free(struct iwl_priv *priv);
+void iwl_cmd_queue_unmap(struct iwl_priv *priv);
 int iwl_rx_queue_alloc(struct iwl_priv *priv);
 void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv,
                                  struct iwl_rx_queue *q);
@@ -514,8 +516,6 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
 /* Handlers */
 void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
                                          struct iwl_rx_mem_buffer *rxb);
-void iwl_recover_from_statistics(struct iwl_priv *priv,
-                               struct iwl_rx_packet *pkt);
 void iwl_chswitch_done(struct iwl_priv *priv, bool is_success);
 void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
 
@@ -530,6 +530,8 @@ int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
 void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq,
                        int slots_num, u32 txq_id);
 void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id);
+void iwl_tx_queue_unmap(struct iwl_priv *priv, int txq_id);
+void iwl_setup_watchdog(struct iwl_priv *priv);
 /*****************************************************
  * TX power
  ****************************************************/
@@ -599,7 +601,6 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
 /*****************************************************
  * PCI                                              *
  *****************************************************/
-irqreturn_t iwl_isr_legacy(int irq, void *data);
 
 static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv)
 {
@@ -610,15 +611,23 @@ static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv)
        return pci_lnk_ctl;
 }
 
-void iwl_bg_monitor_recover(unsigned long data);
+void iwl_bg_watchdog(unsigned long data);
 u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval);
 __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
                           u32 addon, u32 beacon_interval);
 
 #ifdef CONFIG_PM
-int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state);
-int iwl_pci_resume(struct pci_dev *pdev);
-#endif /* CONFIG_PM */
+int iwl_pci_suspend(struct device *device);
+int iwl_pci_resume(struct device *device);
+extern const struct dev_pm_ops iwl_pm_ops;
+
+#define IWL_PM_OPS     (&iwl_pm_ops)
+
+#else /* !CONFIG_PM */
+
+#define IWL_PM_OPS     NULL
+
+#endif /* !CONFIG_PM */
 
 /*****************************************************
 *  Error Handling Debugging
@@ -725,17 +734,23 @@ static inline int iwlcore_commit_rxon(struct iwl_priv *priv,
 {
        return priv->cfg->ops->hcmd->commit_rxon(priv, ctx);
 }
-static inline void iwlcore_config_ap(struct iwl_priv *priv,
-                                    struct ieee80211_vif *vif)
-{
-       priv->cfg->ops->lib->config_ap(priv, vif);
-}
 static inline const struct ieee80211_supported_band *iwl_get_hw_mode(
                        struct iwl_priv *priv, enum ieee80211_band band)
 {
        return priv->hw->wiphy->bands[band];
 }
 
+static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv)
+{
+       return priv->cfg->bt_params &&
+              priv->cfg->bt_params->advanced_bt_coexist;
+}
+
+static inline bool iwl_bt_statistics(struct iwl_priv *priv)
+{
+       return priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics;
+}
+
 extern bool bt_coex_active;
 extern bool bt_siso_mode;