public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Graeme Gregory <gg@slimlogic.co.uk>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mundt <lethal@linux-sh.org>
Subject: I2C dummy, regmap, irq domain issue
Date: Tue, 31 Jul 2012 15:11:21 +0100	[thread overview]
Message-ID: <5017E789.4010701@slimlogic.co.uk> (raw)

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) {



             reply	other threads:[~2012-07-31 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 14:11 Graeme Gregory [this message]
2012-07-31 14:15 ` I2C dummy, regmap, irq domain issue Mark Brown

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=5017E789.4010701@slimlogic.co.uk \
    --to=gg@slimlogic.co.uk \
    --cc=benh@kernel.crashing.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=grant.likely@secretlab.ca \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    /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