From: Daniel Baluta <daniel.baluta@intel.com>
To: jic23@kernel.org
Cc: knaack.h@gmx.de, lars@metafoo.de,
ludovic.tancerel@maplehightech.com, tduszyns@gmail.com,
akinobu.mita@gmail.com, daniel.baluta@intel.com,
k.kozlowski@samsung.com, afd@ti.com, broonie@kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
lucas.demarchi@intel.com
Subject: [PATCH v2 1/2] iio: pressure: ms5611: Add IIO_CHAN_INFO_SCALE to mask
Date: Tue, 26 Jan 2016 18:57:20 +0200 [thread overview]
Message-ID: <1453827441-25611-2-git-send-email-daniel.baluta@intel.com> (raw)
In-Reply-To: <1453827441-25611-1-git-send-email-daniel.baluta@intel.com>
This allows data exported via buffer interface to be converted
to standard units in userspace.
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
---
drivers/iio/pressure/ms5611_core.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c
index 2f3d9b4..6cf0e55 100644
--- a/drivers/iio/pressure/ms5611_core.c
+++ b/drivers/iio/pressure/ms5611_core.c
@@ -201,6 +201,18 @@ static int ms5611_read_raw(struct iio_dev *indio_dev,
default:
return -EINVAL;
}
+ case IIO_CHAN_INFO_SCALE:
+ switch (chan->type) {
+ case IIO_TEMP:
+ *val = 10;
+ return IIO_VAL_INT;
+ case IIO_PRESSURE:
+ *val = 0;
+ *val2 = 1000;
+ return IIO_VAL_INT_PLUS_MICRO;
+ default:
+ return -EINVAL;
+ }
}
return -EINVAL;
@@ -218,11 +230,13 @@ static struct ms5611_chip_info chip_info_tbl[] = {
static const struct iio_chan_spec ms5611_channels[] = {
{
.type = IIO_PRESSURE,
- .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
+ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
+ BIT(IIO_CHAN_INFO_SCALE),
},
{
.type = IIO_TEMP,
- .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
+ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
+ BIT(IIO_CHAN_INFO_SCALE),
}
};
--
2.5.0
next prev parent reply other threads:[~2016-01-26 16:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 16:57 [PATCH v2 0/2] ms5611: Add triggered buffer support Daniel Baluta
2016-01-26 16:57 ` Daniel Baluta [this message]
2016-01-26 16:57 ` [PATCH v2 2/2] iio: pressure: " Daniel Baluta
2016-01-30 17:09 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453827441-25611-2-git-send-email-daniel.baluta@intel.com \
--to=daniel.baluta@intel.com \
--cc=afd@ti.com \
--cc=akinobu.mita@gmail.com \
--cc=broonie@kernel.org \
--cc=jic23@kernel.org \
--cc=k.kozlowski@samsung.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=ludovic.tancerel@maplehightech.com \
--cc=tduszyns@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).