lkml.org 
[lkml]   [2020]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v5 2/5] iio: amplifiers: ad8366: Add write_raw_get_fmt function
Date
This patch add write_raw_get_fmt function to specify conversion for
hardware gain.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
---
Changes in v5:
-nothing changed

drivers/iio/amplifiers/ad8366.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

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) { \
--
2.17.1
\
 
 \ /
  Last update: 2020-02-06 16:11    [W:0.134 / U:2.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site