Explorar o código

qcacmn: Optimize EP request/release vote wait logic

Currently sleep based wait is used for checking EP request/release
vote is taken effect or not. But once worker thread goes to sleep
it is taking in order of milli seconds to schedule back worker thread
this scheduling delay is causing srng HP/TP writes to be updated in
delayed manner.

To avoid this first try checking EP vote is taken affect by busy wait
then go for sleep based method.

Change-Id: I72e81941a23752a41c9b5307e82c2e971aee1ec8
CRs-Fixed: 2999541
Karthik Kantamneni %!s(int64=4) %!d(string=hai) anos
pai
achega
e2c4542bac
Modificáronse 2 ficheiros con 18 adicións e 2 borrados
  1. 16 2
      hif/src/ipcie/if_ipci.c
  2. 2 0
      hif/src/ipcie/if_ipci.h

+ 16 - 2
hif/src/ipcie/if_ipci.c

@@ -935,6 +935,7 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif)
 	struct hif_softc *scn = HIF_GET_SOFTC(hif);
 	struct hif_ipci_softc *ipci_scn = HIF_GET_IPCI_SOFTC(scn);
 	uint32_t start_time = 0, curr_time = 0;
+	uint32_t count = 0;
 
 	if (pld_is_pci_ep_awake(scn->qdf_dev->dev) == -ENOTSUPP)
 		return 0;
@@ -942,10 +943,16 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif)
 	start_time = curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
 	while (pld_is_pci_ep_awake(scn->qdf_dev->dev) &&
 	       curr_time <= start_time + EP_WAKE_RESET_DELAY_TIMEOUT_MS) {
-		qdf_sleep_us(EP_WAKE_RESET_DELAY_US);
+		if (count < EP_VOTE_POLL_TIME_CNT) {
+			qdf_udelay(EP_VOTE_POLL_TIME_US);
+			count++;
+		} else {
+			qdf_sleep_us(EP_WAKE_RESET_DELAY_US);
+		}
 		curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
 	}
 
+
 	if (pld_is_pci_ep_awake(scn->qdf_dev->dev)) {
 		hif_err_rl(" EP state reset is not done to prevent l1");
 		ipci_scn->ep_awake_reset_fail++;
@@ -958,11 +965,18 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif)
 		return 0;
 	}
 
+	count = 0;
 	ipci_scn->prevent_l1 = true;
 	start_time = curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
 	while (!pld_is_pci_ep_awake(scn->qdf_dev->dev) &&
 	       curr_time <= start_time + EP_WAKE_DELAY_TIMEOUT_MS) {
-		qdf_sleep_us(EP_WAKE_DELAY_US);
+		if (count < EP_VOTE_POLL_TIME_CNT) {
+			qdf_udelay(EP_WAKE_RESET_DELAY_US);
+			count++;
+		} else {
+			qdf_sleep_us(EP_WAKE_DELAY_US);
+		}
+
 		curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
 	}
 

+ 2 - 0
hif/src/ipcie/if_ipci.h

@@ -65,6 +65,8 @@ struct hif_ipci_stats {
 #endif /* FORCE_WAKE */
 
 #ifdef FEATURE_HAL_DELAYED_REG_WRITE
+#define EP_VOTE_POLL_TIME_US  50
+#define EP_VOTE_POLL_TIME_CNT 2
 #ifdef HAL_CONFIG_SLUB_DEBUG_ON
 #define EP_WAKE_RESET_DELAY_TIMEOUT_MS 3
 #define EP_WAKE_DELAY_TIMEOUT_MS 7