Browse Source

qcacld-3.0: Provide setters for pm_state to upper layer

Runtime pm opperations will be initiated in hdd, so hdd
needs an api to updated the runtime_pm state.

Change-Id: I783fc136777a56d8ea23f8b11617ebe92641221a
CRs-Fixed: 935300
Houston Hoffman 9 years ago
parent
commit
f2ff37a509
3 changed files with 89 additions and 1 deletions
  1. 3 0
      core/hif/inc/hif.h
  2. 58 0
      core/hif/src/pcie/if_pci.c
  3. 28 1
      core/hif/src/snoc/if_snoc.c

+ 3 - 0
core/hif/inc/hif.h

@@ -648,6 +648,9 @@ int hif_bus_suspend(void);
 void hif_vote_link_down(void);
 void hif_vote_link_up(void);
 bool hif_can_suspend_link(void);
+void hif_runtime_pm_set_state_inprogress(void);
+void hif_runtime_pm_set_state_on(void);
+void hif_runtime_pm_set_state_suspended(void);
 int dump_ce_register(struct ol_softc *scn);
 int ol_copy_ramdump(struct ol_softc *scn);
 void hif_pktlogmod_exit(void *hif_ctx);

+ 58 - 0
core/hif/src/pcie/if_pci.c

@@ -1832,6 +1832,64 @@ int hif_bus_resume(void)
 		return hif_bus_resume_link_up();
 }
 
+#ifdef FEATURE_RUNTIME_PM
+/**
+ * __hif_runtime_pm_set_state(): utility function
+ * @state: state to set
+ *
+ * indexes into the runtime pm state and sets it.
+ */
+static void __hif_runtime_pm_set_state(enum hif_pm_runtime_state state)
+{
+	struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
+	struct hif_pci_softc *sc;
+
+	if (NULL == scn) {
+		HIF_ERROR("%s: HIF_CTX not initialized",
+		       __func__);
+		return;
+	}
+
+	sc = scn->hif_sc;
+	cdf_atomic_set(&sc->pm_state, state);
+
+}
+#else
+static void __hif_runtime_pm_set_state(enum hif_pm_runtime_state state)
+{
+}
+#endif
+
+/**
+ * hif_runtime_pm_set_state_inprogress(): adjust runtime pm state
+ *
+ * Notify hif that a runtime pm opperation has started
+ */
+void hif_runtime_pm_set_state_inprogress(void)
+{
+	__hif_runtime_pm_set_state(HIF_PM_RUNTIME_STATE_INPROGRESS);
+}
+
+/**
+ * hif_runtime_pm_set_state_on():  adjust runtime pm state
+ *
+ * Notify hif that a the runtime pm state should be on
+ */
+void hif_runtime_pm_set_state_on(void)
+{
+	__hif_runtime_pm_set_state(HIF_PM_RUNTIME_STATE_ON);
+}
+
+/**
+ * hif_runtime_pm_set_state_suspended():  adjust runtime pm state
+ *
+ * Notify hif that a runtime suspend attempt has been completed successfully
+ */
+void hif_runtime_pm_set_state_suspended(void)
+{
+	__hif_runtime_pm_set_state(HIF_PM_RUNTIME_STATE_SUSPENDED);
+}
+
 void hif_disable_isr(void *ol_sc)
 {
 	struct ol_softc *scn = (struct ol_softc *)ol_sc;

+ 28 - 1
core/hif/src/snoc/if_snoc.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -114,6 +114,33 @@ void dump_ce_debug_register(struct ol_softc *scn)
 	return;
 }
 
+/**
+ * hif_runtime_pm_set_state_inprogress() - dummy function
+ *
+ * currently runtime pm only supported in pci
+ */
+void hif_runtime_pm_set_state_inprogress(void)
+{
+}
+
+/**
+ * hif_runtime_pm_set_state_on() - dummy function
+ *
+ * currently runtime pm only supported in pci
+ */
+void hif_runtime_pm_set_state_on(void)
+{
+}
+
+/**
+ * hif_runtime_pm_set_state_suspended() - dummy function
+ *
+ * currently runtime pm only supported in pci
+ */
+void hif_runtime_pm_set_state_on(void)
+{
+}
+
 /**
  * hif_bus_suspend() - suspend the bus
  *