OSDN Git Service

android-x86/hardware-intel-libsensors.git
9 years agoIRDA-3484: Add support for filter property
Patrick Porlan [Tue, 27 Jan 2015 15:34:59 +0000 (16:34 +0100)]
IRDA-3484: Add support for filter property

As of today, filtering is only engaged if a sensor has the noisy
quirk. If it is, we use median filtering for gyroscopes and moving
average for magnetometers. Let's allow for a filter configuration
item that would force any of the available filters selectively.

filter=median
filter=average

will supersede the default choice. There's no reason to support
a none setting, as it's the default.

Change-Id: I7f85738e3b770d86efe9a709495c08ca36ba4024
Tracked-On: https://jira01.devtools.intel.com/browse/IRDA-3484
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Mon, 12 Jan 2015 10:41:07 +0000 (12:41 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  739ada1 Thu Jan 8 11:12:04 2015 +0200 | Remove useless log. (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  50085d7 Fri Dec 19 11:16:47 2014 +0200 | Add the TYPE_MAGNETIC_FIELD_UNCALIBRATED sensor [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  control.c     | 87 +++++++++++++++++++++++++++++--------------------------
  description.c |  6 ++--
  enumeration.c | 93 +++++++++++++++++++++++++----------------------------------
  transform.c   | 30 ++++++++++++++++---
  4 files changed, 115 insertions(+), 101 deletions(-)
~
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-5103
Change-Id: Ib5be41558f51f558caf0ae3548a2896be18439e1

9 years agoRemove useless log.
Adriana Reus [Thu, 8 Jan 2015 09:12:04 +0000 (11:12 +0200)]
Remove useless log.

Change-Id: If161e4c5f7284099a138bfa983d21ea12dfe9421
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoAdd the TYPE_MAGNETIC_FIELD_UNCALIBRATED sensor
Adriana Reus [Fri, 19 Dec 2014 09:16:47 +0000 (11:16 +0200)]
Add the TYPE_MAGNETIC_FIELD_UNCALIBRATED sensor

Add the uncalibrated magnetometer type.
Added a single function for checking and adding virtual sensors.
Moved the timestamp handling for polling sensors so that we get a
timestamp before finalize is called.
Also moved the event drop (for sensors not directly enabled)
from finalize to propagate_sensor_report because for polling
sensors we need to signal an fd when we have an event,
and this is made by looking at the finalize return value.

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-2744
Change-Id: I12abd38329ef7f59b2b13427c47a235b54f75fb2
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Mon, 5 Jan 2015 12:36:52 +0000 (14:36 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

  8cefd8e Fri Dec 19 16:40:50 2014 +0200 | cleanup: Remove handling for continous sensors when setting flags [Adriana Reus]
  8a7e617 Fri Dec 19 14:14:07 2014 +0100 | Winter cleanup: reorganize line breaks in filtering.c [Patrick Porlan]
  0c5d4d4 Fri Dec 19 11:34:15 2014 +0100 | Winter cleanup: revisit enable_buffer function [Patrick Porlan]
  d6349f6 Fri Dec 19 10:29:33 2014 +0100 | Winter cleanup: add a specific is_polling flag to the sensor structure [Patrick Porlan]
  45c9688 Thu Dec 18 17:12:39 2014 +0100 | Fix min & max sampling rate for on-change sensors [Patrick Porlan]
  4d8f316 Thu Dec 18 15:50:46 2014 +0100 | Shift max and min rate calculations to enumeration stage [Patrick Porlan]
  3025276 Thu Dec 18 15:20:43 2014 +0100 | Winter cleanup: remove old debugging code from compass-calibration.c [Patrick Porlan]
  5cd8699 Thu Dec 18 14:41:00 2014 +0100 | Winter cleanup: straighten up a few long untouched files [Patrick Porlan]
  cc449e6 Thu Dec 18 11:40:04 2014 +0100 | Winter cleanup: switch to 160 characters lines [Patrick Porlan]
  cae87f2 Thu Dec 18 10:34:12 2014 +0100 | Winter cleanup: use typedef on our own types [Patrick Porlan]
  14261d3 Wed Dec 17 16:35:34 2014 +0100 | Revisit sampling rate arbitration [Patrick Porlan]
  d554e08 Thu Dec 18 10:04:06 2014 +0100 | Tweak a few traces [Patrick Porlan]
  60bf469 Wed Dec 17 17:32:23 2014 +0100 | Winter cleanup: use consistent types for constants [Patrick Porlan]
  1f86600 Wed Dec 17 16:27:04 2014 +0100 | Rework a little bit sensor_activate_virtual [Patrick Porlan]
  de50236 Wed Dec 17 16:19:12 2014 +0100 | Move sensor_activate_virtual next to sensor_activate function [Patrick Porlan]
  8c1267b Wed Dec 17 16:14:07 2014 +0100 | Rename setup_delay_sysfs to sensor_set_rate [Patrick Porlan]
  d9ac41e Wed Dec 17 15:58:51 2014 +0100 | Rework a little bit the end cases in check_state_change [Patrick Porlan]
  9072170 Wed Dec 17 15:54:52 2014 +0100 | Better coordinate frequencies of co-located iio sensors [Patrick Porlan]
  6c1dfd5 Wed Dec 17 15:49:03 2014 +0100 | Only signal an acquisition thread if the target sensor is enabled [Patrick Porlan]
  cce276f Wed Dec 17 15:42:16 2014 +0100 | Allow for a slight difference when parsing available frequencies [Patrick Porlan]
  a4acc70 Wed Dec 17 15:16:37 2014 +0100 | Winter cleanup: rephrase traces and comments, rename vars, fix whitespaces [Patrick Porlan]
  a0caca2 Wed Dec 17 15:03:12 2014 +0100 | Rename MAX_REAL_DEP to MAX_BASE_SENSORS and base_idx to base [Patrick Porlan]
  67ff046 Mon Dec 15 17:44:56 2014 +0100 | Winter cleanup: tidy up enumeration.c [Patrick Porlan]
  0f08a52 Mon Dec 15 11:48:23 2014 +0100 | Winter cleanup: Harmonize spacing before functions [Patrick Porlan]
  0bb03ae Mon Dec 15 10:58:28 2014 +0100 | Winter cleanup: suffix our own types with _t [Patrick Porlan]
  3848e24 Mon Dec 15 10:31:39 2014 +0100 | Winter cleanup: comment harmonization, space shuffling, etc. [Patrick Porlan]
  5d0800d Mon Dec 15 10:11:20 2014 +0100 | Winter cleanup: move iio type field decoding out of utils.c [Patrick Porlan]
  11ed1a2 Mon Dec 15 10:07:26 2014 +0100 | Winter cleanup: remove superfluous volatile specifier [Patrick Porlan]
  2d5e6c1 Mon Dec 15 09:58:20 2014 +0100 | Winter cleanup: sensor_info[] -> sensor[] [Patrick Porlan]
  8aa6c4c Tue Dec 9 09:07:08 2014 +0200 | Better support for virtual sensors [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h         |   27 +-
  common.h              |  189 ++++----
  compass-calibration.c |  204 +++------
  control.c             | 1183 +++++++++++++++++++++++++------------------------
  control.h             |    6 +-
  description.c         |  267 +++++++----
  description.h         |   10 +-
  entry.c               |   21 +-
  enumeration.c         |  396 ++++++++---------
  enumeration.h         |   17 +-
  filtering.c           |  117 +++--
  filtering.h           |    8 +-
  gyro-calibration.c    |   50 +--
  matrix-ops.c          |   14 +-
  transform.c           |  447 +++++++++----------
  utils.c               |   33 --
  utils.h               |    3 -
  17 files changed, 1502 insertions(+), 1490 deletions(-)

Change-Id: If4a7af961dc5970ff5fd8cead24fe0c1723cad45
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoTransmit the entire sensor_event_t structure from acquisition thread
Patrick Porlan [Fri, 19 Dec 2014 14:23:38 +0000 (15:23 +0100)]
Transmit the entire sensor_event_t structure from acquisition thread

We were losing the magnetometer accuracy indicator because of the
wish to limit the amount of data we're transmitting accross threads,
but the volume of data itself is not so different this way. There
should be no impact on performance whatsoever, and this will likely
avoid future bugs.

Change-Id: I55c18553467b442a25a61d29ffaba40eb4fba708
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agocleanup: Remove handling for continous sensors when setting flags
Adriana Reus [Fri, 19 Dec 2014 14:40:50 +0000 (16:40 +0200)]
cleanup: Remove handling for continous sensors when setting flags

This is for nothing, that flag is zero.

Change-Id: I46d71728b30ab7167f4b1ef05f43f0e5662423b0
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoWinter cleanup: reorganize line breaks in filtering.c
Patrick Porlan [Fri, 19 Dec 2014 13:14:07 +0000 (14:14 +0100)]
Winter cleanup: reorganize line breaks in filtering.c

Only cosmetic fixes in there.

Change-Id: I4f6bde87e8e61a98feccac22dfdc428ad65cab1f
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: revisit enable_buffer function
Patrick Porlan [Fri, 19 Dec 2014 10:34:15 +0000 (11:34 +0100)]
Winter cleanup: revisit enable_buffer function

Can't help from tweaking whitespaces too.

Change-Id: I3e5fcf3f364e082ccf0173b75da0691cc26a42b3
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: add a specific is_polling flag to the sensor structure
Patrick Porlan [Fri, 19 Dec 2014 09:29:33 +0000 (10:29 +0100)]
Winter cleanup: add a specific is_polling flag to the sensor structure

Add a dedicated flag telling whether a sensor is triggered or polling.
Checking for the number of channels always felt unnatural.

Change-Id: I03eab9c5bce7c63a90301cfc735afbf72fd780d6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoFix min & max sampling rate for on-change sensors
Patrick Porlan [Thu, 18 Dec 2014 16:12:39 +0000 (17:12 +0100)]
Fix min & max sampling rate for on-change sensors

The BMG160 thermometer was adopting the gyro min sampling rate of
100, which is kind of wasteful in terms of acquisition thread
activity. Same for BMC150 therm (using 15.6 Hz min). The ALS was
probably causing more thread switches than necessary, even if in
the end no event was being reported to Android if the value was
the same as the last measured one.

So, say it's fine to use on change sensors as a frequency as low
as 0.1 Hz, and report 5 Hz the maximum rate we can handle.

Change-Id: I7bd4a8ef97bffd5a0deb17cf581286214ce8a1a4
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoShift max and min rate calculations to enumeration stage
Patrick Porlan [Thu, 18 Dec 2014 14:50:46 +0000 (15:50 +0100)]
Shift max and min rate calculations to enumeration stage

It doesn't make sense te recompute this stuff over and over.
We might even want to use the ones gathered in the min/max
delay routines eventually, to avoid rounding errors.

Change-Id: I3bc6dfa39459b5b88552a9b716d04d6fdffda7af
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: remove old debugging code from compass-calibration.c
Patrick Porlan [Thu, 18 Dec 2014 14:20:43 +0000 (15:20 +0100)]
Winter cleanup: remove old debugging code from compass-calibration.c

Spread harmony too.

Change-Id: Ieb306cc6039478ace05ad8f327a354cd3b4d0c28
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: straighten up a few long untouched files
Patrick Porlan [Thu, 18 Dec 2014 13:41:00 +0000 (14:41 +0100)]
Winter cleanup: straighten up a few long untouched files

Lots of mindless cosmetic fixes.

Change-Id: I8ac28ac57a2186f460df8d82921d32b5b6ffbbe9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: switch to 160 characters lines
Patrick Porlan [Thu, 18 Dec 2014 10:40:04 +0000 (11:40 +0100)]
Winter cleanup: switch to 160 characters lines

This allows for nicer traces, comments, and test conditions.

Change-Id: Ie477ab33d090bce0ffecf252e13885f384909771
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: use typedef on our own types
Patrick Porlan [Thu, 18 Dec 2014 09:34:12 +0000 (10:34 +0100)]
Winter cleanup: use typedef on our own types

All these explicit structs ended up being noisy for little benefit.

Change-Id: I0b7ace85ab8a7644d3895e3e45e97ff0e14c5cfc
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoRevisit sampling rate arbitration
Patrick Porlan [Wed, 17 Dec 2014 15:35:34 +0000 (16:35 +0100)]
Revisit sampling rate arbitration

The previous code was generating superfluous sysfs activity,
and induced failures such as:

W/Sensors: Cannot write 1 (1 bytes) to /sys/bus/iio/devices/
                iio:device1/buffer/enable (Invalid argument)
E/Sensors: Failed enabling buffer, retrying
E/Sensors: Could not enable buffer

Change-Id: I5a0f824880faf09fce3012de64da3eb4100d3213
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoTweak a few traces
Patrick Porlan [Thu, 18 Dec 2014 09:04:06 +0000 (10:04 +0100)]
Tweak a few traces

%f -> %g (don't need all these digits)
ALOGI -> ALOGV (a matter of taste)

Change-Id: Ib65ac6a0fea186cb52da9fa235932b2026bca42b
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: use consistent types for constants
Patrick Porlan [Wed, 17 Dec 2014 16:32:23 +0000 (17:32 +0100)]
Winter cleanup: use consistent types for constants

LL is 64 bits
.0 is double
f is float

Change-Id: Ib19b8e09e767ed69c97f973797451156af2cb7b5
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoRework a little bit sensor_activate_virtual
Patrick Porlan [Wed, 17 Dec 2014 15:27:04 +0000 (16:27 +0100)]
Rework a little bit sensor_activate_virtual

Mostly cosmetic. Added a couple of traces too.

Change-Id: Ia8b8a0474421a25e077975d926d6a39518870297
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMove sensor_activate_virtual next to sensor_activate function
Patrick Porlan [Wed, 17 Dec 2014 15:19:12 +0000 (16:19 +0100)]
Move sensor_activate_virtual next to sensor_activate function

It just makes sense.

Change-Id: I7dd5bd36c7f1a9b10092671f5cddba65bc92c32d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoRename setup_delay_sysfs to sensor_set_rate
Patrick Porlan [Wed, 17 Dec 2014 15:14:07 +0000 (16:14 +0100)]
Rename setup_delay_sysfs to sensor_set_rate

Because a) it's a sampling rate, and b) it's not necessarily sysfs.

Change-Id: I21e0cd355089845a51b98966b812727ea990a110
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoRework a little bit the end cases in check_state_change
Patrick Porlan [Wed, 17 Dec 2014 14:58:51 +0000 (15:58 +0100)]
Rework a little bit the end cases in check_state_change

The new version is equivalent but a little bit clearer.

Change-Id: I8606a3e10007d60bac895f0ad12f4fd40f2fb2c7
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoBetter coordinate frequencies of co-located iio sensors
Patrick Porlan [Wed, 17 Dec 2014 14:54:52 +0000 (15:54 +0100)]
Better coordinate frequencies of co-located iio sensors

This is in the case where several sensors share a single frequency
knob (that was the case on the Invensense MPU chip used by the T100)
rather than have differenciated rate settings.

Change-Id: Id92c6f0b2811a76eb4550fd801e0bee2bb70a48b
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoOnly signal an acquisition thread if the target sensor is enabled
Patrick Porlan [Wed, 17 Dec 2014 14:49:03 +0000 (15:49 +0100)]
Only signal an acquisition thread if the target sensor is enabled

Otherwise the variable is invalid.

Change-Id: I54c6411b29fd3d10f454e17e46ea6d8dbcc228c6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoAllow for a slight difference when parsing available frequencies
Patrick Porlan [Wed, 17 Dec 2014 14:42:16 +0000 (15:42 +0100)]
Allow for a slight difference when parsing available frequencies

I'm seeing missed matches due to rounding errors (accelerometer
set at 31.26 Hz because 15.62 is lower than the minimum 15.6201).

Change-Id: I16593fc51e2b88bc140d0b6f264fe833b3ec1c8d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: rephrase traces and comments, rename vars, fix whitespaces
Patrick Porlan [Wed, 17 Dec 2014 14:16:37 +0000 (15:16 +0100)]
Winter cleanup: rephrase traces and comments, rename vars, fix whitespaces

Change-Id: I37da40035cf427d0352663c4ec936540935dca2a
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoRename MAX_REAL_DEP to MAX_BASE_SENSORS and base_idx to base
Patrick Porlan [Wed, 17 Dec 2014 14:03:12 +0000 (15:03 +0100)]
Rename MAX_REAL_DEP to MAX_BASE_SENSORS and base_idx to base

All your base are belong to us.

Besides, it's simpler.

Change-Id: I6e3711230fbf76d600b3cbbbba91e7528a256062
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: tidy up enumeration.c
Patrick Porlan [Mon, 15 Dec 2014 16:44:56 +0000 (17:44 +0100)]
Winter cleanup: tidy up enumeration.c

Minor cosmetic code changes and factorization.

Change-Id: I4b37a43b44bb3abfff832d57b2ce860c4f9de40f
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: Harmonize spacing before functions
Patrick Porlan [Mon, 15 Dec 2014 10:48:23 +0000 (11:48 +0100)]
Winter cleanup: Harmonize spacing before functions

Avoid inconsistency whenever possible.

Change-Id: I548ea4d9a6a0e1e36e25855a5fc97270f14ac91d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: suffix our own types with _t
Patrick Porlan [Mon, 15 Dec 2014 09:58:28 +0000 (10:58 +0100)]
Winter cleanup: suffix our own types with _t

I slightly rearranged areas using these types, too.

Change-Id: Id3e6cd845cc6caf85dbc1c26d656faa3835126f9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: comment harmonization, space shuffling, etc.
Patrick Porlan [Mon, 15 Dec 2014 09:31:39 +0000 (10:31 +0100)]
Winter cleanup: comment harmonization, space shuffling, etc.

Let's be consistent throughtout the code, unless there's a reason
to do thing differently.

Change-Id: I8aef25020b272d9e1e0210652758c0ce3d4d560c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: move iio type field decoding out of utils.c
Patrick Porlan [Mon, 15 Dec 2014 09:11:20 +0000 (10:11 +0100)]
Winter cleanup: move iio type field decoding out of utils.c

It's a very specialized function, which only makes sense in
the file where it's used. Let's not mix it with general
toolbox pieces.

Change-Id: I9915f380bd75394a4ea98a425a5fdcb0f287ebc6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: remove superfluous volatile specifier
Patrick Porlan [Mon, 15 Dec 2014 09:07:26 +0000 (10:07 +0100)]
Winter cleanup: remove superfluous volatile specifier

It's not needed (at least on x86), so let's remove it.

Change-Id: Ib5aef13e4fd6db73df8e072ede7b8829706ba6b9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoWinter cleanup: sensor_info[] -> sensor[]
Patrick Porlan [Mon, 15 Dec 2014 08:58:20 +0000 (09:58 +0100)]
Winter cleanup: sensor_info[] -> sensor[]

It makes code more legible, and is simply more logical.
Besides, it appears 374 times.

Change-Id: I1a9056b829569d159a7b23b24ceff0a1e9d796a6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoBetter support for virtual sensors
Adriana Reus [Tue, 9 Dec 2014 07:07:08 +0000 (09:07 +0200)]
Better support for virtual sensors

Re-work for the gyro uncalibrated implementation. Instead from reading from the device directly it is now built on top of the 'real' sensor.
The re-work is more general and can be used to construct virtual sensors on top of real ones more easily.

Change-Id: Ife169e860674f3ceec1d22dbb4ac9db278d6762d
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Wed, 3 Dec 2014 14:38:54 +0000 (16:38 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  819f41c Fri Nov 28 15:44:07 2014 +0200 | Additional calibration validation (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  9616608 Wed Nov 26 12:45:28 2014 +0200 | Remove accel special case for managing timestamps [Adriana Reus]
  c6f0e4e Mon Nov 24 15:47:27 2014 +0200 | sens: fix server crash after stopping the poll client [Octavian Purdila]
  48e21a6 Mon Nov 24 13:33:53 2014 +0200 | sens: simplify the server dispatch routine [Octavian Purdila]
  9069fc7 Thu Nov 20 14:26:29 2014 +0200 | Fix Linux build [Octavian Purdila]
  615308b Thu Nov 20 15:22:43 2014 +0200 | sens: mark parameter as unused [Octavian Purdila]
  6fcd893 Thu Nov 20 15:21:22 2014 +0200 | sens: remove unused parameter in dispatch_cmd [Octavian Purdila]
  558ac66 Thu Nov 20 15:15:24 2014 +0200 | sens: trim command buffer [Octavian Purdila]
  b27f9ea Thu Nov 20 15:12:41 2014 +0200 | sens: use strncat and strncpy when composing the command buffer [Octavian Purdila]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h               |  1 +
  compass-calibration.c       | 33 +++++++++++++++-
  control.c                   |  5 +--
  linux/linux/android_alarm.h |  7 ++++
  linux/utils/Atomic.h        | 17 +++++++++
  sens.c                      | 93 +++++++++++++++++++++++++++------------------
  6 files changed, 115 insertions(+), 41 deletions(-)

Change-Id: Iacba7d2b91f1843d4ebb7db29b104103559389e9
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoAdditional calibration validation
Adriana Reus [Fri, 28 Nov 2014 13:44:07 +0000 (15:44 +0200)]
Additional calibration validation

Change-Id: I081391d086980bec97ae271ff89ecfce6ea8451f
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoRemove accel special case for managing timestamps
Adriana Reus [Wed, 26 Nov 2014 10:45:28 +0000 (12:45 +0200)]
Remove accel special case for managing timestamps

Change-Id: I966919ccae5144850279736af16df471bc1b38f2
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agosens: fix server crash after stopping the poll client
Octavian Purdila [Mon, 24 Nov 2014 13:47:27 +0000 (15:47 +0200)]
sens: fix server crash after stopping the poll client

If the poll client is stopped (killed) the server will crash due to
SIGPIPE. Fix this by intercepting SIGPIPE and clearing the client file
to avoid further prints to it.

Change-Id: I588b9c098634e2eb5cec9dd003e4f9a3be188c3f
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agosens: simplify the server dispatch routine
Octavian Purdila [Mon, 24 Nov 2014 11:33:53 +0000 (13:33 +0200)]
sens: simplify the server dispatch routine

Simplify the server dispatch routine so that it supports only one
command per connection. This also fixes the issue of not being able to
issue commands after poll.

Change-Id: I02932ca7c3aad0c6f46f80f547e8e515c085e763
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agoFix Linux build
Octavian Purdila [Thu, 20 Nov 2014 12:26:29 +0000 (14:26 +0200)]
Fix Linux build

Add Atomic.h and android_alarm.h stubs.

Change-Id: I5e044de52ab7ab5f8b68e3361f327adb61b5f3a0
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agosens: mark parameter as unused
Octavian Purdila [Thu, 20 Nov 2014 13:22:43 +0000 (15:22 +0200)]
sens: mark parameter as unused

Mark parameter of run_sensors_thread as unused, to silence compile
warnings.

Change-Id: I3b19445381c52f5e5bfef09ef3249f31e6a3f22d
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agosens: remove unused parameter in dispatch_cmd
Octavian Purdila [Thu, 20 Nov 2014 13:21:22 +0000 (15:21 +0200)]
sens: remove unused parameter in dispatch_cmd

We already assume that cmd is NULL terminated, so lets remove the unused
cmd_len. Add check to verify that the received command is NULL
terminated.

Change-Id: I1da3cdf8005b778d7e3e37fe7b2e3ca4b9322801
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agosens: trim command buffer
Octavian Purdila [Thu, 20 Nov 2014 13:15:24 +0000 (15:15 +0200)]
sens: trim command buffer

Right now we always send 1024 bytes for every command. We can trim the
buffer size to its length + 1 for the NULL terminator.

Change-Id: Ie707a607dd9e267e1dcbc47d97c42ab4816eab2c
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agosens: use strncat and strncpy when composing the command buffer
Octavian Purdila [Thu, 20 Nov 2014 13:12:41 +0000 (15:12 +0200)]
sens: use strncat and strncpy when composing the command buffer

Avoid buffer overflows when composing the command buffer by using
strncat and strncpy.

Change-Id: Ic0ad357168c230496e9358c877b7a01345cc53f3
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Tue, 25 Nov 2014 15:48:27 +0000 (17:48 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  9c98e64 Tue Nov 25 15:13:41 2014 +0100 | Don't use the timestamp channel in any-motion mode (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
  3dd743f Tue Nov 25 09:50:10 2014 +0100 | Small timestamps fixes [Patrick Porlan]
  9cf6760 Mon Nov 24 15:17:49 2014 +0100 | Reinstate monotonic timestamp in data acquisition threads [Patrick Porlan]
  08e484e Mon Nov 24 14:40:16 2014 +0100 | Make sure the deadlines we set are interpreted in CLOCK_BOOTTIME [Patrick Porlan]
  00f369d Mon Nov 24 13:59:14 2014 +0100 | Recompute the boot to realtime delta at iio ts channel read time [Patrick Porlan]
  2fffc09 Mon Nov 24 11:52:50 2014 +0100 | Standardize timestamps on CLOCK_BOOTTIME [Patrick Porlan]
  281581c Fri Nov 21 17:58:37 2014 +0100 | Additional fixes to time stamps code [Patrick Porlan]
  416a770 Fri Nov 21 16:23:50 2014 +0100 | Correct timestamps read from the timestamp iio channel [Patrick Porlan]
  bbcca49 Fri Nov 21 11:53:15 2014 +0100 | Be more careful with the amount of data we read from the iio dev fd [Patrick Porlan]
  802446d Fri Nov 21 10:05:17 2014 +0100 | Moping the floor: hamonize comments delimiters [Patrick Porlan]
  8f338ec Fri Nov 21 10:01:21 2014 +0100 | Moping the floor: remove superfluous f type specifiers [Patrick Porlan]
  2effc32 Fri Nov 21 09:47:35 2014 +0100 | Shift gyro drop count from common.h to filtering.h [Patrick Porlan]
  aa74040 Mon Nov 17 17:43:53 2014 +0100 | Use the driver provided timestamp channel if possible [Patrick Porlan]
  77dea6d Tue Nov 18 16:46:22 2014 +0200 | Magnetometer ts improvements [Adriana Reus]
  48779ad Thu Nov 20 17:51:17 2014 +0200 | Populate quirks at enumeration [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  common.h              |   6 +-
  compass-calibration.c |   8 ++-
  control.c             | 160 +++++++++++++++++++++++++++++++++++++++++++-------
  enumeration.c         |   3 +
  filtering.h           |   2 +
  gyro-calibration.c    |   2 +-
  transform.c           |  40 ++++++-------
  utils.c               |  43 +++++---------
  utils.h               |   8 +--
  9 files changed, 188 insertions(+), 84 deletions(-)

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-4395
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: I546ec0b54639511f90a7346b82969f055a3f1866

9 years agoDon't use the timestamp channel in any-motion mode
Patrick Porlan [Tue, 25 Nov 2014 14:13:41 +0000 (15:13 +0100)]
Don't use the timestamp channel in any-motion mode

That seems to create out of order timestamps issues in the
CTS Verifier Single Sensor Tests, and as it's a degraded, low
accuracy mode anyway, we are probably perfectly fine with the
usermode, HAL-level, timestamp.

Change-Id: I771c7e81916ae8ccf207ba3b213f9bc7525de362
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSmall timestamps fixes
Patrick Porlan [Tue, 25 Nov 2014 08:50:10 +0000 (09:50 +0100)]
Small timestamps fixes

Swap the two clock_gettime calls we use to compute the offset
between realtime and boottime clock so there is no risk that
the timestamp appears in the future (e.g. if the calling thread
gets scheduled out between the calls).

Change-Id: Iad37015a873f7cf7c9b84d05a999eb42c0bb270a
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoReinstate monotonic timestamp in data acquisition threads
Patrick Porlan [Mon, 24 Nov 2014 14:17:49 +0000 (15:17 +0100)]
Reinstate monotonic timestamp in data acquisition threads

Only for the target time used by pthread routines though, as they
unfortunately don't seem to support the boot time clock.

Change-Id: I258d78c1c7e249f7bc3629ba864bee01a761cd57
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMake sure the deadlines we set are interpreted in CLOCK_BOOTTIME
Patrick Porlan [Mon, 24 Nov 2014 13:40:16 +0000 (14:40 +0100)]
Make sure the deadlines we set are interpreted in CLOCK_BOOTTIME

By default pthread_cond_timedwait uses the monotonic time source.

Change-Id: I22acbe17ffc11fc936f362ec37e3f42499fe16d4
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoRecompute the boot to realtime delta at iio ts channel read time
Patrick Porlan [Mon, 24 Nov 2014 12:59:14 +0000 (13:59 +0100)]
Recompute the boot to realtime delta at iio ts channel read time

The RTC can be moved backward or forward at any time... err on
the side of safety, even if there are still potential issues with
this implementation (delay between kernel calls, possibility that
we get scheduled out, or that the clock is adjusted after the iio
buffer was stored...).

Change-Id: If1a517e8e2273ef479bd6095975df26d4aa4d2cd
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoStandardize timestamps on CLOCK_BOOTTIME
Patrick Porlan [Mon, 24 Nov 2014 10:52:50 +0000 (11:52 +0100)]
Standardize timestamps on CLOCK_BOOTTIME

That's time since boot, including sleep, and should match the CDD
5.0 requirement to sync with elapsedRealtimeNanos (which is what
we were doing anyway).

The iio timestamp channel provides timestamps based on the output
of iio_get_time_ns however, which is based on ktime_get_real_ns,
so we have no choice bu periodically recompute the difference
between these.

Change-Id: I1db6c1cea89d8507e1557412267d67756eba5749
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoAdditional fixes to time stamps code
Patrick Porlan [Fri, 21 Nov 2014 16:58:37 +0000 (17:58 +0100)]
Additional fixes to time stamps code

Looks like I did not commit exactly what I tested :)

Change-Id: Id5dddb2a8330a23ad0fac8aadcf5c0a6110c8bf1
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoCorrect timestamps read from the timestamp iio channel
Patrick Porlan [Fri, 21 Nov 2014 15:23:50 +0000 (16:23 +0100)]
Correct timestamps read from the timestamp iio channel

These use the realtime clock, whereas Android expects the
system clock to be used as reference.

Change-Id: I90cb68042a7519570bb97995920a15c03f136fb4
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoBe more careful with the amount of data we read from the iio dev fd
Patrick Porlan [Fri, 21 Nov 2014 10:53:15 +0000 (11:53 +0100)]
Be more careful with the amount of data we read from the iio dev fd

The iio drivers we have operate with a buffer length set at 2, and
can be set at larger sizes, however the current event integration
code path only handles a iio device report per loop.

For now, simply make sure we only read a single "scan", a.k.a. iio
device report, per loop. This could avoid dropping events if the
driver is producing them faster than we can consume them.

Change-Id: Ibfad7abbd445d6aae0345e2c828ca72c555c42ea
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMoping the floor: hamonize comments delimiters
Patrick Porlan [Fri, 21 Nov 2014 09:05:17 +0000 (10:05 +0100)]
Moping the floor: hamonize comments delimiters

// is fine, and I like it, but I like consistency even more

Change-Id: I906c5adc00f4ebe1cbe46e69248a3c80a0aa9403
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMoping the floor: remove superfluous f type specifiers
Patrick Porlan [Fri, 21 Nov 2014 09:01:21 +0000 (10:01 +0100)]
Moping the floor: remove superfluous f type specifiers

... as well as whitespaces, parentheses, etc.

Change-Id: I9f511420ae9dd783955e0f73d51e384712f98075
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoShift gyro drop count from common.h to filtering.h
Patrick Porlan [Fri, 21 Nov 2014 08:47:35 +0000 (09:47 +0100)]
Shift gyro drop count from common.h to filtering.h

Also, rename it with a more specific name.

Change-Id: Id87ad267b25949699cc29dcdd4cac28a5d572fbb
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Fri, 21 Nov 2014 08:27:51 +0000 (10:27 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  222bad1 Thu Nov 20 15:30:26 2014 +0200 | Move defines to appropriate c files (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  ca985fc Thu Nov 20 14:52:50 2014 +0200 | Don't setup an upper limit for the magnetometer sanity_norm [Adriana Reus]
  1fdbe72 Wed Nov 19 14:28:11 2014 +0100 | Warning removal round [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h         | 24 ++++--------------------
  compass-calibration.c | 51 +++++++++++++++++++++++++++++----------------------
  description.c         |  2 +-
  entry.c               | 25 ++++++++++++++++---------
  enumeration.c         |  4 ++--
  gyro-calibration.c    |  5 +++++
  transform.c           |  2 +-
  7 files changed, 58 insertions(+), 55 deletions(-)

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-4280
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: Ifbca09ec6aa18eb8d45c8b41fb4fa1cd1cd36f2f

9 years agoUse the driver provided timestamp channel if possible
Patrick Porlan [Mon, 17 Nov 2014 16:43:53 +0000 (17:43 +0100)]
Use the driver provided timestamp channel if possible

There are several conditions though:
- a suitable iio channel is detected
- it can be enabled
- the scan report are of the expected size
- timestamps aren't nil

Change-Id: I7ee5aebd952225dacab170b9349640def4ddc892
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMagnetometer ts improvements
Adriana Reus [Tue, 18 Nov 2014 14:46:22 +0000 (16:46 +0200)]
Magnetometer ts improvements

Attempt to better estimate timestamps for polling sensors.
Seems to slightly improve jitter on magnetometer, although
not in a very significant manner.

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-4216
Change-Id: I29bf0f4c100f3072b0cca9f1564518c37939ce20
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-on: https://android.intel.com:443/302236

9 years agoPopulate quirks at enumeration
Adriana Reus [Thu, 20 Nov 2014 15:51:17 +0000 (17:51 +0200)]
Populate quirks at enumeration

Currently quirks are populated when Android asks for activation.
This can be troublesome if we're enabling a virtual
sensor before the base sensor.

Change-Id: Ib988559a0e5e44767187380b928e7862adc40d4a
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-on: https://android.intel.com:443/303492

9 years agoMove defines to appropriate c files
Adriana Reus [Thu, 20 Nov 2014 13:30:26 +0000 (15:30 +0200)]
Move defines to appropriate c files

Some clean-up

Change-Id: I5d04f329d0ee965ba6e9c943baf6682209922060
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoDon't setup an upper limit for the magnetometer sanity_norm
Adriana Reus [Thu, 20 Nov 2014 12:52:50 +0000 (14:52 +0200)]
Don't setup an upper limit for the magnetometer sanity_norm

CDD requires a minimum capability of 900 mT and this limits it.

Change-Id: I81596da46a944c4c99cd92498b72b2ebe914f19a
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoWarning removal round
Patrick Porlan [Wed, 19 Nov 2014 13:28:11 +0000 (14:28 +0100)]
Warning removal round

- mark unused parameters as such if we can't delete them
- delete truly unused parameters (ts in magneto calibration)

Change-Id: I9e1a17c962fb06f2ea08dc709ea4d295e4aaf70d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Reviewed-on: https://android.intel.com:443/302995

9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Mon, 17 Nov 2014 11:17:07 +0000 (13:17 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  a60517d Mon Nov 17 12:41:39 2014 +0200 | Fix for broken indexes in compass calibration (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  compass-calibration.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-4125
Change-Id: Iacd7781f98f6bb6c4944b1edb8b7ec7ef8ebdc6a
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoFix for broken indexes in compass calibration
Adriana Reus [Mon, 17 Nov 2014 10:41:39 +0000 (12:41 +0200)]
Fix for broken indexes in compass calibration

My previous patch (Validate old cal_level) introduced an error
in the calibration level logic.

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-4108
Change-Id: I159cc1d5330147333eb25501525773db78b57573
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Fri, 14 Nov 2014 16:42:29 +0000 (18:42 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  bd8906e Fri Nov 14 16:31:49 2014 +0200 | Validate old cal_level (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  41fef7b Fri Nov 14 16:33:42 2014 +0100 | GMINL-3234: Reduce magneto and gyro filter windows [Patrick Porlan]
  11fddd8 Fri Nov 14 15:43:44 2014 +0100 | GMINL-3234: Refactor a little bit our filtering code [Patrick Porlan]
  33fd15a Fri Nov 14 14:36:54 2014 +0100 | GMINL-3234: Reorganize filters a litle [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  compass-calibration.c |  16 +++--
  control.c             |  17 ++---
  enumeration.c         |   7 +-
  filtering.c           | 173 +++++++++++++++++++++++++++++++++++++++++++-------
  filtering.h           |  10 ++-
  transform.c           |  82 ++----------------------
  6 files changed, 176 insertions(+), 129 deletions(-)

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-4053
Change-Id: Ic521c3932544e8e1b853570c9b6f226618f73172

9 years agoValidate old cal_level
Adriana Reus [Fri, 14 Nov 2014 14:31:49 +0000 (16:31 +0200)]
Validate old cal_level

In case we play with the cal level setting for a platform
it's best to check that the old one is not in fact outdated.
For example we lowered it for the ecs so the check is to make
sure this takes effect in case of an OTA update for example.

Change-Id: I78cba3722edd15ca23dc5f8c75bd8f0eef74d50e
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoGMINL-3234: Reduce magneto and gyro filter windows
Patrick Porlan [Fri, 14 Nov 2014 15:33:42 +0000 (16:33 +0100)]
GMINL-3234: Reduce magneto and gyro filter windows

Use 20 samples for the magnetometer moving average, rather than
the previous 30. I believe that reduces latency that the camera
is sensitive to.

Also reduce the median filter set to 5 samples, rather than 7,
in the goal of increasing the "freshness" of gyro readings, with
an increase of noise level though.

At some point in the future we should make these per-sensor params.

Change-Id: I772c1fb720b5a1ebd9ed3d376bb038a1d0fed615
Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3234
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMINL-3234: Refactor a little bit our filtering code
Patrick Porlan [Fri, 14 Nov 2014 14:43:44 +0000 (15:43 +0100)]
GMINL-3234: Refactor a little bit our filtering code

filtering.h has a simpler interface now, and filtering structures
are now uniformly allocated/cleaned on enable/disable, for sensors
marked as noisy.

This paves the way for per-sensor filter type and parameters.

Change-Id: I1e867570e79c3a56bac0734307a023c1101bb826
Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3234
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMINL-3234: Reorganize filters a litle
Patrick Porlan [Fri, 14 Nov 2014 13:36:54 +0000 (14:36 +0100)]
GMINL-3234: Reorganize filters a litle

The moving average filter has a new home: was transform.c, now
filtering.c, with a new name also.

Change-Id: I9670dc687f883bba205ee2525ff364d628d54828
Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3234
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Thu, 13 Nov 2014 13:18:55 +0000 (15:18 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  55a8356 Wed Nov 12 17:53:07 2014 +0100 | GMINL-3234: Temporarily remove uncalibrated gyroscope (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
  89dc581 Wed Nov 12 15:02:07 2014 +0100 | GMINL-3234: Allow for a minimal sensor sampling rate [Patrick Porlan]
  e66ecb2 Tue Nov 11 18:21:14 2014 +0200 | Compass calibration minor fixes [Adriana Reus]
  f2f754d Wed Nov 12 14:56:28 2014 +0100 | GMINL-3234: Tweak magneto filter window size [Patrick Porlan]
  0813206 Tue Nov 11 12:37:29 2014 +0200 | Configurable calibration steps [Adriana Reus]
  fdb0f76 Mon Nov 10 19:56:36 2014 +0200 | Don't let the timestamp get too far behind [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  common.h              |  3 +++
  compass-calibration.c | 16 ++++++++++++++--
  control.c             |  4 ++++
  description.c         | 36 +++++++++++++++++++++++++++++++++++-
  description.h         |  1 +
  enumeration.c         | 10 ++++++++--
  transform.c           |  2 +-
  7 files changed, 66 insertions(+), 6 deletions(-)

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-4014
Change-Id: Ib0eb72773199038832c11be6024e7c0c1e3ee09c
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoGMINL-3234: Temporarily remove uncalibrated gyroscope
Patrick Porlan [Wed, 12 Nov 2014 16:53:07 +0000 (17:53 +0100)]
GMINL-3234: Temporarily remove uncalibrated gyroscope

The camera app seem to be opening both gyros during panorama
creation, and I suspect that this is causing problems, even
though I can't confirm it, and I don't understand why. As
this sensor type is simply a nice-to-have, I prefer disabling
it pending further investigation.

Change-Id: I01b6324fb8c0e3d01c1dbc71096bee17e766c333
Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3234
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMINL-3234: Allow for a minimal sensor sampling rate
Patrick Porlan [Wed, 12 Nov 2014 14:02:07 +0000 (15:02 +0100)]
GMINL-3234: Allow for a minimal sensor sampling rate

The magnetometer is used at 5 Hz by default, which makes calibration
and filtering operate less than optimally. Allow for a minimum sampling
rate specifier, though the min_freq optional parameter.

Change-Id: I7fbb894c72f72cca17d2609454e70f5f8c7874e7
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoCompass calibration minor fixes
Adriana Reus [Tue, 11 Nov 2014 16:21:14 +0000 (18:21 +0200)]
Compass calibration minor fixes

Change-Id: Iccc77d87a160f6a48eb9c74c18ccfd0d1a2b2368
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoGMINL-3234: Tweak magneto filter window size
Patrick Porlan [Wed, 12 Nov 2014 13:56:28 +0000 (14:56 +0100)]
GMINL-3234: Tweak magneto filter window size

100 events is way too much, and besides, this value is being reduced
to one second worth of data samples anyway. That should reduce CPU
load and latency a little bit on fast magnetometers. On the ECS
Cruise 7 it shouldn't change much as the BMC150 operates at 30 Hz max.

Change-Id: I078d071dd7c5fb0b06e0fd01739679cff0ac8bef
Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3234
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoConfigurable calibration steps
Adriana Reus [Tue, 11 Nov 2014 10:37:29 +0000 (12:37 +0200)]
Configurable calibration steps

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3783
Change-Id: I90bb09187c5d6fd8002f65c92612c381b4ea4bf5
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoDon't let the timestamp get too far behind
Adriana Reus [Mon, 10 Nov 2014 17:56:36 +0000 (19:56 +0200)]
Don't let the timestamp get too far behind

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3896
Change-Id: I151d9cc964524998fb4fa5dc388395e5e1857eb7
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Mon, 10 Nov 2014 12:18:56 +0000 (14:18 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  467a854 Fri Nov 7 14:30:05 2014 +0200 | Change enable_count with flag (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  40a6350 Mon Nov 3 16:04:30 2014 +0200 | Magneto calibration tweaks [Adriana Reus]
  8e4a72f Thu Oct 30 16:27:00 2014 +0100 | GMINL-3234: Clamp very low gyro reading to zero [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h         |  1 -
  common.h              |  2 +-
  compass-calibration.c | 10 ++++----
  control.c             | 37 ++++++++++++++---------------
  gyro-calibration.c    |  6 ++---
  transform.c           | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++-
  6 files changed, 91 insertions(+), 30 deletions(-)

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3832
Change-Id: I0b48e2d201d1cb27992cbf5897468abae6d9065d
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoChange enable_count with flag
Adriana Reus [Fri, 7 Nov 2014 12:30:05 +0000 (14:30 +0200)]
Change enable_count with flag

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3725
Change-Id: I50eae55b9128ce4e3c647dbed633fea933b522dd
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoMagneto calibration tweaks
Adriana Reus [Mon, 3 Nov 2014 14:04:30 +0000 (16:04 +0200)]
Magneto calibration tweaks

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3514
Change-Id: I7c1f61310218551ce84fd0a497f57b850490d4a9
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoGMINL-3234: Clamp very low gyro reading to zero
Patrick Porlan [Thu, 30 Oct 2014 15:27:00 +0000 (16:27 +0100)]
GMINL-3234: Clamp very low gyro reading to zero

This avoids accumulating error over long periods of time.
Incidently, be more cautious with the gyro status field,
as it's not valid for the uncal gyro.

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3234
Change-Id: Ic4fa964bb31c3e223eabf23382be27f51e3df529
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Fri, 31 Oct 2014 10:28:17 +0000 (12:28 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  f883d43 Mon Oct 27 14:36:06 2014 +0200 | Provision the preferred scale (origin/abt/topic/gmin/l-dev/sensors/master) [Viorel Suman]
  9b29687 Thu Oct 30 12:56:39 2014 +0200 | Handle max_freq parameter [Adriana Reus]
  64c5e96 Tue Oct 28 12:48:34 2014 +0200 | Reset gyro filtering for each enabling. [Adriana Reus]
  537fd28 Mon Oct 27 19:04:40 2014 +0200 | Fix initialization points for event_count and meta_data_pending [Adriana Reus]
  94c3ac8 Tue Oct 28 12:22:01 2014 +0200 | Fix bug in gyro filtering call. [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  common.h      |  1 -
  control.c     |  2 ++
  description.c | 11 ++++++++++-
  enumeration.c | 24 ++++++++++++++++++++----
  filtering.c   | 14 ++++++++++++++
  filtering.h   |  4 ++--
  6 files changed, 48 insertions(+), 8 deletions(-)

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3440
Change-Id: I944e1a752ca2a93f6ce3728246aaf317729bac02
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoProvision the preferred scale
Viorel Suman [Mon, 27 Oct 2014 12:36:06 +0000 (14:36 +0200)]
Provision the preferred scale

The patch enables the provisioning of the preferred
scale for a specific sensor.

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3156
Change-Id: I6884ea03a98621e61c39ce956e9b19624e8682f0
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
Reviewed-on: https://android.intel.com:443/293561

9 years agoHandle max_freq parameter
Adriana Reus [Thu, 30 Oct 2014 10:56:39 +0000 (12:56 +0200)]
Handle max_freq parameter

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-1535
Change-Id: I5aea4c040e2da587aff7bed5b08df26ea0950bda
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-on: https://android.intel.com:443/294928

9 years agoReset gyro filtering for each enabling.
Adriana Reus [Tue, 28 Oct 2014 10:48:34 +0000 (12:48 +0200)]
Reset gyro filtering for each enabling.

Issue: GMINL-2659
Change-Id: I1d7703cb384c8ffb40539955a91fd1d3c17a074e
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoFix initialization points for event_count and meta_data_pending
Adriana Reus [Mon, 27 Oct 2014 17:04:40 +0000 (19:04 +0200)]
Fix initialization points for event_count and meta_data_pending

Issue: GMINL-2659
Change-Id: Iec77dacc2eec496ebe5f63950840de3c3ce46aca
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoFix bug in gyro filtering call.
Adriana Reus [Tue, 28 Oct 2014 10:22:01 +0000 (12:22 +0200)]
Fix bug in gyro filtering call.

Issue: GMINL-2659
Change-Id: I49b96138fa2de50ef1f324205b354769e66a18e6
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Mon, 27 Oct 2014 15:05:26 +0000 (17:05 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  f4cb7dc Fri Oct 24 15:17:45 2014 +0200 | GMINL-2659: Keep recent events history for fusion-like processing (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
  7c24cdc Mon Oct 27 13:11:25 2014 +0200 | Scale magnetic events within a sanity limit [Adriana Reus]
  ff21ce0 Thu Oct 23 16:27:42 2014 +0300 | Keep gyro cal between reboots [Adriana Reus]
  910e5cc Wed Oct 22 15:13:51 2014 +0300 | Collect a minimum number of events for filtering for noisy sensors [Adriana Reus]
  fc476f1 Fri Oct 17 15:34:20 2014 +0200 | IRDA-2056: Add type field to sensor_info structure [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h         |  2 ++
  common.h              | 22 ++++++++++++++++++++-
  compass-calibration.c | 45 +++++++++++++++++++++++++------------------
  control.c             | 48 +++++++++++++++++++++-------------------------
  description.c         | 32 ++++++-------------------------
  enumeration.c         | 12 ++++++------
  filtering.c           | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
  filtering.h           |  2 ++
  gyro-calibration.c    | 41 +++++++++++++++++++++++++++++++++++++--
  transform.c           | 38 ++++++++++++++++++++++--------------
  10 files changed, 201 insertions(+), 94 deletions(-)

Tracked-On: https://jira01.devtools.intel.com/browse/GMINL-3169
Change-Id: I6e0ec40cfd34c7cf3eef2428ee6b33de7f7173c4
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Mon, 27 Oct 2014 15:05:26 +0000 (17:05 +0200)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  f4cb7dc Fri Oct 24 15:17:45 2014 +0200 | GMINL-2659: Keep recent events history for fusion-like processing (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
  7c24cdc Mon Oct 27 13:11:25 2014 +0200 | Scale magnetic events within a sanity limit [Adriana Reus]
  ff21ce0 Thu Oct 23 16:27:42 2014 +0300 | Keep gyro cal between reboots [Adriana Reus]
  910e5cc Wed Oct 22 15:13:51 2014 +0300 | Collect a minimum number of events for filtering for noisy sensors [Adriana Reus]
  fc476f1 Fri Oct 17 15:34:20 2014 +0200 | IRDA-2056: Add type field to sensor_info structure [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h         |  2 ++
  common.h              | 22 ++++++++++++++++++++-
  compass-calibration.c | 45 +++++++++++++++++++++++++------------------
  control.c             | 48 +++++++++++++++++++++-------------------------
  description.c         | 32 ++++++-------------------------
  enumeration.c         | 12 ++++++------
  filtering.c           | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
  filtering.h           |  2 ++
  gyro-calibration.c    | 41 +++++++++++++++++++++++++++++++++++++--
  transform.c           | 38 ++++++++++++++++++++++--------------
  10 files changed, 201 insertions(+), 94 deletions(-)

Change-Id: I6e0ec40cfd34c7cf3eef2428ee6b33de7f7173c4

9 years agoGMINL-2659: Keep recent events history for fusion-like processing
Patrick Porlan [Fri, 24 Oct 2014 13:17:45 +0000 (15:17 +0200)]
GMINL-2659: Keep recent events history for fusion-like processing

We may wish to correlate recent input from several active sensors.
In preparation to that, keep the last 100 events we got for the
entire sensors collection. This is intended as a lightweight record,
built and used from the main sensor sample retrieval thread exclusively
so we don't have to deal with performance-degrading synchronization
primitives. This data will enable multi-sensors filtering decisions.

Change-Id: Ied6559c7dd91e94bebbeb1bc60182d1db3103d8c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoScale magnetic events within a sanity limit
Adriana Reus [Mon, 27 Oct 2014 11:11:25 +0000 (13:11 +0200)]
Scale magnetic events within a sanity limit

Scale magnetic events even if we don't have a calibration.
If the values are considered "wrong" by Android it does not compute
values for the virtual sensors until we have a calibration and
sane looking values in place

Change-Id: I94347d98f541c85d9734ce347a070abca351de2c
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoKeep gyro cal between reboots
Adriana Reus [Thu, 23 Oct 2014 13:27:42 +0000 (16:27 +0300)]
Keep gyro cal between reboots

Issue: GMINL-2743
Change-Id: I232e979d62d12f31168c0bfdcfcd3b224d5237b3
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-on: https://android.intel.com:443/292457

9 years agoCollect a minimum number of events for filtering for noisy sensors
Adriana Reus [Wed, 22 Oct 2014 12:13:51 +0000 (15:13 +0300)]
Collect a minimum number of events for filtering for noisy sensors

This is to make sure we have at least a couple of events for
the filtering queue and to make sure we are not sensing events
that can affect the overall mean or standard deviation.

Change-Id: If359915e7281a553758eb79ec10ea0559f9490f8
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-on: https://android.intel.com:443/291953

9 years agoIRDA-2056: Add type field to sensor_info structure
Patrick Porlan [Fri, 17 Oct 2014 13:34:20 +0000 (15:34 +0200)]
IRDA-2056: Add type field to sensor_info structure

We were getting this information through the associated catalog
entry but it's considerably more readable this way.

Change-Id: I7b4489738e755a2831930c0a1a335a2fb9e731cc
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Thu, 23 Oct 2014 13:58:47 +0000 (16:58 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master

git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  5b9cb96 Thu Oct 16 10:33:57 2014 +0200 | IRDA-2056: Header file cleanup (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
  af41894 Wed Oct 15 14:30:40 2014 +0200 | IRDA-2056: Rename continuous quirk flag and fix the location where it's used [Patrick Porlan]
  7755b1c Wed Oct 15 14:29:25 2014 +0200 | IRDA-2056: Cosmetic whitespace shuffling [Patrick Porlan]
  138a7ad Wed Oct 15 14:27:10 2014 +0200 | IRDA-2056: Link the terse flag to the variable we're now using to decide whether or not to operate in "driver only sending events on motion" mode. [Patrick Porlan]
  4b21c9f Wed Oct 15 14:22:02 2014 +0200 | IRDA-2056: Remove a superfluous check [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  control.c     |  4 ++--
  description.c |  7 +++----
  description.h | 35 +++++++++++++++--------------------
  enumeration.c | 59 ++++++++++++++++++++++-------------------------------------
  4 files changed, 42 insertions(+), 63 deletions(-)

Tracked-On:https://jira01.devtools.intel.com/browse/GMINL-2821
Change-Id: I36bcd5eee3af84edc2c311a72f032bb14a3546b7
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoIRDA-2056: Header file cleanup
Patrick Porlan [Thu, 16 Oct 2014 08:33:57 +0000 (10:33 +0200)]
IRDA-2056: Header file cleanup

Order and symetry reduce the reader's cognitive load...

Change-Id: Ifa47d3a109898a16565eac7315bc35711bda4b9c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Reviewed-on: https://android.intel.com:443/289221

9 years agoIRDA-2056: Rename continuous quirk flag and fix the location where it's used
Patrick Porlan [Wed, 15 Oct 2014 12:30:40 +0000 (14:30 +0200)]
IRDA-2056: Rename continuous quirk flag and fix the location where it's used

This flag is used to force use of the continuous trigger, typically
in cases where the motion trigger would otherwise be autoselected.

Also, there are cases, such as with the Invensense driver that we
have on the T100, where a single trigger will control several
sensors because they're associated to the same iio device. In that
case having a single sensor forced to continous mode will imply that
no sensor co-located on the same iio device can be in "only send
events whenever there's motion" mode.

Change-Id: I4d01d2d964b70dead3e67c54bdd92d7d938cbf23
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Reviewed-on: https://android.intel.com:443/289220