aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartosz Markowski <bartosz.markowski@tieto.com>2013-08-02 03:58:49 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2013-08-07 03:03:29 -0400
commit8cc8df906f953ae0cfe785720989928021d7fe2d (patch)
tree21446c1b57d3b793a60c41bcca2d9ed3b89a4ee6
parent32270b61b3fcdce3495c7b746576d49f70587150 (diff)
ath10k: add SoC power save option to PCI features map
Unify the PCI options location. By default the SoC PS option is disabled to boost the performance and due to poor stability on early HW revisions. In future we can remove the module parameter and turn on/off the PS for given hardware. This change also makes the pci module parameter for SoC PS static. Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.c22
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.h11
2 files changed, 21 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 503e380e4cc0..e2f9ef50b1bd 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -32,7 +32,7 @@
32#include "ce.h" 32#include "ce.h"
33#include "pci.h" 33#include "pci.h"
34 34
35unsigned int ath10k_target_ps; 35static unsigned int ath10k_target_ps;
36module_param(ath10k_target_ps, uint, 0644); 36module_param(ath10k_target_ps, uint, 0644);
37MODULE_PARM_DESC(ath10k_target_ps, "Enable ath10k Target (SoC) PS option"); 37MODULE_PARM_DESC(ath10k_target_ps, "Enable ath10k Target (SoC) PS option");
38 38
@@ -1759,6 +1759,7 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar)
1759 1759
1760static int ath10k_pci_hif_power_up(struct ath10k *ar) 1760static int ath10k_pci_hif_power_up(struct ath10k *ar)
1761{ 1761{
1762 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1762 int ret; 1763 int ret;
1763 1764
1764 ret = ath10k_pci_start_intr(ar); 1765 ret = ath10k_pci_start_intr(ar);
@@ -1783,13 +1784,9 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
1783 if (ret) 1784 if (ret)
1784 goto err_irq; 1785 goto err_irq;
1785 1786
1786 if (ath10k_target_ps) { 1787 if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features))
1787 ath10k_dbg(ATH10K_DBG_PCI, "on-chip power save enabled\n");
1788 } else {
1789 /* Force AWAKE forever */ 1788 /* Force AWAKE forever */
1790 ath10k_dbg(ATH10K_DBG_PCI, "on-chip power save disabled\n");
1791 ath10k_do_pci_wake(ar); 1789 ath10k_do_pci_wake(ar);
1792 }
1793 1790
1794 ret = ath10k_pci_ce_init(ar); 1791 ret = ath10k_pci_ce_init(ar);
1795 if (ret) 1792 if (ret)
@@ -1810,7 +1807,7 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
1810err_ce: 1807err_ce:
1811 ath10k_pci_ce_deinit(ar); 1808 ath10k_pci_ce_deinit(ar);
1812err_ps: 1809err_ps:
1813 if (!ath10k_target_ps) 1810 if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features))
1814 ath10k_do_pci_sleep(ar); 1811 ath10k_do_pci_sleep(ar);
1815err_irq: 1812err_irq:
1816 ath10k_pci_stop_intr(ar); 1813 ath10k_pci_stop_intr(ar);
@@ -1820,9 +1817,12 @@ err:
1820 1817
1821static void ath10k_pci_hif_power_down(struct ath10k *ar) 1818static void ath10k_pci_hif_power_down(struct ath10k *ar)
1822{ 1819{
1820 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1821
1823 ath10k_pci_stop_intr(ar); 1822 ath10k_pci_stop_intr(ar);
1823
1824 ath10k_pci_ce_deinit(ar); 1824 ath10k_pci_ce_deinit(ar);
1825 if (!ath10k_target_ps) 1825 if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features))
1826 ath10k_do_pci_sleep(ar); 1826 ath10k_do_pci_sleep(ar);
1827} 1827}
1828 1828
@@ -2272,6 +2272,9 @@ static void ath10k_pci_dump_features(struct ath10k_pci *ar_pci)
2272 case ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND: 2272 case ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND:
2273 ath10k_dbg(ATH10K_DBG_PCI, "QCA988X_1.0 workaround enabled\n"); 2273 ath10k_dbg(ATH10K_DBG_PCI, "QCA988X_1.0 workaround enabled\n");
2274 break; 2274 break;
2275 case ATH10K_PCI_FEATURE_SOC_POWER_SAVE:
2276 ath10k_dbg(ATH10K_DBG_PCI, "QCA98XX SoC power save enabled\n");
2277 break;
2275 } 2278 }
2276 } 2279 }
2277} 2280}
@@ -2307,6 +2310,9 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
2307 goto err_ar_pci; 2310 goto err_ar_pci;
2308 } 2311 }
2309 2312
2313 if (ath10k_target_ps)
2314 set_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features);
2315
2310 ath10k_pci_dump_features(ar_pci); 2316 ath10k_pci_dump_features(ar_pci);
2311 2317
2312 ar = ath10k_core_create(ar_pci, ar_pci->dev, &ath10k_pci_hif_ops); 2318 ar = ath10k_core_create(ar_pci, ar_pci->dev, &ath10k_pci_hif_ops);
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
index d3a2e6cc9179..871bb339d56d 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -153,6 +153,7 @@ struct service_to_pipe {
153enum ath10k_pci_features { 153enum ath10k_pci_features {
154 ATH10K_PCI_FEATURE_MSI_X = 0, 154 ATH10K_PCI_FEATURE_MSI_X = 0,
155 ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND = 1, 155 ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND = 1,
156 ATH10K_PCI_FEATURE_SOC_POWER_SAVE = 2,
156 157
157 /* keep last */ 158 /* keep last */
158 ATH10K_PCI_FEATURE_COUNT 159 ATH10K_PCI_FEATURE_COUNT
@@ -335,20 +336,22 @@ static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
335 return ioread32(ar_pci->mem + offset); 336 return ioread32(ar_pci->mem + offset);
336} 337}
337 338
338extern unsigned int ath10k_target_ps;
339
340void ath10k_do_pci_wake(struct ath10k *ar); 339void ath10k_do_pci_wake(struct ath10k *ar);
341void ath10k_do_pci_sleep(struct ath10k *ar); 340void ath10k_do_pci_sleep(struct ath10k *ar);
342 341
343static inline void ath10k_pci_wake(struct ath10k *ar) 342static inline void ath10k_pci_wake(struct ath10k *ar)
344{ 343{
345 if (ath10k_target_ps) 344 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
345
346 if (test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features))
346 ath10k_do_pci_wake(ar); 347 ath10k_do_pci_wake(ar);
347} 348}
348 349
349static inline void ath10k_pci_sleep(struct ath10k *ar) 350static inline void ath10k_pci_sleep(struct ath10k *ar)
350{ 351{
351 if (ath10k_target_ps) 352 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
353
354 if (test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features))
352 ath10k_do_pci_sleep(ar); 355 ath10k_do_pci_sleep(ar);
353} 356}
354 357