From f2ee05f167917a1cc3c289cf88fdf496f5bbe455 Mon Sep 17 00:00:00 2001 From: Yuanyuan Liu Date: Wed, 27 Jul 2016 16:52:52 -0700 Subject: [PATCH] qcacld-3.0: Provide PLD API for getting IRQ number Provide PLD API of getting IRQ number for a given CE ID. Change-Id: Icd293993e84ab4daa98430db231b8b73e082cd29 CRs-Fixed: 1047259 --- core/pld/inc/pld_common.h | 1 + core/pld/src/pld_common.c | 24 ++++++++++++++++++++++++ core/pld/src/pld_snoc.c | 12 ++++++++++++ core/pld/src/pld_snoc.h | 5 +++++ 4 files changed, 42 insertions(+) diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 75de74aac862..345f69b06aa3 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -376,6 +376,7 @@ void pld_enable_irq(struct device *dev, unsigned int ce_id); void pld_disable_irq(struct device *dev, unsigned int ce_id); int pld_get_soc_info(struct device *dev, struct pld_soc_info *info); int pld_get_ce_id(struct device *dev, int irq); +int pld_get_irq(struct device *dev, int ce_id); void pld_lock_pm_sem(struct device *dev); void pld_release_pm_sem(struct device *dev); int pld_power_on(struct device *dev); diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index 29458eb7853d..0aa3017bbd90 100644 --- a/core/pld/src/pld_common.c +++ b/core/pld/src/pld_common.c @@ -1271,6 +1271,30 @@ int pld_get_ce_id(struct device *dev, int irq) return ret; } +/** + * pld_get_irq() - Get IRQ number for given CE ID + * @dev: device + * @ce_id: CE ID + * + * Return: IRQ number + */ +int pld_get_irq(struct device *dev, int ce_id) +{ + int ret = 0; + + switch (pld_get_bus_type(dev)) { + case PLD_BUS_TYPE_SNOC: + ret = pld_snoc_get_irq(ce_id); + break; + case PLD_BUS_TYPE_PCIE: + default: + ret = -EINVAL; + break; + } + + return ret; +} + /** * pld_lock_pm_sem() - Lock PM semaphore * @dev: device diff --git a/core/pld/src/pld_snoc.c b/core/pld/src/pld_snoc.c index 22297b4e7944..bfbedb056c12 100644 --- a/core/pld/src/pld_snoc.c +++ b/core/pld/src/pld_snoc.c @@ -381,4 +381,16 @@ int pld_snoc_power_off(struct device *dev) { return icnss_power_off(dev); } + +/** + * pld_snoc_get_irq() - Get IRQ number for given CE ID + * @ce_id: CE ID + * + * Return: IRQ number + */ +int pld_snoc_get_irq(int ce_id) +{ + return icnss_get_irq(ce_id); +} + #endif diff --git a/core/pld/src/pld_snoc.h b/core/pld/src/pld_snoc.h index 75f3f1036f37..ca1ce1d91cd6 100644 --- a/core/pld/src/pld_snoc.h +++ b/core/pld/src/pld_snoc.h @@ -83,6 +83,10 @@ static inline int pld_snoc_power_off(struct device *dev) { return 0; } +static inline int pld_snoc_get_irq(int ce_id) +{ + return 0; +} #else int pld_snoc_register_driver(void); void pld_snoc_unregister_driver(void); @@ -99,6 +103,7 @@ void pld_snoc_disable_irq(unsigned int ce_id); int pld_snoc_get_ce_id(int irq); int pld_snoc_power_on(struct device *dev); int pld_snoc_power_off(struct device *dev); +int pld_snoc_get_irq(int ce_id); #endif #endif