spi-topcliff-pch: add recovery processing in case wait-event timeout
[zen-stable.git] / drivers / net / wireless / ath / ath9k / mci.h
blob29e3e51d078f52e661f0693f267d6e2f031f4479
1 /*
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.
17 #ifndef MCI_H
18 #define MCI_H
20 #define ATH_MCI_SCHED_BUF_SIZE (16 * 16) /* 16 entries, 4 dword each */
21 #define ATH_MCI_GPM_MAX_ENTRY 16
22 #define ATH_MCI_GPM_BUF_SIZE (ATH_MCI_GPM_MAX_ENTRY * 16)
23 #define ATH_MCI_DEF_BT_PERIOD 40
24 #define ATH_MCI_BDR_DUTY_CYCLE 20
25 #define ATH_MCI_MAX_DUTY_CYCLE 90
27 #define ATH_MCI_DEF_AGGR_LIMIT 6 /* in 0.24 ms */
28 #define ATH_MCI_MAX_ACL_PROFILE 7
29 #define ATH_MCI_MAX_SCO_PROFILE 1
30 #define ATH_MCI_MAX_PROFILE (ATH_MCI_MAX_ACL_PROFILE +\
31 ATH_MCI_MAX_SCO_PROFILE)
33 #define INC_PROF(_mci, _info) do { \
34 switch (_info->type) { \
35 case MCI_GPM_COEX_PROFILE_RFCOMM:\
36 _mci->num_other_acl++; \
37 break; \
38 case MCI_GPM_COEX_PROFILE_A2DP: \
39 _mci->num_a2dp++; \
40 if (!_info->edr) \
41 _mci->num_bdr++; \
42 break; \
43 case MCI_GPM_COEX_PROFILE_HID: \
44 _mci->num_hid++; \
45 break; \
46 case MCI_GPM_COEX_PROFILE_BNEP: \
47 _mci->num_pan++; \
48 break; \
49 case MCI_GPM_COEX_PROFILE_VOICE: \
50 _mci->num_sco++; \
51 break; \
52 default: \
53 break; \
54 } \
55 } while (0)
57 #define DEC_PROF(_mci, _info) do { \
58 switch (_info->type) { \
59 case MCI_GPM_COEX_PROFILE_RFCOMM:\
60 _mci->num_other_acl--; \
61 break; \
62 case MCI_GPM_COEX_PROFILE_A2DP: \
63 _mci->num_a2dp--; \
64 if (!_info->edr) \
65 _mci->num_bdr--; \
66 break; \
67 case MCI_GPM_COEX_PROFILE_HID: \
68 _mci->num_hid--; \
69 break; \
70 case MCI_GPM_COEX_PROFILE_BNEP: \
71 _mci->num_pan--; \
72 break; \
73 case MCI_GPM_COEX_PROFILE_VOICE: \
74 _mci->num_sco--; \
75 break; \
76 default: \
77 break; \
78 } \
79 } while (0)
81 #define NUM_PROF(_mci) (_mci->num_other_acl + _mci->num_a2dp + \
82 _mci->num_hid + _mci->num_pan + _mci->num_sco)
84 struct ath_mci_profile_info {
85 u8 type;
86 u8 conn_handle;
87 bool start;
88 bool master;
89 bool edr;
90 u8 voice_type;
91 u16 T; /* Voice: Tvoice, HID: Tsniff, in slots */
92 u8 W; /* Voice: Wvoice, HID: Sniff timeout, in slots */
93 u8 A; /* HID: Sniff attempt, in slots */
94 struct list_head list;
97 struct ath_mci_profile_status {
98 bool is_critical;
99 bool is_link;
100 u8 conn_handle;
103 struct ath_mci_profile {
104 struct list_head info;
105 DECLARE_BITMAP(status, ATH_MCI_MAX_PROFILE);
106 u16 aggr_limit;
107 u8 num_mgmt;
108 u8 num_sco;
109 u8 num_a2dp;
110 u8 num_hid;
111 u8 num_pan;
112 u8 num_other_acl;
113 u8 num_bdr;
117 struct ath_mci_buf {
118 void *bf_addr; /* virtual addr of desc */
119 dma_addr_t bf_paddr; /* physical addr of buffer */
120 u32 bf_len; /* len of data */
123 struct ath_mci_coex {
124 atomic_t mci_cal_flag;
125 struct ath_mci_buf sched_buf;
126 struct ath_mci_buf gpm_buf;
127 u32 bt_cal_start;
130 void ath_mci_flush_profile(struct ath_mci_profile *mci);
131 int ath_mci_setup(struct ath_softc *sc);
132 void ath_mci_cleanup(struct ath_softc *sc);
133 void ath_mci_intr(struct ath_softc *sc);
134 #endif