From ace98f847fcb48598e6fb6997839dc33748a4191 Mon Sep 17 00:00:00 2001 From: Mohit Khanna Date: Fri, 21 Feb 2020 12:29:37 -0800 Subject: [PATCH] qcacmn: HIF APIs to prevent/allow low power states Add HIF APIs to prevent or allow link to go into low power states. The current implementation uses PLD APIs to make the needed configuration. Change-Id: I22efb4bcf902f9aff674ed1872f4f23bef508aae CRs-Fixed: 2602029 --- hif/inc/hif.h | 31 +++++++++++++++++++++++++++++++ hif/src/pcie/if_pci.c | 11 +++++++++++ 2 files changed, 42 insertions(+) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index e7f6d7425ad7..56419b1d1841 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -1202,6 +1202,37 @@ int hif_force_wake_release(struct hif_opaque_softc *handle) } #endif /* FORCE_WAKE */ +#ifdef FEATURE_HAL_DELAYED_REG_WRITE +/** + * hif_prevent_link_low_power_states() - Prevent from going to low power states + * @hif - HIF opaque context + * + * Return: 0 on success. Error code on failure. + */ +int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif); + +/** + * hif_allow_link_low_power_states() - Allow link to go to low power states + * @hif - HIF opaque context + * + * Return: None + */ +void hif_allow_link_low_power_states(struct hif_opaque_softc *hif); + +#else + +static inline +int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif) +{ + return 0; +} + +static inline +void hif_allow_link_low_power_states(struct hif_opaque_softc *hif) +{ +} +#endif + void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle); /** diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 4ff0c6ba3da4..56b346564b44 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -4844,3 +4844,14 @@ void hif_print_pci_stats(struct hif_pci_softc *pci_handle) } #endif /* FORCE_WAKE */ +#ifdef FEATURE_HAL_DELAYED_REG_WRITE +int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif) +{ + return pld_prevent_l1(HIF_GET_SOFTC(hif)->qdf_dev->dev); +} + +void hif_allow_link_low_power_states(struct hif_opaque_softc *hif) +{ + pld_allow_l1(HIF_GET_SOFTC(hif)->qdf_dev->dev); +} +#endif