}
 EXPORT_SYMBOL(ath9k_hw_btcoex_init_3wire);
 
+void ath9k_hw_btcoex_deinit(struct ath_hw *ah)
+{
+       struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
+
+       ath9k_hw_gpio_free(ah, btcoex_hw->btactive_gpio);
+       ath9k_hw_gpio_free(ah, btcoex_hw->btpriority_gpio);
+       ath9k_hw_gpio_free(ah, btcoex_hw->wlanactive_gpio);
+}
+EXPORT_SYMBOL(ath9k_hw_btcoex_deinit);
+
 void ath9k_hw_btcoex_init_mci(struct ath_hw *ah)
 {
        ah->btcoex_hw.mci.ready = false;
 
 void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah);
 void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah);
 void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah);
+void ath9k_hw_btcoex_deinit(struct ath_hw *ah);
 void ath9k_hw_btcoex_init_mci(struct ath_hw *ah);
 void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum);
 void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,
 
 
        ath_led_brightness(&sc->led_cdev, LED_OFF);
        led_classdev_unregister(&sc->led_cdev);
+
+       ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
 }
 
 void ath_init_leds(struct ath_softc *sc)
 
        if (ath9k_hw_mci_is_enabled(ah))
                ath_mci_cleanup(sc);
+       else {
+               enum ath_btcoex_scheme scheme = ath9k_hw_get_btcoex_scheme(ah);
+
+               if (scheme == ATH_BTCOEX_CFG_2WIRE ||
+                   scheme == ATH_BTCOEX_CFG_3WIRE)
+                       ath9k_hw_btcoex_deinit(sc->sc_ah);
+       }
 }
 
 int ath9k_init_btcoex(struct ath_softc *sc)
 
        ath9k_led_brightness(&priv->led_cdev, LED_OFF);
        led_classdev_unregister(&priv->led_cdev);
        cancel_work_sync(&priv->led_work);
+
+       ath9k_hw_gpio_free(priv->ah, priv->ah->led_pin);
 }
 
 
 
                ath9k_hw_gpio_request_out(ah, i, NULL,
                                          AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
                ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i)));
+               ath9k_hw_gpio_free(ah, i);
        }
 }