162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright (c) 2009-2011 Atheros Communications Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 562306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 662306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 962306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1062306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1162306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1262306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1362306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1462306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#ifndef BTCOEX_H 1862306a36Sopenharmony_ci#define BTCOEX_H 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#include "hw.h" 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#define ATH_WLANACTIVE_GPIO_9280 5 2362306a36Sopenharmony_ci#define ATH_BTACTIVE_GPIO_9280 6 2462306a36Sopenharmony_ci#define ATH_BTPRIORITY_GPIO_9285 7 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#define ATH_WLANACTIVE_GPIO_9300 5 2762306a36Sopenharmony_ci#define ATH_BTACTIVE_GPIO_9300 4 2862306a36Sopenharmony_ci#define ATH_BTPRIORITY_GPIO_9300 8 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#define ATH_BTCOEX_DEF_BT_PERIOD 45 3162306a36Sopenharmony_ci#define ATH_BTCOEX_DEF_DUTY_CYCLE 55 3262306a36Sopenharmony_ci#define ATH_BTCOEX_BTSCAN_DUTY_CYCLE 90 3362306a36Sopenharmony_ci#define ATH_BTCOEX_BMISS_THRESH 50 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#define ATH_BT_PRIORITY_TIME_THRESHOLD 1000 /* ms */ 3662306a36Sopenharmony_ci#define ATH_BT_CNT_THRESHOLD 3 3762306a36Sopenharmony_ci#define ATH_BT_CNT_SCAN_THRESHOLD 15 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define ATH_BTCOEX_RX_WAIT_TIME 100 4062306a36Sopenharmony_ci#define ATH_BTCOEX_STOMP_FTP_THRESH 5 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define ATH_BTCOEX_HT20_MAX_TXPOWER 0x14 4362306a36Sopenharmony_ci#define ATH_BTCOEX_HT40_MAX_TXPOWER 0x10 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define AR9300_NUM_BT_WEIGHTS 4 4662306a36Sopenharmony_ci#define AR9300_NUM_WLAN_WEIGHTS 4 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define ATH_AIC_MAX_BT_CHANNEL 79 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci/* Defines the BT AR_BT_COEX_WGHT used */ 5162306a36Sopenharmony_cienum ath_stomp_type { 5262306a36Sopenharmony_ci ATH_BTCOEX_STOMP_ALL, 5362306a36Sopenharmony_ci ATH_BTCOEX_STOMP_LOW, 5462306a36Sopenharmony_ci ATH_BTCOEX_STOMP_NONE, 5562306a36Sopenharmony_ci ATH_BTCOEX_STOMP_LOW_FTP, 5662306a36Sopenharmony_ci ATH_BTCOEX_STOMP_AUDIO, 5762306a36Sopenharmony_ci ATH_BTCOEX_STOMP_MAX 5862306a36Sopenharmony_ci}; 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_cienum ath_btcoex_scheme { 6162306a36Sopenharmony_ci ATH_BTCOEX_CFG_NONE, 6262306a36Sopenharmony_ci ATH_BTCOEX_CFG_2WIRE, 6362306a36Sopenharmony_ci ATH_BTCOEX_CFG_3WIRE, 6462306a36Sopenharmony_ci ATH_BTCOEX_CFG_MCI, 6562306a36Sopenharmony_ci}; 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_cistruct ath9k_hw_mci { 6862306a36Sopenharmony_ci u32 raw_intr; 6962306a36Sopenharmony_ci u32 rx_msg_intr; 7062306a36Sopenharmony_ci u32 cont_status; 7162306a36Sopenharmony_ci u32 gpm_addr; 7262306a36Sopenharmony_ci u32 gpm_len; 7362306a36Sopenharmony_ci u32 gpm_idx; 7462306a36Sopenharmony_ci u32 sched_addr; 7562306a36Sopenharmony_ci u32 wlan_channels[4]; 7662306a36Sopenharmony_ci u32 wlan_cal_seq; 7762306a36Sopenharmony_ci u32 wlan_cal_done; 7862306a36Sopenharmony_ci u32 config; 7962306a36Sopenharmony_ci u8 *gpm_buf; 8062306a36Sopenharmony_ci bool ready; 8162306a36Sopenharmony_ci bool update_2g5g; 8262306a36Sopenharmony_ci bool is_2g; 8362306a36Sopenharmony_ci bool query_bt; 8462306a36Sopenharmony_ci bool unhalt_bt_gpm; /* need send UNHALT */ 8562306a36Sopenharmony_ci bool halted_bt_gpm; /* HALT sent */ 8662306a36Sopenharmony_ci bool need_flush_btinfo; 8762306a36Sopenharmony_ci bool bt_version_known; 8862306a36Sopenharmony_ci bool wlan_channels_update; 8962306a36Sopenharmony_ci u8 wlan_ver_major; 9062306a36Sopenharmony_ci u8 wlan_ver_minor; 9162306a36Sopenharmony_ci u8 bt_ver_major; 9262306a36Sopenharmony_ci u8 bt_ver_minor; 9362306a36Sopenharmony_ci u8 bt_state; 9462306a36Sopenharmony_ci u8 stomp_ftp; 9562306a36Sopenharmony_ci bool concur_tx; 9662306a36Sopenharmony_ci u32 last_recovery; 9762306a36Sopenharmony_ci}; 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_cistruct ath9k_hw_aic { 10062306a36Sopenharmony_ci bool aic_enabled; 10162306a36Sopenharmony_ci u8 aic_cal_state; 10262306a36Sopenharmony_ci u8 aic_caled_chan; 10362306a36Sopenharmony_ci u32 aic_sram[ATH_AIC_MAX_BT_CHANNEL]; 10462306a36Sopenharmony_ci u32 aic_cal_start_time; 10562306a36Sopenharmony_ci}; 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_cistruct ath_btcoex_hw { 10862306a36Sopenharmony_ci enum ath_btcoex_scheme scheme; 10962306a36Sopenharmony_ci struct ath9k_hw_mci mci; 11062306a36Sopenharmony_ci struct ath9k_hw_aic aic; 11162306a36Sopenharmony_ci bool enabled; 11262306a36Sopenharmony_ci u8 wlanactive_gpio; 11362306a36Sopenharmony_ci u8 btactive_gpio; 11462306a36Sopenharmony_ci u8 btpriority_gpio; 11562306a36Sopenharmony_ci u32 bt_coex_mode; /* Register setting for AR_BT_COEX_MODE */ 11662306a36Sopenharmony_ci u32 bt_coex_weights; /* Register setting for AR_BT_COEX_WEIGHT */ 11762306a36Sopenharmony_ci u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */ 11862306a36Sopenharmony_ci u32 bt_coex_mode3; /* Register setting for AR_BT_COEX_MODE3 */ 11962306a36Sopenharmony_ci u32 bt_weight[AR9300_NUM_BT_WEIGHTS]; 12062306a36Sopenharmony_ci u32 wlan_weight[AR9300_NUM_WLAN_WEIGHTS]; 12162306a36Sopenharmony_ci u8 tx_prio[ATH_BTCOEX_STOMP_MAX]; 12262306a36Sopenharmony_ci}; 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_civoid ath9k_hw_btcoex_init_scheme(struct ath_hw *ah); 12562306a36Sopenharmony_civoid ath9k_hw_btcoex_init_2wire(struct ath_hw *ah); 12662306a36Sopenharmony_civoid ath9k_hw_btcoex_init_3wire(struct ath_hw *ah); 12762306a36Sopenharmony_civoid ath9k_hw_btcoex_deinit(struct ath_hw *ah); 12862306a36Sopenharmony_civoid ath9k_hw_btcoex_init_mci(struct ath_hw *ah); 12962306a36Sopenharmony_civoid ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum); 13062306a36Sopenharmony_civoid ath9k_hw_btcoex_set_weight(struct ath_hw *ah, 13162306a36Sopenharmony_ci u32 bt_weight, 13262306a36Sopenharmony_ci u32 wlan_weight, 13362306a36Sopenharmony_ci enum ath_stomp_type stomp_type); 13462306a36Sopenharmony_civoid ath9k_hw_btcoex_disable(struct ath_hw *ah); 13562306a36Sopenharmony_civoid ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah, 13662306a36Sopenharmony_ci enum ath_stomp_type stomp_type); 13762306a36Sopenharmony_civoid ath9k_hw_btcoex_set_concur_txprio(struct ath_hw *ah, u8 *stomp_txprio); 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci#endif 140