summaryrefslogtreecommitdiff
path: root/drivers/iio/amplifiers
diff options
context:
space:
mode:
authorBeniamin Bia <beniamin.bia@analog.com>2020-02-06 17:11:46 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-02-21 10:02:16 +0000
commit0cc97f2e46e0b374bbf7efc30bad638d8974cf1e (patch)
tree68fc8a6439fe4dfebc010aa14563756438a54cac /drivers/iio/amplifiers
parentb8528224741b53100381b1382d35422f4b696abb (diff)
iio: amplifiers: ad8366: Add write_raw_get_fmt function
This patch add write_raw_get_fmt function to specify conversion for hardware gain. Signed-off-by: Beniamin Bia <beniamin.bia@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/amplifiers')
-rw-r--r--drivers/iio/amplifiers/ad8366.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index 0176d3d8cc9c..95972ab60f42 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -180,9 +180,22 @@ static int ad8366_write_raw(struct iio_dev *indio_dev,
return ret;
}
+static int ad8366_write_raw_get_fmt(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ long mask)
+{
+ switch (mask) {
+ case IIO_CHAN_INFO_HARDWAREGAIN:
+ return IIO_VAL_INT_PLUS_MICRO_DB;
+ default:
+ return -EINVAL;
+ }
+}
+
static const struct iio_info ad8366_info = {
.read_raw = &ad8366_read_raw,
.write_raw = &ad8366_write_raw,
+ .write_raw_get_fmt = &ad8366_write_raw_get_fmt,
};
#define AD8366_CHAN(_channel) { \