From cd4e0368a7e32ed4fab313718b8fd1677f5a3e72 Mon Sep 17 00:00:00 2001 From: Vevek Venkatesan Date: Fri, 8 Jan 2021 17:28:20 +0530 Subject: [PATCH] qcacmn: add wake_irq_type in HIF for power management Add wake_irq_type in HIF layer for power management, this helps in deciding to enable sync-up between runtime suspend and wow resume in case of moselle. Change-Id: I23a4d02d3ae7ec543a28174461996b84b18fd95d CRs-Fixed: 2851265 --- hif/inc/hif.h | 22 +++++++++++++++++++++- hif/src/hif_main.c | 9 ++++++++- hif/src/hif_main.h | 3 ++- hif/src/ipcie/if_ipci.c | 3 ++- hif/src/pcie/if_pci.c | 4 +++- hif/src/snoc/if_snoc.c | 3 ++- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 84ebc32790be..3d946ea7f33d 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 8e5aab19afdf..b4fe3e396d66 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 @@ -1706,6 +1706,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 8ad42f65e271..630e09039e52 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 b93f55724c21..c665f243026a 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 0f95ebad3e80..c66a9dc40870 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 @@ -2875,6 +2875,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, @@ -2948,6 +2949,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 360deba654d2..d8797b960ade 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);