Lines Matching +full:half +full:- +full:dbm
2 * Copyright (c) 2010-2011 Atheros Communications Inc.
17 #include <linux/dma-mapping.h>
31 if (list_empty(&mci->info)) in ath_mci_find_profile()
34 list_for_each_entry(entry, &mci->info, list) { in ath_mci_find_profile()
35 if (entry->conn_handle == info->conn_handle) in ath_mci_find_profile()
48 if ((mci->num_sco == ATH_MCI_MAX_SCO_PROFILE) && in ath_mci_add_profile()
49 (info->type == MCI_GPM_COEX_PROFILE_VOICE)) in ath_mci_add_profile()
52 if (((NUM_PROF(mci) - mci->num_sco) == ATH_MCI_MAX_ACL_PROFILE) && in ath_mci_add_profile()
53 (info->type != MCI_GPM_COEX_PROFILE_VOICE)) in ath_mci_add_profile()
62 list_add_tail(&entry->list, &mci->info); in ath_mci_add_profile()
63 if (info->type == MCI_GPM_COEX_PROFILE_VOICE) { in ath_mci_add_profile()
64 if (info->voice_type < sizeof(voice_priority)) in ath_mci_add_profile()
65 mci->voice_priority = voice_priority[info->voice_type]; in ath_mci_add_profile()
67 mci->voice_priority = 110; in ath_mci_add_profile()
81 list_del(&entry->list); in ath_mci_del_profile()
89 mci->aggr_limit = 0; in ath_mci_flush_profile()
90 mci->num_mgmt = 0; in ath_mci_flush_profile()
92 if (list_empty(&mci->info)) in ath_mci_flush_profile()
95 list_for_each_entry_safe(info, tinfo, &mci->info, list) { in ath_mci_flush_profile()
96 list_del(&info->list); in ath_mci_flush_profile()
104 struct ath_mci_profile *mci = &btcoex->mci; in ath_mci_adjust_aggr_limit()
105 u32 wlan_airtime = btcoex->btcoex_period * in ath_mci_adjust_aggr_limit()
106 (100 - btcoex->duty_cycle) / 100; in ath_mci_adjust_aggr_limit()
111 * adjusted half of wlan_airtime to ensure that the aggregation can fit in ath_mci_adjust_aggr_limit()
115 (!mci->aggr_limit || (mci->aggr_limit > (2 * wlan_airtime)))) in ath_mci_adjust_aggr_limit()
116 mci->aggr_limit = 2 * wlan_airtime; in ath_mci_adjust_aggr_limit()
121 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_mci_update_scheme()
122 struct ath_btcoex *btcoex = &sc->btcoex; in ath_mci_update_scheme()
123 struct ath_mci_profile *mci = &btcoex->mci; in ath_mci_update_scheme()
124 struct ath9k_hw_mci *mci_hw = &sc->sc_ah->btcoex_hw.mci; in ath_mci_update_scheme()
128 if (mci_hw->config & ATH_MCI_CONFIG_DISABLE_TUNING) in ath_mci_update_scheme()
131 mci->aggr_limit = 0; in ath_mci_update_scheme()
132 btcoex->duty_cycle = ath_mci_duty_cycle[num_profile]; in ath_mci_update_scheme()
133 btcoex->btcoex_period = ATH_MCI_DEF_BT_PERIOD; in ath_mci_update_scheme()
135 btcoex->bt_stomp_type = ATH_BTCOEX_STOMP_LOW; in ath_mci_update_scheme()
137 btcoex->bt_stomp_type = mci->num_mgmt ? ATH_BTCOEX_STOMP_ALL : in ath_mci_update_scheme()
141 info = list_first_entry(&mci->info, in ath_mci_update_scheme()
144 if (mci->num_sco) { in ath_mci_update_scheme()
145 if (info->T == 12) in ath_mci_update_scheme()
146 mci->aggr_limit = 8; in ath_mci_update_scheme()
147 else if (info->T == 6) { in ath_mci_update_scheme()
148 mci->aggr_limit = 6; in ath_mci_update_scheme()
149 btcoex->duty_cycle = 30; in ath_mci_update_scheme()
151 mci->aggr_limit = 6; in ath_mci_update_scheme()
154 mci->aggr_limit); in ath_mci_update_scheme()
155 } else if (mci->num_pan || mci->num_other_acl) { in ath_mci_update_scheme()
160 btcoex->duty_cycle = AR_SREV_9565(sc->sc_ah) ? 40 : 35; in ath_mci_update_scheme()
161 btcoex->btcoex_period = 53; in ath_mci_update_scheme()
164 btcoex->duty_cycle, btcoex->btcoex_period); in ath_mci_update_scheme()
165 } else if (mci->num_hid) { in ath_mci_update_scheme()
166 btcoex->duty_cycle = 30; in ath_mci_update_scheme()
167 mci->aggr_limit = 6; in ath_mci_update_scheme()
173 if (mci->num_hid == 2) in ath_mci_update_scheme()
174 btcoex->duty_cycle = 30; in ath_mci_update_scheme()
175 mci->aggr_limit = 6; in ath_mci_update_scheme()
178 btcoex->duty_cycle); in ath_mci_update_scheme()
180 mci->aggr_limit = 4; in ath_mci_update_scheme()
186 if (IS_CHAN_2GHZ(sc->sc_ah->curchan)) { in ath_mci_update_scheme()
187 if (IS_CHAN_HT(sc->sc_ah->curchan)) in ath_mci_update_scheme()
190 btcoex->btcoex_period >>= 1; in ath_mci_update_scheme()
194 ath9k_hw_btcoex_disable(sc->sc_ah); in ath_mci_update_scheme()
196 if (IS_CHAN_5GHZ(sc->sc_ah->curchan)) in ath_mci_update_scheme()
199 btcoex->duty_cycle += (mci->num_bdr ? ATH_MCI_BDR_DUTY_CYCLE : 0); in ath_mci_update_scheme()
200 if (btcoex->duty_cycle > ATH_MCI_MAX_DUTY_CYCLE) in ath_mci_update_scheme()
201 btcoex->duty_cycle = ATH_MCI_MAX_DUTY_CYCLE; in ath_mci_update_scheme()
203 btcoex->btcoex_no_stomp = btcoex->btcoex_period * in ath_mci_update_scheme()
204 (100 - btcoex->duty_cycle) / 100; in ath_mci_update_scheme()
206 ath9k_hw_btcoex_enable(sc->sc_ah); in ath_mci_update_scheme()
212 struct ath_hw *ah = sc->sc_ah; in ath_mci_cal_msg()
214 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; in ath_mci_cal_msg()
219 if (mci_hw->bt_state == MCI_BT_AWAKE) { in ath_mci_cal_msg()
220 mci_hw->bt_state = MCI_BT_CAL_START; in ath_mci_cal_msg()
223 ath_dbg(common, MCI, "MCI State : %d\n", mci_hw->bt_state); in ath_mci_cal_msg()
227 ar9003_mci_send_message(sc->sc_ah, MCI_GPM, 0, payload, in ath_mci_cal_msg()
258 struct ath_btcoex *btcoex = &sc->btcoex; in ath_mci_set_concur_txprio()
259 struct ath_mci_profile *mci = &btcoex->mci; in ath_mci_set_concur_txprio()
263 if (mci->num_mgmt) { in ath_mci_set_concur_txprio()
265 if (!mci->num_pan && !mci->num_other_acl) in ath_mci_set_concur_txprio()
274 if (mci->num_sco) in ath_mci_set_concur_txprio()
275 ath_mci_update_stomp_txprio(mci->voice_priority, in ath_mci_set_concur_txprio()
277 if (mci->num_other_acl) in ath_mci_set_concur_txprio()
279 if (mci->num_a2dp) in ath_mci_set_concur_txprio()
281 if (mci->num_hid) in ath_mci_set_concur_txprio()
283 if (mci->num_pan) in ath_mci_set_concur_txprio()
292 ath9k_hw_btcoex_set_concur_txprio(sc->sc_ah, stomp_txprio); in ath_mci_set_concur_txprio()
298 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_mci_process_profile()
299 struct ath_btcoex *btcoex = &sc->btcoex; in ath_mci_process_profile()
300 struct ath_mci_profile *mci = &btcoex->mci; in ath_mci_process_profile()
313 if (entry->type != info->type) { in ath_mci_process_profile()
320 if (info->start) { in ath_mci_process_profile()
333 struct ath_btcoex *btcoex = &sc->btcoex; in ath_mci_process_status()
334 struct ath_mci_profile *mci = &btcoex->mci; in ath_mci_process_status()
336 int i = 0, old_num_mgmt = mci->num_mgmt; in ath_mci_process_status()
339 if (status->is_link) in ath_mci_process_status()
342 info.conn_handle = status->conn_handle; in ath_mci_process_status()
346 if (status->conn_handle >= ATH_MCI_MAX_PROFILE) in ath_mci_process_status()
349 if (status->is_critical) in ath_mci_process_status()
350 __set_bit(status->conn_handle, mci->status); in ath_mci_process_status()
352 __clear_bit(status->conn_handle, mci->status); in ath_mci_process_status()
354 mci->num_mgmt = 0; in ath_mci_process_status()
356 if (test_bit(i, mci->status)) in ath_mci_process_status()
357 mci->num_mgmt++; in ath_mci_process_status()
361 if (old_num_mgmt != mci->num_mgmt) in ath_mci_process_status()
369 struct ath_hw *ah = sc->sc_ah; in ath_mci_msg()
372 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_mci_msg()
379 ath_mci_flush_profile(&sc->btcoex.mci); in ath_mci_msg()
431 ieee80211_queue_work(sc->hw, &sc->mci_work); in ath_mci_msg()
436 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_mci_setup()
437 struct ath_mci_coex *mci = &sc->mci_coex; in ath_mci_setup()
438 struct ath_mci_buf *buf = &mci->sched_buf; in ath_mci_setup()
441 buf->bf_addr = dmam_alloc_coherent(sc->dev, in ath_mci_setup()
443 &buf->bf_paddr, GFP_KERNEL); in ath_mci_setup()
445 if (buf->bf_addr == NULL) { in ath_mci_setup()
447 return -ENOMEM; in ath_mci_setup()
450 memset(buf->bf_addr, MCI_GPM_RSVD_PATTERN, in ath_mci_setup()
453 mci->sched_buf.bf_len = ATH_MCI_SCHED_BUF_SIZE; in ath_mci_setup()
455 mci->gpm_buf.bf_len = ATH_MCI_GPM_BUF_SIZE; in ath_mci_setup()
456 mci->gpm_buf.bf_addr = mci->sched_buf.bf_addr + mci->sched_buf.bf_len; in ath_mci_setup()
457 mci->gpm_buf.bf_paddr = mci->sched_buf.bf_paddr + mci->sched_buf.bf_len; in ath_mci_setup()
459 ret = ar9003_mci_setup(sc->sc_ah, mci->gpm_buf.bf_paddr, in ath_mci_setup()
460 mci->gpm_buf.bf_addr, (mci->gpm_buf.bf_len >> 4), in ath_mci_setup()
461 mci->sched_buf.bf_paddr); in ath_mci_setup()
467 INIT_WORK(&sc->mci_work, ath9k_mci_work); in ath_mci_setup()
475 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_mci_cleanup()
476 struct ath_hw *ah = sc->sc_ah; in ath_mci_cleanup()
480 ath_dbg(common, MCI, "MCI De-Initialized\n"); in ath_mci_cleanup()
485 struct ath_mci_coex *mci = &sc->mci_coex; in ath_mci_intr()
486 struct ath_hw *ah = sc->sc_ah; in ath_mci_intr()
488 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; in ath_mci_intr()
495 ar9003_mci_get_interrupt(sc->sc_ah, &mci_int, &mci_int_rxmsg); in ath_mci_intr()
528 if ((mci_hw->bt_state == MCI_BT_SLEEP) && in ath_mci_intr()
537 if ((mci_hw->bt_state == MCI_BT_AWAKE) && in ath_mci_intr()
540 mci_hw->bt_state = MCI_BT_SLEEP; in ath_mci_intr()
558 if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) in ath_mci_intr()
561 pgpm = mci->gpm_buf.bf_addr; in ath_mci_intr()
603 int value_dbm = MS(mci_hw->cont_status, in ath_mci_intr()
609 "MCI CONT_INFO: (%s) pri = %d pwr = %d dBm\n", in ath_mci_intr()
610 MS(mci_hw->cont_status, AR_MCI_CONT_TXRX) ? in ath_mci_intr()
612 MS(mci_hw->cont_status, AR_MCI_CONT_PRIORITY), in ath_mci_intr()
633 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_mci_enable()
635 if (!common->btcoex_enabled) in ath_mci_enable()
638 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI) in ath_mci_enable()
639 sc->sc_ah->imask |= ATH9K_INT_MCI; in ath_mci_enable()
644 struct ath_hw *ah = sc->sc_ah; in ath9k_mci_update_wlan_channels()
645 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ath9k_mci_update_wlan_channels()
646 struct ath9k_channel *chan = ah->curchan; in ath9k_mci_update_wlan_channels()
658 wlan_chan = chan->channel - 2402; in ath9k_mci_update_wlan_channels()
660 chan_start = wlan_chan - 10; in ath9k_mci_update_wlan_channels()
666 chan_start -= 20; in ath9k_mci_update_wlan_channels()
669 chan_start -= 7; in ath9k_mci_update_wlan_channels()
675 chan_end = ATH_MCI_NUM_BT_CHANNELS - 1; in ath9k_mci_update_wlan_channels()
678 "WLAN current channel %d mask BT channel %d - %d\n", in ath9k_mci_update_wlan_channels()
687 mci->wlan_channels[i] = channelmap[i]; in ath9k_mci_update_wlan_channels()
695 struct ath_hw *ah = sc->sc_ah; in ath9k_mci_set_txpower()
696 struct ath9k_hw_mci *mci_hw = &sc->sc_ah->btcoex_hw.mci; in ath9k_mci_set_txpower()
697 bool old_concur_tx = mci_hw->concur_tx; in ath9k_mci_set_txpower()
699 if (!(mci_hw->config & ATH_MCI_CONFIG_CONCUR_TX)) { in ath9k_mci_set_txpower()
700 mci_hw->concur_tx = false; in ath9k_mci_set_txpower()
704 if (!IS_CHAN_2GHZ(ah->curchan)) in ath9k_mci_set_txpower()
708 struct ath9k_hw_cal_data *caldata = &sc->cur_chan->caldata; in ath9k_mci_set_txpower()
709 if (IS_CHAN_HT40PLUS(ah->curchan) && in ath9k_mci_set_txpower()
710 (ah->curchan->channel > caldata->channel) && in ath9k_mci_set_txpower()
711 (ah->curchan->channel <= caldata->channel + 20)) in ath9k_mci_set_txpower()
713 if (IS_CHAN_HT40MINUS(ah->curchan) && in ath9k_mci_set_txpower()
714 (ah->curchan->channel < caldata->channel) && in ath9k_mci_set_txpower()
715 (ah->curchan->channel >= caldata->channel - 20)) in ath9k_mci_set_txpower()
717 mci_hw->concur_tx = false; in ath9k_mci_set_txpower()
719 mci_hw->concur_tx = concur_tx; in ath9k_mci_set_txpower()
721 if (old_concur_tx != mci_hw->concur_tx) in ath9k_mci_set_txpower()
722 ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false); in ath9k_mci_set_txpower()
727 struct ath_hw *ah = sc->sc_ah; in ath9k_mci_stomp_audio()
728 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_mci_stomp_audio()
729 struct ath_mci_profile *mci = &btcoex->mci; in ath9k_mci_stomp_audio()
731 if (!mci->num_sco && !mci->num_a2dp) in ath9k_mci_stomp_audio()
734 if (ah->stats.avgbrssi > 25) { in ath9k_mci_stomp_audio()
735 btcoex->stomp_audio = 0; in ath9k_mci_stomp_audio()
739 btcoex->stomp_audio++; in ath9k_mci_stomp_audio()
743 struct ath_hw *ah = sc->sc_ah; in ath9k_mci_update_rssi()
744 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_mci_update_rssi()
745 struct ath9k_hw_mci *mci_hw = &sc->sc_ah->btcoex_hw.mci; in ath9k_mci_update_rssi()
749 if (!(mci_hw->config & ATH_MCI_CONFIG_CONCUR_TX)) in ath9k_mci_update_rssi()
752 if (ah->stats.avgbrssi >= 40) { in ath9k_mci_update_rssi()
753 if (btcoex->rssi_count < 0) in ath9k_mci_update_rssi()
754 btcoex->rssi_count = 0; in ath9k_mci_update_rssi()
755 if (++btcoex->rssi_count >= ATH_MCI_CONCUR_TX_SWITCH) { in ath9k_mci_update_rssi()
756 btcoex->rssi_count = 0; in ath9k_mci_update_rssi()
760 if (btcoex->rssi_count > 0) in ath9k_mci_update_rssi()
761 btcoex->rssi_count = 0; in ath9k_mci_update_rssi()
762 if (--btcoex->rssi_count <= -ATH_MCI_CONCUR_TX_SWITCH) { in ath9k_mci_update_rssi()
763 btcoex->rssi_count = 0; in ath9k_mci_update_rssi()