mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
To: linux-kernel@vger.kernel.org
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>,
	Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Subject: [PATCH] max17042_battery: Clean up interrupt handling
Date: Wed, 21 Mar 2012 03:03:16 +0530	[thread overview]
Message-ID: <1332279196-17991-1-git-send-email-ramakrishna.pallala@intel.com> (raw)

Max17042 driver has dummy hardIRQ function which
does nothing but waking the threaded handler.

This patch removes the hardIRQ function and also
modifies the interrupt type to falling edge. While
we are there, change the macros to comply with the
Data sheet.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
---
 drivers/power/max17042_battery.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index e36763a..abf3400 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -47,8 +47,8 @@
 
 /* Interrupt mask bits */
 #define CONFIG_ALRT_BIT_ENBL	(1 << 2)
-#define STATUS_INTR_SOC_BIT	(1 << 14)
-#define STATUS_INTR_LOW_SOC_BIT	(1 << 10)
+#define STATUS_INTR_SOCMIN_BIT	(1 << 10)
+#define STATUS_INTR_SOCMAX_BIT	(1 << 14)
 
 #define VFSOC0_LOCK		0x0000
 #define VFSOC0_UNLOCK		0x0080
@@ -572,19 +572,14 @@ static void max17042_set_soc_threshold(struct max17042_chip *chip, u16 off)
 	max17042_write_reg(chip->client, MAX17042_SALRT_Th, soc_tr);
 }
 
-static irqreturn_t max17042_intr_handler(int id, void *dev)
-{
-	return IRQ_WAKE_THREAD;
-}
-
 static irqreturn_t max17042_thread_handler(int id, void *dev)
 {
 	struct max17042_chip *chip = dev;
 	u16 val;
 
 	val = max17042_read_reg(chip->client, MAX17042_STATUS);
-	if ((val & STATUS_INTR_SOC_BIT) ||
-		(val & STATUS_INTR_LOW_SOC_BIT)) {
+	if ((val & STATUS_INTR_SOCMIN_BIT) ||
+		(val & STATUS_INTR_SOCMAX_BIT)) {
 		dev_info(&chip->client->dev, "SOC threshold INTR\n");
 		max17042_set_soc_threshold(chip, 1);
 	}
@@ -692,9 +687,10 @@ static int __devinit max17042_probe(struct i2c_client *client,
 	}
 
 	if (client->irq) {
-		ret = request_threaded_irq(client->irq, max17042_intr_handler,
+		ret = request_threaded_irq(client->irq, NULL,
 						max17042_thread_handler,
-						0, chip->battery.name, chip);
+						IRQF_TRIGGER_FALLING,
+						chip->battery.name, chip);
 		if (!ret) {
 			reg =  max17042_read_reg(client, MAX17042_CONFIG);
 			reg |= CONFIG_ALRT_BIT_ENBL;
-- 
1.7.0.4


             reply	other threads:[~2012-03-21  5:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20 21:33 Ramakrishna Pallala [this message]
2012-03-26 16:33 ` Anton Vorontsov

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=1332279196-17991-1-git-send-email-ramakrishna.pallala@intel.com \
    --to=ramakrishna.pallala@intel.com \
    --cc=anton.vorontsov@linaro.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®