mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan@nvidia.com>
To: <broonie@opensource.wolfsonmicro.com>,
	<gregkh@linuxfoundation.org>, <sameo@linux.intel.com>
Cc: <swarren@nvidia.com>, <linux-kernel@vger.kernel.org>,
	Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH V2 4/5] regmap: add API to get irq_domain from regmap irq
Date: Wed, 10 Oct 2012 22:49:04 +0530	[thread overview]
Message-ID: <1349889545-21517-5-git-send-email-ldewangan@nvidia.com> (raw)
In-Reply-To: <1349889545-21517-1-git-send-email-ldewangan@nvidia.com>

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@nvidia.com>
---
Changes from V1:
- Add stubbing of new API.
- Add empty line between paragraph.

 drivers/base/regmap/regmap-irq.c |   16 ++++++++++++++++
 include/linux/regmap.h           |    8 ++++++++
 2 files changed, 24 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..d3216a7 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
 
@@ -433,6 +434,13 @@ static inline struct regmap *dev_get_regmap(struct device *dev,
 	return NULL;
 }
 
+static inline struct irq_domain *regmap_irq_get_irq_domain(
+			struct regmap_irq_chip_data *data)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return NULL;
+}
+
 #endif
 
 #endif
-- 
1.7.1.1


  parent reply	other threads:[~2012-10-10 17:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 17:19 [PATCH V2 0/5]mfd: tps65910: use regmap irq framework for interrupt Laxman Dewangan
2012-10-10 17:19 ` [PATCH V2 1/5] mfd: tps65910: Initialize mfd devices after all initialization done Laxman Dewangan
2012-10-10 17:19 ` [PATCH V2 2/5] mfd: tps65910: use regmap irq framework for interrupt support Laxman Dewangan
2012-10-10 17:19 ` [PATCH V2 3/5] mfd: tps65910: move interrupt implementation code to mfd file Laxman Dewangan
2012-10-10 17:19 ` Laxman Dewangan [this message]
2012-10-11  7:38   ` [PATCH V2 4/5] regmap: add API to get irq_domain from regmap irq Mark Brown
2012-10-15  0:56   ` Mark Brown
2012-10-15 11:41     ` Laxman Dewangan
2012-10-10 17:19 ` [PATCH V2 5/5] mfd: tps65910: pass irq_domain when adding mfd sub devices Laxman Dewangan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349889545-21517-5-git-send-email-ldewangan@nvidia.com \
    --to=ldewangan@nvidia.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=swarren@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®