linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org,
	mika.westerberg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	jdelvare-l3A5Bk7waGM@public.gmane.org
Subject: [RFC Patch 2/2] i2c/ACPI: Don't ignore IRQ flags
Date: Tue, 18 Mar 2014 13:59:21 -0700	[thread overview]
Message-ID: <1395176361-3956-2-git-send-email-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <1395176361-3956-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 | 7 ++++++-
 include/linux/i2c.h    | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

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;
 };
 
 /**
-- 
1.8.3.2

      parent reply	other threads:[~2014-03-18 20:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 20:59 [RFC Patch 1/2] i2c/ACPI: Support for multiple serial bus addresses Srinivas Pandruvada
     [not found] ` <1395176361-3956-1-git-send-email-srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-03-18 20:59   ` Srinivas Pandruvada [this message]

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=1395176361-3956-2-git-send-email-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=jdelvare-l3A5Bk7waGM@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mika.westerberg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=rjw-LthD3rsA81gm4RdzfppkhA@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).