瀏覽代碼

qcacmn: refer system time for pld_is_pci_ep_awake timeout

Currently timeout for checking pld_is_pci_ep_awake in
hif_prevent_link_low_power_states might be higher than
the defined timeout depends on how long qdf_sleep takes
to get scheduled again, so avoid this uncertain timeout
adding reference to the system time.

Change-Id: I67a28d46c996ccc56680cf8e20c09a70729a33c5
CRs-Fixed: 2994746
Vevek Venkatesan 4 年之前
父節點
當前提交
9f5cc5aae8
共有 2 個文件被更改,包括 11 次插入10 次删除
  1. 7 6
      hif/src/ipcie/if_ipci.c
  2. 4 4
      hif/src/ipcie/if_ipci.h

+ 7 - 6
hif/src/ipcie/if_ipci.c

@@ -897,15 +897,16 @@ 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 timeout = 0;
+	uint32_t start_time = 0, curr_time = 0;
 
 	if (pld_is_pci_ep_awake(scn->qdf_dev->dev) == -ENOTSUPP)
 		return 0;
 
+	start_time = curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
 	while (pld_is_pci_ep_awake(scn->qdf_dev->dev) &&
-	       timeout <= EP_WAKE_RESET_DELAY_TIMEOUT_US) {
+	       curr_time <= start_time + EP_WAKE_RESET_DELAY_TIMEOUT_MS) {
 		qdf_sleep_us(EP_WAKE_RESET_DELAY_US);
-		timeout += 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)) {
@@ -921,11 +922,11 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif)
 	}
 
 	ipci_scn->prevent_l1 = true;
-	timeout = 0;
+	start_time = curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
 	while (!pld_is_pci_ep_awake(scn->qdf_dev->dev) &&
-	       timeout <= EP_WAKE_DELAY_TIMEOUT_US) {
+	       curr_time <= start_time + EP_WAKE_DELAY_TIMEOUT_MS) {
 		qdf_sleep_us(EP_WAKE_DELAY_US);
-		timeout += EP_WAKE_DELAY_US;
+		curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
 	}
 
 	if (pld_is_pci_ep_awake(scn->qdf_dev->dev) <= 0) {

+ 4 - 4
hif/src/ipcie/if_ipci.h

@@ -66,11 +66,11 @@ struct hif_ipci_stats {
 
 #ifdef FEATURE_HAL_DELAYED_REG_WRITE
 #ifdef HAL_CONFIG_SLUB_DEBUG_ON
-#define EP_WAKE_RESET_DELAY_TIMEOUT_US 3000
-#define EP_WAKE_DELAY_TIMEOUT_US 7000
+#define EP_WAKE_RESET_DELAY_TIMEOUT_MS 3
+#define EP_WAKE_DELAY_TIMEOUT_MS 7
 #else
-#define EP_WAKE_RESET_DELAY_TIMEOUT_US 10000
-#define EP_WAKE_DELAY_TIMEOUT_US 10000
+#define EP_WAKE_RESET_DELAY_TIMEOUT_MS 10
+#define EP_WAKE_DELAY_TIMEOUT_MS 10
 #endif
 #define EP_WAKE_RESET_DELAY_US 50
 #define EP_WAKE_DELAY_US 200