aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2015-05-06 06:29:08 -0400
committerLinus Walleij <linus.walleij@linaro.org>2015-05-13 04:24:35 -0400
commit845c877009cf014b971aab7f54613f9185a824b0 (patch)
treecfccc40626314dbb5a9351f27f1b4982e76f215d /drivers/i2c/i2c-core.c
parentdab472eb931bc2916fa779e56deccd0ec319cf5b (diff)
i2c / ACPI: Assign IRQ for devices that have GpioInt automatically
Following what DT already does. If the device does not have ACPI Interrupt resource but instead it has one or more GpioInt resources listed below it, we take the first GpioInt resource, convert it to suitable Linux IRQ number and pass it to the driver instead. This makes drivers simpler because the don't need to care about GPIOs at all if only thing they need is interrupt. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index c21b3de70234..fc2ee8213fb6 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -631,8 +631,13 @@ static int i2c_device_probe(struct device *dev)
631 if (!client) 631 if (!client)
632 return 0; 632 return 0;
633 633
634 if (!client->irq && dev->of_node) { 634 if (!client->irq) {
635 int irq = of_irq_get(dev->of_node, 0); 635 int irq = -ENOENT;
636
637 if (dev->of_node)
638 irq = of_irq_get(dev->of_node, 0);
639 else if (ACPI_COMPANION(dev))
640 irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(dev), 0);
636 641
637 if (irq == -EPROBE_DEFER) 642 if (irq == -EPROBE_DEFER)
638 return irq; 643 return irq;