LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Irina Tirdea <irina.tirdea@intel.com>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Daniel Baluta <daniel.baluta@intel.com>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Irina Tirdea <irina.tirdea@intel.com>
Subject: [PATCH v3 1/3] iio: core: Introduce IIO_CHAN_INFO_DEBOUNCE_COUNT and _TIME
Date: Tue, 27 Jan 2015 20:41:52 +0200	[thread overview]
Message-ID: <1422384114-23392-2-git-send-email-irina.tirdea@intel.com> (raw)
In-Reply-To: <1422384114-23392-1-git-send-email-irina.tirdea@intel.com>

The pedometer needs to filter out false steps that might be generated by
tapping the foot, sitting, etc. To do that it computes the number of
steps that occur in a given time and decides the user is moving only
if this value is over a threshold. E.g.: the user starts moving only
if he takes 4 steps in 3 seconds. This filter is applied only when
the user starts moving.

A device that has such pedometer functionality is Freescale's MMA9553L:
http://www.freescale.com/files/sensors/doc/ref_manual/MMA9553LSWRM.pdf.

To export this feature, this patch introduces IIO_CHAN_INFO_DEBOUNCE_COUNT
and IIO_CHAN_INFO_DEBOUNCE_TIME. For the pedometer, in_steps_debounce_count
will specify the number of steps that need to occur in
in_steps_debounce_time seconds so that the pedometer decides the user is
moving.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
 Documentation/ABI/testing/sysfs-bus-iio | 15 +++++++++++++++
 drivers/iio/industrialio-core.c         |  2 ++
 include/linux/iio/iio.h                 |  2 ++
 3 files changed, 19 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index c03a140..b4ea9c5 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -1193,3 +1193,18 @@ Description:
 		This attribute is used to read the current speed value of the
 		user (which is the norm or magnitude of the velocity vector).
 		Units after application of scale are m/s.
+
+What:		/sys/.../iio:deviceX/in_steps_debounce_count
+KernelVersion:	3.20
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Specifies the number of steps that must occur within
+		in_steps_filter_debounce_time for the pedometer to decide the
+		consumer is making steps.
+
+What:		/sys/.../iio:deviceX/in_steps_debounce_time
+KernelVersion:	3.20
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Specifies number of seconds in which we compute the steps
+		that occur in order to decide if the consumer is making steps.
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 4ee6fdf..aaba9d3 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -126,6 +126,8 @@ static const char * const iio_chan_info_postfix[] = {
 	[IIO_CHAN_INFO_ENABLE] = "en",
 	[IIO_CHAN_INFO_CALIBHEIGHT] = "calibheight",
 	[IIO_CHAN_INFO_CALIBWEIGHT] = "calibweight",
+	[IIO_CHAN_INFO_DEBOUNCE_COUNT] = "debounce_count",
+	[IIO_CHAN_INFO_DEBOUNCE_TIME] = "debounce_time",
 };
 
 /**
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 51f1643..80d8550 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -41,6 +41,8 @@ enum iio_chan_info_enum {
 	IIO_CHAN_INFO_ENABLE,
 	IIO_CHAN_INFO_CALIBHEIGHT,
 	IIO_CHAN_INFO_CALIBWEIGHT,
+	IIO_CHAN_INFO_DEBOUNCE_COUNT,
+	IIO_CHAN_INFO_DEBOUNCE_TIME,
 };
 
 enum iio_shared_by {
-- 
1.9.1


  reply	other threads:[~2015-01-27 18:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 18:41 [PATCH v3 0/3] Add MMA9553 driver & PM support for MMA9551 Irina Tirdea
2015-01-27 18:41 ` Irina Tirdea [this message]
2015-01-29 18:39   ` [PATCH v3 1/3] iio: core: Introduce IIO_CHAN_INFO_DEBOUNCE_COUNT and _TIME Jonathan Cameron
2015-01-27 18:41 ` [PATCH v3 2/3] iio: Documentation: Fix calibheight unit Irina Tirdea
2015-01-29 18:43   ` Jonathan Cameron
2015-01-27 18:41 ` [PATCH v3 3/3] iio: add driver for Freescale MMA9553 Irina Tirdea
2015-01-29 18:46   ` Jonathan Cameron
2015-04-04 23:17   ` Hartmut Knaack
2015-04-06 14:33     ` Tirdea, Irina
2015-04-08 15:47       ` Tirdea, Irina

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=1422384114-23392-2-git-send-email-irina.tirdea@intel.com \
    --to=irina.tirdea@intel.com \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --subject='Re: [PATCH v3 1/3] iio: core: Introduce IIO_CHAN_INFO_DEBOUNCE_COUNT and _TIME' \
    /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

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).