Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2009 Atheros Communications Inc. |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #include "ath9k.h" |
| 18 | |
| 19 | void ath9k_hw_btcoex_init(struct ath_hw *ah) |
| 20 | { |
| 21 | /* connect bt_active to baseband */ |
| 22 | REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL, |
| 23 | (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF | |
| 24 | AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF)); |
| 25 | |
| 26 | REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, |
| 27 | AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB); |
| 28 | |
| 29 | /* Set input mux for bt_active to gpio pin */ |
| 30 | REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1, |
| 31 | AR_GPIO_INPUT_MUX1_BT_ACTIVE, |
| 32 | ah->btactive_gpio); |
| 33 | |
| 34 | /* Configure the desired gpio port for input */ |
| 35 | ath9k_hw_cfg_gpio_input(ah, ah->btactive_gpio); |
| 36 | } |
| 37 | |
| 38 | void ath9k_hw_btcoex_enable(struct ath_hw *ah) |
| 39 | { |
| 40 | /* Configure the desired GPIO port for TX_FRAME output */ |
| 41 | ath9k_hw_cfg_output(ah, ah->wlanactive_gpio, |
| 42 | AR_GPIO_OUTPUT_MUX_AS_TX_FRAME); |
| 43 | |
| 44 | ah->ah_sc->sc_flags |= SC_OP_BTCOEX_ENABLED; |
| 45 | } |
| 46 | |
| 47 | void ath9k_hw_btcoex_disable(struct ath_hw *ah) |
| 48 | { |
| 49 | ath9k_hw_set_gpio(ah, ah->wlanactive_gpio, 0); |
| 50 | |
| 51 | ath9k_hw_cfg_output(ah, ah->wlanactive_gpio, |
| 52 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); |
| 53 | |
| 54 | ah->ah_sc->sc_flags &= ~SC_OP_BTCOEX_ENABLED; |
| 55 | } |