mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: J Keerthy <j-keerthy@ti.com>
To: <linux-omap@vger.kernel.org>
Cc: <broonie@kernel.org>, <j-keerthy@ti.com>, <ldewangan@nvidia.com>,
	<sameo@linux.intel.com>, <grant.likely@secretlab.ca>,
	<swarren@nvidia.com>, <linux-kernel@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <gg@slimlogic.co.uk>
Subject: [PATCH v2 1/4] MFD: Palmas: Check if interrupts property exists and then only request irq
Date: Tue, 18 Jun 2013 15:31:29 +0530	[thread overview]
Message-ID: <1371549692-7361-2-git-send-email-j-keerthy@ti.com> (raw)
In-Reply-To: <1371549692-7361-1-git-send-email-j-keerthy@ti.com>

Check if interrupts property exists and then only request irq.
On some boards INT line might not be connected to a valid
irq line on the application processor. Hence keeping a check
before requesting irq.

Boot tested on OMAP5-UEVM board.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
---
 drivers/mfd/palmas.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 62fa728..69c4e62 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -236,6 +236,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 {
 	struct palmas *palmas;
 	struct palmas_platform_data *pdata;
+	struct device_node *regnode = NULL;
 	struct device_node *node = i2c->dev.of_node;
 	int ret = 0, i;
 	unsigned int reg, addr;
@@ -262,7 +263,6 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 	i2c_set_clientdata(i2c, palmas);
 	palmas->dev = &i2c->dev;
 	palmas->id = id->driver_data;
-	palmas->irq = i2c->irq;
 
 	for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {
 		if (i == 0)
@@ -290,6 +290,15 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 		}
 	}
 
+	regnode = of_parse_phandle(node, "interrupts", 0);
+
+	if (!regnode) {
+		dev_warn(palmas->dev, "IRQ missing: skipping irq request\n");
+		goto no_irq;
+	} else {
+		palmas->irq = i2c->irq;
+	}
+
 	/* Change interrupt line output polarity */
 	if (pdata->irq_flags & IRQ_TYPE_LEVEL_HIGH)
 		reg = PALMAS_POLARITY_CTRL_INT_POLARITY;
@@ -316,6 +325,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 	if (ret < 0)
 		goto err;
 
+no_irq:
 	slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
 	addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE,
 			PALMAS_PRIMARY_SECONDARY_PAD1);
-- 
1.7.5.4


  reply	other threads:[~2013-06-18 10:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 10:01 [PATCH v2 0/4] MFD: Palmas: Add TPS659038 PMIC support on Palmas J Keerthy
2013-06-18 10:01 ` J Keerthy [this message]
2013-06-18 15:51   ` [PATCH v2 1/4] MFD: Palmas: Check if interrupts property exists and then only request irq Stephen Warren
2013-06-18 16:54     ` J, KEERTHY
2013-06-18 17:08       ` Stephen Warren
2013-06-18 17:19         ` J, KEERTHY
2013-06-18 17:22           ` Stephen Warren
2013-06-18 17:33             ` J, KEERTHY
2013-06-18 19:11               ` Stephen Warren
2013-06-19  1:28                 ` J, KEERTHY
2013-06-18 18:07             ` Mark Brown

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=1371549692-7361-2-git-send-email-j-keerthy@ti.com \
    --to=j-keerthy@ti.com \
    --cc=broonie@kernel.org \
    --cc=gg@slimlogic.co.uk \
    --cc=grant.likely@secretlab.ca \
    --cc=ldewangan@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=swarren@nvidia.com \
    /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

all inboxes | Powered by JetHome®