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>
enum iio_chan_type {
/* real channel types */
IIO_IN,
+ IIO_OUT,
IIO_CURRENT,
IIO_POWER,
IIO_ACCEL,
[IIO_TIMESTAMP] = "timestamp",
[IIO_ACCEL] = "accel",
[IIO_IN] = "in",
+ [IIO_OUT] = "out",
[IIO_CURRENT] = "current",
[IIO_POWER] = "power",
[IIO_IN_DIFF] = "in-in",
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,