public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* I2C dummy, regmap, irq domain issue
@ 2012-07-31 14:11 Graeme Gregory
  2012-07-31 14:15 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Graeme Gregory @ 2012-07-31 14:11 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org
  Cc: Mark Brown, Grant Likely, Benjamin Herrenschmidt, Paul Mundt

I have an interesting issue with the combination of i2c dummy devices,
regmap-irq and domains.

I have been adding device tree support to the palmas mfd driver.

The palmas device has 3 i2c addresses it responds to so it has one
normal i2c device and 2 dummy devices to claim the 2nd/3rd addresses
(this is pretty normal).

The registers for the IRQ handling on the chip happen to be in the 2nd
slave address. This means that when I am calling the regmap_add_irq_chip
call it is using a regmap based on the dummy i2c device.

regmap_add_irq_chip(palmas->regmap[slave], palmas->irq,
            IRQF_ONESHOT | IRQF_TRIGGER_LOW, -1, &palmas_irq_chip,
            &palmas->irq_data);

This works however when probing the child devices from the device tree
because I have used a dummy I2C device it fails to find the IRQ domain
created by regmap-irq.

of_platform_populate(node, NULL, NULL, &i2c->dev);

While debugging this issue I changed the regmap_add_irq_chip as per the
diff at end of the email. Is there a cleaner way to solve this within
the DT system?

Graeme

@@ -194,7 +194,7 @@ static struct irq_domain_ops regmap_domain_ops = {
  * register cache.  The chip driver is responsible for restoring the
  * register values used by the IRQ controller over suspend and resume.
  */
-int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
+int regmap_add_irq_chip(struct device *dev, struct regmap *map, int
irq, int irq_flags,
             int irq_base, struct regmap_irq_chip *chip,
             struct regmap_irq_chip_data **data)
 {
@@ -269,11 +269,11 @@ int regmap_add_irq_chip(struct regmap *map, int
irq, int irq_flags,
     }
 
     if (irq_base)
-        d->domain = irq_domain_add_legacy(map->dev->of_node,
+        d->domain = irq_domain_add_legacy(dev->of_node,
                           chip->num_irqs, irq_base, 0,
                           &regmap_domain_ops, d);
     else
-        d->domain = irq_domain_add_linear(map->dev->of_node,
+        d->domain = irq_domain_add_linear(dev->of_node,
                           chip->num_irqs,
                           &regmap_domain_ops, d);
     if (!d->domain) {



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: I2C dummy, regmap, irq domain issue
  2012-07-31 14:11 I2C dummy, regmap, irq domain issue Graeme Gregory
@ 2012-07-31 14:15 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-07-31 14:15 UTC (permalink / raw)
  To: Graeme Gregory
  Cc: linux-kernel@vger.kernel.org, Grant Likely,
	Benjamin Herrenschmidt, Paul Mundt

On Tue, Jul 31, 2012 at 03:11:21PM +0100, Graeme Gregory wrote:

> -        d->domain = irq_domain_add_legacy(map->dev->of_node,
> +        d->domain = irq_domain_add_legacy(dev->of_node,

Oh, ick.  If we're going to have to do this sort of stuff we should just
pass the of_node in and have done with it.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-31 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-31 14:11 I2C dummy, regmap, irq domain issue Graeme Gregory
2012-07-31 14:15 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox