From: Vlad Dogaru <vlad.dogaru@intel.com>
To: linux-iio@vger.kernel.org
Cc: Vlad Dogaru <vlad.dogaru@intel.com>
Subject: [RFC PATCH 3/4] iio: add valid sample channel
Date: Tue, 25 Nov 2014 14:48:06 +0200 [thread overview]
Message-ID: <1416919687-14271-4-git-send-email-vlad.dogaru@intel.com> (raw)
In-Reply-To: <1416919687-14271-1-git-send-email-vlad.dogaru@intel.com>
When a sensor has channels which are sampled at different rates, the
situation can arise when a new buffer sample was triggered, but some of
the channels are not yet ready to be read.
To avoid serving bogus values, we can use a "valid sample" channel.
This value is a bitmap where bit N signifies that the Nth value in the
current buffer sample is a valid reading.
This new channel only makes sense for buffering, so it should have no
other files associated, save for the ones in the scan_elements
directory. It is also entirely optional to define the channel. If it
is not defined, all the values in the current sample should be
interpreted as valid, thus preserving semantics for existing drivers.
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
---
drivers/iio/industrialio-core.c | 1 +
include/linux/iio/types.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 45bb3a4..b6bb1b3 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -72,6 +72,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_HUMIDITYRELATIVE] = "humidityrelative",
[IIO_ACTIVITY] = "activity",
[IIO_STEPS] = "steps",
+ [IIO_VALIDSAMPLE] = "validsample",
};
static const char * const iio_modifier_names[] = {
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 904dcbb..c75b724 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -32,6 +32,7 @@ enum iio_chan_type {
IIO_HUMIDITYRELATIVE,
IIO_ACTIVITY,
IIO_STEPS,
+ IIO_VALIDSAMPLE,
};
enum iio_modifier {
--
1.9.1
next prev parent reply other threads:[~2014-11-25 12:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-25 12:48 [PATCH 0/4] Add valid sample channel Vlad Dogaru
2014-11-25 12:48 ` [PATCH 1/4] iio: dummy: set scan_index for unbuffered channels Vlad Dogaru
2014-11-25 16:11 ` Daniel Baluta
2014-12-12 11:48 ` Jonathan Cameron
2014-11-25 12:48 ` [PATCH 2/4] iio: ensure scan index is unique at buffer register Vlad Dogaru
2014-12-06 20:19 ` Hartmut Knaack
2014-12-12 11:50 ` Jonathan Cameron
2014-11-25 12:48 ` Vlad Dogaru [this message]
2014-11-25 12:48 ` [RFC PATCH 4/4] iio: illustrate the use of a valid sample channel Vlad Dogaru
2014-11-25 16:36 ` [PATCH 0/4] Add " Lars-Peter Clausen
2014-11-25 16:55 ` Daniel Baluta
2014-11-25 17:00 ` Lars-Peter Clausen
2014-11-25 17:29 ` Jonathan Cameron
2014-11-25 18:27 ` Octavian Purdila
2014-11-25 18:53 ` Lars-Peter Clausen
2014-11-26 12:58 ` Daniel Baluta
2014-12-01 20:06 ` Lars-Peter Clausen
2014-12-01 20:46 ` Daniel Baluta
2014-12-01 20:51 ` Lars-Peter Clausen
2014-12-01 21:03 ` Daniel Baluta
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=1416919687-14271-4-git-send-email-vlad.dogaru@intel.com \
--to=vlad.dogaru@intel.com \
--cc=linux-iio@vger.kernel.org \
/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).