Преглед на файлове

qcacmn: Add INI to disable wake IRQ

Some platform would like to disable wake IRQ, so add INI to disable
wake IRQ.

Wake IRQ can't share the same IRQ with the copy engines. In one MSI
mode, we don't know whether wake IRQ is triggered or not in wake IRQ
handler. known issue CR 2055359.

Disable wake IRQ for one MSI mode. If you want to support wake IRQ.
Please allocate at least 2 MSI vector. The first is for wake IRQ while
the others share the second vector.

Change-Id: Id9e54e287f146ff64d94669bbc44dc0a724d9480
CRs-Fixed: 3290867
Bing Sun преди 2 години
родител
ревизия
4fb2121bbe
променени са 5 файла, в които са добавени 81 реда и са изтрити 18 реда
  1. 39 5
      hif/inc/cfg_hif.h
  2. 4 4
      hif/src/ce/ce_main.c
  3. 34 6
      hif/src/hif_main.c
  4. 2 1
      hif/src/hif_main.h
  5. 2 2
      hif/src/pcie/if_pci.c

+ 39 - 5
hif/inc/cfg_hif.h

@@ -1,6 +1,6 @@
 /**
  * Copyright (c) 2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -60,6 +60,8 @@
 		     CFG_VALUE_OR_DEFAULT, \
 		     "CE Status ring timer threshold")
 
+#define CFG_RING_TIMER_THRESHOLD CFG(CFG_CE_STATUS_RING_TIMER_THRESHOLD)
+
 /**
  * <ini>
  * ce_status_ring_batch_count_thresh - ce status srng batch count threshold
@@ -85,10 +87,42 @@
 		     CFG_VALUE_OR_DEFAULT, \
 		     "CE Status ring batch count threshold")
 
-#define CFG_HIF \
-	CFG(CFG_CE_STATUS_RING_TIMER_THRESHOLD) \
-	CFG(CFG_CE_STATUS_RING_BATCH_COUNT_THRESHOLD)
+#define CFG_BATCH_COUNT_THRESHOLD CFG(CFG_CE_STATUS_RING_BATCH_COUNT_THRESHOLD)
+
 #else
-#define CFG_HIF
+#define CFG_RING_TIMER_THRESHOLD
+#define CFG_BATCH_COUNT_THRESHOLD
 #endif /* WLAN_CE_INTERRUPT_THRESHOLD_CONFIG */
+
+/*
+ * <ini>
+ * gDisableWakeIrq - Disable wake IRQ or not
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This ini controls driver to disable wake IRQ or not.
+ * Disable wake IRQ for one MSI mode.
+ * If you want to support wake IRQ. Please allocate at least
+ * 2 MSI vector. The first is for wake IRQ while the others
+ * share the second vector.
+ *
+ * Related: None.
+ *
+ * Supported Feature: wake IRQ
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_DISABLE_WAKE_IRQ CFG_INI_BOOL( \
+	"gDisableWakeIrq", \
+	0, \
+	"Disable wake IRQ")
+
+#define CFG_HIF \
+	CFG_RING_TIMER_THRESHOLD \
+	CFG_BATCH_COUNT_THRESHOLD \
+	CFG(CFG_DISABLE_WAKE_IRQ)
+
 #endif /* _CFG_HIF_H_ */

+ 4 - 4
hif/src/ce/ce_main.c

@@ -1316,7 +1316,7 @@ void hif_set_ce_config_qcn9224(struct hif_softc *scn,
 	hif_state->target_ce_config_sz =
 				 sizeof(target_ce_config_wlan_qcn9224);
 	scn->ce_count = QCN_9224_CE_COUNT;
-	scn->disable_wake_irq = 1;
+	scn->ini_cfg.disable_wake_irq = 1;
 }
 
 static
@@ -4085,7 +4085,7 @@ void hif_ce_prepare_config(struct hif_softc *scn)
 		hif_state->target_ce_config_sz =
 					sizeof(target_ce_config_wlan_qcn9000);
 		scn->ce_count = QCN_9000_CE_COUNT;
-		scn->disable_wake_irq = 1;
+		scn->ini_cfg.disable_wake_irq = 1;
 		break;
 	case TARGET_TYPE_QCN9224:
 		hif_set_ce_config_qcn9224(scn, hif_state);
@@ -4103,7 +4103,7 @@ void hif_ce_prepare_config(struct hif_softc *scn)
 		hif_state->target_ce_config_sz =
 					sizeof(target_ce_config_wlan_qcn6122);
 		scn->ce_count = QCN_6122_CE_COUNT;
-		scn->disable_wake_irq = 1;
+		scn->ini_cfg.disable_wake_irq = 1;
 		break;
 	case TARGET_TYPE_QCN9160:
 		hif_state->host_ce_config = host_ce_config_wlan_qcn9160;
@@ -4111,7 +4111,7 @@ void hif_ce_prepare_config(struct hif_softc *scn)
 		hif_state->target_ce_config_sz =
 					sizeof(target_ce_config_wlan_qcn9160);
 		scn->ce_count = QCN_9160_CE_COUNT;
-		scn->disable_wake_irq = 1;
+		scn->ini_cfg.disable_wake_irq = 1;
 		break;
 	case TARGET_TYPE_QCA5018:
 		hif_state->host_ce_config = host_ce_config_wlan_qca5018;

