Patchwork [RFC,2/2] i2c/ACPI: Don't ignore IRQ flags

login
register
mail settings
Submitter Srinivas Pandruvada
Date March 18, 2014, 8:59 p.m.
Message ID <1395176361-3956-2-git-send-email-srinivas.pandruvada@linux.intel.com>
Download mbox | patch
Permalink /patch/331537/
State Superseded
Headers show

Comments

Srinivas Pandruvada - March 18, 2014, 8:59 p.m.
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@linux.intel.com>
---
 drivers/i2c/i2c-core.c | 7 ++++++-
 include/linux/i2c.h    | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 2d9b4bd..6217d80 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -675,6 +675,7 @@  i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
 	client->flags = info->flags;
 	client->addr = info->addr;
 	client->irq = info->irq;
+	client->irq_flags = info->irq_flags;
 	client->comp_addr_count = info->comp_addr_count;
 	client->comp_addrs = info->comp_addrs;
 
@@ -1120,6 +1121,7 @@  struct i2c_resource_info {
 	struct i2c_comp_address addrs[MAX_CRS_ELEMENTS];
 	int count;
 	int common_irq;
+	unsigned long irq_flags;
 };
 
 static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data)
@@ -1143,8 +1145,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->irq_flags = r.flags;
+		}
 	}
 
 	/* Tell the ACPI core to skip this resource */
@@ -1184,6 +1188,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.irq_flags;
 	info.comp_addr_count = rcs_info.count;
 	for (i = 0; i < rcs_info.count; ++i) {
 		if (!rcs_info.addrs[i].addr)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 4197a0d..63b511b 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -225,6 +225,7 @@  struct i2c_comp_address {
  * @comp_addr_count: Number of addresses in comp_addrs pointer
  * @comp_addrs: Pointer to companion list of i2c addresses and
  *	associated flags.
+ * @irq_flags: indicates the IRQ flags (format: IORESOURCE_IRQ_XXXX)
  *
  * An i2c_client identifies a single device (i.e. chip) connected to an
  * i2c bus. The behaviour exposed to Linux is defined by the driver
@@ -242,6 +243,7 @@  struct i2c_client {
 	struct list_head detected;
 	int comp_addr_count;
 	struct i2c_comp_address *comp_addrs;
+	unsigned long irq_flags;
 };
 #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
 
@@ -277,6 +279,7 @@  static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
  * @comp_addr_count: Number of addresses in comp_addrs pointer
  * @comp_addrs: Pointer to companion list of i2c addresses and
  *	associated flags.
+ * @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
@@ -300,6 +303,7 @@  struct i2c_board_info {
 	int		irq;
 	int comp_addr_count;
 	struct i2c_comp_address *comp_addrs;
+	unsigned long irq_flags;
 };
 
 /**