2 * Copyright (c) 2010-2011 Atheros Communications Inc.
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.
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.
20 #include "ar9003_mci.h"
22 #define ATH_MCI_SCHED_BUF_SIZE (16 * 16) /* 16 entries, 4 dword each */
23 #define ATH_MCI_GPM_MAX_ENTRY 16
24 #define ATH_MCI_GPM_BUF_SIZE (ATH_MCI_GPM_MAX_ENTRY * 16)
25 #define ATH_MCI_DEF_BT_PERIOD 40
26 #define ATH_MCI_BDR_DUTY_CYCLE 20
27 #define ATH_MCI_MAX_DUTY_CYCLE 90
29 #define ATH_MCI_DEF_AGGR_LIMIT 6 /* in 0.24 ms */
30 #define ATH_MCI_MAX_ACL_PROFILE 7
31 #define ATH_MCI_MAX_SCO_PROFILE 1
32 #define ATH_MCI_MAX_PROFILE (ATH_MCI_MAX_ACL_PROFILE +\
33 ATH_MCI_MAX_SCO_PROFILE)
35 #define INC_PROF(_mci, _info) do { \
36 switch (_info->type) { \
37 case MCI_GPM_COEX_PROFILE_RFCOMM:\
38 _mci->num_other_acl++; \
40 case MCI_GPM_COEX_PROFILE_A2DP: \
45 case MCI_GPM_COEX_PROFILE_HID: \
48 case MCI_GPM_COEX_PROFILE_BNEP: \
51 case MCI_GPM_COEX_PROFILE_VOICE: \
59 #define DEC_PROF(_mci, _info) do { \
60 switch (_info->type) { \
61 case MCI_GPM_COEX_PROFILE_RFCOMM:\
62 _mci->num_other_acl--; \
64 case MCI_GPM_COEX_PROFILE_A2DP: \
69 case MCI_GPM_COEX_PROFILE_HID: \
72 case MCI_GPM_COEX_PROFILE_BNEP: \
75 case MCI_GPM_COEX_PROFILE_VOICE: \
83 #define NUM_PROF(_mci) (_mci->num_other_acl + _mci->num_a2dp + \
84 _mci->num_hid + _mci->num_pan + _mci->num_sco)
86 struct ath_mci_profile_info
{
93 u16 T
; /* Voice: Tvoice, HID: Tsniff, in slots */
94 u8 W
; /* Voice: Wvoice, HID: Sniff timeout, in slots */
95 u8 A
; /* HID: Sniff attempt, in slots */
96 struct list_head list
;
99 struct ath_mci_profile_status
{
105 struct ath_mci_profile
{
106 struct list_head info
;
107 DECLARE_BITMAP(status
, ATH_MCI_MAX_PROFILE
);
119 void *bf_addr
; /* virtual addr of desc */
120 dma_addr_t bf_paddr
; /* physical addr of buffer */
121 u32 bf_len
; /* len of data */
124 struct ath_mci_coex
{
125 struct ath_mci_buf sched_buf
;
126 struct ath_mci_buf gpm_buf
;
129 void ath_mci_flush_profile(struct ath_mci_profile
*mci
);
130 int ath_mci_setup(struct ath_softc
*sc
);
131 void ath_mci_cleanup(struct ath_softc
*sc
);
132 void ath_mci_intr(struct ath_softc
*sc
);
134 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
135 void ath_mci_enable(struct ath_softc
*sc
);
137 static inline void ath_mci_enable(struct ath_softc
*sc
)
140 #endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */