gpio.c revision d68475de9637a476ad8e5870060ccc69a80f2299
10fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* 25b68138e5659cbfd5df2879d17f9ba0b66477fecSujith Manoharan * Copyright (c) 2008-2011 Atheros Communications Inc. 30fca65c1c0569d6a143e978b6f4974c519033e63Sujith * 40fca65c1c0569d6a143e978b6f4974c519033e63Sujith * Permission to use, copy, modify, and/or distribute this software for any 50fca65c1c0569d6a143e978b6f4974c519033e63Sujith * purpose with or without fee is hereby granted, provided that the above 60fca65c1c0569d6a143e978b6f4974c519033e63Sujith * copyright notice and this permission notice appear in all copies. 70fca65c1c0569d6a143e978b6f4974c519033e63Sujith * 80fca65c1c0569d6a143e978b6f4974c519033e63Sujith * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 90fca65c1c0569d6a143e978b6f4974c519033e63Sujith * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 100fca65c1c0569d6a143e978b6f4974c519033e63Sujith * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 110fca65c1c0569d6a143e978b6f4974c519033e63Sujith * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 120fca65c1c0569d6a143e978b6f4974c519033e63Sujith * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 130fca65c1c0569d6a143e978b6f4974c519033e63Sujith * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 140fca65c1c0569d6a143e978b6f4974c519033e63Sujith * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 150fca65c1c0569d6a143e978b6f4974c519033e63Sujith */ 160fca65c1c0569d6a143e978b6f4974c519033e63Sujith 170fca65c1c0569d6a143e978b6f4974c519033e63Sujith#include "ath9k.h" 180fca65c1c0569d6a143e978b6f4974c519033e63Sujith 190fca65c1c0569d6a143e978b6f4974c519033e63Sujith/********************************/ 200fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* LED functions */ 210fca65c1c0569d6a143e978b6f4974c519033e63Sujith/********************************/ 220fca65c1c0569d6a143e978b6f4974c519033e63Sujith 230cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau#ifdef CONFIG_MAC80211_LEDS 240fca65c1c0569d6a143e978b6f4974c519033e63Sujithstatic void ath_led_brightness(struct led_classdev *led_cdev, 250fca65c1c0569d6a143e978b6f4974c519033e63Sujith enum led_brightness brightness) 260fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 270cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev); 280cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, (brightness == LED_OFF)); 290fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 300fca65c1c0569d6a143e978b6f4974c519033e63Sujith 310fca65c1c0569d6a143e978b6f4974c519033e63Sujithvoid ath_deinit_leds(struct ath_softc *sc) 320fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 330cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau if (!sc->led_registered) 340cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau return; 350cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau 360cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau ath_led_brightness(&sc->led_cdev, LED_OFF); 370cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau led_classdev_unregister(&sc->led_cdev); 380fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 390fca65c1c0569d6a143e978b6f4974c519033e63Sujith 400fca65c1c0569d6a143e978b6f4974c519033e63Sujithvoid ath_init_leds(struct ath_softc *sc) 410fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 420fca65c1c0569d6a143e978b6f4974c519033e63Sujith int ret; 430fca65c1c0569d6a143e978b6f4974c519033e63Sujith 446de66dd963ddd669667a81a2401f2fd6472ff55cFelix Fietkau if (sc->sc_ah->led_pin < 0) { 456de66dd963ddd669667a81a2401f2fd6472ff55cFelix Fietkau if (AR_SREV_9287(sc->sc_ah)) 466de66dd963ddd669667a81a2401f2fd6472ff55cFelix Fietkau sc->sc_ah->led_pin = ATH_LED_PIN_9287; 476de66dd963ddd669667a81a2401f2fd6472ff55cFelix Fietkau else if (AR_SREV_9485(sc->sc_ah)) 486de66dd963ddd669667a81a2401f2fd6472ff55cFelix Fietkau sc->sc_ah->led_pin = ATH_LED_PIN_9485; 49353e5019e048562dc8f434c6237d41ef5e758922Senthil Balasubramanian else if (AR_SREV_9300(sc->sc_ah)) 50353e5019e048562dc8f434c6237d41ef5e758922Senthil Balasubramanian sc->sc_ah->led_pin = ATH_LED_PIN_9300; 51423e38e8079f8f4fe0bf66d4f9a7d61beb232acaRajkumar Manoharan else if (AR_SREV_9462(sc->sc_ah)) 52423e38e8079f8f4fe0bf66d4f9a7d61beb232acaRajkumar Manoharan sc->sc_ah->led_pin = ATH_LED_PIN_9462; 536de66dd963ddd669667a81a2401f2fd6472ff55cFelix Fietkau else 546de66dd963ddd669667a81a2401f2fd6472ff55cFelix Fietkau sc->sc_ah->led_pin = ATH_LED_PIN_DEF; 556de66dd963ddd669667a81a2401f2fd6472ff55cFelix Fietkau } 560fca65c1c0569d6a143e978b6f4974c519033e63Sujith 570fca65c1c0569d6a143e978b6f4974c519033e63Sujith /* Configure gpio 1 for output */ 580fca65c1c0569d6a143e978b6f4974c519033e63Sujith ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin, 590fca65c1c0569d6a143e978b6f4974c519033e63Sujith AR_GPIO_OUTPUT_MUX_AS_OUTPUT); 600fca65c1c0569d6a143e978b6f4974c519033e63Sujith /* LED off, active low */ 610fca65c1c0569d6a143e978b6f4974c519033e63Sujith ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); 620fca65c1c0569d6a143e978b6f4974c519033e63Sujith 630cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau if (!led_blink) 640cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau sc->led_cdev.default_trigger = 650cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau ieee80211_get_radio_led_name(sc->hw); 660cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau 670cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau snprintf(sc->led_name, sizeof(sc->led_name), 680cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau "ath9k-%s", wiphy_name(sc->hw->wiphy)); 690cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau sc->led_cdev.name = sc->led_name; 700cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau sc->led_cdev.brightness_set = ath_led_brightness; 710cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau 720cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); 730cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau if (ret < 0) 740cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau return; 750cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau 760cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau sc->led_registered = true; 770fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 780cf55c21ec401632043db2b8acb7cd3bef64c9e6Felix Fietkau#endif 790fca65c1c0569d6a143e978b6f4974c519033e63Sujith 800fca65c1c0569d6a143e978b6f4974c519033e63Sujith/*******************/ 810fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* Rfkill */ 820fca65c1c0569d6a143e978b6f4974c519033e63Sujith/*******************/ 830fca65c1c0569d6a143e978b6f4974c519033e63Sujith 840fca65c1c0569d6a143e978b6f4974c519033e63Sujithstatic bool ath_is_rfkill_set(struct ath_softc *sc) 850fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 860fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_hw *ah = sc->sc_ah; 8790826313fd69d198da7574779460f793765abfa5Mohammed Shafi Shajakhan bool is_blocked; 880fca65c1c0569d6a143e978b6f4974c519033e63Sujith 8990826313fd69d198da7574779460f793765abfa5Mohammed Shafi Shajakhan ath9k_ps_wakeup(sc); 9090826313fd69d198da7574779460f793765abfa5Mohammed Shafi Shajakhan is_blocked = ath9k_hw_gpio_get(ah, ah->rfkill_gpio) == 910fca65c1c0569d6a143e978b6f4974c519033e63Sujith ah->rfkill_polarity; 9290826313fd69d198da7574779460f793765abfa5Mohammed Shafi Shajakhan ath9k_ps_restore(sc); 9390826313fd69d198da7574779460f793765abfa5Mohammed Shafi Shajakhan 9490826313fd69d198da7574779460f793765abfa5Mohammed Shafi Shajakhan return is_blocked; 950fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 960fca65c1c0569d6a143e978b6f4974c519033e63Sujith 970fca65c1c0569d6a143e978b6f4974c519033e63Sujithvoid ath9k_rfkill_poll_state(struct ieee80211_hw *hw) 980fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 999ac58615d93c8a28b1c649a90a5e2ede4dfd368aFelix Fietkau struct ath_softc *sc = hw->priv; 1000fca65c1c0569d6a143e978b6f4974c519033e63Sujith bool blocked = !!ath_is_rfkill_set(sc); 1010fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1020fca65c1c0569d6a143e978b6f4974c519033e63Sujith wiphy_rfkill_set_hw_state(hw->wiphy, blocked); 1030fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 1040fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1050fca65c1c0569d6a143e978b6f4974c519033e63Sujithvoid ath_start_rfkill_poll(struct ath_softc *sc) 1060fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 1070fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_hw *ah = sc->sc_ah; 1080fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1090fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) 1100fca65c1c0569d6a143e978b6f4974c519033e63Sujith wiphy_rfkill_start_polling(sc->hw->wiphy); 1110fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 1120fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1134daa7760e2da9324e740f7d872970fa91c8ea6f0Sujith Manoharan#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT 1144daa7760e2da9324e740f7d872970fa91c8ea6f0Sujith Manoharan 1150fca65c1c0569d6a143e978b6f4974c519033e63Sujith/******************/ 1160fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* BTCOEX */ 1170fca65c1c0569d6a143e978b6f4974c519033e63Sujith/******************/ 1180fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1190fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* 1200fca65c1c0569d6a143e978b6f4974c519033e63Sujith * Detects if there is any priority bt traffic 1210fca65c1c0569d6a143e978b6f4974c519033e63Sujith */ 1220fca65c1c0569d6a143e978b6f4974c519033e63Sujithstatic void ath_detect_bt_priority(struct ath_softc *sc) 1230fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 1240fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_btcoex *btcoex = &sc->btcoex; 1250fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_hw *ah = sc->sc_ah; 1260fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1270fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (ath9k_hw_gpio_get(sc->sc_ah, ah->btcoex_hw.btpriority_gpio)) 1280fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->bt_priority_cnt++; 1290fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1300fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (time_after(jiffies, btcoex->bt_priority_time + 1310fca65c1c0569d6a143e978b6f4974c519033e63Sujith msecs_to_jiffies(ATH_BT_PRIORITY_TIME_THRESHOLD))) { 13258da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan sc->sc_flags &= ~(SC_OP_BT_PRIORITY_DETECTED | SC_OP_BT_SCAN); 13358da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan /* Detect if colocated bt started scanning */ 13458da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) { 135d2182b69dcb6a68b1ef6070b2efd094e13dea3f1Joe Perches ath_dbg(ath9k_hw_common(sc->sc_ah), BTCOEX, 136226afe68fdbd1aa3680158aca0a3631cbd019626Joe Perches "BT scan detected\n"); 13758da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan sc->sc_flags |= (SC_OP_BT_SCAN | 13858da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan SC_OP_BT_PRIORITY_DETECTED); 13958da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { 140d2182b69dcb6a68b1ef6070b2efd094e13dea3f1Joe Perches ath_dbg(ath9k_hw_common(sc->sc_ah), BTCOEX, 141226afe68fdbd1aa3680158aca0a3631cbd019626Joe Perches "BT priority traffic detected\n"); 1420fca65c1c0569d6a143e978b6f4974c519033e63Sujith sc->sc_flags |= SC_OP_BT_PRIORITY_DETECTED; 1430fca65c1c0569d6a143e978b6f4974c519033e63Sujith } 1440fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1450fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->bt_priority_cnt = 0; 1460fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->bt_priority_time = jiffies; 1470fca65c1c0569d6a143e978b6f4974c519033e63Sujith } 1480fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 1490fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1500fca65c1c0569d6a143e978b6f4974c519033e63Sujithstatic void ath9k_gen_timer_start(struct ath_hw *ah, 1510fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_gen_timer *timer, 152788f6875fcf5d2bce221fbfd2318ac48df299031Vasanthakumar Thiagarajan u32 trig_timeout, 1530fca65c1c0569d6a143e978b6f4974c519033e63Sujith u32 timer_period) 1540fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 155788f6875fcf5d2bce221fbfd2318ac48df299031Vasanthakumar Thiagarajan ath9k_hw_gen_timer_start(ah, timer, trig_timeout, timer_period); 1560fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1573069168c82d65f88e4ac76eda09baff02adfd743Pavel Roskin if ((ah->imask & ATH9K_INT_GENTIMER) == 0) { 1584df3071ebd92ef7115b409da64d0eb405d24a631Felix Fietkau ath9k_hw_disable_interrupts(ah); 1593069168c82d65f88e4ac76eda09baff02adfd743Pavel Roskin ah->imask |= ATH9K_INT_GENTIMER; 16072d874c67c3cdf21ca95045baabac6a5843222d8Felix Fietkau ath9k_hw_set_interrupts(ah); 161b037b693265e5c83ddc3f003a713d19b9832bf24Rajkumar Manoharan ath9k_hw_enable_interrupts(ah); 1620fca65c1c0569d6a143e978b6f4974c519033e63Sujith } 1630fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 1640fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1650fca65c1c0569d6a143e978b6f4974c519033e63Sujithstatic void ath9k_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) 1660fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 1670fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; 1680fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1690fca65c1c0569d6a143e978b6f4974c519033e63Sujith ath9k_hw_gen_timer_stop(ah, timer); 1700fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1710fca65c1c0569d6a143e978b6f4974c519033e63Sujith /* if no timer is enabled, turn off interrupt mask */ 1720fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (timer_table->timer_mask.val == 0) { 1734df3071ebd92ef7115b409da64d0eb405d24a631Felix Fietkau ath9k_hw_disable_interrupts(ah); 1743069168c82d65f88e4ac76eda09baff02adfd743Pavel Roskin ah->imask &= ~ATH9K_INT_GENTIMER; 17572d874c67c3cdf21ca95045baabac6a5843222d8Felix Fietkau ath9k_hw_set_interrupts(ah); 176b037b693265e5c83ddc3f003a713d19b9832bf24Rajkumar Manoharan ath9k_hw_enable_interrupts(ah); 1770fca65c1c0569d6a143e978b6f4974c519033e63Sujith } 1780fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 1790fca65c1c0569d6a143e978b6f4974c519033e63Sujith 1800fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* 1810fca65c1c0569d6a143e978b6f4974c519033e63Sujith * This is the master bt coex timer which runs for every 1820fca65c1c0569d6a143e978b6f4974c519033e63Sujith * 45ms, bt traffic will be given priority during 55% of this 1830fca65c1c0569d6a143e978b6f4974c519033e63Sujith * period while wlan gets remaining 45% 1840fca65c1c0569d6a143e978b6f4974c519033e63Sujith */ 1850fca65c1c0569d6a143e978b6f4974c519033e63Sujithstatic void ath_btcoex_period_timer(unsigned long data) 1860fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 1870fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_softc *sc = (struct ath_softc *) data; 1880fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_hw *ah = sc->sc_ah; 1890fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_btcoex *btcoex = &sc->btcoex; 19058da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan u32 timer_period; 19158da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan bool is_btscan; 1920fca65c1c0569d6a143e978b6f4974c519033e63Sujith 193a039a993496d79d09ae9709c82b545b9800954c9Vivek Natarajan ath9k_ps_wakeup(sc); 1947dc181c273861c4d96991f59a4fdcda3a3eaccaeRajkumar Manoharan if (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) 1957dc181c273861c4d96991f59a4fdcda3a3eaccaeRajkumar Manoharan ath_detect_bt_priority(sc); 19658da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan is_btscan = sc->sc_flags & SC_OP_BT_SCAN; 19758da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan 1980fca65c1c0569d6a143e978b6f4974c519033e63Sujith spin_lock_bh(&btcoex->btcoex_lock); 1990fca65c1c0569d6a143e978b6f4974c519033e63Sujith 200978f78bf71372a48785ac9407ebc10170f14f56cVivek Natarajan ath9k_hw_btcoex_bt_stomp(ah, is_btscan ? ATH_BTCOEX_STOMP_ALL : 20158da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan btcoex->bt_stomp_type); 2020fca65c1c0569d6a143e978b6f4974c519033e63Sujith 203bc6d5c29afa724901c2feb7e4446c6eec7788cecRajkumar Manoharan ath9k_hw_btcoex_enable(ah); 2040fca65c1c0569d6a143e978b6f4974c519033e63Sujith spin_unlock_bh(&btcoex->btcoex_lock); 2050fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2060fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) { 2070fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (btcoex->hw_timer_enabled) 2080fca65c1c0569d6a143e978b6f4974c519033e63Sujith ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); 2090fca65c1c0569d6a143e978b6f4974c519033e63Sujith 21058da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan timer_period = is_btscan ? btcoex->btscan_no_stomp : 21158da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan btcoex->btcoex_no_stomp; 212788f6875fcf5d2bce221fbfd2318ac48df299031Vasanthakumar Thiagarajan ath9k_gen_timer_start(ah, btcoex->no_stomp_timer, timer_period, 2138eb1dabbd10e067cff671935d3e0c819f8e80d54Felix Fietkau timer_period * 10); 2140fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->hw_timer_enabled = true; 2150fca65c1c0569d6a143e978b6f4974c519033e63Sujith } 2160fca65c1c0569d6a143e978b6f4974c519033e63Sujith 217a039a993496d79d09ae9709c82b545b9800954c9Vivek Natarajan ath9k_ps_restore(sc); 2187dc181c273861c4d96991f59a4fdcda3a3eaccaeRajkumar Manoharan timer_period = btcoex->btcoex_period / 1000; 2190fca65c1c0569d6a143e978b6f4974c519033e63Sujith mod_timer(&btcoex->period_timer, jiffies + 2207dc181c273861c4d96991f59a4fdcda3a3eaccaeRajkumar Manoharan msecs_to_jiffies(timer_period)); 2210fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 2220fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2230fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* 2240fca65c1c0569d6a143e978b6f4974c519033e63Sujith * Generic tsf based hw timer which configures weight 2250fca65c1c0569d6a143e978b6f4974c519033e63Sujith * registers to time slice between wlan and bt traffic 2260fca65c1c0569d6a143e978b6f4974c519033e63Sujith */ 2270fca65c1c0569d6a143e978b6f4974c519033e63Sujithstatic void ath_btcoex_no_stomp_timer(void *arg) 2280fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 2290fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_softc *sc = (struct ath_softc *)arg; 2300fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_hw *ah = sc->sc_ah; 2310fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_btcoex *btcoex = &sc->btcoex; 232d99eeb87420a6da1f87064c7fa70bdf299699d90Vivek Natarajan struct ath_common *common = ath9k_hw_common(ah); 23358da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan bool is_btscan = sc->sc_flags & SC_OP_BT_SCAN; 2340fca65c1c0569d6a143e978b6f4974c519033e63Sujith 235d2182b69dcb6a68b1ef6070b2efd094e13dea3f1Joe Perches ath_dbg(common, BTCOEX, "no stomp timer running\n"); 2360fca65c1c0569d6a143e978b6f4974c519033e63Sujith 237a039a993496d79d09ae9709c82b545b9800954c9Vivek Natarajan ath9k_ps_wakeup(sc); 2380fca65c1c0569d6a143e978b6f4974c519033e63Sujith spin_lock_bh(&btcoex->btcoex_lock); 2390fca65c1c0569d6a143e978b6f4974c519033e63Sujith 24058da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) 241978f78bf71372a48785ac9407ebc10170f14f56cVivek Natarajan ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); 2420fca65c1c0569d6a143e978b6f4974c519033e63Sujith else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) 243978f78bf71372a48785ac9407ebc10170f14f56cVivek Natarajan ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); 2440fca65c1c0569d6a143e978b6f4974c519033e63Sujith 245bc6d5c29afa724901c2feb7e4446c6eec7788cecRajkumar Manoharan ath9k_hw_btcoex_enable(ah); 2460fca65c1c0569d6a143e978b6f4974c519033e63Sujith spin_unlock_bh(&btcoex->btcoex_lock); 247a039a993496d79d09ae9709c82b545b9800954c9Vivek Natarajan ath9k_ps_restore(sc); 2480fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 2490fca65c1c0569d6a143e978b6f4974c519033e63Sujith 250df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharanstatic int ath_init_btcoex_timer(struct ath_softc *sc) 2510fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 2520fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_btcoex *btcoex = &sc->btcoex; 2530fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2548a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau if (ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_NONE) 2558a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau return 0; 2568a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau 2570fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->btcoex_period = ATH_BTCOEX_DEF_BT_PERIOD * 1000; 2580fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->btcoex_no_stomp = (100 - ATH_BTCOEX_DEF_DUTY_CYCLE) * 2590fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->btcoex_period / 100; 26058da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan btcoex->btscan_no_stomp = (100 - ATH_BTCOEX_BTSCAN_DUTY_CYCLE) * 26158da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan btcoex->btcoex_period / 100; 2620fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2630fca65c1c0569d6a143e978b6f4974c519033e63Sujith setup_timer(&btcoex->period_timer, ath_btcoex_period_timer, 2640fca65c1c0569d6a143e978b6f4974c519033e63Sujith (unsigned long) sc); 2650fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2660fca65c1c0569d6a143e978b6f4974c519033e63Sujith spin_lock_init(&btcoex->btcoex_lock); 2670fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2680fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->no_stomp_timer = ath_gen_timer_alloc(sc->sc_ah, 2690fca65c1c0569d6a143e978b6f4974c519033e63Sujith ath_btcoex_no_stomp_timer, 2700fca65c1c0569d6a143e978b6f4974c519033e63Sujith ath_btcoex_no_stomp_timer, 2710fca65c1c0569d6a143e978b6f4974c519033e63Sujith (void *) sc, AR_FIRST_NDP_TIMER); 2720fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2730fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (!btcoex->no_stomp_timer) 2740fca65c1c0569d6a143e978b6f4974c519033e63Sujith return -ENOMEM; 2750fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2760fca65c1c0569d6a143e978b6f4974c519033e63Sujith return 0; 2770fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 2780fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2790fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* 2800fca65c1c0569d6a143e978b6f4974c519033e63Sujith * (Re)start btcoex timers 2810fca65c1c0569d6a143e978b6f4974c519033e63Sujith */ 2820fca65c1c0569d6a143e978b6f4974c519033e63Sujithvoid ath9k_btcoex_timer_resume(struct ath_softc *sc) 2830fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 2840fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_btcoex *btcoex = &sc->btcoex; 2850fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_hw *ah = sc->sc_ah; 2860fca65c1c0569d6a143e978b6f4974c519033e63Sujith 287d2182b69dcb6a68b1ef6070b2efd094e13dea3f1Joe Perches ath_dbg(ath9k_hw_common(ah), BTCOEX, "Starting btcoex timers\n"); 2880fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2898a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE) 2908a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau return; 2918a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau 2920fca65c1c0569d6a143e978b6f4974c519033e63Sujith /* make sure duty cycle timer is also stopped when resuming */ 2930fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (btcoex->hw_timer_enabled) 2940fca65c1c0569d6a143e978b6f4974c519033e63Sujith ath9k_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer); 2950fca65c1c0569d6a143e978b6f4974c519033e63Sujith 2960fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->bt_priority_cnt = 0; 2970fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->bt_priority_time = jiffies; 29858da1318ee92ad3fe7917278d596768bbe441850Vasanthakumar Thiagarajan sc->sc_flags &= ~(SC_OP_BT_PRIORITY_DETECTED | SC_OP_BT_SCAN); 2990fca65c1c0569d6a143e978b6f4974c519033e63Sujith 3000fca65c1c0569d6a143e978b6f4974c519033e63Sujith mod_timer(&btcoex->period_timer, jiffies); 3010fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 3020fca65c1c0569d6a143e978b6f4974c519033e63Sujith 3030fca65c1c0569d6a143e978b6f4974c519033e63Sujith 3040fca65c1c0569d6a143e978b6f4974c519033e63Sujith/* 3050fca65c1c0569d6a143e978b6f4974c519033e63Sujith * Pause btcoex timer and bt duty cycle timer 3060fca65c1c0569d6a143e978b6f4974c519033e63Sujith */ 3070fca65c1c0569d6a143e978b6f4974c519033e63Sujithvoid ath9k_btcoex_timer_pause(struct ath_softc *sc) 3080fca65c1c0569d6a143e978b6f4974c519033e63Sujith{ 3090fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_btcoex *btcoex = &sc->btcoex; 3100fca65c1c0569d6a143e978b6f4974c519033e63Sujith struct ath_hw *ah = sc->sc_ah; 3110fca65c1c0569d6a143e978b6f4974c519033e63Sujith 3128a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE) 3138a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau return; 3148a30930563521c9dba73c93b5631be1d0993f78fFelix Fietkau 3150fca65c1c0569d6a143e978b6f4974c519033e63Sujith del_timer_sync(&btcoex->period_timer); 3160fca65c1c0569d6a143e978b6f4974c519033e63Sujith 3170fca65c1c0569d6a143e978b6f4974c519033e63Sujith if (btcoex->hw_timer_enabled) 3180fca65c1c0569d6a143e978b6f4974c519033e63Sujith ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); 3190fca65c1c0569d6a143e978b6f4974c519033e63Sujith 3200fca65c1c0569d6a143e978b6f4974c519033e63Sujith btcoex->hw_timer_enabled = false; 3210fca65c1c0569d6a143e978b6f4974c519033e63Sujith} 3225908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan 323c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharanu16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen) 324c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan{ 325c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan struct ath_mci_profile *mci = &sc->btcoex.mci; 326c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan u16 aggr_limit = 0; 327c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan 328c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI) && mci->aggr_limit) 329c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan aggr_limit = (max_4ms_framelen * mci->aggr_limit) >> 4; 330c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan else if (sc->sc_flags & SC_OP_BT_PRIORITY_DETECTED) 331c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan aggr_limit = min((max_4ms_framelen * 3) / 8, 332c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan (u32)ATH_AMPDU_LIMIT_MAX); 333c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan 334c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan return aggr_limit; 335c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan} 336c0ac53fa5725aa9e571386d3e7249c1be50eca10Sujith Manoharan 33756ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharanvoid ath9k_btcoex_handle_interrupt(struct ath_softc *sc, u32 status) 33856ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan{ 33956ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan struct ath_hw *ah = sc->sc_ah; 34056ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan 34156ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) 34256ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan if (status & ATH9K_INT_GENTIMER) 34356ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan ath_gen_timer_isr(sc->sc_ah); 34456ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan 34556ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan if ((status & ATH9K_INT_MCI) && ATH9K_HW_CAP_MCI) 34656ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan ath_mci_intr(sc); 34756ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan} 34856ca0dba9d5fbc2948ed0c3a4fffc51cd875abb9Sujith Manoharan 349df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharanvoid ath9k_start_btcoex(struct ath_softc *sc) 350df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan{ 351df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan struct ath_hw *ah = sc->sc_ah; 352df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan 353df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) && 354df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan !ah->btcoex_hw.enabled) { 355df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) 356df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, 357df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan AR_STOMP_LOW_WLAN_WGHT); 358df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan ath9k_hw_btcoex_enable(ah); 359df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan 360df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) 361df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan ath9k_btcoex_timer_resume(sc); 362df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan } 363df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan} 364df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan 365df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharanvoid ath9k_stop_btcoex(struct ath_softc *sc) 366df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan{ 367df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan struct ath_hw *ah = sc->sc_ah; 368df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan 369df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan if (ah->btcoex_hw.enabled && 370df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) { 371df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan ath9k_hw_btcoex_disable(ah); 372df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) 373df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan ath9k_btcoex_timer_pause(sc); 374df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan ath_mci_flush_profile(&sc->btcoex.mci); 375df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan } 376df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan} 377df198b172f7a14ecf7aefaadb3761c273600333eSujith Manoharan 3785908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharanvoid ath9k_deinit_btcoex(struct ath_softc *sc) 3795908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan{ 3805908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan if ((sc->btcoex.no_stomp_timer) && 3815908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_3WIRE) 3825908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); 3835908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan 3845908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan if (ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_MCI) 3855908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan ath_mci_cleanup(sc); 3865908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan} 3875908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan 3885908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharanint ath9k_init_btcoex(struct ath_softc *sc) 3895908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan{ 3905908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan struct ath_txq *txq; 3915908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan struct ath_hw *ah = sc->sc_ah; 3925908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan int r; 3935908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan 394d68475de9637a476ad8e5870060ccc69a80f2299Sujith Manoharan ath9k_hw_btcoex_init_scheme(ah); 395d68475de9637a476ad8e5870060ccc69a80f2299Sujith Manoharan 3965908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan switch (ath9k_hw_get_btcoex_scheme(sc->sc_ah)) { 3975908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan case ATH_BTCOEX_CFG_NONE: 3985908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan break; 3995908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan case ATH_BTCOEX_CFG_2WIRE: 4005908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan ath9k_hw_btcoex_init_2wire(sc->sc_ah); 4015908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan break; 4025908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan case ATH_BTCOEX_CFG_3WIRE: 4035908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan ath9k_hw_btcoex_init_3wire(sc->sc_ah); 4045908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan r = ath_init_btcoex_timer(sc); 4055908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan if (r) 4065908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan return -1; 4075908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan txq = sc->tx.txq_map[WME_AC_BE]; 4085908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); 4095908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; 4105908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan break; 4115908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan case ATH_BTCOEX_CFG_MCI: 4125908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; 4135908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE; 4145908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan INIT_LIST_HEAD(&sc->btcoex.mci.info); 4155908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan 4165908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan r = ath_mci_setup(sc); 4175908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan if (r) 4185908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan return r; 4195908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan 4205908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan ath9k_hw_btcoex_init_mci(ah); 4215908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan 4225908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan break; 4235908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan default: 4245908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan WARN_ON(1); 4255908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan break; 4265908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan } 4275908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan 4285908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan return 0; 4295908120fdc2aac0cb1be4059b40ec256d55934bcSujith Manoharan} 4304daa7760e2da9324e740f7d872970fa91c8ea6f0Sujith Manoharan 4314daa7760e2da9324e740f7d872970fa91c8ea6f0Sujith Manoharan#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ 432