]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
regmap: irq: Allow users to retrieve the irq_domain
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 20 Aug 2012 20:45:05 +0000 (21:45 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 21 Aug 2012 10:41:39 +0000 (11:41 +0100)
This is useful for integration with other subsystems, especially MFD,
and provides an alternative API for users that request their own IRQs.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regmap-irq.c
include/linux/regmap.h

index a89734621e517e367b15b925ccd507da04daca89..f40a41f09c28d896ca69c80c6fa0f7189e83b5ba 100644 (file)
@@ -400,3 +400,22 @@ 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_domain(): Retrieve the irq_domain for the chip
+ *
+ * Useful for drivers to request their own IRQs and for integration
+ * with subsystems.  For ease of integration NULL is accepted as a
+ * domain, allowing devices to just call this even if no domain is
+ * allocated.
+ *
+ * @data: regmap_irq controller to operate on.
+ */
+struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data)
+{
+       if (data)
+               return data->domain;
+       else
+               return NULL;
+}
+EXPORT_SYMBOL_GPL(regmap_irq_get_domain);
index 7f7e00df3adf9991ce844a280c4c5c03a9d7bcb6..cb1fde1c85c2121e6b72e7a0130a85b2b7ea8869 100644 (file)
@@ -19,6 +19,7 @@
 struct module;
 struct device;
 struct i2c_client;
+struct irq_domain;
 struct spi_device;
 struct regmap;
 struct regmap_range_cfg;
@@ -314,6 +315,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_domain(struct regmap_irq_chip_data *data);
 
 #else