linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/WIP 09/22] ath9k: Initialize BTCOEX scheme using a helper
@ 2012-02-21  9:22 Sujith Manoharan
  2012-02-21 11:11 ` Mohammed Shafi
  0 siblings, 1 reply; 3+ messages in thread
From: Sujith Manoharan @ 2012-02-21  9:22 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel

Setting up the required scheme can be done as part of the
BTCOEX initialization path and it doesn't belong in
ath9k_hw_fill_cap_info() anyway.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/btcoex.c |   34 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/btcoex.h |    1 +
 drivers/net/wireless/ath/ath9k/gpio.c   |    2 +
 drivers/net/wireless/ath/ath9k/hw.c     |   25 ----------------------
 4 files changed, 37 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c
index 6566952..5365959 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -98,6 +98,40 @@ void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum)
 }
 EXPORT_SYMBOL(ath9k_hw_init_btcoex_hw);
 
+void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah)
+{
+	struct ath_common *common = ath9k_hw_common(ah);
+	struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
+
+	/*
+	 * Check if BTCOEX is globally disabled.
+	 */
+	if (!common->btcoex_enabled) {
+		btcoex_hw->scheme = ATH_BTCOEX_CFG_NONE;
+		return;
+	}
+
+	if (AR_SREV_9462(ah)) {
+		btcoex_hw->scheme = ATH_BTCOEX_CFG_MCI;
+	} else if (AR_SREV_9300_20_OR_LATER(ah)) {
+		btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
+		btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300;
+		btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300;
+		btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9300;
+	} else if (AR_SREV_9280_20_OR_LATER(ah)) {
+		btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9280;
+		btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9280;
+
+		if (AR_SREV_9285(ah)) {
+			btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
+			btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9285;
+		} else {
+			btcoex_hw->scheme = ATH_BTCOEX_CFG_2WIRE;
+		}
+	}
+}
+EXPORT_SYMBOL(ath9k_hw_btcoex_init_scheme);
+
 void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah)
 {
 	struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h b/drivers/net/wireless/ath/ath9k/btcoex.h
index 0cb15cd..10627b4 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.h
+++ b/drivers/net/wireless/ath/ath9k/btcoex.h
@@ -97,6 +97,7 @@ struct ath_btcoex_hw {
 	u32 wlan_weight[AR9300_NUM_WLAN_WEIGHTS];
 };
 
+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_init_mci(struct ath_hw *ah);
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c
index 3ab62af..c2238ff 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -391,6 +391,8 @@ int ath9k_init_btcoex(struct ath_softc *sc)
 	struct ath_hw *ah = sc->sc_ah;
 	int r;
 
+	ath9k_hw_btcoex_init_scheme(ah);
+
 	switch (ath9k_hw_get_btcoex_scheme(sc->sc_ah)) {
 	case ATH_BTCOEX_CFG_NONE:
 		break;
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index cb46d41..f4b121f 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2303,7 +2303,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
 	struct ath9k_hw_capabilities *pCap = &ah->caps;
 	struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
 	struct ath_common *common = ath9k_hw_common(ah);
-	struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
 	unsigned int chip_chainmask;
 
 	u16 eeval;
@@ -2422,30 +2421,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
 	else
 		pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS;
 
-	if (common->btcoex_enabled) {
-		if (AR_SREV_9462(ah))
-			btcoex_hw->scheme = ATH_BTCOEX_CFG_MCI;
-		else if (AR_SREV_9300_20_OR_LATER(ah)) {
-			btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
-			btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300;
-			btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300;
-			btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9300;
-		} else if (AR_SREV_9280_20_OR_LATER(ah)) {
-			btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9280;
-			btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9280;
-
-			if (AR_SREV_9285(ah)) {
-				btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
-				btcoex_hw->btpriority_gpio =
-						ATH_BTPRIORITY_GPIO_9285;
-			} else {
-				btcoex_hw->scheme = ATH_BTCOEX_CFG_2WIRE;
-			}
-		}
-	} else {
-		btcoex_hw->scheme = ATH_BTCOEX_CFG_NONE;
-	}
-
 	if (AR_SREV_9300_20_OR_LATER(ah)) {
 		pCap->hw_caps |= ATH9K_HW_CAP_EDMA | ATH9K_HW_CAP_FASTCLOCK;
 		if (!AR_SREV_9330(ah) && !AR_SREV_9485(ah))
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC/WIP 09/22] ath9k: Initialize BTCOEX scheme using a helper
  2012-02-21  9:22 [RFC/WIP 09/22] ath9k: Initialize BTCOEX scheme using a helper Sujith Manoharan
@ 2012-02-21 11:11 ` Mohammed Shafi
  2012-02-21 14:13   ` Sujith Manoharan
  0 siblings, 1 reply; 3+ messages in thread
From: Mohammed Shafi @ 2012-02-21 11:11 UTC (permalink / raw)
  To: Sujith Manoharan; +Cc: linux-wireless, ath9k-devel

On Tue, Feb 21, 2012 at 2:52 PM, Sujith Manoharan
<c_manoha@qca.qualcomm.com> wrote:
> Setting up the required scheme can be done as part of the
> BTCOEX initialization path and it doesn't belong in
> ath9k_hw_fill_cap_info() anyway.
>
> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath9k/btcoex.c |   34 +++++++++++++++++++++++++++++++
>  drivers/net/wireless/ath/ath9k/btcoex.h |    1 +
>  drivers/net/wireless/ath/ath9k/gpio.c   |    2 +
>  drivers/net/wireless/ath/ath9k/hw.c     |   25 ----------------------
>  4 files changed, 37 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c
> index 6566952..5365959 100644
> --- a/drivers/net/wireless/ath/ath9k/btcoex.c
> +++ b/drivers/net/wireless/ath/ath9k/btcoex.c
> @@ -98,6 +98,40 @@ void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum)
>  }
>  EXPORT_SYMBOL(ath9k_hw_init_btcoex_hw);
>
> +void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah)
> +{
> +       struct ath_common *common = ath9k_hw_common(ah);
> +       struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
> +
> +       /*
> +        * Check if BTCOEX is globally disabled.
> +        */
> +       if (!common->btcoex_enabled) {
> +               btcoex_hw->scheme = ATH_BTCOEX_CFG_NONE;
> +               return;
> +       }
> +
> +       if (AR_SREV_9462(ah)) {
> +               btcoex_hw->scheme = ATH_BTCOEX_CFG_MCI;
> +       } else if (AR_SREV_9300_20_OR_LATER(ah)) {
> +               btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
> +               btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300;
> +               btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300;
> +               btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9300;
> +       } else if (AR_SREV_9280_20_OR_LATER(ah)) {
> +               btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9280;
> +               btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9280;
> +
> +               if (AR_SREV_9285(ah)) {
> +                       btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
> +                       btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9285;
> +               } else {
> +                       btcoex_hw->scheme = ATH_BTCOEX_CFG_2WIRE;
> +               }
> +       }
> +}
> +EXPORT_SYMBOL(ath9k_hw_btcoex_init_scheme);
> +
>  void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah)
>  {
>        struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
> diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h b/drivers/net/wireless/ath/ath9k/btcoex.h
> index 0cb15cd..10627b4 100644
> --- a/drivers/net/wireless/ath/ath9k/btcoex.h
> +++ b/drivers/net/wireless/ath/ath9k/btcoex.h
> @@ -97,6 +97,7 @@ struct ath_btcoex_hw {
>        u32 wlan_weight[AR9300_NUM_WLAN_WEIGHTS];
>  };
>
> +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_init_mci(struct ath_hw *ah);
> diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c
> index 3ab62af..c2238ff 100644
> --- a/drivers/net/wireless/ath/ath9k/gpio.c
> +++ b/drivers/net/wireless/ath/ath9k/gpio.c
> @@ -391,6 +391,8 @@ int ath9k_init_btcoex(struct ath_softc *sc)
>        struct ath_hw *ah = sc->sc_ah;
>        int r;
>
> +       ath9k_hw_btcoex_init_scheme(ah);
> +
>        switch (ath9k_hw_get_btcoex_scheme(sc->sc_ah)) {
>        case ATH_BTCOEX_CFG_NONE:
>                break;
> diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
> index cb46d41..f4b121f 100644
> --- a/drivers/net/wireless/ath/ath9k/hw.c
> +++ b/drivers/net/wireless/ath/ath9k/hw.c
> @@ -2303,7 +2303,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
>        struct ath9k_hw_capabilities *pCap = &ah->caps;
>        struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
>        struct ath_common *common = ath9k_hw_common(ah);
> -       struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
>        unsigned int chip_chainmask;
>
>        u16 eeval;
> @@ -2422,30 +2421,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
>        else
>                pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS;
>
> -       if (common->btcoex_enabled) {
> -               if (AR_SREV_9462(ah))
> -                       btcoex_hw->scheme = ATH_BTCOEX_CFG_MCI;
> -               else if (AR_SREV_9300_20_OR_LATER(ah)) {
> -                       btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
> -                       btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300;
> -                       btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300;
> -                       btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9300;
> -               } else if (AR_SREV_9280_20_OR_LATER(ah)) {
> -                       btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9280;
> -                       btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9280;
> -
> -                       if (AR_SREV_9285(ah)) {
> -                               btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
> -                               btcoex_hw->btpriority_gpio =
> -                                               ATH_BTPRIORITY_GPIO_9285;
> -                       } else {
> -                               btcoex_hw->scheme = ATH_BTCOEX_CFG_2WIRE;
> -                       }
> -               }
> -       } else {
> -               btcoex_hw->scheme = ATH_BTCOEX_CFG_NONE;
> -       }
> -
>        if (AR_SREV_9300_20_OR_LATER(ah)) {
>                pCap->hw_caps |= ATH9K_HW_CAP_EDMA | ATH9K_HW_CAP_FASTCLOCK;
>                if (!AR_SREV_9330(ah) && !AR_SREV_9485(ah))
> --
> 1.7.9.1
>

is it possible to move it to gpio.c, except we are initializing btcoex
related GPIO pins so logically gpio.c could be a good idea. pls let me
know if i had missed something


-- 
thanks,
shafi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC/WIP 09/22] ath9k: Initialize BTCOEX scheme using a helper
  2012-02-21 11:11 ` Mohammed Shafi
@ 2012-02-21 14:13   ` Sujith Manoharan
  0 siblings, 0 replies; 3+ messages in thread
From: Sujith Manoharan @ 2012-02-21 14:13 UTC (permalink / raw)
  To: Mohammed Shafi; +Cc: linux-wireless, ath9k-devel

Mohammed Shafi wrote:
> is it possible to move it to gpio.c, except we are initializing btcoex
> related GPIO pins so logically gpio.c could be a good idea. pls let me
> know if i had missed something

The coex parameters in ath_hw are initialized, so btcoex.c is okay.

Sujith

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-21 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-21  9:22 [RFC/WIP 09/22] ath9k: Initialize BTCOEX scheme using a helper Sujith Manoharan
2012-02-21 11:11 ` Mohammed Shafi
2012-02-21 14:13   ` Sujith Manoharan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).