* [PATCH 1/3] iio: capfun: fix typo
@ 2011-08-19 12:41 michael.hennerich
2011-08-19 12:41 ` [PATCH 2/3] iio: capfun: ad7150: remove conversion mode handling michael.hennerich
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: michael.hennerich @ 2011-08-19 12:41 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, device-drivers-devel, drivers, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/iio_core.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h
index edc295e..d7eb0d8 100644
--- a/drivers/staging/iio/iio_core.h
+++ b/drivers/staging/iio/iio_core.h
@@ -6,7 +6,7 @@
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
- * These definitions are meant for use only within the IIO core, not indvidual
+ * These definitions are meant for use only within the IIO core, not individual
* drivers.
*/
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] iio: capfun: ad7150: remove conversion mode handling.
2011-08-19 12:41 [PATCH 1/3] iio: capfun: fix typo michael.hennerich
@ 2011-08-19 12:41 ` michael.hennerich
2011-08-19 13:39 ` Jonathan Cameron
2011-08-19 12:41 ` [PATCH 3/3] iio: capfun: AD7150: Add support for the second interrupt strobe michael.hennerich
2011-08-19 12:51 ` [PATCH 1/3] iio: capfun: fix typo Jonathan Cameron
2 siblings, 1 reply; 9+ messages in thread
From: michael.hennerich @ 2011-08-19 12:41 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, device-drivers-devel, drivers, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
The AD7150 family of devices power up in continues conversion mode.
We can stay in this mode, unless power consumption becomes a real issue.
Actually the event generation as well as the running average
relies on continues conversion mode, so we better stay there.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/adc/ad7150.c | 94 --------------------------------------
1 files changed, 0 insertions(+), 94 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c
index fdf4da8..4bc5b20 100644
--- a/drivers/staging/iio/adc/ad7150.c
+++ b/drivers/staging/iio/adc/ad7150.c
@@ -88,93 +88,10 @@ struct ad7150_chip_info {
struct mutex state_lock;
};
-struct ad7150_conversion_mode {
- char *name;
- u8 reg_cfg;
-};
-
-static struct ad7150_conversion_mode
-ad7150_conv_mode_table[AD7150_MAX_CONV_MODE] = {
- { "idle", 0 },
- { "continuous-conversion", 1 },
- { "single-conversion", 2 },
- { "power-down", 3 },
-};
-
/*
* sysfs nodes
*/
-#define IIO_DEV_ATTR_AVAIL_CONVERSION_MODES(_show) \
- IIO_DEVICE_ATTR(available_conversion_modes, S_IRUGO, _show, NULL, 0)
-#define IIO_DEV_ATTR_CONVERSION_MODE(_mode, _show, _store) \
- IIO_DEVICE_ATTR(conversion_mode, _mode, _show, _store, 0)
-
-static ssize_t ad7150_show_conversion_modes(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- int i;
- int len = 0;
-
- for (i = 0; i < AD7150_MAX_CONV_MODE; i++)
- len += sprintf(buf + len, "%s\n",
- ad7150_conv_mode_table[i].name);
-
- return len;
-}
-
-static IIO_DEV_ATTR_AVAIL_CONVERSION_MODES(ad7150_show_conversion_modes);
-
-static ssize_t ad7150_show_conversion_mode(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7150_chip_info *chip = iio_priv(dev_info);
-
- return sprintf(buf, "%s\n", chip->conversion_mode);
-}
-
-static ssize_t ad7150_store_conversion_mode(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7150_chip_info *chip = iio_priv(dev_info);
- u8 cfg;
- int i, ret;
-
- ret = i2c_smbus_read_byte_data(chip->client, AD7150_CFG);
- if (ret < 0)
- return ret;
- cfg = ret;
-
- for (i = 0; i < AD7150_MAX_CONV_MODE; i++) {
- if (strncmp(buf, ad7150_conv_mode_table[i].name,
- strlen(ad7150_conv_mode_table[i].name) - 1) ==
- 0) {
- chip->conversion_mode = ad7150_conv_mode_table[i].name;
- cfg |= 0x18 | ad7150_conv_mode_table[i].reg_cfg;
- ret = i2c_smbus_write_byte_data(chip->client,
- AD7150_CFG,
- cfg);
- if (ret < 0)
- return ret;
- return len;
- }
- }
-
- dev_err(dev, "not supported conversion mode\n");
-
- return -EINVAL;
-}
-
-static IIO_DEV_ATTR_CONVERSION_MODE(S_IRUGO | S_IWUSR,
- ad7150_show_conversion_mode,
- ad7150_store_conversion_mode);
-
static const u8 ad7150_addresses[][6] = {
{ AD7150_CH1_DATA_HIGH, AD7150_CH1_AVG_HIGH,
AD7150_CH1_SETUP, AD7150_CH1_THR_HOLD_H,
@@ -542,16 +459,6 @@ static const struct iio_chan_spec ad7150_channels[] = {
},
};
-static struct attribute *ad7150_attributes[] = {
- &iio_dev_attr_available_conversion_modes.dev_attr.attr,
- &iio_dev_attr_conversion_mode.dev_attr.attr,
- NULL,
-};
-
-static const struct attribute_group ad7150_attribute_group = {
- .attrs = ad7150_attributes,
-};
-
/*
* threshold events
*/
@@ -636,7 +543,6 @@ static struct attribute_group ad7150_event_attribute_group = {
};
static const struct iio_info ad7150_info = {
- .attrs = &ad7150_attribute_group,
.event_attrs = &ad7150_event_attribute_group,
.driver_module = THIS_MODULE,
.read_raw = &ad7150_read_raw,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] iio: capfun: AD7150: Add support for the second interrupt strobe.
2011-08-19 12:41 [PATCH 1/3] iio: capfun: fix typo michael.hennerich
2011-08-19 12:41 ` [PATCH 2/3] iio: capfun: ad7150: remove conversion mode handling michael.hennerich
@ 2011-08-19 12:41 ` michael.hennerich
2011-08-19 13:38 ` Jonathan Cameron
2011-08-19 12:51 ` [PATCH 1/3] iio: capfun: fix typo Jonathan Cameron
2 siblings, 1 reply; 9+ messages in thread
From: michael.hennerich @ 2011-08-19 12:41 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, device-drivers-devel, drivers, Michael Hennerich
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>
---
drivers/staging/iio/adc/ad7150.c | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c
index 4bc5b20..711e8b1 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
@@ -596,17 +588,30 @@ 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(client->dev.platform_data,
+ NULL,
+ &ad7150_event_handler,
+ IRQF_TRIGGER_RISING |
+ IRQF_TRIGGER_FALLING,
+ "ad7150_irq2",
+ indio_dev);
+ if (ret)
+ goto error_free_irq;
+ }
+
dev_info(&client->dev, "%s capacitive sensor registered,irq: %d\n",
id->name, client->irq);
return 0;
-
+error_free_irq:
+ free_irq(client->irq, indio_dev);
error_free_dev:
if (regdone)
iio_device_unregister(indio_dev);
@@ -622,6 +627,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(client->dev.platform_data, indio_dev);
+
iio_device_unregister(indio_dev);
return 0;
@@ -656,7 +665,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.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] iio: capfun: fix typo
2011-08-19 12:41 [PATCH 1/3] iio: capfun: fix typo michael.hennerich
2011-08-19 12:41 ` [PATCH 2/3] iio: capfun: ad7150: remove conversion mode handling michael.hennerich
2011-08-19 12:41 ` [PATCH 3/3] iio: capfun: AD7150: Add support for the second interrupt strobe michael.hennerich
@ 2011-08-19 12:51 ` Jonathan Cameron
2 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2011-08-19 12:51 UTC (permalink / raw)
To: michael.hennerich; +Cc: linux-iio, device-drivers-devel, drivers
On 08/19/11 13:41, michael.hennerich@analog.com wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
>
Thanks will apply.
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
> drivers/staging/iio/iio_core.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h
> index edc295e..d7eb0d8 100644
> --- a/drivers/staging/iio/iio_core.h
> +++ b/drivers/staging/iio/iio_core.h
> @@ -6,7 +6,7 @@
> * under the terms of the GNU General Public License version 2 as published by
> * the Free Software Foundation.
> *
> - * These definitions are meant for use only within the IIO core, not indvidual
> + * These definitions are meant for use only within the IIO core, not individual
> * drivers.
> */
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] iio: capfun: AD7150: Add support for the second interrupt strobe.
2011-08-19 12:41 ` [PATCH 3/3] iio: capfun: AD7150: Add support for the second interrupt strobe michael.hennerich
@ 2011-08-19 13:38 ` Jonathan Cameron
2011-08-19 13:48 ` Jonathan Cameron
0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2011-08-19 13:38 UTC (permalink / raw)
To: michael.hennerich; +Cc: linux-iio, device-drivers-devel, drivers
On 08/19/11 13:41, michael.hennerich@analog.com wrote:
> 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.
Looks sane. I'll pull it into capfun for now.
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
> drivers/staging/iio/adc/ad7150.c | 33 +++++++++++++++++++++------------
> 1 files changed, 21 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c
> index 4bc5b20..711e8b1 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
> @@ -596,17 +588,30 @@ 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(client->dev.platform_data,
> + NULL,
> + &ad7150_event_handler,
> + IRQF_TRIGGER_RISING |
> + IRQF_TRIGGER_FALLING,
> + "ad7150_irq2",
> + indio_dev);
> + if (ret)
> + goto error_free_irq;
> + }
> +
> dev_info(&client->dev, "%s capacitive sensor registered,irq: %d\n",
> id->name, client->irq);
>
> return 0;
> -
> +error_free_irq:
> + free_irq(client->irq, indio_dev);
> error_free_dev:
> if (regdone)
> iio_device_unregister(indio_dev);
> @@ -622,6 +627,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(client->dev.platform_data, indio_dev);
> +
> iio_device_unregister(indio_dev);
>
> return 0;
> @@ -656,7 +665,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);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] iio: capfun: ad7150: remove conversion mode handling.
2011-08-19 12:41 ` [PATCH 2/3] iio: capfun: ad7150: remove conversion mode handling michael.hennerich
@ 2011-08-19 13:39 ` Jonathan Cameron
2011-08-22 11:48 ` Hennerich, Michael
0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2011-08-19 13:39 UTC (permalink / raw)
To: michael.hennerich; +Cc: linux-iio, device-drivers-devel, drivers
On 08/19/11 13:41, michael.hennerich@analog.com wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
>
> The AD7150 family of devices power up in continues conversion mode.
> We can stay in this mode, unless power consumption becomes a real issue.
> Actually the event generation as well as the running average
> relies on continues conversion mode, so we better stay there.
Makes sense
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
(rather than ack as I'll handle this patch through the capfun branch)
- actually I'll sign off all 3 for that reason.
> ---
> drivers/staging/iio/adc/ad7150.c | 94 --------------------------------------
> 1 files changed, 0 insertions(+), 94 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c
> index fdf4da8..4bc5b20 100644
> --- a/drivers/staging/iio/adc/ad7150.c
> +++ b/drivers/staging/iio/adc/ad7150.c
> @@ -88,93 +88,10 @@ struct ad7150_chip_info {
> struct mutex state_lock;
> };
>
> -struct ad7150_conversion_mode {
> - char *name;
> - u8 reg_cfg;
> -};
> -
> -static struct ad7150_conversion_mode
> -ad7150_conv_mode_table[AD7150_MAX_CONV_MODE] = {
> - { "idle", 0 },
> - { "continuous-conversion", 1 },
> - { "single-conversion", 2 },
> - { "power-down", 3 },
> -};
> -
> /*
> * sysfs nodes
> */
>
> -#define IIO_DEV_ATTR_AVAIL_CONVERSION_MODES(_show) \
> - IIO_DEVICE_ATTR(available_conversion_modes, S_IRUGO, _show, NULL, 0)
> -#define IIO_DEV_ATTR_CONVERSION_MODE(_mode, _show, _store) \
> - IIO_DEVICE_ATTR(conversion_mode, _mode, _show, _store, 0)
> -
> -static ssize_t ad7150_show_conversion_modes(struct device *dev,
> - struct device_attribute *attr,
> - char *buf)
> -{
> - int i;
> - int len = 0;
> -
> - for (i = 0; i < AD7150_MAX_CONV_MODE; i++)
> - len += sprintf(buf + len, "%s\n",
> - ad7150_conv_mode_table[i].name);
> -
> - return len;
> -}
> -
> -static IIO_DEV_ATTR_AVAIL_CONVERSION_MODES(ad7150_show_conversion_modes);
> -
> -static ssize_t ad7150_show_conversion_mode(struct device *dev,
> - struct device_attribute *attr,
> - char *buf)
> -{
> - struct iio_dev *dev_info = dev_get_drvdata(dev);
> - struct ad7150_chip_info *chip = iio_priv(dev_info);
> -
> - return sprintf(buf, "%s\n", chip->conversion_mode);
> -}
> -
> -static ssize_t ad7150_store_conversion_mode(struct device *dev,
> - struct device_attribute *attr,
> - const char *buf,
> - size_t len)
> -{
> - struct iio_dev *dev_info = dev_get_drvdata(dev);
> - struct ad7150_chip_info *chip = iio_priv(dev_info);
> - u8 cfg;
> - int i, ret;
> -
> - ret = i2c_smbus_read_byte_data(chip->client, AD7150_CFG);
> - if (ret < 0)
> - return ret;
> - cfg = ret;
> -
> - for (i = 0; i < AD7150_MAX_CONV_MODE; i++) {
> - if (strncmp(buf, ad7150_conv_mode_table[i].name,
> - strlen(ad7150_conv_mode_table[i].name) - 1) ==
> - 0) {
> - chip->conversion_mode = ad7150_conv_mode_table[i].name;
> - cfg |= 0x18 | ad7150_conv_mode_table[i].reg_cfg;
> - ret = i2c_smbus_write_byte_data(chip->client,
> - AD7150_CFG,
> - cfg);
> - if (ret < 0)
> - return ret;
> - return len;
> - }
> - }
> -
> - dev_err(dev, "not supported conversion mode\n");
> -
> - return -EINVAL;
> -}
> -
> -static IIO_DEV_ATTR_CONVERSION_MODE(S_IRUGO | S_IWUSR,
> - ad7150_show_conversion_mode,
> - ad7150_store_conversion_mode);
> -
> static const u8 ad7150_addresses[][6] = {
> { AD7150_CH1_DATA_HIGH, AD7150_CH1_AVG_HIGH,
> AD7150_CH1_SETUP, AD7150_CH1_THR_HOLD_H,
> @@ -542,16 +459,6 @@ static const struct iio_chan_spec ad7150_channels[] = {
> },
> };
>
> -static struct attribute *ad7150_attributes[] = {
> - &iio_dev_attr_available_conversion_modes.dev_attr.attr,
> - &iio_dev_attr_conversion_mode.dev_attr.attr,
> - NULL,
> -};
> -
> -static const struct attribute_group ad7150_attribute_group = {
> - .attrs = ad7150_attributes,
> -};
> -
> /*
> * threshold events
> */
> @@ -636,7 +543,6 @@ static struct attribute_group ad7150_event_attribute_group = {
> };
>
> static const struct iio_info ad7150_info = {
> - .attrs = &ad7150_attribute_group,
> .event_attrs = &ad7150_event_attribute_group,
> .driver_module = THIS_MODULE,
> .read_raw = &ad7150_read_raw,
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] iio: capfun: AD7150: Add support for the second interrupt strobe.
2011-08-19 13:38 ` Jonathan Cameron
@ 2011-08-19 13:48 ` Jonathan Cameron
2011-08-19 13:50 ` Jonathan Cameron
0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2011-08-19 13:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: michael.hennerich, linux-iio, device-drivers-devel, drivers
On 08/19/11 14:38, Jonathan Cameron wrote:
> On 08/19/11 13:41, michael.hennerich@analog.com wrote:
>> 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.
>
> Looks sane. I'll pull it into capfun for now.
>>
>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
>> ---
>> drivers/staging/iio/adc/ad7150.c | 33 +++++++++++++++++++++------------
>> 1 files changed, 21 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c
>> index 4bc5b20..711e8b1 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
>> @@ -596,17 +588,30 @@ 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(client->dev.platform_data,
Small query here - should this be
*client->dev.platform_data? (that's the fixup I've just merged)
>> + NULL,
>> + &ad7150_event_handler,
>> + IRQF_TRIGGER_RISING |
>> + IRQF_TRIGGER_FALLING,
>> + "ad7150_irq2",
>> + indio_dev);
>> + if (ret)
>> + goto error_free_irq;
>> + }
>> +
>> dev_info(&client->dev, "%s capacitive sensor registered,irq: %d\n",
>> id->name, client->irq);
>>
>> return 0;
>> -
>> +error_free_irq:
>> + free_irq(client->irq, indio_dev);
>> error_free_dev:
>> if (regdone)
>> iio_device_unregister(indio_dev);
>> @@ -622,6 +627,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(client->dev.platform_data, indio_dev);
>> +
>> iio_device_unregister(indio_dev);
>>
>> return 0;
>> @@ -656,7 +665,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);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] iio: capfun: AD7150: Add support for the second interrupt strobe.
2011-08-19 13:48 ` Jonathan Cameron
@ 2011-08-19 13:50 ` Jonathan Cameron
0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2011-08-19 13:50 UTC (permalink / raw)
To: Jonathan Cameron
Cc: michael.hennerich, linux-iio, device-drivers-devel, drivers
On 08/19/11 14:48, Jonathan Cameron wrote:
> On 08/19/11 14:38, Jonathan Cameron wrote:
>> On 08/19/11 13:41, michael.hennerich@analog.com wrote:
>>> 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.
>>
>> Looks sane. I'll pull it into capfun for now.
>>>
>>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
>> Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
>>> ---
>>> drivers/staging/iio/adc/ad7150.c | 33 +++++++++++++++++++++------------
>>> 1 files changed, 21 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c
>>> index 4bc5b20..711e8b1 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
>>> @@ -596,17 +588,30 @@ 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(client->dev.platform_data,
> Small query here - should this be
> *client->dev.platform_data? (that's the fixup I've just merged)
Doh. Of course that is a void derefernce.
What I mean is
*(unsigned int *)client->dev.platform_data.
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 2/3] iio: capfun: ad7150: remove conversion mode handling.
2011-08-19 13:39 ` Jonathan Cameron
@ 2011-08-22 11:48 ` Hennerich, Michael
0 siblings, 0 replies; 9+ messages in thread
From: Hennerich, Michael @ 2011-08-22 11:48 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org, Drivers
Jonathan Cameron wrote on 2011-08-19:
> On 08/19/11 13:41, michael.hennerich@analog.com wrote:
>> From: Michael Hennerich <michael.hennerich@analog.com>
>>
>> The AD7150 family of devices power up in continues conversion mode. We
>> can stay in this mode, unless power consumption becomes a real issue.
>> Actually the event generation as well as the running average relies on
>> continues conversion mode, so we better stay there. Makes sense
>>
>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
>
> (rather than ack as I'll handle this patch through the capfun branch)
> - actually I'll sign off all 3 for that reason.
Sure - no problem.
I'll send you more patches shortly when I tested the AD7152 driver.
-Michael
>> ---
>> drivers/staging/iio/adc/ad7150.c | 94 ----------------------------
>> ---------- 1 files changed, 0 insertions(+), 94 deletions(-)
>> diff --git a/drivers/staging/iio/adc/ad7150.c
>> b/drivers/staging/iio/adc/ad7150.c index fdf4da8..4bc5b20 100644 ---
>> a/drivers/staging/iio/adc/ad7150.c +++
>> b/drivers/staging/iio/adc/ad7150.c @@ -88,93 +88,10 @@ struct
>> ad7150_chip_info {
>> struct mutex state_lock;
>> };
>> -struct ad7150_conversion_mode {
>> - char *name;
>> - u8 reg_cfg;
>> -};
>> -
>> -static struct ad7150_conversion_mode
>> -ad7150_conv_mode_table[AD7150_MAX_CONV_MODE] =3D {
>> - { "idle", 0 },
>> - { "continuous-conversion", 1 },
>> - { "single-conversion", 2 },
>> - { "power-down", 3 },
>> -};
>> -
>> /*
>> * sysfs nodes
>> */
>> -#define IIO_DEV_ATTR_AVAIL_CONVERSION_MODES(_show) \
>> - IIO_DEVICE_ATTR(available_conversion_modes, S_IRUGO, _show, NULL, 0=
)
>> -#define IIO_DEV_ATTR_CONVERSION_MODE(_mode, _show, _store) \
>> - IIO_DEVICE_ATTR(conversion_mode, _mode, _show, _store, 0) - -static
>> ssize_t ad7150_show_conversion_modes(struct device *dev, - str=
uct
>> device_attribute *attr, - char *buf) -{ - int i; - int=
len =3D 0; -
>> - for (i =3D 0; i < AD7150_MAX_CONV_MODE; i++) - len +=3D =
sprintf(buf +
>> len, "%s\n", - ad7150_conv_mode_table[i].na=
me); - - return
>> len; -} - -static
>> IIO_DEV_ATTR_AVAIL_CONVERSION_MODES(ad7150_show_conversion_modes); -
>> -static ssize_t ad7150_show_conversion_mode(struct device *dev,
>> - struct device_attribute *attr, - char *buf) =
-{ - struct iio_dev
>> *dev_info =3D dev_get_drvdata(dev); - struct ad7150_chip_info *chip =3D
>> iio_priv(dev_info); - - return sprintf(buf, "%s\n",
>> chip->conversion_mode); -} - -static ssize_t
>> ad7150_store_conversion_mode(struct device *dev, - struct
>> device_attribute *attr, - const char *buf, - siz=
e_t len) -{ - struct
>> iio_dev *dev_info =3D dev_get_drvdata(dev); - struct ad7150_chip_info
>> *chip =3D iio_priv(dev_info); - u8 cfg; - int i, ret; - - r=
et =3D
>> i2c_smbus_read_byte_data(chip->client, AD7150_CFG); - if (ret < 0=
)
>> - return ret; - cfg =3D ret; - - for (i =3D 0; i < AD7150_=
MAX_CONV_MODE;
>> i++) { - if (strncmp(buf, ad7150_conv_mode_table[i].name,
>> - strlen(ad7150_conv_mode_table[i].name) - 1)=
=3D=3D - 0) {
>> - chip->conversion_mode =3D ad7150_conv_mode_table[i]=
.name; - cfg |=3D
>> 0x18 | ad7150_conv_mode_table[i].reg_cfg; - ret =3D
>> i2c_smbus_write_byte_data(chip->client, - =
AD7150_CFG,
>> - cfg); - =
if (ret < 0) - return ret; - =
return len; - }
>> - } - - dev_err(dev, "not supported conversion mode\n"); - - ret=
urn
>> -EINVAL; -} - -static IIO_DEV_ATTR_CONVERSION_MODE(S_IRUGO | S_IWUSR,
>> - ad7150_show_conversion_mode, - ad7150_store_conver=
sion_mode); -
>> static const u8 ad7150_addresses[][6] =3D {
>> { AD7150_CH1_DATA_HIGH, AD7150_CH1_AVG_HIGH,
>> AD7150_CH1_SETUP, AD7150_CH1_THR_HOLD_H,
>> @@ -542,16 +459,6 @@ static const struct iio_chan_spec
> ad7150_channels[] =3D {
>> },
>> };
>> -static struct attribute *ad7150_attributes[] =3D {
>> - &iio_dev_attr_available_conversion_modes.dev_attr.attr,
>> - &iio_dev_attr_conversion_mode.dev_attr.attr,
>> - NULL,
>> -};
>> -
>> -static const struct attribute_group ad7150_attribute_group =3D {
>> - .attrs =3D ad7150_attributes,
>> -};
>> -
>> /*
>> * threshold events
>> */
>> @@ -636,7 +543,6 @@ static struct attribute_group
> ad7150_event_attribute_group =3D {
>> };
>>
>> static const struct iio_info ad7150_info =3D { - .attrs =3D
>> &ad7150_attribute_group, .event_attrs =3D
>> &ad7150_event_attribute_group, .driver_module =3D THIS_MODULE,
>> .read_raw =3D &ad7150_read_raw,
>
Greetings,
Michael
--
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Mar=
garet Seif
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-08-22 11:48 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-19 12:41 [PATCH 1/3] iio: capfun: fix typo michael.hennerich
2011-08-19 12:41 ` [PATCH 2/3] iio: capfun: ad7150: remove conversion mode handling michael.hennerich
2011-08-19 13:39 ` Jonathan Cameron
2011-08-22 11:48 ` Hennerich, Michael
2011-08-19 12:41 ` [PATCH 3/3] iio: capfun: AD7150: Add support for the second interrupt strobe michael.hennerich
2011-08-19 13:38 ` Jonathan Cameron
2011-08-19 13:48 ` Jonathan Cameron
2011-08-19 13:50 ` Jonathan Cameron
2011-08-19 12:51 ` [PATCH 1/3] iio: capfun: fix typo Jonathan Cameron
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).