linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Srinivas Pandruvada
	<srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: [PATCH 2/2] i2c/ACPI: Don't ignore IRQ flags
Date: Thu, 10 Apr 2014 21:15:17 -0700	[thread overview]
Message-ID: <1397189717-30657-2-git-send-email-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <1397189717-30657-1-git-send-email-srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

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-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 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

  parent reply	other threads:[~2014-04-11  4:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11  4:15 [PATCH 1/2] i2c/ACPI: Support for multiple serial bus addresses Srinivas Pandruvada
     [not found] ` <1397189717-30657-1-git-send-email-srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-04-11  4:15   ` Srinivas Pandruvada [this message]
2014-06-10  9:24   ` Mika Westerberg
     [not found]     ` <20140610092411.GM1657-3PARRvDOhMZrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-06-10 15:09       ` Srinivas Pandruvada
     [not found]         ` <53971FA2.4090706-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-06-11 10:53           ` Mika Westerberg
2014-06-06 12:32 ` Wolfram Sang
2014-06-09  7:54   ` Mika Westerberg
     [not found]     ` <20140609075421.GD1657-3PARRvDOhMZrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-06-09 17:27       ` Srinivas Pandruvada

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=1397189717-30657-2-git-send-email-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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;
as well as URLs for NNTP newsgroup(s).