* [PATCH 1/3] iio: core: introduce dB scle: IIO_VAL_INT_PLUS_MICRO_DB
@ 2012-05-11 9:36 michael.hennerich
2012-05-11 9:36 ` [PATCH 2/3] iio: core: introduce IIO_CHAN_INFO_HARDWAREGAIN michael.hennerich
2012-05-11 9:36 ` [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier michael.hennerich
0 siblings, 2 replies; 8+ messages in thread
From: michael.hennerich @ 2012-05-11 9:36 UTC (permalink / raw)
To: gregkh; +Cc: jic23, linux-iio, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron<jic23@kernel.org>
---
drivers/iio/industrialio-core.c | 19 +++++++++++++------
include/linux/iio/types.h | 1 +
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index b39a587..425cd4c 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -295,26 +295,33 @@ static ssize_t iio_read_channel_info(struct device *dev,
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int val, val2;
+ bool scale_db = false;
int ret = indio_dev->info->read_raw(indio_dev, this_attr->c,
&val, &val2, this_attr->address);
if (ret < 0)
return ret;
- if (ret == IIO_VAL_INT)
+ switch (ret) {
+ case IIO_VAL_INT:
return sprintf(buf, "%d\n", val);
- else if (ret == IIO_VAL_INT_PLUS_MICRO) {
+ case IIO_VAL_INT_PLUS_MICRO_DB:
+ scale_db = true;
+ case IIO_VAL_INT_PLUS_MICRO:
if (val2 < 0)
- return sprintf(buf, "-%d.%06u\n", val, -val2);
+ return sprintf(buf, "-%d.%06u%s\n", val, -val2,
+ scale_db ? " dB" : "");
else
- return sprintf(buf, "%d.%06u\n", val, val2);
- } else if (ret == IIO_VAL_INT_PLUS_NANO) {
+ return sprintf(buf, "%d.%06u%s\n", val, val2,
+ scale_db ? " dB" : "");
+ case IIO_VAL_INT_PLUS_NANO:
if (val2 < 0)
return sprintf(buf, "-%d.%09u\n", val, -val2);
else
return sprintf(buf, "%d.%09u\n", val, val2);
- } else
+ default:
return 0;
+ }
}
static ssize_t iio_write_channel_info(struct device *dev,
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index a471fd5..1b073b1 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -50,5 +50,6 @@ enum iio_modifier {
#define IIO_VAL_INT 1
#define IIO_VAL_INT_PLUS_MICRO 2
#define IIO_VAL_INT_PLUS_NANO 3
+#define IIO_VAL_INT_PLUS_MICRO_DB 4
#endif /* _IIO_TYPES_H_ */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/3] iio: core: introduce IIO_CHAN_INFO_HARDWAREGAIN
2012-05-11 9:36 [PATCH 1/3] iio: core: introduce dB scle: IIO_VAL_INT_PLUS_MICRO_DB michael.hennerich
@ 2012-05-11 9:36 ` michael.hennerich
2012-05-11 9:36 ` [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier michael.hennerich
1 sibling, 0 replies; 8+ messages in thread
From: michael.hennerich @ 2012-05-11 9:36 UTC (permalink / raw)
To: gregkh; +Cc: jic23, linux-iio, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron<jic23@kernel.org>
---
Documentation/ABI/testing/sysfs-bus-iio | 7 +++++++
drivers/iio/industrialio-core.c | 1 +
include/linux/iio/iio.h | 5 +++++
3 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index 2ce4dad..5bc8a47 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -280,6 +280,13 @@ Description:
If a discrete set of scale values are available, they
are listed in this attribute.
+What /sys/bus/iio/devices/iio:deviceX/out_voltageY_hardwaregain
+KernelVersion: 2.6.35
+Contact: linux-iio@vger.kernel.org
+Description:
+ Hardware applied gain factor. If shared across all channels,
+ <type>_hardwaregain is used.
+
What: /sys/.../in_accel_filter_low_pass_3db_frequency
What: /sys/.../in_magn_filter_low_pass_3db_frequency
What: /sys/.../in_anglvel_filter_low_pass_3db_frequency
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 425cd4c..86f3460 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -91,6 +91,7 @@ static const char * const iio_chan_info_postfix[] = {
[IIO_CHAN_INFO_SAMP_FREQ] = "sampling_frequency",
[IIO_CHAN_INFO_FREQUENCY] = "frequency",
[IIO_CHAN_INFO_PHASE] = "phase",
+ [IIO_CHAN_INFO_HARDWAREGAIN] = "hardwaregain",
};
const struct iio_chan_spec
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 6fdbdb8..897c6b0 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -34,6 +34,7 @@ enum iio_chan_info_enum {
IIO_CHAN_INFO_SAMP_FREQ,
IIO_CHAN_INFO_FREQUENCY,
IIO_CHAN_INFO_PHASE,
+ IIO_CHAN_INFO_HARDWAREGAIN,
};
#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
@@ -95,6 +96,10 @@ enum iio_chan_info_enum {
IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE)
#define IIO_CHAN_INFO_PHASE_SHARED_BIT \
IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE)
+#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT \
+ IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
+#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \
+ IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
enum iio_endian {
IIO_CPU,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier
2012-05-11 9:36 [PATCH 1/3] iio: core: introduce dB scle: IIO_VAL_INT_PLUS_MICRO_DB michael.hennerich
2012-05-11 9:36 ` [PATCH 2/3] iio: core: introduce IIO_CHAN_INFO_HARDWAREGAIN michael.hennerich
@ 2012-05-11 9:36 ` michael.hennerich
2012-05-14 20:13 ` Greg KH
1 sibling, 1 reply; 8+ messages in thread
From: michael.hennerich @ 2012-05-11 9:36 UTC (permalink / raw)
To: gregkh; +Cc: jic23, linux-iio, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Changes since V1:
Apply review feedback:
Introduce and use IIO_CHAN_INFO_HARDWAREGAIN
Introduce and use Use IIO_VAL_INT_PLUS_MICRO_DB
Modify out of staging include paths.
Convert to new iio core API naming.
Changes since V2:
more sanity checking in write_raw
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron<jic23@kernel.org>
---
drivers/iio/Kconfig | 2 +
drivers/iio/Makefile | 2 +
drivers/iio/amplifiers/Kconfig | 17 +++
drivers/iio/amplifiers/Makefile | 5 +
drivers/iio/amplifiers/ad8366.c | 222 +++++++++++++++++++++++++++++++++++++++
5 files changed, 248 insertions(+), 0 deletions(-)
create mode 100644 drivers/iio/amplifiers/Kconfig
create mode 100644 drivers/iio/amplifiers/Makefile
create mode 100644 drivers/iio/amplifiers/ad8366.c
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
index 3ab7d48..bb1e35c 100644
--- a/drivers/iio/Kconfig
+++ b/drivers/iio/Kconfig
@@ -48,4 +48,6 @@ config IIO_CONSUMERS_PER_TRIGGER
This value controls the maximum number of consumers that a
given trigger may handle. Default is 2.
+source "drivers/iio/amplifiers/Kconfig"
+
endif # IIO
diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
index d5fc57d..5552491 100644
--- a/drivers/iio/Makefile
+++ b/drivers/iio/Makefile
@@ -8,3 +8,5 @@ industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o
industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o
obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o
+
+obj-y += amplifiers/
diff --git a/drivers/iio/amplifiers/Kconfig b/drivers/iio/amplifiers/Kconfig
new file mode 100644
index 0000000..05d707e
--- /dev/null
+++ b/drivers/iio/amplifiers/Kconfig
@@ -0,0 +1,17 @@
+#
+# Gain Amplifiers, etc.
+#
+menu "Amplifiers"
+
+config AD8366
+ tristate "Analog Devices AD8366 VGA"
+ depends on SPI
+ select BITREVERSE
+ help
+ Say yes here to build support for Analog Devices AD8366
+ SPI Dual-Digital Variable Gain Amplifier (VGA).
+
+ To compile this driver as a module, choose M here: the
+ module will be called ad8366.
+
+endmenu
diff --git a/drivers/iio/amplifiers/Makefile b/drivers/iio/amplifiers/Makefile
new file mode 100644
index 0000000..a6ca366
--- /dev/null
+++ b/drivers/iio/amplifiers/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile iio/amplifiers
+#
+
+obj-$(CONFIG_AD8366) += ad8366.o
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
new file mode 100644
index 0000000..d8281cd
--- /dev/null
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -0,0 +1,222 @@
+/*
+ * AD8366 SPI Dual-Digital Variable Gain Amplifier (VGA)
+ *
+ * Copyright 2012 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2.
+ */
+
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/sysfs.h>
+#include <linux/spi/spi.h>
+#include <linux/regulator/consumer.h>
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/bitrev.h>
+
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+
+struct ad8366_state {
+ struct spi_device *spi;
+ struct regulator *reg;
+ unsigned char ch[2];
+ /*
+ * DMA (thus cache coherency maintenance) requires the
+ * transfer buffers to live in their own cache lines.
+ */
+ unsigned char data[2] ____cacheline_aligned;
+};
+
+static int ad8366_write(struct iio_dev *indio_dev,
+ unsigned char ch_a, char unsigned ch_b)
+{
+ struct ad8366_state *st = iio_priv(indio_dev);
+ int ret;
+
+ ch_a = bitrev8(ch_a & 0x3F);
+ ch_b = bitrev8(ch_b & 0x3F);
+
+ st->data[0] = ch_b >> 4;
+ st->data[1] = (ch_b << 4) | (ch_a >> 2);
+
+ ret = spi_write(st->spi, st->data, ARRAY_SIZE(st->data));
+ if (ret < 0)
+ dev_err(&indio_dev->dev, "write failed (%d)", ret);
+
+ return ret;
+}
+
+static int ad8366_read_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int *val,
+ int *val2,
+ long m)
+{
+ struct ad8366_state *st = iio_priv(indio_dev);
+ int ret;
+ unsigned code;
+
+ mutex_lock(&indio_dev->mlock);
+ switch (m) {
+ case IIO_CHAN_INFO_HARDWAREGAIN:
+ code = st->ch[chan->channel];
+
+ /* Values in dB */
+ code = code * 253 + 4500;
+ *val = code / 1000;
+ *val2 = (code % 1000) * 1000;
+
+ ret = IIO_VAL_INT_PLUS_MICRO_DB;
+ break;
+ default:
+ ret = -EINVAL;
+ }
+ mutex_unlock(&indio_dev->mlock);
+
+ return ret;
+};
+
+static int ad8366_write_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int val,
+ int val2,
+ long mask)
+{
+ struct ad8366_state *st = iio_priv(indio_dev);
+ unsigned code;
+ int ret;
+
+ if (val < 0 || val2 < 0)
+ return -EINVAL;
+
+ /* Values in dB */
+ code = (((u8)val * 1000) + ((u32)val2 / 1000));
+
+ if (code > 20500 || code < 4500)
+ return -EINVAL;
+
+ code = (code - 4500) / 253;
+
+ mutex_lock(&indio_dev->mlock);
+ switch (mask) {
+ case IIO_CHAN_INFO_HARDWAREGAIN:
+ st->ch[chan->channel] = code;
+ ret = ad8366_write(indio_dev, st->ch[0], st->ch[1]);
+ break;
+ default:
+ ret = -EINVAL;
+ }
+ mutex_unlock(&indio_dev->mlock);
+
+ return ret;
+}
+
+static const struct iio_info ad8366_info = {
+ .read_raw = &ad8366_read_raw,
+ .write_raw = &ad8366_write_raw,
+ .driver_module = THIS_MODULE,
+};
+
+#define AD8366_CHAN(_channel) { \
+ .type = IIO_VOLTAGE, \
+ .output = 1, \
+ .indexed = 1, \
+ .channel = _channel, \
+ .info_mask = IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT,\
+}
+
+static const struct iio_chan_spec ad8366_channels[] = {
+ AD8366_CHAN(0),
+ AD8366_CHAN(1),
+};
+
+static int __devinit ad8366_probe(struct spi_device *spi)
+{
+ struct iio_dev *indio_dev;
+ struct ad8366_state *st;
+ int ret;
+
+ indio_dev = iio_device_alloc(sizeof(*st));
+ if (indio_dev == NULL)
+ return -ENOMEM;
+
+ st = iio_priv(indio_dev);
+
+ st->reg = regulator_get(&spi->dev, "vcc");
+ if (!IS_ERR(st->reg)) {
+ ret = regulator_enable(st->reg);
+ if (ret)
+ goto error_put_reg;
+ }
+
+ spi_set_drvdata(spi, indio_dev);
+ st->spi = spi;
+
+ indio_dev->dev.parent = &spi->dev;
+ indio_dev->name = spi_get_device_id(spi)->name;
+ indio_dev->info = &ad8366_info;
+ indio_dev->modes = INDIO_DIRECT_MODE;
+ indio_dev->channels = ad8366_channels;
+ indio_dev->num_channels = ARRAY_SIZE(ad8366_channels);
+
+ ret = iio_device_register(indio_dev);
+ if (ret)
+ goto error_disable_reg;
+
+ ad8366_write(indio_dev, 0 , 0);
+
+ return 0;
+
+error_disable_reg:
+ if (!IS_ERR(st->reg))
+ regulator_disable(st->reg);
+error_put_reg:
+ if (!IS_ERR(st->reg))
+ regulator_put(st->reg);
+
+ iio_device_free(indio_dev);
+
+ return ret;
+}
+
+static int __devexit ad8366_remove(struct spi_device *spi)
+{
+ struct iio_dev *indio_dev = spi_get_drvdata(spi);
+ struct ad8366_state *st = iio_priv(indio_dev);
+ struct regulator *reg = st->reg;
+
+ iio_device_unregister(indio_dev);
+
+ if (!IS_ERR(reg)) {
+ regulator_disable(reg);
+ regulator_put(reg);
+ }
+
+ iio_device_free(indio_dev);
+
+ return 0;
+}
+
+static const struct spi_device_id ad8366_id[] = {
+ {"ad8366", 0},
+ {}
+};
+
+static struct spi_driver ad8366_driver = {
+ .driver = {
+ .name = KBUILD_MODNAME,
+ .owner = THIS_MODULE,
+ },
+ .probe = ad8366_probe,
+ .remove = __devexit_p(ad8366_remove),
+ .id_table = ad8366_id,
+};
+
+module_spi_driver(ad8366_driver);
+
+MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
+MODULE_DESCRIPTION("Analog Devices AD8366 VGA");
+MODULE_LICENSE("GPL v2");
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier
2012-05-11 9:36 ` [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier michael.hennerich
@ 2012-05-14 20:13 ` Greg KH
0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2012-05-14 20:13 UTC (permalink / raw)
To: michael.hennerich; +Cc: jic23, linux-iio, device-drivers-devel
On Fri, May 11, 2012 at 11:36:54AM +0200, michael.hennerich@analog.com wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
>
> Changes since V1:
>
> Apply review feedback:
> Introduce and use IIO_CHAN_INFO_HARDWAREGAIN
> Introduce and use Use IIO_VAL_INT_PLUS_MICRO_DB
>
> Modify out of staging include paths.
> Convert to new iio core API naming.
>
> Changes since V2:
>
> more sanity checking in write_raw
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> Acked-by: Jonathan Cameron<jic23@kernel.org>
> ---
> drivers/iio/Kconfig | 2 +
> drivers/iio/Makefile | 2 +
> drivers/iio/amplifiers/Kconfig | 17 +++
> drivers/iio/amplifiers/Makefile | 5 +
> drivers/iio/amplifiers/ad8366.c | 222 +++++++++++++++++++++++++++++++++++++++
Woah, the first "real" iio driver? Congrats!
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] iio: core: introduce dB scle: IIO_VAL_INT_PLUS_MICRO_DB
@ 2012-05-09 10:36 michael.hennerich
2012-05-09 10:36 ` [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier michael.hennerich
0 siblings, 1 reply; 8+ messages in thread
From: michael.hennerich @ 2012-05-09 10:36 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/iio/industrialio-core.c | 19 +++++++++++++------
include/linux/iio/types.h | 1 +
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 72e33b8..e799d35 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -306,26 +306,33 @@ static ssize_t iio_read_channel_info(struct device *dev,
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int val, val2;
+ bool scale_db = false;
int ret = indio_dev->info->read_raw(indio_dev, this_attr->c,
&val, &val2, this_attr->address);
if (ret < 0)
return ret;
- if (ret == IIO_VAL_INT)
+ switch (ret) {
+ case IIO_VAL_INT:
return sprintf(buf, "%d\n", val);
- else if (ret == IIO_VAL_INT_PLUS_MICRO) {
+ case IIO_VAL_INT_PLUS_MICRO_DB:
+ scale_db = true;
+ case IIO_VAL_INT_PLUS_MICRO:
if (val2 < 0)
- return sprintf(buf, "-%d.%06u\n", val, -val2);
+ return sprintf(buf, "-%d.%06u%s\n", val, -val2,
+ scale_db ? " dB" : "");
else
- return sprintf(buf, "%d.%06u\n", val, val2);
- } else if (ret == IIO_VAL_INT_PLUS_NANO) {
+ return sprintf(buf, "%d.%06u%s\n", val, val2,
+ scale_db ? " dB" : "");
+ case IIO_VAL_INT_PLUS_NANO:
if (val2 < 0)
return sprintf(buf, "-%d.%09u\n", val, -val2);
else
return sprintf(buf, "%d.%09u\n", val, val2);
- } else
+ default:
return 0;
+ }
}
static ssize_t iio_write_channel_info(struct device *dev,
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index a471fd5..1b073b1 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -50,5 +50,6 @@ enum iio_modifier {
#define IIO_VAL_INT 1
#define IIO_VAL_INT_PLUS_MICRO 2
#define IIO_VAL_INT_PLUS_NANO 3
+#define IIO_VAL_INT_PLUS_MICRO_DB 4
#endif /* _IIO_TYPES_H_ */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier
2012-05-09 10:36 [PATCH 1/3] iio: core: introduce dB scle: IIO_VAL_INT_PLUS_MICRO_DB michael.hennerich
@ 2012-05-09 10:36 ` michael.hennerich
2012-05-10 9:08 ` Jonathan Cameron
0 siblings, 1 reply; 8+ messages in thread
From: michael.hennerich @ 2012-05-09 10:36 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Changes since V1:
Apply review feedback:
Introduce and use IIO_CHAN_INFO_HARDWAREGAIN
Introduce and use Use IIO_VAL_INT_PLUS_MICRO_DB
Modify out of staging include paths.
Convert to new iio core API naming.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/Kconfig | 1 +
drivers/staging/iio/Makefile | 1 +
drivers/staging/iio/amplifiers/Kconfig | 17 +++
drivers/staging/iio/amplifiers/Makefile | 5 +
drivers/staging/iio/amplifiers/ad8366.c | 219 +++++++++++++++++++++++++++++++
5 files changed, 243 insertions(+), 0 deletions(-)
create mode 100644 drivers/staging/iio/amplifiers/Kconfig
create mode 100644 drivers/staging/iio/amplifiers/Makefile
create mode 100644 drivers/staging/iio/amplifiers/ad8366.c
diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig
index 3c8e5ec..10c899b 100644
--- a/drivers/staging/iio/Kconfig
+++ b/drivers/staging/iio/Kconfig
@@ -28,6 +28,7 @@ endif # IIO_BUFFER
source "drivers/staging/iio/accel/Kconfig"
source "drivers/staging/iio/adc/Kconfig"
source "drivers/staging/iio/addac/Kconfig"
+source "drivers/staging/iio/amplifiers/Kconfig"
source "drivers/staging/iio/cdc/Kconfig"
source "drivers/staging/iio/dac/Kconfig"
source "drivers/staging/iio/frequency/Kconfig"
diff --git a/drivers/staging/iio/Makefile b/drivers/staging/iio/Makefile
index 6a46d5a..8e18228 100644
--- a/drivers/staging/iio/Makefile
+++ b/drivers/staging/iio/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_IIO_ST_HWMON) += iio_hwmon.o
obj-y += accel/
obj-y += adc/
obj-y += addac/
+obj-y += amplifiers/
obj-y += cdc/
obj-y += dac/
obj-y += frequency/
diff --git a/drivers/staging/iio/amplifiers/Kconfig b/drivers/staging/iio/amplifiers/Kconfig
new file mode 100644
index 0000000..05d707e
--- /dev/null
+++ b/drivers/staging/iio/amplifiers/Kconfig
@@ -0,0 +1,17 @@
+#
+# Gain Amplifiers, etc.
+#
+menu "Amplifiers"
+
+config AD8366
+ tristate "Analog Devices AD8366 VGA"
+ depends on SPI
+ select BITREVERSE
+ help
+ Say yes here to build support for Analog Devices AD8366
+ SPI Dual-Digital Variable Gain Amplifier (VGA).
+
+ To compile this driver as a module, choose M here: the
+ module will be called ad8366.
+
+endmenu
diff --git a/drivers/staging/iio/amplifiers/Makefile b/drivers/staging/iio/amplifiers/Makefile
new file mode 100644
index 0000000..a6ca366
--- /dev/null
+++ b/drivers/staging/iio/amplifiers/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile iio/amplifiers
+#
+
+obj-$(CONFIG_AD8366) += ad8366.o
diff --git a/drivers/staging/iio/amplifiers/ad8366.c b/drivers/staging/iio/amplifiers/ad8366.c
new file mode 100644
index 0000000..9067750
--- /dev/null
+++ b/drivers/staging/iio/amplifiers/ad8366.c
@@ -0,0 +1,219 @@
+/*
+ * AD8366 SPI Dual-Digital Variable Gain Amplifier (VGA)
+ *
+ * Copyright 2012 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2.
+ */
+
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/sysfs.h>
+#include <linux/spi/spi.h>
+#include <linux/regulator/consumer.h>
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/bitrev.h>
+
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+
+struct ad8366_state {
+ struct spi_device *spi;
+ struct regulator *reg;
+ unsigned char ch[2];
+ /*
+ * DMA (thus cache coherency maintenance) requires the
+ * transfer buffers to live in their own cache lines.
+ */
+ unsigned char data[2] ____cacheline_aligned;
+};
+
+static int ad8366_write(struct iio_dev *indio_dev,
+ unsigned char ch_a, char unsigned ch_b)
+{
+ struct ad8366_state *st = iio_priv(indio_dev);
+ int ret;
+
+ ch_a = bitrev8(ch_a & 0x3F);
+ ch_b = bitrev8(ch_b & 0x3F);
+
+ st->data[0] = ch_b >> 4;
+ st->data[1] = (ch_b << 4) | (ch_a >> 2);
+
+ ret = spi_write(st->spi, st->data, ARRAY_SIZE(st->data));
+ if (ret < 0)
+ dev_err(&indio_dev->dev, "write failed (%d)", ret);
+
+ return ret;
+}
+
+static int ad8366_read_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int *val,
+ int *val2,
+ long m)
+{
+ struct ad8366_state *st = iio_priv(indio_dev);
+ int ret;
+ unsigned code;
+
+ mutex_lock(&indio_dev->mlock);
+ switch (m) {
+ case IIO_CHAN_INFO_HARDWAREGAIN:
+ code = st->ch[chan->channel];
+
+ /* Values in dB */
+ code = code * 253 + 4500;
+ *val = code / 1000;
+ *val2 = (code % 1000) * 1000;
+
+ ret = IIO_VAL_INT_PLUS_MICRO_DB;
+ break;
+ default:
+ ret = -EINVAL;
+ }
+ mutex_unlock(&indio_dev->mlock);
+
+ return ret;
+};
+
+static int ad8366_write_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int val,
+ int val2,
+ long mask)
+{
+ struct ad8366_state *st = iio_priv(indio_dev);
+ unsigned code;
+ int ret;
+
+ /* Values in dB */
+ code = (((u8)val * 1000) + ((u32)val2 / 1000));
+
+ if (code > 20500 || code < 4500)
+ return -EINVAL;
+
+ code = (code - 4500) / 253;
+
+ mutex_lock(&indio_dev->mlock);
+ switch (mask) {
+ case IIO_CHAN_INFO_HARDWAREGAIN:
+ st->ch[chan->channel] = code;
+ ret = ad8366_write(indio_dev, st->ch[0], st->ch[1]);
+ break;
+ default:
+ ret = -EINVAL;
+ }
+ mutex_unlock(&indio_dev->mlock);
+
+ return ret;
+}
+
+static const struct iio_info ad8366_info = {
+ .read_raw = &ad8366_read_raw,
+ .write_raw = &ad8366_write_raw,
+ .driver_module = THIS_MODULE,
+};
+
+#define AD8366_CHAN(_channel) { \
+ .type = IIO_VOLTAGE, \
+ .output = 1, \
+ .indexed = 1, \
+ .channel = _channel, \
+ .info_mask = IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT,\
+}
+
+static const struct iio_chan_spec ad8366_channels[] = {
+ AD8366_CHAN(0),
+ AD8366_CHAN(1),
+};
+
+static int __devinit ad8366_probe(struct spi_device *spi)
+{
+ struct iio_dev *indio_dev;
+ struct ad8366_state *st;
+ int ret;
+
+ indio_dev = iio_device_alloc(sizeof(*st));
+ if (indio_dev == NULL)
+ return -ENOMEM;
+
+ st = iio_priv(indio_dev);
+
+ st->reg = regulator_get(&spi->dev, "vcc");
+ if (!IS_ERR(st->reg)) {
+ ret = regulator_enable(st->reg);
+ if (ret)
+ goto error_put_reg;
+ }
+
+ spi_set_drvdata(spi, indio_dev);
+ st->spi = spi;
+
+ indio_dev->dev.parent = &spi->dev;
+ indio_dev->name = spi_get_device_id(spi)->name;
+ indio_dev->info = &ad8366_info;
+ indio_dev->modes = INDIO_DIRECT_MODE;
+ indio_dev->channels = ad8366_channels;
+ indio_dev->num_channels = ARRAY_SIZE(ad8366_channels);
+
+ ret = iio_device_register(indio_dev);
+ if (ret)
+ goto error_disable_reg;
+
+ ad8366_write(indio_dev, 0 , 0);
+
+ return 0;
+
+error_disable_reg:
+ if (!IS_ERR(st->reg))
+ regulator_disable(st->reg);
+error_put_reg:
+ if (!IS_ERR(st->reg))
+ regulator_put(st->reg);
+
+ iio_device_free(indio_dev);
+
+ return ret;
+}
+
+static int __devexit ad8366_remove(struct spi_device *spi)
+{
+ struct iio_dev *indio_dev = spi_get_drvdata(spi);
+ struct ad8366_state *st = iio_priv(indio_dev);
+ struct regulator *reg = st->reg;
+
+ iio_device_unregister(indio_dev);
+
+ if (!IS_ERR(reg)) {
+ regulator_disable(reg);
+ regulator_put(reg);
+ }
+
+ iio_device_free(indio_dev);
+
+ return 0;
+}
+
+static const struct spi_device_id ad8366_id[] = {
+ {"ad8366", 0},
+ {}
+};
+
+static struct spi_driver ad8366_driver = {
+ .driver = {
+ .name = KBUILD_MODNAME,
+ .owner = THIS_MODULE,
+ },
+ .probe = ad8366_probe,
+ .remove = __devexit_p(ad8366_remove),
+ .id_table = ad8366_id,
+};
+
+module_spi_driver(ad8366_driver);
+
+MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
+MODULE_DESCRIPTION("Analog Devices AD8366 VGA");
+MODULE_LICENSE("GPL v2");
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier
2012-05-09 10:36 ` [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier michael.hennerich
@ 2012-05-10 9:08 ` Jonathan Cameron
2012-05-11 7:32 ` Michael Hennerich
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2012-05-10 9:08 UTC (permalink / raw)
To: michael.hennerich; +Cc: linux-iio, device-drivers-devel
On 5/9/2012 11:36 AM, michael.hennerich@analog.com wrote:
> From: Michael Hennerich<michael.hennerich@analog.com>
>
> Changes since V1:
>
> Apply review feedback:
> Introduce and use IIO_CHAN_INFO_HARDWAREGAIN
> Introduce and use Use IIO_VAL_INT_PLUS_MICRO_DB
>
> Modify out of staging include paths.
> Convert to new iio core API naming.
For reasons I don't understand thunderbird on windows (yes I'm doing
this whilst waiting for something to run at the day job), is wrecking
spacing in subtle ways despite being in plain text mode... Grr.
Anyhow, my only real comment is that I think we may want a little more
value sanity checking in the write_raw function. Not critical as
hopefully no one will write anything stupid to that, but nice to lock
down anyway if you have the time.
>
> Signed-off-by: Michael Hennerich<michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/staging/iio/Kconfig | 1 +
> drivers/staging/iio/Makefile | 1 +
> drivers/staging/iio/amplifiers/Kconfig | 17 +++
> drivers/staging/iio/amplifiers/Makefile | 5 +
> drivers/staging/iio/amplifiers/ad8366.c | 219 +++++++++++++++++++++++++++++++
> 5 files changed, 243 insertions(+), 0 deletions(-)
> create mode 100644 drivers/staging/iio/amplifiers/Kconfig
> create mode 100644 drivers/staging/iio/amplifiers/Makefile
> create mode 100644 drivers/staging/iio/amplifiers/ad8366.c
>
> diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig
> index 3c8e5ec..10c899b 100644
> --- a/drivers/staging/iio/Kconfig
> +++ b/drivers/staging/iio/Kconfig
> @@ -28,6 +28,7 @@ endif # IIO_BUFFER
> source "drivers/staging/iio/accel/Kconfig"
> source "drivers/staging/iio/adc/Kconfig"
> source "drivers/staging/iio/addac/Kconfig"
> +source "drivers/staging/iio/amplifiers/Kconfig"
> source "drivers/staging/iio/cdc/Kconfig"
> source "drivers/staging/iio/dac/Kconfig"
> source "drivers/staging/iio/frequency/Kconfig"
> diff --git a/drivers/staging/iio/Makefile b/drivers/staging/iio/Makefile
> index 6a46d5a..8e18228 100644
> --- a/drivers/staging/iio/Makefile
> +++ b/drivers/staging/iio/Makefile
> @@ -16,6 +16,7 @@ obj-$(CONFIG_IIO_ST_HWMON) += iio_hwmon.o
> obj-y += accel/
> obj-y += adc/
> obj-y += addac/
> +obj-y += amplifiers/
> obj-y += cdc/
> obj-y += dac/
> obj-y += frequency/
> diff --git a/drivers/staging/iio/amplifiers/Kconfig b/drivers/staging/iio/amplifiers/Kconfig
> new file mode 100644
> index 0000000..05d707e
> --- /dev/null
> +++ b/drivers/staging/iio/amplifiers/Kconfig
> @@ -0,0 +1,17 @@
> +#
> +# Gain Amplifiers, etc.
> +#
> +menu "Amplifiers"
> +
> +config AD8366
> + tristate "Analog Devices AD8366 VGA"
> + depends on SPI
> + select BITREVERSE
> + help
> + Say yes here to build support for Analog Devices AD8366
> + SPI Dual-Digital Variable Gain Amplifier (VGA).
> +
> + To compile this driver as a module, choose M here: the
> + module will be called ad8366.
> +
> +endmenu
> diff --git a/drivers/staging/iio/amplifiers/Makefile b/drivers/staging/iio/amplifiers/Makefile
> new file mode 100644
> index 0000000..a6ca366
> --- /dev/null
> +++ b/drivers/staging/iio/amplifiers/Makefile
> @@ -0,0 +1,5 @@
> +#
> +# Makefile iio/amplifiers
> +#
> +
> +obj-$(CONFIG_AD8366) += ad8366.o
> diff --git a/drivers/staging/iio/amplifiers/ad8366.c b/drivers/staging/iio/amplifiers/ad8366.c
> new file mode 100644
> index 0000000..9067750
> --- /dev/null
> +++ b/drivers/staging/iio/amplifiers/ad8366.c
> @@ -0,0 +1,219 @@
> +/*
> + * AD8366 SPI Dual-Digital Variable Gain Amplifier (VGA)
> + *
> + * Copyright 2012 Analog Devices Inc.
> + *
> + * Licensed under the GPL-2.
> + */
> +
> +#include<linux/device.h>
> +#include<linux/kernel.h>
> +#include<linux/slab.h>
> +#include<linux/sysfs.h>
> +#include<linux/spi/spi.h>
> +#include<linux/regulator/consumer.h>
> +#include<linux/err.h>
> +#include<linux/module.h>
> +#include<linux/bitrev.h>
> +
> +#include<linux/iio/iio.h>
> +#include<linux/iio/sysfs.h>
> +
> +struct ad8366_state {
> + struct spi_device *spi;
> + struct regulator *reg;
> + unsigned char ch[2];
> + /*
> + * DMA (thus cache coherency maintenance) requires the
> + * transfer buffers to live in their own cache lines.
> + */
> + unsigned char data[2] ____cacheline_aligned;
> +};
> +
> +static int ad8366_write(struct iio_dev *indio_dev,
> + unsigned char ch_a, char unsigned ch_b)
> +{
> + struct ad8366_state *st = iio_priv(indio_dev);
> + int ret;
> +
> + ch_a = bitrev8(ch_a& 0x3F);
> + ch_b = bitrev8(ch_b& 0x3F);
> +
> + st->data[0] = ch_b>> 4;
> + st->data[1] = (ch_b<< 4) | (ch_a>> 2);
> +
> + ret = spi_write(st->spi, st->data, ARRAY_SIZE(st->data));
> + if (ret< 0)
> + dev_err(&indio_dev->dev, "write failed (%d)", ret);
> +
> + return ret;
> +}
> +
> +static int ad8366_read_raw(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan,
> + int *val,
> + int *val2,
> + long m)
> +{
> + struct ad8366_state *st = iio_priv(indio_dev);
> + int ret;
> + unsigned code;
> +
> + mutex_lock(&indio_dev->mlock);
> + switch (m) {
> + case IIO_CHAN_INFO_HARDWAREGAIN:
> + code = st->ch[chan->channel];
> +
> + /* Values in dB */
> + code = code * 253 + 4500;
> + *val = code / 1000;
> + *val2 = (code % 1000) * 1000;
> +
> + ret = IIO_VAL_INT_PLUS_MICRO_DB;
> + break;
> + default:
> + ret = -EINVAL;
> + }
> + mutex_unlock(&indio_dev->mlock);
> +
> + return ret;
> +};
> +
> +static int ad8366_write_raw(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan,
> + int val,
> + int val2,
> + long mask)
> +{
> + struct ad8366_state *st = iio_priv(indio_dev);
> + unsigned code;
> + int ret;
> +
> + /* Values in dB */
This could do some rather unpredictable things if for whatever
reason val2 is negative. Might be worth doing a little more sanity checking?
> + code = (((u8)val * 1000) + ((u32)val2 / 1000));
> +
> + if (code> 20500 || code< 4500)
> + return -EINVAL;
> +
> + code = (code - 4500) / 253;
> +
> + mutex_lock(&indio_dev->mlock);
> + switch (mask) {
> + case IIO_CHAN_INFO_HARDWAREGAIN:
> + st->ch[chan->channel] = code;
> + ret = ad8366_write(indio_dev, st->ch[0], st->ch[1]);
> + break;
> + default:
> + ret = -EINVAL;
> + }
> + mutex_unlock(&indio_dev->mlock);
> +
> + return ret;
> +}
> +
> +static const struct iio_info ad8366_info = {
> + .read_raw =&ad8366_read_raw,
> + .write_raw =&ad8366_write_raw,
> + .driver_module = THIS_MODULE,
> +};
> +
> +#define AD8366_CHAN(_channel) { \
> + .type = IIO_VOLTAGE, \
> + .output = 1, \
> + .indexed = 1, \
> + .channel = _channel, \
> + .info_mask = IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT,\
> +}
> +
> +static const struct iio_chan_spec ad8366_channels[] = {
> + AD8366_CHAN(0),
> + AD8366_CHAN(1),
> +};
> +
> +static int __devinit ad8366_probe(struct spi_device *spi)
> +{
> + struct iio_dev *indio_dev;
> + struct ad8366_state *st;
> + int ret;
> +
> + indio_dev = iio_device_alloc(sizeof(*st));
> + if (indio_dev == NULL)
> + return -ENOMEM;
> +
> + st = iio_priv(indio_dev);
> +
> + st->reg = regulator_get(&spi->dev, "vcc");
> + if (!IS_ERR(st->reg)) {
> + ret = regulator_enable(st->reg);
> + if (ret)
> + goto error_put_reg;
> + }
> +
> + spi_set_drvdata(spi, indio_dev);
> + st->spi = spi;
> +
> + indio_dev->dev.parent =&spi->dev;
> + indio_dev->name = spi_get_device_id(spi)->name;
> + indio_dev->info =&ad8366_info;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->channels = ad8366_channels;
> + indio_dev->num_channels = ARRAY_SIZE(ad8366_channels);
> +
> + ret = iio_device_register(indio_dev);
> + if (ret)
> + goto error_disable_reg;
> +
> + ad8366_write(indio_dev, 0 , 0);
> +
> + return 0;
> +
> +error_disable_reg:
> + if (!IS_ERR(st->reg))
> + regulator_disable(st->reg);
> +error_put_reg:
> + if (!IS_ERR(st->reg))
> + regulator_put(st->reg);
> +
> + iio_device_free(indio_dev);
> +
> + return ret;
> +}
> +
> +static int __devexit ad8366_remove(struct spi_device *spi)
> +{
> + struct iio_dev *indio_dev = spi_get_drvdata(spi);
> + struct ad8366_state *st = iio_priv(indio_dev);
> + struct regulator *reg = st->reg;
> +
> + iio_device_unregister(indio_dev);
> +
> + if (!IS_ERR(reg)) {
> + regulator_disable(reg);
> + regulator_put(reg);
> + }
> +
> + iio_device_free(indio_dev);
> +
> + return 0;
> +}
> +
> +static const struct spi_device_id ad8366_id[] = {
> + {"ad8366", 0},
> + {}
> +};
> +
> +static struct spi_driver ad8366_driver = {
> + .driver = {
> + .name = KBUILD_MODNAME,
> + .owner = THIS_MODULE,
> + },
> + .probe = ad8366_probe,
> + .remove = __devexit_p(ad8366_remove),
> + .id_table = ad8366_id,
> +};
> +
> +module_spi_driver(ad8366_driver);
> +
> +MODULE_AUTHOR("Michael Hennerich<hennerich@blackfin.uclinux.org>");
> +MODULE_DESCRIPTION("Analog Devices AD8366 VGA");
> +MODULE_LICENSE("GPL v2");
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier
2012-05-10 9:08 ` Jonathan Cameron
@ 2012-05-11 7:32 ` Michael Hennerich
2012-05-11 7:36 ` Jonathan Cameron
0 siblings, 1 reply; 8+ messages in thread
From: Michael Hennerich @ 2012-05-11 7:32 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org
On 05/10/2012 11:08 AM, Jonathan Cameron wrote:
> On 5/9/2012 11:36 AM, michael.hennerich@analog.com wrote:
>> From: Michael Hennerich<michael.hennerich@analog.com>
>>
>> Changes since V1:
>>
>> Apply review feedback:
>> Introduce and use IIO_CHAN_INFO_HARDWAREGAIN
>> Introduce and use Use IIO_VAL_INT_PLUS_MICRO_DB
>>
>> Modify out of staging include paths.
>> Convert to new iio core API naming.
> For reasons I don't understand thunderbird on windows (yes I'm doing
> this whilst waiting for something to run at the day job), is wrecking
> spacing in subtle ways despite being in plain text mode... Grr.
>
> Anyhow, my only real comment is that I think we may want a little more
> value sanity checking in the write_raw function. Not critical as
> hopefully no one will write anything stupid to that, but nice to lock
> down anyway if you have the time.
Hi Jonathan,
Will add a check for val < 0 || val2 < 0.
If you don't mind I'll target the patch to the out of staging iio folder.
drivers/iio/amplifiers/ad8366.c
>> Signed-off-by: Michael Hennerich<michael.hennerich@analog.com>
> Acked-by: Jonathan Cameron<jic23@kernel.org>
>
--
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,
Margaret Seif
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier
2012-05-11 7:32 ` Michael Hennerich
@ 2012-05-11 7:36 ` Jonathan Cameron
0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2012-05-11 7:36 UTC (permalink / raw)
To: michael.hennerich
Cc: Jonathan Cameron, linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org
On 5/11/2012 8:32 AM, Michael Hennerich wrote:
> On 05/10/2012 11:08 AM, Jonathan Cameron wrote:
>> On 5/9/2012 11:36 AM, michael.hennerich@analog.com wrote:
>>> From: Michael Hennerich<michael.hennerich@analog.com>
>>>
>>> Changes since V1:
>>>
>>> Apply review feedback:
>>> Introduce and use IIO_CHAN_INFO_HARDWAREGAIN
>>> Introduce and use Use IIO_VAL_INT_PLUS_MICRO_DB
>>>
>>> Modify out of staging include paths.
>>> Convert to new iio core API naming.
>> For reasons I don't understand thunderbird on windows (yes I'm doing
>> this whilst waiting for something to run at the day job), is wrecking
>> spacing in subtle ways despite being in plain text mode... Grr.
>>
>> Anyhow, my only real comment is that I think we may want a little more
>> value sanity checking in the write_raw function. Not critical as
>> hopefully no one will write anything stupid to that, but nice to lock
>> down anyway if you have the time.
> Hi Jonathan,
>
> Will add a check for val < 0 || val2 < 0.
> If you don't mind I'll target the patch to the out of staging iio folder.
Yes, that would be good. I'll start discouraging any drivers going into
staging unless there are unresolved abi issues.
>
> drivers/iio/amplifiers/ad8366.c
>
>>> Signed-off-by: Michael Hennerich<michael.hennerich@analog.com>
>> Acked-by: Jonathan Cameron<jic23@kernel.org>
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-05-14 20:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11 9:36 [PATCH 1/3] iio: core: introduce dB scle: IIO_VAL_INT_PLUS_MICRO_DB michael.hennerich
2012-05-11 9:36 ` [PATCH 2/3] iio: core: introduce IIO_CHAN_INFO_HARDWAREGAIN michael.hennerich
2012-05-11 9:36 ` [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier michael.hennerich
2012-05-14 20:13 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2012-05-09 10:36 [PATCH 1/3] iio: core: introduce dB scle: IIO_VAL_INT_PLUS_MICRO_DB michael.hennerich
2012-05-09 10:36 ` [PATCH 3/3] iio: amplifiers: New driver for AD8366 Dual-Digital Variable Gain Amplifier michael.hennerich
2012-05-10 9:08 ` Jonathan Cameron
2012-05-11 7:32 ` Michael Hennerich
2012-05-11 7:36 ` 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).