+ 34 - 6
hif/src/hif_main.c

@@ -54,9 +54,7 @@
 #endif
 #include <linux/cpumask.h>
 
-#if defined(HIF_IPCI) && defined(FEATURE_HAL_DELAYED_REG_WRITE)
 #include <pld_common.h>
-#endif
 
 void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t cmd_id, bool start)
 {
@@ -543,15 +541,15 @@ void hif_rtpm_lock_deinit(struct hif_softc *scn)
 
 #ifdef WLAN_CE_INTERRUPT_THRESHOLD_CONFIG
 /**
- * hif_get_cfg_from_psoc() - Retrieve ini cfg from psoc
+ * hif_get_interrupt_threshold_cfg_from_psoc() - Retrieve ini cfg from psoc
  * @scn: hif context
  * @psoc: psoc objmgr handle
  *
  * Return: None
  */
 static inline
-void hif_get_cfg_from_psoc(struct hif_softc *scn,
-			   struct wlan_objmgr_psoc *psoc)
+void hif_get_interrupt_threshold_cfg_from_psoc(struct hif_softc *scn,
+					       struct wlan_objmgr_psoc *psoc)
 {
 	if (psoc) {
 		scn->ini_cfg.ce_status_ring_timer_threshold =
@@ -564,11 +562,41 @@ void hif_get_cfg_from_psoc(struct hif_softc *scn,
 }
 #else
 static inline
+void hif_get_interrupt_threshold_cfg_from_psoc(struct hif_softc *scn,
+					       struct wlan_objmgr_psoc *psoc)
+{
+}
+#endif /* WLAN_CE_INTERRUPT_THRESHOLD_CONFIG */
+
+/**
+ * hif_get_cfg_from_psoc() - Retrieve ini cfg from psoc
+ * @scn: hif context
+ * @psoc: psoc objmgr handle
+ *
+ * Return: None
+ */
+static inline
 void hif_get_cfg_from_psoc(struct hif_softc *scn,
 			   struct wlan_objmgr_psoc *psoc)
 {
+	if (psoc) {
+		scn->ini_cfg.disable_wake_irq =
+			cfg_get(psoc, CFG_DISABLE_WAKE_IRQ);
+		/**
+		 * Wake IRQ can't share the same IRQ with the copy engines
+		 * In one MSI mode, we don't know whether wake IRQ is triggered
+		 * or not in wake IRQ handler. known issue CR 2055359
+		 * If you want to support Wake IRQ. Please allocate at least
+		 * 2 MSI vector. The first is for wake IRQ while the others
+		 * share the second vector
+		 */
+		if (pld_is_one_msi(scn->qdf_dev->dev)) {
+			hif_debug("Disable wake IRQ once it is one MSI mode");
+			scn->ini_cfg.disable_wake_irq = true;
+		}
+		hif_get_interrupt_threshold_cfg_from_psoc(scn, psoc);
+	}
 }
-#endif /* WLAN_CE_INTERRUPT_THRESHOLD_CONFIG */
 
 #if defined(HIF_CE_LOG_INFO) || defined(HIF_BUS_LOG_INFO)
 /**

+ 2 - 1
hif/src/hif_main.h

@@ -220,10 +220,12 @@ void hif_record_latest_evt(struct ce_desc_hist *ce_hist,
  * struct hif_cfg() - store ini config parameters in hif layer
  * @ce_status_ring_timer_threshold: ce status ring timer threshold
  * @ce_status_ring_batch_count_threshold: ce status ring batch count threshold
+ * @disable_wake_irq: disable wake irq
  */
 struct hif_cfg {
 	uint16_t ce_status_ring_timer_threshold;
 	uint8_t ce_status_ring_batch_count_threshold;
+	bool disable_wake_irq;
 };
 
 #ifdef DP_UMAC_HW_RESET_SUPPORT
@@ -307,7 +309,6 @@ struct hif_softc {
 	struct hif_ut_suspend_context ut_suspend_ctx;
 	uint32_t hif_attribute;
 	int wake_irq;
-	int disable_wake_irq;
 	hif_pm_wake_irq_type wake_irq_type;
 	void (*initial_wakeup_cb)(void *);
 	void *initial_wakeup_priv;

+ 2 - 2
hif/src/pcie/if_pci.c

@@ -3081,7 +3081,7 @@ static int hif_ce_msi_configure_irq(struct hif_softc *scn)
 	struct HIF_CE_state *ce_sc = HIF_GET_CE_STATE(scn);
 	struct CE_attr *host_ce_conf = ce_sc->host_ce_config;
 
-	if (!scn->disable_wake_irq) {
+	if (!scn->ini_cfg.disable_wake_irq) {
 		/* do wake irq assignment */
 		ret = pld_get_user_msi_assignment(scn->qdf_dev->dev, "WAKE",
 						  &msi_data_count,
@@ -3149,7 +3149,7 @@ free_irq:
 	}
 
 free_wake_irq:
-	if (!scn->disable_wake_irq) {
+	if (!scn->ini_cfg.disable_wake_irq) {
 		pfrm_free_irq(scn->qdf_dev->dev,
 			      scn->wake_irq, scn->qdf_dev->dev);
 		scn->wake_irq = 0;