[PATCH 2/2] i2c/ACPI: Don't ignore IRQ flags
From: Srinivas Pandruvada
Date: Fri Apr 11 2014 - 00:12:16 EST
Currently irq flags from IRQ resources are ignored. They have important
IRQ configuration for level, trigger and sharable.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
---
drivers/i2c/i2c-core.c | 6 +++++-
include/linux/i2c.h | 4 ++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a69a7b4..cb72629 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1093,6 +1093,7 @@ struct i2c_resource_info {
unsigned short flags[MAX_CRS_ELEMENTS];
int count;
int common_irq;
+ int common_irq_flags;
};
static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data)
@@ -1116,8 +1117,10 @@ static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data)
} else if (rcs_info->common_irq < 0) {
struct resource r;
- if (acpi_dev_resource_interrupt(ares, 0, &r))
+ if (acpi_dev_resource_interrupt(ares, 0, &r)) {
rcs_info->common_irq = r.start;
+ rcs_info->common_irq_flags = r.flags;
+ }
}
/* Tell the ACPI core to skip this resource */
@@ -1157,6 +1160,7 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
adev->power.flags.ignore_parent = true;
info.irq = rcs_info.common_irq;
+ info.irq_flags = rcs_info.common_irq_flags;
for (i = 0; i < rcs_info.count; ++i) {
if (!rcs_info.addr[i])
continue;
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index ce75c73..cea41ab 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -207,6 +207,7 @@ struct i2c_driver {
* @adapter: manages the bus segment hosting this I2C device
* @dev: Driver model device node for the slave.
* @irq: indicates the IRQ generated by this device (if any)
+ * @irq_flags: indicates the IRQ flags (format: IORESOURCE_IRQ_XXXX)
* @detected: member of an i2c_driver.clients list or i2c-core's
* userspace_devices list
*
@@ -223,6 +224,7 @@ struct i2c_client {
struct i2c_adapter *adapter; /* the adapter we sit on */
struct device dev; /* the device structure */
int irq; /* irq issued by device */
+ unsigned long irq_flags; /* irq flags by device */
struct list_head detected;
};
#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -256,6 +258,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
* @of_node: pointer to OpenFirmware device node
* @acpi_node: ACPI device node
* @irq: stored in i2c_client.irq
+ * @irq_flags: indicates the IRQ flags (format: IORESOURCE_IRQ_XXXX)
*
* I2C doesn't actually support hardware probing, although controllers and
* devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's
@@ -277,6 +280,7 @@ struct i2c_board_info {
struct device_node *of_node;
struct acpi_dev_node acpi_node;
int irq;
+ unsigned long irq_flags;
};
/**
--
1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/