lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200129142301.13918-3-beniamin.bia@analog.com>
Date:   Wed, 29 Jan 2020 16:22:58 +0200
From:   Beniamin Bia <beniamin.bia@...log.com>
To:     <jic23@...nel.org>
CC:     <lars@...afoo.de>, <Michael.Hennerich@...log.com>,
        <pmeerw@...erw.net>, <linux-iio@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <biabeniamin@...look.com>,
        <knaack.h@....de>, <robh+dt@...nel.org>, <mark.rutland@....com>,
        <devicetree@...r.kernel.org>,
        Beniamin Bia <beniamin.bia@...log.com>
Subject: [PATCH v4 2/5] 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@...log.com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