Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2009-2011 Atheros Communications Inc.
0003  *
0004  * Permission to use, copy, modify, and/or distribute this software for any
0005  * purpose with or without fee is hereby granted, provided that the above
0006  * copyright notice and this permission notice appear in all copies.
0007  *
0008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0009  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0010  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0011  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0012  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0013  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0014  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0015  */
0016 
0017 #ifndef BTCOEX_H
0018 #define BTCOEX_H
0019 
0020 #include "hw.h"
0021 
0022 #define ATH_WLANACTIVE_GPIO_9280     5
0023 #define ATH_BTACTIVE_GPIO_9280       6
0024 #define ATH_BTPRIORITY_GPIO_9285     7
0025 
0026 #define ATH_WLANACTIVE_GPIO_9300     5
0027 #define ATH_BTACTIVE_GPIO_9300       4
0028 #define ATH_BTPRIORITY_GPIO_9300     8
0029 
0030 #define ATH_BTCOEX_DEF_BT_PERIOD  45
0031 #define ATH_BTCOEX_DEF_DUTY_CYCLE 55
0032 #define ATH_BTCOEX_BTSCAN_DUTY_CYCLE 90
0033 #define ATH_BTCOEX_BMISS_THRESH   50
0034 
0035 #define ATH_BT_PRIORITY_TIME_THRESHOLD 1000 /* ms */
0036 #define ATH_BT_CNT_THRESHOLD           3
0037 #define ATH_BT_CNT_SCAN_THRESHOLD      15
0038 
0039 #define ATH_BTCOEX_RX_WAIT_TIME       100
0040 #define ATH_BTCOEX_STOMP_FTP_THRESH   5
0041 
0042 #define ATH_BTCOEX_HT20_MAX_TXPOWER   0x14
0043 #define ATH_BTCOEX_HT40_MAX_TXPOWER   0x10
0044 
0045 #define AR9300_NUM_BT_WEIGHTS   4
0046 #define AR9300_NUM_WLAN_WEIGHTS 4
0047 
0048 #define ATH_AIC_MAX_BT_CHANNEL  79
0049 
0050 /* Defines the BT AR_BT_COEX_WGHT used */
0051 enum ath_stomp_type {
0052     ATH_BTCOEX_STOMP_ALL,
0053     ATH_BTCOEX_STOMP_LOW,
0054     ATH_BTCOEX_STOMP_NONE,
0055     ATH_BTCOEX_STOMP_LOW_FTP,
0056     ATH_BTCOEX_STOMP_AUDIO,
0057     ATH_BTCOEX_STOMP_MAX
0058 };
0059 
0060 enum ath_btcoex_scheme {
0061     ATH_BTCOEX_CFG_NONE,
0062     ATH_BTCOEX_CFG_2WIRE,
0063     ATH_BTCOEX_CFG_3WIRE,
0064     ATH_BTCOEX_CFG_MCI,
0065 };
0066 
0067 struct ath9k_hw_mci {
0068     u32 raw_intr;
0069     u32 rx_msg_intr;
0070     u32 cont_status;
0071     u32 gpm_addr;
0072     u32 gpm_len;
0073     u32 gpm_idx;
0074     u32 sched_addr;
0075     u32 wlan_channels[4];
0076     u32 wlan_cal_seq;
0077     u32 wlan_cal_done;
0078     u32 config;
0079     u8 *gpm_buf;
0080     bool ready;
0081     bool update_2g5g;
0082     bool is_2g;
0083     bool query_bt;
0084     bool unhalt_bt_gpm; /* need send UNHALT */
0085     bool halted_bt_gpm; /* HALT sent */
0086     bool need_flush_btinfo;
0087     bool bt_version_known;
0088     bool wlan_channels_update;
0089     u8 wlan_ver_major;
0090     u8 wlan_ver_minor;
0091     u8 bt_ver_major;
0092     u8 bt_ver_minor;
0093     u8 bt_state;
0094     u8 stomp_ftp;
0095     bool concur_tx;
0096     u32 last_recovery;
0097 };
0098 
0099 struct ath9k_hw_aic {
0100     bool aic_enabled;
0101     u8 aic_cal_state;
0102     u8 aic_caled_chan;
0103     u32 aic_sram[ATH_AIC_MAX_BT_CHANNEL];
0104     u32 aic_cal_start_time;
0105 };
0106 
0107 struct ath_btcoex_hw {
0108     enum ath_btcoex_scheme scheme;
0109     struct ath9k_hw_mci mci;
0110     struct ath9k_hw_aic aic;
0111     bool enabled;
0112     u8 wlanactive_gpio;
0113     u8 btactive_gpio;
0114     u8 btpriority_gpio;
0115     u32 bt_coex_mode;   /* Register setting for AR_BT_COEX_MODE */
0116     u32 bt_coex_weights;    /* Register setting for AR_BT_COEX_WEIGHT */
0117     u32 bt_coex_mode2;  /* Register setting for AR_BT_COEX_MODE2 */
0118     u32 bt_coex_mode3;  /* Register setting for AR_BT_COEX_MODE3 */
0119     u32 bt_weight[AR9300_NUM_BT_WEIGHTS];
0120     u32 wlan_weight[AR9300_NUM_WLAN_WEIGHTS];
0121     u8 tx_prio[ATH_BTCOEX_STOMP_MAX];
0122 };
0123 
0124 void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah);
0125 void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah);
0126 void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah);
0127 void ath9k_hw_btcoex_deinit(struct ath_hw *ah);
0128 void ath9k_hw_btcoex_init_mci(struct ath_hw *ah);
0129 void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum);
0130 void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,
0131                 u32 bt_weight,
0132                 u32 wlan_weight,
0133                 enum ath_stomp_type stomp_type);
0134 void ath9k_hw_btcoex_disable(struct ath_hw *ah);
0135 void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah,
0136                   enum ath_stomp_type stomp_type);
0137 void ath9k_hw_btcoex_set_concur_txprio(struct ath_hw *ah, u8 *stomp_txprio);
0138 
0139 #endif