summaryrefslogtreecommitdiff
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2011-06-10 15:40:48 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-28 14:47:25 -0700
commitae19178eacfab141afdd886e002bb80c99dba63a (patch)
treefa8e3b7de3aa00f8f0e0dcecc1496c47a116a022 /drivers/staging/iio
parent88bc30548aae18a39fd5d35cbb160a1ea347b4a7 (diff)
iio: industrialio-core: Add IIO_OUT type
Add IIO_OUT type for DAC like devices In case of IIO_OUT make sure the channel device attribute is writable Ideally we add a flag to iio_chan_spec that tells the core that the channel device attribute is writable... Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/iio.h1
-rw-r--r--drivers/staging/iio/industrialio-core.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
index 9ca89c7d5693..7a6ce4d0fb7b 100644
--- a/drivers/staging/iio/iio.h
+++ b/drivers/staging/iio/iio.h
@@ -30,6 +30,7 @@
enum iio_chan_type {
/* real channel types */
IIO_IN,
+ IIO_OUT,
IIO_CURRENT,
IIO_POWER,
IIO_ACCEL,
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 744153ee2edb..8fa2be6f566f 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -47,6 +47,7 @@ static const char * const iio_chan_type_name_spec_shared[] = {
[IIO_TIMESTAMP] = "timestamp",
[IIO_ACCEL] = "accel",
[IIO_IN] = "in",
+ [IIO_OUT] = "out",
[IIO_CURRENT] = "current",
[IIO_POWER] = "power",
[IIO_IN_DIFF] = "in-in",
@@ -675,7 +676,8 @@ static int iio_device_add_channel_sysfs(struct iio_dev *dev_info,
else
ret = __iio_add_chan_devattr("raw", NULL, chan,
&iio_read_channel_info,
- NULL,
+ (chan->type == IIO_OUT ?
+ &iio_write_channel_info : NULL),
0,
0,
&dev_info->dev,