diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 84ebc32790..3d946ea7f3 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -942,6 +942,26 @@ void hif_enable_ce_latency_stats(struct hif_opaque_softc *hif_ctx, void hif_display_stats(struct hif_opaque_softc *hif_ctx); void hif_clear_stats(struct hif_opaque_softc *hif_ctx); +/** + * enum hif_pm_wake_irq_type - Wake interrupt type for Power Management + * HIF_PM_INVALID_WAKE: Wake irq is invalid or not configured + * HIF_PM_MSI_WAKE: Wake irq is MSI interrupt + * HIF_PM_CE_WAKE: Wake irq is CE interrupt + */ +typedef enum { + HIF_PM_INVALID_WAKE, + HIF_PM_MSI_WAKE, + HIF_PM_CE_WAKE, +} hif_pm_wake_irq_type; + +/** + * hif_pm_get_wake_irq_type - Get wake irq type for Power Management + * @hif_ctx: HIF context + * + * Return: enum hif_pm_wake_irq_type + */ +hif_pm_wake_irq_type hif_pm_get_wake_irq_type(struct hif_opaque_softc *hif_ctx); + /** * enum wlan_rtpm_dbgid - runtime pm put/get debug id * @RTPM_ID_RESVERD: Reserved diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index 411f1b1d62..a007ef920a 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1710,6 +1710,13 @@ void hif_ramdump_handler(struct hif_opaque_softc *scn) hif_usb_ramdump_handler(scn); } +hif_pm_wake_irq_type hif_pm_get_wake_irq_type(struct hif_opaque_softc *hif_ctx) +{ + struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); + + return scn->wake_irq_type; +} + irqreturn_t hif_wake_interrupt_handler(int irq, void *context) { struct hif_softc *scn = context; diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index f9bb9546ef..65fb7ed6da 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -230,6 +230,7 @@ struct hif_softc { uint32_t hif_attribute; int wake_irq; int disable_wake_irq; + hif_pm_wake_irq_type wake_irq_type; void (*initial_wakeup_cb)(void *); void *initial_wakeup_priv; #ifdef REMOVE_PKT_LOG diff --git a/hif/src/ipcie/if_ipci.c b/hif/src/ipcie/if_ipci.c index b93f55724c..c665f24302 100644 --- a/hif/src/ipcie/if_ipci.c +++ b/hif/src/ipcie/if_ipci.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -150,6 +150,7 @@ int hif_ipci_bus_configure(struct hif_softc *hif_sc) goto unconfig_ce; hif_sc->wake_irq = hif_ce_msi_map_ce_to_irq(hif_sc, wake_ce_id); + hif_sc->wake_irq_type = HIF_PM_CE_WAKE; hif_info("expecting wake from ce %d, irq %d", wake_ce_id, hif_sc->wake_irq); diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 76ae4241f4..c173c24c23 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -2933,6 +2933,7 @@ static int hif_ce_msi_configure_irq(struct hif_softc *scn) scn->wake_irq = pld_get_msi_irq(scn->qdf_dev->dev, msi_irq_start); + scn->wake_irq_type = HIF_PM_MSI_WAKE; ret = pfrm_request_irq(scn->qdf_dev->dev, scn->wake_irq, hif_wake_interrupt_handler, @@ -2994,6 +2995,7 @@ free_wake_irq: pfrm_free_irq(scn->qdf_dev->dev, scn->wake_irq, scn->qdf_dev->dev); scn->wake_irq = 0; + scn->wake_irq_type = HIF_PM_INVALID_WAKE; } return ret; diff --git a/hif/src/snoc/if_snoc.c b/hif/src/snoc/if_snoc.c index 360deba654..d8797b960a 100644 --- a/hif/src/snoc/if_snoc.c +++ b/hif/src/snoc/if_snoc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -180,6 +180,7 @@ int hif_snoc_bus_configure(struct hif_softc *scn) goto unconfig_ce; scn->wake_irq = pld_get_irq(scn->qdf_dev->dev, wake_ce_id); + scn->wake_irq_type = HIF_PM_CE_WAKE; hif_info("expecting wake from ce %d, irq %d", wake_ce_id, scn->wake_irq);