ath9k: free GPIO resource for SOC GPIOs
authorMiaoqing Pan <miaoqing@codeaurora.org>
Mon, 7 Mar 2016 02:38:16 +0000 (10:38 +0800)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 11 Mar 2016 12:00:02 +0000 (14:00 +0200)
For SOC GPIOs, should call ath9k_hw_gpio_free() to release
the GPIO resource.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath9k/btcoex.c
drivers/net/wireless/ath/ath9k/btcoex.h
drivers/net/wireless/ath/ath9k/gpio.c
drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
drivers/net/wireless/ath/ath9k/hw.c

index 7719cb1d8b68df89fbe49c7683555c425e94d2d3..4737aa947f99d19f80a5ae549066e9cb8eb51fc9 100644 (file)
@@ -174,6 +174,16 @@ void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah)
 }
 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;
index cd2f0a2373cb92f7eeb47f0fa0ab21e5a78c3a9e..0f7c4e61ac13bc7e6aeebf1ea71736134a53adf1 100644 (file)
@@ -123,6 +123,7 @@ struct ath_btcoex_hw {
 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,
index b41dfb7c27840dd91724a63cb99c2ff49dbc8943..4964bb36dad2aebee92e23a1ad460684e917b564 100644 (file)
@@ -40,6 +40,8 @@ void ath_deinit_leds(struct ath_softc *sc)
 
        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)
@@ -404,6 +406,13 @@ void ath9k_deinit_btcoex(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)
index d9b640a2488c46adc1cf9354b52ba635a13fa6cf..ecb848b60725461a2cfd810b25aa226ec74b69c8 100644 (file)
@@ -253,6 +253,8 @@ void ath9k_deinit_leds(struct ath9k_htc_priv *priv)
        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);
 }
 
 
index 7f39b13a4ca01848f9e0452ec35deb1839a1cb10..42009065e234ed3f151597dd8cda060f1be724c6 100644 (file)
@@ -1585,6 +1585,7 @@ static void ath9k_hw_apply_gpio_override(struct ath_hw *ah)
                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);
        }
 }