[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1349782116-9757-5-git-send-email-ldewangan@nvidia.com>
Date: Tue, 9 Oct 2012 16:58:35 +0530
From: Laxman Dewangan <ldewangan@...dia.com>
To: <broonie@...nsource.wolfsonmicro.com>,
<gregkh@...uxfoundation.org>, <sameo@...ux.intel.com>
CC: <swarren@...dia.com>, <linux-kernel@...r.kernel.org>,
Laxman Dewangan <ldewangan@...dia.com>
Subject: [PATCH 4/5] regmap: add API to get irq_domain from regmap irq
Add API regmap_irq_get_irq_domain() for getting the
irq domain from regmap irq.
The irq domain created on result of regmap_add_irq_chip()
from driver.
This API is useful in mfd driver when driver add mfd sub devices.
The sub devices IRQs can be passed through IORESOURCE_IRQ and it
need to be mapped properly with device irq domain. The
mfd_add_devices() creates mapping when adding sub devices and for
this it is require to have irq domain.
Signed-off-by: Laxman Dewangan <ldewangan@...dia.com>
---
drivers/base/regmap/regmap-irq.c | 16 ++++++++++++++++
include/linux/regmap.h | 1 +
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 5b6b1d8..70bce5f 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -458,3 +458,19 @@ int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq)
return irq_create_mapping(data->domain, irq);
}
EXPORT_SYMBOL_GPL(regmap_irq_get_virq);
+
+/**
+ * regmap_irq_get_irq_domain(): Return IRQ domain for of the interrupt added.
+ *
+ * Useful for drivers who locally create mapping from irq_domain which is
+ * created on result of the call regmap_add_irq_chip().
+ *
+ * @data: regmap_irq controller to operate on.
+ */
+struct irq_domain *regmap_irq_get_irq_domain(struct regmap_irq_chip_data *data)
+{
+ if (data)
+ return data->domain;
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(regmap_irq_get_irq_domain);
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index e3bcc3f..3a6d7b8 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -317,6 +317,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
+struct irq_domain *regmap_irq_get_irq_domain(struct regmap_irq_chip_data *data);
#else
--
1.7.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists