Przeglądaj źródła

qcacmn: Enhance runtime PM enablement check

Currently HIF runtime PM APIs will check runtime PM enablement using
pm_runtime_enabled() by checking for disable_depth which can be changed
at any time. This may cause usage count imbalance since the HIF API may
skip calling the corresponding runtime PM framework API to increase or
decrease usage count. Enhance runtime PM enablement check so that it
will always honor WLAN ini config first.

Change-Id: I4b2863ef7fa0dcd6fd61b776e6cb0ab109ffb3ec
CRs-fixed: 2647986
Yue Ma 5 lat temu
rodzic
commit
e3c95fdc04
1 zmienionych plików z 18 dodań i 8 usunięć
  1. 18 8
      hif/src/pcie/if_pci.c

+ 18 - 8
hif/src/pcie/if_pci.c

@@ -891,6 +891,16 @@ end:
 }
 }
 
 
 #ifdef FEATURE_RUNTIME_PM
 #ifdef FEATURE_RUNTIME_PM
+static bool hif_pci_pm_runtime_enabled(struct hif_pci_softc *sc)
+{
+	struct hif_softc *scn = HIF_GET_SOFTC(sc);
+
+	if (scn->hif_config.enable_runtime_pm)
+		return true;
+
+	return pm_runtime_enabled(sc->dev);
+}
+
 static const char *hif_pm_runtime_state_to_string(uint32_t state)
 static const char *hif_pm_runtime_state_to_string(uint32_t state)
 {
 {
 	switch (state) {
 	switch (state) {
@@ -1307,7 +1317,7 @@ int hif_pm_runtime_sync_resume(struct hif_opaque_softc *hif_ctx)
 	if (!sc)
 	if (!sc)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	if (!pm_runtime_enabled(sc->dev))
+	if (!hif_pci_pm_runtime_enabled(sc))
 		return 0;
 		return 0;
 
 
 	pm_state = qdf_atomic_read(&sc->pm_state);
 	pm_state = qdf_atomic_read(&sc->pm_state);
@@ -3977,7 +3987,7 @@ int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx)
 	if (!sc)
 	if (!sc)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	if (!pm_runtime_enabled(sc->dev))
+	if (!hif_pci_pm_runtime_enabled(sc))
 		return 0;
 		return 0;
 
 
 	pm_state = qdf_atomic_read(&sc->pm_state);
 	pm_state = qdf_atomic_read(&sc->pm_state);
@@ -4024,7 +4034,7 @@ int hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx)
 	if (!sc)
 	if (!sc)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	if (!pm_runtime_enabled(sc->dev))
+	if (!hif_pci_pm_runtime_enabled(sc))
 		return 0;
 		return 0;
 
 
 	usage_count = atomic_read(&sc->dev->power.usage_count);
 	usage_count = atomic_read(&sc->dev->power.usage_count);
@@ -4053,7 +4063,7 @@ int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx)
 	if (!sc)
 	if (!sc)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	if (!pm_runtime_enabled(sc->dev))
+	if (!hif_pci_pm_runtime_enabled(sc))
 		return 0;
 		return 0;
 
 
 	pm_state = qdf_atomic_read(&sc->pm_state);
 	pm_state = qdf_atomic_read(&sc->pm_state);
@@ -4088,7 +4098,7 @@ void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx)
 	if (!sc)
 	if (!sc)
 		return;
 		return;
 
 
-	if (!pm_runtime_enabled(sc->dev))
+	if (!hif_pci_pm_runtime_enabled(sc))
 		return;
 		return;
 
 
 	HIF_PM_STATS_RUNTIME_GET_RECORD(sc);
 	HIF_PM_STATS_RUNTIME_GET_RECORD(sc);
@@ -4120,7 +4130,7 @@ int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx)
 		return -EFAULT;
 		return -EFAULT;
 	}
 	}
 
 
-	if (!pm_runtime_enabled(sc->dev))
+	if (!hif_pci_pm_runtime_enabled(sc))
 		return 0;
 		return 0;
 
 
 	pm_state = qdf_atomic_read(&sc->pm_state);
 	pm_state = qdf_atomic_read(&sc->pm_state);
@@ -4188,7 +4198,7 @@ int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx)
 		return -EFAULT;
 		return -EFAULT;
 	}
 	}
 
 
-	if (!pm_runtime_enabled(sc->dev))
+	if (!hif_pci_pm_runtime_enabled(sc))
 		return 0;
 		return 0;
 
 
 	usage_count = atomic_read(&sc->dev->power.usage_count);
 	usage_count = atomic_read(&sc->dev->power.usage_count);
@@ -4234,7 +4244,7 @@ int hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx)
 	if (!sc)
 	if (!sc)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	if (!pm_runtime_enabled(sc->dev))
+	if (!hif_pci_pm_runtime_enabled(sc))
 		return 0;
 		return 0;
 
 
 	usage_count = atomic_read(&sc->dev->power.usage_count);
 	usage_count = atomic_read(&sc->dev->power.usage_count);