btcoex.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #include "ath9k.h"
  17. void ath9k_hw_btcoex_init(struct ath_hw *ah)
  18. {
  19. struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
  20. /* connect bt_active to baseband */
  21. REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL,
  22. (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF |
  23. AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF));
  24. REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
  25. AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB);
  26. /* Set input mux for bt_active to gpio pin */
  27. REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
  28. AR_GPIO_INPUT_MUX1_BT_ACTIVE,
  29. btcoex_info->btactive_gpio);
  30. /* Configure the desired gpio port for input */
  31. ath9k_hw_cfg_gpio_input(ah, btcoex_info->btactive_gpio);
  32. }
  33. void ath9k_hw_btcoex_enable(struct ath_hw *ah)
  34. {
  35. struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
  36. /* Configure the desired GPIO port for TX_FRAME output */
  37. ath9k_hw_cfg_output(ah, btcoex_info->wlanactive_gpio,
  38. AR_GPIO_OUTPUT_MUX_AS_TX_FRAME);
  39. ah->ah_sc->sc_flags |= SC_OP_BTCOEX_ENABLED;
  40. }
  41. void ath9k_hw_btcoex_disable(struct ath_hw *ah)
  42. {
  43. struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
  44. ath9k_hw_set_gpio(ah, btcoex_info->wlanactive_gpio, 0);
  45. ath9k_hw_cfg_output(ah, btcoex_info->wlanactive_gpio,
  46. AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  47. ah->ah_sc->sc_flags &= ~SC_OP_BTCOEX_ENABLED;
  48. }