linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: linux-iio@vger.kernel.org
Cc: Michael Hennerich <michael.hennerich@analog.com>,
	Jonathan Cameron <jic23@cam.ac.uk>
Subject: [PATCH 04/16] staging:iio:adc:ad7150: Add support for the second interrupt strobe.
Date: Fri, 26 Aug 2011 11:19:21 +0100	[thread overview]
Message-ID: <1314353973-7662-5-git-send-email-jic23@cam.ac.uk> (raw)
In-Reply-To: <1314353973-7662-1-git-send-email-jic23@cam.ac.uk>

From: Michael Hennerich <michael.hennerich@analog.com>

The AD7150 features two outputs that can be used as interrupt strobes
to the host processor. In order to receive all events independently,
both need to utilized.

Update copyright notice.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/adc/ad7150.c |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c
index deb0339..25f354c 100644
--- a/drivers/staging/iio/adc/ad7150.c
+++ b/drivers/staging/iio/adc/ad7150.c
@@ -1,7 +1,7 @@
 /*
  * AD7150 capacitive sensor driver supporting AD7150/1/6
  *
- * Copyright 2010 Analog Devices Inc.
+ * Copyright 2010-2011 Analog Devices Inc.
  *
  * Licensed under the GPL-2 or later.
  */
@@ -45,14 +45,6 @@
 #define AD7150_SN0                 22
 #define AD7150_ID                  23
 
-#define AD7150_MAX_CONV_MODE       4
-
-/**
- * Todo list:
- * - Review whether old_state usage makes sense.
- * - get rid of explicit control of conversion mode
- */
-
 /**
  * struct ad7150_chip_info - instance specific chip data
  * @client: i2c client for this device
@@ -591,24 +583,40 @@ static int __devinit ad7150_probe(struct i2c_client *client,
 					   &ad7150_event_handler,
 					   IRQF_TRIGGER_RISING |
 					   IRQF_TRIGGER_FALLING,
-					   "ad7150",
+					   "ad7150_irq1",
 					   indio_dev);
 		if (ret)
 			goto error_free_dev;
 	}
 
+	if (client->dev.platform_data) {
+		ret = request_threaded_irq(*(unsigned int *)
+					   client->dev.platform_data,
+					   NULL,
+					   &ad7150_event_handler,
+					   IRQF_TRIGGER_RISING |
+					   IRQF_TRIGGER_FALLING,
+					   "ad7150_irq2",
+					   indio_dev);
+		if (ret)
+			goto error_free_irq;
+	}
+
 	ret = iio_device_register(indio_dev);
 	if (ret)
-		goto error_free_irq;
+		goto error_free_irq2;
 
 	dev_info(&client->dev, "%s capacitive sensor registered,irq: %d\n",
 		 id->name, client->irq);
 
 	return 0;
+error_free_irq2:
+	if (client->dev.platform_data)
+		free_irq(*(unsigned int *)client->dev.platform_data,
+			 indio_dev);
 error_free_irq:
 	if (client->irq)
 		free_irq(client->irq, indio_dev);
-
 error_free_dev:
 	iio_free_device(indio_dev);
 error_ret:
@@ -621,6 +629,10 @@ static int __devexit ad7150_remove(struct i2c_client *client)
 
 	if (client->irq)
 		free_irq(client->irq, indio_dev);
+
+	if (client->dev.platform_data)
+		free_irq(*(unsigned int *)client->dev.platform_data, indio_dev);
+
 	iio_device_unregister(indio_dev);
 
 	return 0;
@@ -655,7 +667,7 @@ static __exit void ad7150_exit(void)
 }
 
 MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
-MODULE_DESCRIPTION("Analog Devices ad7150/1/6 capacitive sensor driver");
+MODULE_DESCRIPTION("Analog Devices AD7150/1/6 capacitive sensor driver");
 MODULE_LICENSE("GPL v2");
 
 module_init(ad7150_init);
-- 
1.7.3.4

  parent reply	other threads:[~2011-08-26 10:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 10:19 [PATCH 00/16] staging:iio: CDC and other driver updates Jonathan Cameron
2011-08-26 10:19 ` [PATCH 01/16] staging:iio:dac:ad5791 chan spec conversion Jonathan Cameron
2011-08-26 10:19 ` [PATCH 02/16] staging:iio:adc:ad7150: chan_spec conv + i2c_smbus commands + drop unused poweroff timeout control Jonathan Cameron
2011-08-26 10:19 ` [PATCH 03/16] staging:iio:adc:ad7150: remove conversion mode handling Jonathan Cameron
2011-08-26 10:19 ` Jonathan Cameron [this message]
2011-08-26 10:19 ` [PATCH 05/16] staging:iio:adc:ad7152 use smbus read / write functions + checkpatch fixes Jonathan Cameron
2011-08-26 10:19 ` [PATCH 06/16] staging:iio:adc:ad7152 set correct number of channels for ad7153 Jonathan Cameron
2011-08-26 10:19 ` [PATCH 07/16] staging:iio:adc:ad7152 bring more into line with abi Jonathan Cameron
2011-08-26 10:19 ` [PATCH 08/16] staging:iio:adc:ad7152: increase readability by introducing proper bit defines Jonathan Cameron
2011-08-26 10:19 ` [PATCH 09/16] staging:iio:adc:ad7152: Miscellaneous fixes and touch-up Jonathan Cameron
2011-08-26 10:19 ` [PATCH 10/16] staging:iio:adc:ad7152: update scale handling Jonathan Cameron
2011-08-26 10:19 ` [PATCH 11/16] staging:iio:adc:ad7152: Add proper locking Jonathan Cameron
2011-08-26 10:19 ` [PATCH 12/16] staging:iio:adc:ad7152: Update sample rate, conversion time, digital filter handling Jonathan Cameron
2011-08-26 10:19 ` [PATCH 13/16] staging:iio:adc:ad7152: Fix differential channel return value and increase delay Jonathan Cameron
2011-08-26 10:19 ` [PATCH 14/16] staging:iio:adc:ad7291 bring into line with current abi + chan_spec conversion Jonathan Cameron
2011-08-26 10:19 ` [PATCH 15/16] staging:iio:imu:adis16400 cleanups Jonathan Cameron
2011-08-26 10:19 ` [PATCH 16/16] iio: imu: adis16400: Avoid using printk facility Jonathan Cameron
2011-09-02 16:24 ` [PATCH 00/16] staging:iio: CDC and other driver updates Jonathan Cameron

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=1314353973-7662-5-git-send-email-jic23@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=michael.hennerich@analog.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;
as well as URLs for NNTP newsgroup(s).