2009-08-26 19:38:44 +04:00
/*
2011-05-17 12:06:18 +04:00
* Copyright ( c ) 2009 - 2011 Atheros Communications Inc .
2009-08-26 19:38:44 +04:00
*
* Permission to use , copy , modify , and / or distribute this software for any
* purpose with or without fee is hereby granted , provided that the above
* copyright notice and this permission notice appear in all copies .
*
* THE SOFTWARE IS PROVIDED " AS IS " AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS . IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL , DIRECT , INDIRECT , OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE , DATA OR PROFITS , WHETHER IN AN
* ACTION OF CONTRACT , NEGLIGENCE OR OTHER TORTIOUS ACTION , ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE .
*/
2011-05-28 00:14:23 +04:00
# include <linux/export.h>
2009-09-14 10:39:31 +04:00
# include "hw.h"
2009-08-26 19:38:44 +04:00
2009-09-10 02:24:02 +04:00
enum ath_bt_mode {
ATH_BT_COEX_MODE_LEGACY , /* legacy rx_clear mode */
ATH_BT_COEX_MODE_UNSLOTTED , /* untimed/unslotted mode */
ATH_BT_COEX_MODE_SLOTTED , /* slotted mode */
2011-11-30 09:11:29 +04:00
ATH_BT_COEX_MODE_DISABLED , /* coexistence disabled */
2009-09-10 02:24:02 +04:00
} ;
struct ath_btcoex_config {
u8 bt_time_extend ;
bool bt_txstate_extend ;
bool bt_txframe_extend ;
enum ath_bt_mode bt_mode ; /* coexistence mode */
bool bt_quiet_collision ;
bool bt_rxclear_polarity ; /* invert rx_clear as WLAN_ACTIVE*/
u8 bt_priority_time ;
u8 bt_first_slot_time ;
bool bt_hold_rx_clear ;
} ;
2009-08-26 19:38:50 +04:00
2011-11-12 18:05:47 +04:00
static const u32 ar9003_wlan_weights [ ATH_BTCOEX_STOMP_MAX ]
[ AR9300_NUM_WLAN_WEIGHTS ] = {
{ 0xfffffff0 , 0xfffffff0 , 0xfffffff0 , 0xfffffff0 } , /* STOMP_ALL */
{ 0x88888880 , 0x88888880 , 0x88888880 , 0x88888880 } , /* STOMP_LOW */
{ 0x00000000 , 0x00000000 , 0x00000000 , 0x00000000 } , /* STOMP_NONE */
} ;
2009-08-26 19:38:50 +04:00
2012-09-28 09:43:51 +04:00
static const u32 mci_wlan_weights [ ATH_BTCOEX_STOMP_MAX ]
[ AR9300_NUM_WLAN_WEIGHTS ] = {
2011-11-12 18:05:48 +04:00
{ 0x01017d01 , 0x41414101 , 0x41414101 , 0x41414141 } , /* STOMP_ALL */
{ 0x01017d01 , 0x3b3b3b01 , 0x3b3b3b01 , 0x3b3b3b3b } , /* STOMP_LOW */
{ 0x01017d01 , 0x01010101 , 0x01010101 , 0x01010101 } , /* STOMP_NONE */
{ 0x01017d01 , 0x013b0101 , 0x3b3b0101 , 0x3b3b013b } , /* STOMP_LOW_FTP */
2012-11-20 17:00:01 +04:00
{ 0xffffff01 , 0xffffffff , 0xffffff01 , 0xffffffff } , /* STOMP_AUDIO */
2011-11-12 18:05:48 +04:00
} ;
2009-09-10 01:52:02 +04:00
void ath9k_hw_init_btcoex_hw ( struct ath_hw * ah , int qnum )
2009-09-09 13:33:11 +04:00
{
2009-09-10 01:52:02 +04:00
struct ath_btcoex_hw * btcoex_hw = & ah - > btcoex_hw ;
2009-09-10 02:24:02 +04:00
const struct ath_btcoex_config ath_bt_config = {
. bt_time_extend = 0 ,
. bt_txstate_extend = true ,
. bt_txframe_extend = true ,
. bt_mode = ATH_BT_COEX_MODE_SLOTTED ,
. bt_quiet_collision = true ,
. bt_rxclear_polarity = true ,
. bt_priority_time = 2 ,
. bt_first_slot_time = 5 ,
. bt_hold_rx_clear = true ,
} ;
2011-04-26 09:09:53 +04:00
bool rxclear_polarity = ath_bt_config . bt_rxclear_polarity ;
if ( AR_SREV_9300_20_OR_LATER ( ah ) )
rxclear_polarity = ! ath_bt_config . bt_rxclear_polarity ;
2009-08-26 19:38:50 +04:00
2009-09-10 01:52:02 +04:00
btcoex_hw - > bt_coex_mode =
( btcoex_hw - > bt_coex_mode & AR_BT_QCU_THRESH ) |
2009-08-26 19:38:50 +04:00
SM ( ath_bt_config . bt_time_extend , AR_BT_TIME_EXTEND ) |
SM ( ath_bt_config . bt_txstate_extend , AR_BT_TXSTATE_EXTEND ) |
SM ( ath_bt_config . bt_txframe_extend , AR_BT_TX_FRAME_EXTEND ) |
SM ( ath_bt_config . bt_mode , AR_BT_MODE ) |
SM ( ath_bt_config . bt_quiet_collision , AR_BT_QUIET ) |
2011-04-26 09:09:53 +04:00
SM ( rxclear_polarity , AR_BT_RX_CLEAR_POLARITY ) |
2009-08-26 19:38:50 +04:00
SM ( ath_bt_config . bt_priority_time , AR_BT_PRIORITY_TIME ) |
SM ( ath_bt_config . bt_first_slot_time , AR_BT_FIRST_SLOT_TIME ) |
SM ( qnum , AR_BT_QCU_THRESH ) ;
2009-09-10 01:52:02 +04:00
btcoex_hw - > bt_coex_mode2 =
2009-08-26 19:38:50 +04:00
SM ( ath_bt_config . bt_hold_rx_clear , AR_BT_HOLD_RX_CLEAR ) |
SM ( ATH_BTCOEX_BMISS_THRESH , AR_BT_BCN_MISS_THRESH ) |
AR_BT_DISABLE_BT_ANT ;
}
2009-09-24 07:07:00 +04:00
EXPORT_SYMBOL ( ath9k_hw_init_btcoex_hw ) ;
2009-08-26 19:38:50 +04:00
2012-02-22 11:10:49 +04:00
void ath9k_hw_btcoex_init_scheme ( struct ath_hw * ah )
{
struct ath_common * common = ath9k_hw_common ( ah ) ;
struct ath_btcoex_hw * btcoex_hw = & ah - > btcoex_hw ;
/*
* Check if BTCOEX is globally disabled .
*/
if ( ! common - > btcoex_enabled ) {
btcoex_hw - > scheme = ATH_BTCOEX_CFG_NONE ;
return ;
}
2012-04-19 17:43:52 +04:00
if ( AR_SREV_9300_20_OR_LATER ( ah ) ) {
2012-02-22 11:10:49 +04:00
btcoex_hw - > scheme = ATH_BTCOEX_CFG_3WIRE ;
btcoex_hw - > btactive_gpio = ATH_BTACTIVE_GPIO_9300 ;
btcoex_hw - > wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300 ;
btcoex_hw - > btpriority_gpio = ATH_BTPRIORITY_GPIO_9300 ;
} else if ( AR_SREV_9280_20_OR_LATER ( ah ) ) {
btcoex_hw - > btactive_gpio = ATH_BTACTIVE_GPIO_9280 ;
btcoex_hw - > wlanactive_gpio = ATH_WLANACTIVE_GPIO_9280 ;
if ( AR_SREV_9285 ( ah ) ) {
btcoex_hw - > scheme = ATH_BTCOEX_CFG_3WIRE ;
btcoex_hw - > btpriority_gpio = ATH_BTPRIORITY_GPIO_9285 ;
} else {
btcoex_hw - > scheme = ATH_BTCOEX_CFG_2WIRE ;
}
}
}
EXPORT_SYMBOL ( ath9k_hw_btcoex_init_scheme ) ;
2009-09-09 15:00:10 +04:00
void ath9k_hw_btcoex_init_2wire ( struct ath_hw * ah )
2009-08-26 19:38:44 +04:00
{
2009-09-10 01:52:02 +04:00
struct ath_btcoex_hw * btcoex_hw = & ah - > btcoex_hw ;
2009-08-26 19:38:50 +04:00
2009-09-09 13:54:40 +04:00
/* connect bt_active to baseband */
REG_CLR_BIT ( ah , AR_GPIO_INPUT_EN_VAL ,
( AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF |
AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF ) ) ;
2009-08-26 19:38:50 +04:00
2009-09-09 13:54:40 +04:00
REG_SET_BIT ( ah , AR_GPIO_INPUT_EN_VAL ,
AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB ) ;
2009-08-26 19:38:50 +04:00
2009-09-09 13:54:40 +04:00
/* Set input mux for bt_active to gpio pin */
REG_RMW_FIELD ( ah , AR_GPIO_INPUT_MUX1 ,
AR_GPIO_INPUT_MUX1_BT_ACTIVE ,
2009-09-10 01:52:02 +04:00
btcoex_hw - > btactive_gpio ) ;
2009-08-26 19:38:46 +04:00
2009-09-09 13:54:40 +04:00
/* Configure the desired gpio port for input */
2009-09-10 01:52:02 +04:00
ath9k_hw_cfg_gpio_input ( ah , btcoex_hw - > btactive_gpio ) ;
2009-09-09 13:54:40 +04:00
}
2009-09-24 07:07:00 +04:00
EXPORT_SYMBOL ( ath9k_hw_btcoex_init_2wire ) ;
2009-09-09 13:54:40 +04:00
2009-09-09 15:00:10 +04:00
void ath9k_hw_btcoex_init_3wire ( struct ath_hw * ah )
2009-09-09 13:54:40 +04:00
{
2009-09-10 01:52:02 +04:00
struct ath_btcoex_hw * btcoex_hw = & ah - > btcoex_hw ;
2009-08-26 19:38:44 +04:00
2009-09-09 13:54:40 +04:00
/* btcoex 3-wire */
REG_SET_BIT ( ah , AR_GPIO_INPUT_EN_VAL ,
( AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB |
AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB ) ) ;
2009-08-26 19:38:44 +04:00
2009-09-09 13:54:40 +04:00
/* Set input mux for bt_prority_async and
* bt_active_async to GPIO pins */
REG_RMW_FIELD ( ah , AR_GPIO_INPUT_MUX1 ,
AR_GPIO_INPUT_MUX1_BT_ACTIVE ,
2009-09-10 01:52:02 +04:00
btcoex_hw - > btactive_gpio ) ;
2009-08-26 19:38:44 +04:00
2009-09-09 13:54:40 +04:00
REG_RMW_FIELD ( ah , AR_GPIO_INPUT_MUX1 ,
AR_GPIO_INPUT_MUX1_BT_PRIORITY ,
2009-09-10 01:52:02 +04:00
btcoex_hw - > btpriority_gpio ) ;
2009-08-26 19:38:50 +04:00
2009-09-09 13:54:40 +04:00
/* Configure the desired GPIO ports for input */
2009-09-10 01:52:02 +04:00
ath9k_hw_cfg_gpio_input ( ah , btcoex_hw - > btactive_gpio ) ;
ath9k_hw_cfg_gpio_input ( ah , btcoex_hw - > btpriority_gpio ) ;
2009-09-09 13:54:40 +04:00
}
2009-09-24 07:07:00 +04:00
EXPORT_SYMBOL ( ath9k_hw_btcoex_init_3wire ) ;
2009-09-09 13:54:40 +04:00
2012-02-22 11:10:15 +04:00
void ath9k_hw_btcoex_init_mci ( struct ath_hw * ah )
{
ah - > btcoex_hw . mci . ready = false ;
ah - > btcoex_hw . mci . bt_state = 0 ;
ah - > btcoex_hw . mci . bt_ver_major = 3 ;
ah - > btcoex_hw . mci . bt_ver_minor = 0 ;
ah - > btcoex_hw . mci . bt_version_known = false ;
ah - > btcoex_hw . mci . update_2g5g = true ;
ah - > btcoex_hw . mci . is_2g = true ;
ah - > btcoex_hw . mci . wlan_channels_update = false ;
ah - > btcoex_hw . mci . wlan_channels [ 0 ] = 0x00000000 ;
ah - > btcoex_hw . mci . wlan_channels [ 1 ] = 0xffffffff ;
ah - > btcoex_hw . mci . wlan_channels [ 2 ] = 0xffffffff ;
ah - > btcoex_hw . mci . wlan_channels [ 3 ] = 0x7fffffff ;
ah - > btcoex_hw . mci . query_bt = true ;
ah - > btcoex_hw . mci . unhalt_bt_gpm = true ;
ah - > btcoex_hw . mci . halted_bt_gpm = false ;
ah - > btcoex_hw . mci . need_flush_btinfo = false ;
ah - > btcoex_hw . mci . wlan_cal_seq = 0 ;
ah - > btcoex_hw . mci . wlan_cal_done = 0 ;
2012-10-15 13:59:53 +04:00
ah - > btcoex_hw . mci . config = ( AR_SREV_9462 ( ah ) ) ? 0x2201 : 0xa4c1 ;
2012-02-22 11:10:15 +04:00
}
EXPORT_SYMBOL ( ath9k_hw_btcoex_init_mci ) ;
2009-09-09 15:17:45 +04:00
static void ath9k_hw_btcoex_enable_2wire ( struct ath_hw * ah )
{
2009-09-10 01:52:02 +04:00
struct ath_btcoex_hw * btcoex_hw = & ah - > btcoex_hw ;
2009-09-09 15:17:45 +04:00
/* Configure the desired GPIO port for TX_FRAME output */
2009-09-10 01:52:02 +04:00
ath9k_hw_cfg_output ( ah , btcoex_hw - > wlanactive_gpio ,
2009-09-09 15:17:45 +04:00
AR_GPIO_OUTPUT_MUX_AS_TX_FRAME ) ;
}
2012-09-28 09:43:51 +04:00
/*
* For AR9002 , bt_weight / wlan_weight are used .
* For AR9003 and above , stomp_type is used .
*/
2009-09-10 02:15:55 +04:00
void ath9k_hw_btcoex_set_weight ( struct ath_hw * ah ,
u32 bt_weight ,
2012-09-28 09:43:51 +04:00
u32 wlan_weight ,
enum ath_stomp_type stomp_type )
2009-09-10 02:15:55 +04:00
{
struct ath_btcoex_hw * btcoex_hw = & ah - > btcoex_hw ;
2012-10-12 12:37:23 +04:00
struct ath9k_hw_mci * mci_hw = & ah - > btcoex_hw . mci ;
u8 txprio_shift [ ] = { 24 , 16 , 16 , 0 } ; /* tx priority weight */
bool concur_tx = ( mci_hw - > concur_tx & & btcoex_hw - > tx_prio [ stomp_type ] ) ;
const u32 * weight = ar9003_wlan_weights [ stomp_type ] ;
int i ;
2009-09-10 02:15:55 +04:00
2012-10-12 12:37:23 +04:00
if ( ! AR_SREV_9300_20_OR_LATER ( ah ) ) {
2012-09-28 09:43:51 +04:00
btcoex_hw - > bt_coex_weights =
SM ( bt_weight , AR_BTCOEX_BT_WGHT ) |
SM ( wlan_weight , AR_BTCOEX_WL_WGHT ) ;
2012-10-12 12:37:23 +04:00
return ;
}
if ( AR_SREV_9462 ( ah ) | | AR_SREV_9565 ( ah ) ) {
enum ath_stomp_type stype =
( ( stomp_type = = ATH_BTCOEX_STOMP_LOW ) & &
btcoex_hw - > mci . stomp_ftp ) ?
ATH_BTCOEX_STOMP_LOW_FTP : stomp_type ;
weight = mci_wlan_weights [ stype ] ;
2012-09-28 09:43:51 +04:00
}
2012-10-12 12:37:23 +04:00
for ( i = 0 ; i < AR9300_NUM_WLAN_WEIGHTS ; i + + ) {
btcoex_hw - > bt_weight [ i ] = AR9300_BT_WGHT ;
btcoex_hw - > wlan_weight [ i ] = weight [ i ] ;
if ( concur_tx & & i ) {
btcoex_hw - > wlan_weight [ i ] & =
~ ( 0xff < < txprio_shift [ i - 1 ] ) ;
btcoex_hw - > wlan_weight [ i ] | =
( btcoex_hw - > tx_prio [ stomp_type ] < <
txprio_shift [ i - 1 ] ) ;
}
}
/* Last WLAN weight has to be adjusted wrt tx priority */
if ( concur_tx ) {
btcoex_hw - > wlan_weight [ i - 1 ] & = ~ ( 0xff < < txprio_shift [ i - 1 ] ) ;
btcoex_hw - > wlan_weight [ i - 1 ] | = ( btcoex_hw - > tx_prio [ stomp_type ]
< < txprio_shift [ i - 1 ] ) ;
}
2009-09-10 02:15:55 +04:00
}
2009-09-24 07:07:00 +04:00
EXPORT_SYMBOL ( ath9k_hw_btcoex_set_weight ) ;
2009-09-10 02:15:55 +04:00
2011-04-26 09:09:53 +04:00
2009-09-09 15:17:45 +04:00
static void ath9k_hw_btcoex_enable_3wire ( struct ath_hw * ah )
{
2011-11-12 18:05:47 +04:00
struct ath_btcoex_hw * btcoex = & ah - > btcoex_hw ;
2010-08-18 18:27:49 +04:00
u32 val ;
2011-11-12 18:05:47 +04:00
int i ;
2009-09-09 15:17:45 +04:00
/*
* Program coex mode and weight registers to
* enable coex 3 - wire
*/
2011-11-12 18:05:47 +04:00
REG_WRITE ( ah , AR_BT_COEX_MODE , btcoex - > bt_coex_mode ) ;
REG_WRITE ( ah , AR_BT_COEX_MODE2 , btcoex - > bt_coex_mode2 ) ;
2009-09-09 15:17:45 +04:00
2011-04-26 09:09:53 +04:00
if ( AR_SREV_9300_20_OR_LATER ( ah ) ) {
2011-11-12 18:05:47 +04:00
REG_WRITE ( ah , AR_BT_COEX_WL_WEIGHTS0 , btcoex - > wlan_weight [ 0 ] ) ;
REG_WRITE ( ah , AR_BT_COEX_WL_WEIGHTS1 , btcoex - > wlan_weight [ 1 ] ) ;
for ( i = 0 ; i < AR9300_NUM_BT_WEIGHTS ; i + + )
REG_WRITE ( ah , AR_BT_COEX_BT_WEIGHTS ( i ) ,
btcoex - > bt_weight [ i ] ) ;
2011-04-26 09:09:53 +04:00
} else
2011-11-12 18:05:47 +04:00
REG_WRITE ( ah , AR_BT_COEX_WEIGHT , btcoex - > bt_coex_weights ) ;
2011-04-26 09:09:53 +04:00
2010-08-18 18:27:49 +04:00
if ( AR_SREV_9271 ( ah ) ) {
val = REG_READ ( ah , 0x50040 ) ;
val & = 0xFFFFFEFF ;
REG_WRITE ( ah , 0x50040 , val ) ;
}
2009-09-09 15:17:45 +04:00
REG_RMW_FIELD ( ah , AR_QUIET1 , AR_QUIET1_QUIET_ACK_CTS_ENABLE , 1 ) ;
REG_RMW_FIELD ( ah , AR_PCU_MISC , AR_PCU_BT_ANT_PREVENT_RX , 0 ) ;
2011-11-12 18:05:47 +04:00
ath9k_hw_cfg_output ( ah , btcoex - > wlanactive_gpio ,
2009-09-09 15:17:45 +04:00
AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL ) ;
}
2011-11-12 18:05:48 +04:00
static void ath9k_hw_btcoex_enable_mci ( struct ath_hw * ah )
{
struct ath_btcoex_hw * btcoex = & ah - > btcoex_hw ;
int i ;
for ( i = 0 ; i < AR9300_NUM_BT_WEIGHTS ; i + + )
REG_WRITE ( ah , AR_MCI_COEX_WL_WEIGHTS ( i ) ,
btcoex - > wlan_weight [ i ] ) ;
REG_RMW_FIELD ( ah , AR_QUIET1 , AR_QUIET1_QUIET_ACK_CTS_ENABLE , 1 ) ;
btcoex - > enabled = true ;
}
2009-08-26 19:38:44 +04:00
void ath9k_hw_btcoex_enable ( struct ath_hw * ah )
{
2009-09-10 01:52:02 +04:00
struct ath_btcoex_hw * btcoex_hw = & ah - > btcoex_hw ;
2009-08-26 19:38:46 +04:00
2011-12-17 19:47:56 +04:00
switch ( ath9k_hw_get_btcoex_scheme ( ah ) ) {
2009-09-09 15:17:45 +04:00
case ATH_BTCOEX_CFG_NONE :
2011-12-17 19:47:56 +04:00
return ;
2009-09-09 15:17:45 +04:00
case ATH_BTCOEX_CFG_2WIRE :
ath9k_hw_btcoex_enable_2wire ( ah ) ;
break ;
case ATH_BTCOEX_CFG_3WIRE :
2012-09-26 15:34:26 +04:00
if ( AR_SREV_9462 ( ah ) | | AR_SREV_9565 ( ah ) ) {
2012-04-19 17:43:52 +04:00
ath9k_hw_btcoex_enable_mci ( ah ) ;
return ;
}
2009-09-09 15:17:45 +04:00
ath9k_hw_btcoex_enable_3wire ( ah ) ;
break ;
2009-08-26 19:38:50 +04:00
}
REG_RMW ( ah , AR_GPIO_PDPU ,
2009-09-10 01:52:02 +04:00
( 0x2 < < ( btcoex_hw - > btactive_gpio * 2 ) ) ,
( 0x3 < < ( btcoex_hw - > btactive_gpio * 2 ) ) ) ;
2009-08-26 19:38:44 +04:00
2009-09-10 01:52:02 +04:00
ah - > btcoex_hw . enabled = true ;
2009-08-26 19:38:44 +04:00
}
2009-09-24 07:07:00 +04:00
EXPORT_SYMBOL ( ath9k_hw_btcoex_enable ) ;
2009-08-26 19:38:44 +04:00
void ath9k_hw_btcoex_disable ( struct ath_hw * ah )
{
2009-09-10 01:52:02 +04:00
struct ath_btcoex_hw * btcoex_hw = & ah - > btcoex_hw ;
2011-11-12 18:05:47 +04:00
int i ;
2009-08-26 19:38:46 +04:00
2011-11-12 18:05:48 +04:00
btcoex_hw - > enabled = false ;
2012-09-26 15:34:26 +04:00
if ( AR_SREV_9462 ( ah ) | | AR_SREV_9565 ( ah ) ) {
2011-11-12 18:05:48 +04:00
ath9k_hw_btcoex_bt_stomp ( ah , ATH_BTCOEX_STOMP_NONE ) ;
for ( i = 0 ; i < AR9300_NUM_BT_WEIGHTS ; i + + )
REG_WRITE ( ah , AR_MCI_COEX_WL_WEIGHTS ( i ) ,
btcoex_hw - > wlan_weight [ i ] ) ;
2012-04-19 17:43:52 +04:00
return ;
2011-11-12 18:05:48 +04:00
}
2009-09-10 01:52:02 +04:00
ath9k_hw_set_gpio ( ah , btcoex_hw - > wlanactive_gpio , 0 ) ;
2009-08-26 19:38:44 +04:00
2009-09-10 01:52:02 +04:00
ath9k_hw_cfg_output ( ah , btcoex_hw - > wlanactive_gpio ,
2009-08-26 19:38:44 +04:00
AR_GPIO_OUTPUT_MUX_AS_OUTPUT ) ;
2009-09-10 01:52:02 +04:00
if ( btcoex_hw - > scheme = = ATH_BTCOEX_CFG_3WIRE ) {
2009-08-26 19:38:50 +04:00
REG_WRITE ( ah , AR_BT_COEX_MODE , AR_BT_QUIET | AR_BT_MODE ) ;
REG_WRITE ( ah , AR_BT_COEX_MODE2 , 0 ) ;
2011-04-26 09:09:53 +04:00
if ( AR_SREV_9300_20_OR_LATER ( ah ) ) {
REG_WRITE ( ah , AR_BT_COEX_WL_WEIGHTS0 , 0 ) ;
REG_WRITE ( ah , AR_BT_COEX_WL_WEIGHTS1 , 0 ) ;
2011-11-12 18:05:47 +04:00
for ( i = 0 ; i < AR9300_NUM_BT_WEIGHTS ; i + + )
REG_WRITE ( ah , AR_BT_COEX_BT_WEIGHTS ( i ) , 0 ) ;
2011-04-26 09:09:53 +04:00
} else
REG_WRITE ( ah , AR_BT_COEX_WEIGHT , 0 ) ;
2009-08-26 19:38:50 +04:00
}
2009-08-26 19:38:44 +04:00
}
2009-09-24 07:07:00 +04:00
EXPORT_SYMBOL ( ath9k_hw_btcoex_disable ) ;
2011-04-26 09:09:52 +04:00
/*
* Configures appropriate weight based on stomp type .
*/
void ath9k_hw_btcoex_bt_stomp ( struct ath_hw * ah ,
enum ath_stomp_type stomp_type )
{
if ( AR_SREV_9300_20_OR_LATER ( ah ) ) {
2012-09-28 09:43:51 +04:00
ath9k_hw_btcoex_set_weight ( ah , 0 , 0 , stomp_type ) ;
2011-04-26 09:09:52 +04:00
return ;
}
switch ( stomp_type ) {
case ATH_BTCOEX_STOMP_ALL :
ath9k_hw_btcoex_set_weight ( ah , AR_BT_COEX_WGHT ,
2012-09-28 09:43:51 +04:00
AR_STOMP_ALL_WLAN_WGHT , 0 ) ;
2011-04-26 09:09:52 +04:00
break ;
case ATH_BTCOEX_STOMP_LOW :
ath9k_hw_btcoex_set_weight ( ah , AR_BT_COEX_WGHT ,
2012-09-28 09:43:51 +04:00
AR_STOMP_LOW_WLAN_WGHT , 0 ) ;
2011-04-26 09:09:52 +04:00
break ;
case ATH_BTCOEX_STOMP_NONE :
ath9k_hw_btcoex_set_weight ( ah , AR_BT_COEX_WGHT ,
2012-09-28 09:43:51 +04:00
AR_STOMP_NONE_WLAN_WGHT , 0 ) ;
2011-04-26 09:09:52 +04:00
break ;
default :
2011-12-16 02:55:53 +04:00
ath_dbg ( ath9k_hw_common ( ah ) , BTCOEX , " Invalid Stomptype \n " ) ;
2011-04-26 09:09:52 +04:00
break ;
}
}
EXPORT_SYMBOL ( ath9k_hw_btcoex_bt_stomp ) ;
2012-10-12 12:37:23 +04:00
void ath9k_hw_btcoex_set_concur_txprio ( struct ath_hw * ah , u8 * stomp_txprio )
{
struct ath_btcoex_hw * btcoex = & ah - > btcoex_hw ;
int i ;
for ( i = 0 ; i < ATH_BTCOEX_STOMP_MAX ; i + + )
btcoex - > tx_prio [ i ] = stomp_txprio [ i ] ;
}
EXPORT_SYMBOL ( ath9k_hw_btcoex_set_concur_txprio ) ;