Pārlūkot izejas kodu

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
Vevek Venkatesan 4 gadi atpakaļ
vecāks
revīzija
bae1042f1c

+ 21 - 1
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

+ 8 - 1
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;

+ 2 - 1
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

+ 2 - 1
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);

+ 3 - 1
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;

+ 2 - 1
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);