diff --git a/core/hif/inc/hif.h b/core/hif/inc/hif.h index b1ff3d930269..c49e14b102b2 100644 --- a/core/hif/inc/hif.h +++ b/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); diff --git a/core/hif/src/pcie/if_pci.c b/core/hif/src/pcie/if_pci.c index 15e8ccb94c3e..71d0291aa1c1 100644 --- a/core/hif/src/pcie/if_pci.c +++ b/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; diff --git a/core/hif/src/snoc/if_snoc.c b/core/hif/src/snoc/if_snoc.c index f9fa886ce12a..c5f248d8f847 100644 --- a/core/hif/src/snoc/if_snoc.c +++ b/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 *