@@ -984,6 +984,8 @@ static int i2c_device_probe(struct device *dev)
if (!client)
return 0;
+ driver = to_i2c_driver(dev->driver);
+
if (!client->irq) {
int irq = -ENOENT;
@@ -995,7 +997,8 @@ static int i2c_device_probe(struct device *dev)
if (irq == -EINVAL || irq == -ENODATA)
irq = of_irq_get(dev->of_node, 0);
} else if (ACPI_COMPANION(dev)) {
- irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(dev), 0);
+ irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(dev),
+ driver->irq_index);
}
if (irq == -EPROBE_DEFER)
return irq;
@@ -212,6 +212,9 @@ struct i2c_driver {
int (*detect)(struct i2c_client *, struct i2c_board_info *);
const unsigned short *address_list;
struct list_head clients;
+
+ /* IRQ index for retreiving irq from ACPI resources */
+ int irq_index;
};
#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
Some of or acpi declared / enumerated devices may have multiple irq resources declared and the driver may want to use a different irq then the one with index 0. This commit adds a new irq_index field to struct i2c_driver and makes the i2c-core pass this to of_irq_get / acpi_dev_gpio_irq_get. This is esp. useful for acpi declared devices where the irq with index 0 may be entirely useless and cause i2c_device_probe to fail with -EPROBE_DEFER. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/i2c/i2c-core.c | 5 ++++- include/linux/i2c.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-)