mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yadwinder Singh Brar <yadi.brar01@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: sameo@linux.intel.com,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>,
	Jonghwa Lee <jonghwa3.lee@samsung.com>,
	Myungjoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Chiwoong Byun <woong.byun@samsung.com>,
	Yadwinder Singh Brar <yadi.brar@samsung.com>
Subject: [PATCH 3/6] mfd: max77686: Allow to specify interrupt through DT or platform file also.
Date: Thu,  5 Jul 2012 09:28:22 +0530	[thread overview]
Message-ID: <1341460705-10868-3-git-send-email-yadi.brar@samsung.com> (raw)
In-Reply-To: <1341460705-10868-1-git-send-email-yadi.brar@samsung.com>

Presently driver expects irq_gpio pin in platform data and maps it to irq
itself. But we can also directly specify the interrupt in DT or platform file.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
---
 drivers/mfd/max77686-irq.c |   33 ++++++++++++++++++++-------------
 drivers/mfd/max77686.c     |    1 +
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/max77686-irq.c b/drivers/mfd/max77686-irq.c
index 0758fac..1fbbc64 100644
--- a/drivers/mfd/max77686-irq.c
+++ b/drivers/mfd/max77686-irq.c
@@ -252,21 +252,28 @@ int max77686_irq_init(struct max77686_dev *max77686)
 
 	mutex_init(&max77686->irqlock);
 
-	max77686->irq = gpio_to_irq(max77686->irq_gpio);
-
-	if (debug_mask & MAX77686_DEBUG_IRQ_INT) {
-		ret = gpio_request(max77686->irq_gpio, "pmic_irq");
-		if (ret < 0) {
-			dev_err(max77686->dev,
-				"Failed to request gpio %d with ret: %d\n",
-				max77686->irq_gpio, ret);
-			return IRQ_NONE;
+	if (max77686->irq_gpio && !max77686->irq) {
+		max77686->irq = gpio_to_irq(max77686->irq_gpio);
+
+		if (debug_mask & MAX77686_DEBUG_IRQ_INT) {
+			ret = gpio_request(max77686->irq_gpio, "pmic_irq");
+			if (ret < 0) {
+				dev_err(max77686->dev,
+					"Failed to request gpio %d with ret:"
+					"%d\n",	max77686->irq_gpio, ret);
+				return IRQ_NONE;
+			}
+
+			gpio_direction_input(max77686->irq_gpio);
+			val = gpio_get_value(max77686->irq_gpio);
+			gpio_free(max77686->irq_gpio);
+			pr_info("%s: gpio_irq=%x\n", __func__, val);
 		}
+	}
 
-		gpio_direction_input(max77686->irq_gpio);
-		val = gpio_get_value(max77686->irq_gpio);
-		gpio_free(max77686->irq_gpio);
-		pr_info("%s: gpio_irq=%x\n", __func__, val);
+	if (!max77686->irq) {
+		dev_err(max77686->dev, "irq is not specified\n");
+		return -ENODEV;
 	}
 
 	/* Mask individual interrupt sources */
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index 11e5601..5c78e94 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -78,6 +78,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
 
 	max77686->wakeup = pdata->wakeup;
 	max77686->irq_gpio = pdata->irq_gpio;
+	max77686->irq = i2c->irq;
 
 	mutex_init(&max77686->iolock);
 
-- 
1.7.0.4


  parent reply	other threads:[~2012-07-05  3:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05  3:58 [PATCH 1/6] mfd: max77686: Use pmic regmap to read pmic interrupt register Yadwinder Singh Brar
2012-07-05  3:58 ` [PATCH 2/6] mfd: max77686: Apply irq_mask_cur before handling interrupts Yadwinder Singh Brar
2012-07-05  3:58 ` Yadwinder Singh Brar [this message]
2012-07-05  3:58 ` [PATCH 4/6] mfd: max77686: Add device tree support Yadwinder Singh Brar
2012-07-05 12:41   ` Mark Brown
2012-07-05 13:37     ` Yadwinder Singh Brar
2012-07-06  8:56     ` [PATCH v2] " Yadwinder Singh Brar
2012-07-06 11:32     ` [PATCH v3] " Yadwinder Singh Brar
2012-07-06 18:09       ` Mark Brown
2012-07-05  3:58 ` [PATCH 5/6] mfd: max77686: Remove the clocks from the list of regulators Yadwinder Singh Brar
2012-07-05  3:58 ` [PATCH 6/6] regulator: max77686: Add device tree support Yadwinder Singh Brar
2012-07-05 12:42   ` Mark Brown
2012-07-09 11:25 ` [PATCH 1/6] mfd: max77686: Use pmic regmap to read pmic interrupt register Samuel Ortiz

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=1341460705-10868-3-git-send-email-yadi.brar@samsung.com \
    --to=yadi.brar01@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jonghwa3.lee@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=sameo@linux.intel.com \
    --cc=woong.byun@samsung.com \
    --cc=yadi.brar@samsung.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®