OSDN Git Service

android-x86/hardware-intel-libsensors.git
9 years agoMin/Max delay for Light and Temperature
Viorel Suman [Fri, 3 Oct 2014 07:24:36 +0000 (10:24 +0300)]
Min/Max delay for Light and Temperature

The patch reviews the get_min_delay and
get_max_delay methods, and sets the min delay
for polling light and temperature sensors.

Change-Id: I75303c672c7ccc5ec5fe4d7f879ed934cda1f55a
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Wed, 1 Oct 2014 15:17:20 +0000 (18:17 +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:
  66e23b6 Tue Sep 30 17:03:23 2014 +0300 | load/set_timestamp functions implementation (origin/abt/topic/gmin/l-dev/sensors/master) [Viorel Suman]
  5426187 Mon Sep 29 17:59:12 2014 +0200 | IRDA-1184: Fix event duplication condition [Patrick Porlan]
  91169af Mon Sep 29 17:26:00 2014 +0200 | IRDA-1184: Fix poll time calculation routine [Patrick Porlan]
  2afe869 Tue Sep 23 16:23:10 2014 +0300 | Moving average optimization [Viorel Suman]
  6cd353a Wed Oct 1 12:08:58 2014 +0300 | Minor clean-up [Adriana Reus]
  c8bc431 Wed Oct 1 11:42:12 2014 +0300 | Don't setup the timestamp artificially for non-continous sensors [Adriana Reus]
  58dfca4 Thu Sep 25 15:37:21 2014 +0300 | Clamp frequency to smallest supported rate if requested lower [Adriana Reus]
  77fd2f6 Wed Sep 24 16:43:08 2014 +0200 | IRDA-1184: Alternate between triggers depending on sampling rate [Patrick Porlan]
  c230e47 Thu Sep 18 23:22:31 2014 +0200 | control: Retry when buffer enabling fails [Samuel Ortiz]
  8977477 Thu Sep 25 12:12:44 2014 +0300 | Initialize fifoReservedEventCount and fifoMaxEventCount [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h         |    8 -----
  common.h              |    1 +
  compass-calibration.c |    6 ++++
  control.c             |   93 +++++++++++++++++++++++++++++++++++++++++--------
  description.h         |    3 ++
  enumeration.c         |    6 ++++
  transform.c           |   41 ++++++++++++++--------
  utils.c               |   15 ++++++--
  utils.h               |    2 ++
  9 files changed, 135 insertions(+), 40 deletions(-)

Change-Id: Idc427a94cdc7645185dba5f57e5d8359d7a46815
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoload/set_timestamp functions implementation
Viorel Suman [Tue, 30 Sep 2014 14:03:23 +0000 (17:03 +0300)]
load/set_timestamp functions implementation

The patch implements the load_timestamp and
set_timestamp functions aimed to provide a
common way to manage the timestamps.

Change-Id: If5d5d86ed9f83298385e7736345f7eee2884418c
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
9 years agoIRDA-1184: Fix event duplication condition
Patrick Porlan [Mon, 29 Sep 2014 15:59:12 +0000 (17:59 +0200)]
IRDA-1184: Fix event duplication condition

Now that we can dynamically switch between continous and motion
triggers, checking for the terse flag is not necessary, and is
confusing.

Issue: IRDA-1184

Change-Id: Iaed039550a2d4d30b1cb1aa1c03785d4bcbe6b70
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoIRDA-1184: Fix poll time calculation routine
Patrick Porlan [Mon, 29 Sep 2014 15:26:00 +0000 (17:26 +0200)]
IRDA-1184: Fix poll time calculation routine

The poll delay should be maximum if we're operating in continuous mode
even if the sensor supports a motion trigger. This should very slightly
lower CPU consumption, avoiding a few unrequired exits from epoll.

Issue: IRDA-1184

Change-Id: I026be3de5fed49b77f7d9ac3718ab7c71e527d9d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMoving average optimization
Viorel Suman [Tue, 23 Sep 2014 13:23:10 +0000 (16:23 +0300)]
Moving average optimization

The patch optimizes the moving average calculation
by introducing the moving history sum calculated
while the new data is recorded.

Change-Id: I9a8a505c983ecd48c1e160495ea45030dabbf535
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
9 years agoMinor clean-up
Adriana Reus [Wed, 1 Oct 2014 09:08:58 +0000 (12:08 +0300)]
Minor clean-up

Change-Id: Ib2b81f09c6a640f858b2564cb8232622693f3c4c
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoDon't setup the timestamp artificially for non-continous sensors
Adriana Reus [Wed, 1 Oct 2014 08:42:12 +0000 (11:42 +0300)]
Don't setup the timestamp artificially for non-continous sensors

Change-Id: I52c2e8777f28ea8a958f3078486ec0dcce4e505d
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoClamp frequency to smallest supported rate if requested lower
Adriana Reus [Thu, 25 Sep 2014 12:37:21 +0000 (15:37 +0300)]
Clamp frequency to smallest supported rate if requested lower

As per HAL spec requirements.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: I31df5dfef5bf5ba463aeaa295369fea1f19cf96d

9 years agoIRDA-1184: Alternate between triggers depending on sampling rate
Patrick Porlan [Wed, 24 Sep 2014 14:43:08 +0000 (16:43 +0200)]
IRDA-1184: Alternate between triggers depending on sampling rate

The BMC150 accel driver any-motion trigger is too jerky for certain
games such as the "sniper shooter" one, or "doodle jump". Switch back
to continuous event generation mode if a sampling rate above 25 is
requested, which should keep both the launcher (15 events per second)
and games (60 events per second) happy.

Issue: IRDA-1184

Change-Id: I16000d57e17506aa7e7c0a4f83ced7739e01dd01
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agocontrol: Retry when buffer enabling fails
Samuel Ortiz [Thu, 18 Sep 2014 21:22:31 +0000 (23:22 +0200)]
control: Retry when buffer enabling fails

On suspend/resume cycles, enabling the data buffer might fail and thus
would keep the driver in sleep mode.
We retry a few times in that case, giving the driver a few ms to come
back from suspend.

Issue: IRDA-603
Change-Id: Icd781d6574052d1c87a9f0b29b68ea72aa4dbbb2
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoInitialize fifoReservedEventCount and fifoMaxEventCount
Adriana Reus [Thu, 25 Sep 2014 09:12:44 +0000 (12:12 +0300)]
Initialize fifoReservedEventCount and fifoMaxEventCount

Set them up to 0 as we are not implementing batch yet,
will be set up appropriately when we will have batch mode.

Change-Id: Ia6d3fc46d12ce453deb150e312afb6ae5043a973
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...
Viorel Suman [Wed, 24 Sep 2014 14:29:10 +0000 (17:29 +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]" origin/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
  ccf4852 Wed Sep 24 14:53:45 2014 +0300 | Adapt polling rate to get a real frequency closer to the advertised one (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  83d771c Wed Sep 24 12:33:11 2014 +0300 | Median filter implementation [Adriana Reus]
  38059a0 Thu Sep 18 16:08:42 2014 +0300 | The event timestamp as function of frequency [Viorel Suman]
  eb6f309 Thu Sep 18 14:36:04 2014 +0300 | Revert "[Workaround] Fix event timestamp recurrency" [Viorel Suman]

git diff --stat origin/abt/topic/gmin/l-dev/master..HEAD:
  Android.mk    |   1 +
  common.h      |   5 ++-
  control.c     |  36 +++++++++++++++-----
  description.c |   6 +++-
  description.h |   1 +
  enumeration.c |  28 +++++++++++++++
  filtering.c   | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  filtering.h   |  25 ++++++++++++++
  transform.c   |   3 +-
  9 files changed, 202 insertions(+), 11 deletions(-)

Change-Id: I74cefcc04c195180362a9c34f4d57cda9e5151f1
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
9 years agoAdapt polling rate to get a real frequency closer to the advertised one
Adriana Reus [Wed, 24 Sep 2014 11:53:45 +0000 (14:53 +0300)]
Adapt polling rate to get a real frequency closer to the advertised one

When polling try to compensate for the iio overhead in
order to try to get a frequency closer to the advertised one.
It helps for a bunch of cts tests.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: I9fd6352d9515faff368167f8f2be66869cf75eda

9 years agoMedian filter implementation
Adriana Reus [Wed, 24 Sep 2014 09:33:11 +0000 (12:33 +0300)]
Median filter implementation

Use a median filter for gyroscope. It seems better
suited for the type of noise we are observing and it
also solves cts standard deviation failures

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: Ib53846cfb92912ae66d16e6993e6f97d4a3e3328

9 years agoThe event timestamp as function of frequency
Viorel Suman [Thu, 18 Sep 2014 13:08:42 +0000 (16:08 +0300)]
The event timestamp as function of frequency

The patch guards the sensor event timestamp
as function of frequency in order to fix the
"EventGapVerification" and "FrequencyVerification"
from the new L-Dessert SingleSensorTests CTS test
case. It also introduces the CONTINUOUS_DRIVER quirk
used to enforce the continuous driver mode.

Issue: GMINL-544
Change-Id: I5b6accd1c7fa84e3eaeeb48c77fe86bc824781b3
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
9 years agoRevert "[Workaround] Fix event timestamp recurrency"
Viorel Suman [Thu, 18 Sep 2014 11:36:04 +0000 (14:36 +0300)]
Revert "[Workaround] Fix event timestamp recurrency"

This reverts commit b1f370d00598b68a52c754495e6455a8af5c2b35.
Change-Id: If9aa055b01ad2326f5c567a7c25f207188b206eb

9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Thu, 18 Sep 2014 09:43:01 +0000 (12:43 +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:
  ca5db17 Wed Sep 17 17:26:14 2014 +0300 | Setup some sanity limitations for magnetometer calibration (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  642a2d2 Wed Sep 17 15:38:04 2014 +0300 | Change the uncalibrated vs calibrated order. [Adriana Reus]
  3dc768c Tue Sep 16 14:08:10 2014 +0300 | Don't calibrate gyro if terse driver [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h         |    3 +++
  compass-calibration.c |   18 ++++++++++++++++++
  control.c             |   19 +++++++++++--------
  transform.c           |    3 ++-
  4 files changed, 34 insertions(+), 9 deletions(-)

Change-Id: I08d7310a03dcacfc2285496d199873840191d3a2

9 years agoSetup some sanity limitations for magnetometer calibration
Adriana Reus [Wed, 17 Sep 2014 14:26:14 +0000 (17:26 +0300)]
Setup some sanity limitations for magnetometer calibration

We never considered a certain magnetic field strength
because it varies depending on the location. Added some
sanity checking though because sometimes the calibration
gets a big bias and reduces the data values.

Change-Id: I7020b68f0bbd6ed0ba9bded1dbd3936034d92aa5
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoChange the uncalibrated vs calibrated order.
Adriana Reus [Wed, 17 Sep 2014 12:38:04 +0000 (15:38 +0300)]
Change the uncalibrated vs calibrated order.

Send the calibrated event before the corresponding uncalibrated
one for gyro. It pleases Cts Verifier.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: I0e1be4d38b47ba3d1fcb6ee33ba43c0b99afe31f

9 years agoDon't calibrate gyro if terse driver
Adriana Reus [Tue, 16 Sep 2014 11:08:10 +0000 (14:08 +0300)]
Don't calibrate gyro if terse driver

If we get events on a on-change basis it's better not to
attempt a calibration since we may receive the same event
duplicated and may end up with a wrong bias.

Issue: GMINL-1234
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: Ieb99ee794299f3112f3149757a5a2ae0cdfc256e

9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Mon, 15 Sep 2014 14:22:01 +0000 (17:22 +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:
  298c194 Fri Aug 29 13:57:07 2014 +0200 | Refine sensor property get function to filter by iio dev name (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
  b1f370d Mon Sep 15 14:06:56 2014 +0300 | [Workaround] Fix event timestamp recurrency [Adriana Reus]
  8b0553e Mon Sep 15 14:05:29 2014 +0300 | Limit max frequency to 1000 Hz [Adriana Reus]
  05135a5 Mon Sep 15 14:03:27 2014 +0300 | Revert "STPK-1429: Always wait for at least 1 ms before repeating samples" [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  common.h      |    1 +
  control.c     |   13 ++++---------
  description.c |   25 ++++++++++++++++++++++++-
  3 files changed, 29 insertions(+), 10 deletions(-)

Change-Id: Ic8e63f31165e0e63e41c32d745cde37dae17da9b

9 years agoRefine sensor property get function to filter by iio dev name
Patrick Porlan [Fri, 29 Aug 2014 11:57:07 +0000 (13:57 +0200)]
Refine sensor property get function to filter by iio dev name

This enables having multiple sensors of the same type.

ro.iio.anglvel.bmg160.name is picked up instead of
ro.iio.anglvel.name if the iio device name fort he sensor we
are querying is bmg160.

Change-Id: I62995ea293b765585778a2190bff31c6a75c3ef5
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years ago[Workaround] Fix event timestamp recurrency
Adriana Reus [Mon, 15 Sep 2014 11:06:56 +0000 (14:06 +0300)]
[Workaround] Fix event timestamp recurrency

A lot of new cts test for sensors expect to have
very regular intervals for events or else they will
report event gaps. Getting the timestamp right before
reporting seems to level them.

Issue: GMINL-544
Change-Id: Ie9554ba3ff95a5fa2c5bb29083181bf23776765e
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoLimit max frequency to 1000 Hz
Adriana Reus [Mon, 15 Sep 2014 11:05:29 +0000 (14:05 +0300)]
Limit max frequency to 1000 Hz

Android sets up 1000 hz for DELAY_FASTEST. This conflicts
with some cts tests for sensors that report higher frequencies
(example bmg160 gyro). Since none of the current sensors actually
report these kind of high values to userspace it also
doesn't make much sense to duplicate events in a higher rate.

Issue: GMINL-544
Change-Id: I2ded62ca7345b0f49c4b8b20ce3022055bacbdd1
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoRevert "STPK-1429: Always wait for at least 1 ms before repeating samples"
Adriana Reus [Mon, 15 Sep 2014 11:03:27 +0000 (14:03 +0300)]
Revert "STPK-1429: Always wait for at least 1 ms before repeating samples"

This adds an artificial limitation for frequency which makes
some cts tests fail. They expect to receive higher frequencies
(example 1000 hz) but this limits the frequency at aroung 850 hz.
I wasn't able to see any side effect from removing this, so revert
at least for the moment.

This reverts commit 4c189692e67bc68d520d7adf462348ea4fd54900.

Issue: GMINL-544

9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin...
Adriana Reus [Tue, 9 Sep 2014 14:55:30 +0000 (17:55 +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:
  28c665e Mon Aug 18 11:28:26 2014 +0300 | Fix build for x86_64 (origin/abt/topic/gmin/l-dev/sensors/master) [Irina Tirdea]
  4acf533 Thu Sep 4 13:54:01 2014 +0300 | Populate minDelay field. [Adriana Reus]
  61a5b42 Thu Aug 28 19:20:01 2014 +0200 | GMIN-2992: Prefix uncalibrated gyro name with Uncalibrated [Patrick Porlan]
  7d7c4b0 Wed Aug 27 18:12:10 2014 +0200 | GMIN-3015: Initialize accuracy flag on accel and gyro samples [Patrick Porlan]
  25e58ad Wed Aug 27 18:36:43 2014 +0200 | GMIN-3015: Refine a little bit the magnetometer accuracy indicator [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  compass-calibration.c |   31 +++++++++++++++++++++----
  control.c             |   15 +++++++-----
  description.c         |   62 +++++++++++++++++++++++++++++++++++++++++++++++++
  enumeration.c         |    8 +++++++
  gyro-calibration.c    |    5 ++++
  transform.c           |    2 ++
  6 files changed, 112 insertions(+), 11 deletions(-)

Change-Id: I2c9474899c85908c2c69eab675bf90b751cdca3a

9 years agoFix build for x86_64
Irina Tirdea [Mon, 18 Aug 2014 08:28:26 +0000 (11:28 +0300)]
Fix build for x86_64

target  C: sensors.gmin <= vendor/intel/hardware/iio-sensors/./control.c
vendor/intel/hardware/iio-sensors/./control.c: In function 'acquisition_routine':
vendor/intel/hardware/iio-sensors/./control.c:337:10: error: cast from pointer
to integer of different size [-Werror=pointer-to-int-cast]
  int s = (int) param;
          ^
vendor/intel/hardware/iio-sensors/./control.c: In function
'start_acquisition_thread':
vendor/intel/hardware/iio-sensors/./control.c:453:5: error: cast to pointer
from integer of different size [-Werror=int-to-pointer-cast]
     (void*) s);
     ^

Change-Id: Id994ceab05378e53b38bfafa4ead9121eb4163e8
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
9 years agoPopulate minDelay field.
Adriana Reus [Thu, 4 Sep 2014 10:54:01 +0000 (13:54 +0300)]
Populate minDelay field.

Populate minDelay field with what data we find in
'sampling_frequencies_available'.
For sensors in poll mode where we don't have a way to
request a frequency, artificially set up a limit per
CDD requirements.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: I962e6e352a07f42b4833a83908a4b984a3f17235

9 years agoGMIN-2992: Prefix uncalibrated gyro name with Uncalibrated
Patrick Porlan [Thu, 28 Aug 2014 17:20:01 +0000 (19:20 +0200)]
GMIN-2992: Prefix uncalibrated gyro name with Uncalibrated

Otherwise it's not clear in many applications which of the two
gyroscopes is the uncalibrated one.

Issue: GMIN-2992

Change-Id: I5610e16290e0e8914efb8bf5aa3a8250bc141509
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-3015: Initialize accuracy flag on accel and gyro samples
Patrick Porlan [Wed, 27 Aug 2014 16:12:10 +0000 (18:12 +0200)]
GMIN-3015: Initialize accuracy flag on accel and gyro samples

It's done already for magnetometer samples, and this flag does not
exist for sensors other than 3D (see sensors.h). This indicator is
visible in applications such as My Sensors, and may be used by the
sensors framework to decide how much it can trust incoming data.

Issue: GMIN-3015

Change-Id: I6773819396b1adc44ab0b56f7cf3b9e295706644
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-3015: Refine a little bit the magnetometer accuracy indicator
Patrick Porlan [Wed, 27 Aug 2014 16:36:43 +0000 (18:36 +0200)]
GMIN-3015: Refine a little bit the magnetometer accuracy indicator

We now start at the default (unreliable) level then increase as we
go through calibration stages.

Issue: GMIN-3015

Change-Id: I3432feaad3426748b991da94bc41983d0b97943d
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 [Wed, 3 Sep 2014 09:23:22 +0000 (12:23 +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:
  e58ac5e Tue Aug 26 11:57:01 2014 +0200 | GMIN-2992: Revisit gyroscope calibration (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
  85c4211 Tue Aug 26 15:51:42 2014 +0200 | GMIN-2992: Don't be as heavy handed with gyro filtering as compass [Patrick Porlan]
  86b28ca Tue Aug 26 11:00:52 2014 +0200 | GMIN-2992: Use much larger set for gyro calibration [Patrick Porlan]
  aac966e Mon Aug 25 18:51:55 2014 +0200 | GMIN-2992: Start with -dev trigger before switching to -any-motion [Patrick Porlan]
  50e0b4b Mon Aug 4 20:01:38 2014 +0200 | Reconciliate tree with SP version regarding uncalibrated gyro. [Patrick Porlan]
  c4b7635 Wed Aug 20 19:30:30 2014 +0200 | GMIN-2992: Enable filtering on accelerometer and gyroscope [Patrick Porlan]
  ac3a0ef Wed Aug 20 16:31:19 2014 +0200 | GMIN-3044: Fix a few edge cases in filtering code [Patrick Porlan]
  1f3fb0e Wed Aug 20 16:24:46 2014 +0200 | GMIN-3044: Fix a problem were filtering would not reengage [Patrick Porlan]
  9d9e281 Wed Aug 20 11:28:57 2014 +0200 | PLD processing readibility tweaks [Patrick Porlan]
  97b100e Tue Aug 19 11:54:44 2014 +0200 | Enable .panel and .rotation specifiers in property files [Patrick Porlan]
  e366844 Mon Aug 18 14:53:25 2014 +0200 | Derive sensor orientation from PLD ACPI data if available. [Patrick Porlan]
  1fdd271 Mon Aug 18 14:44:52 2014 +0200 | Small changes intended at making the code more readable [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h      |    8 +-
  common.h           |   19 ++-
  control.c          |  109 ++++++++++++++---
  description.c      |   29 +++--
  description.h      |   13 +-
  enumeration.c      |  335 ++++++++++++++++++++++++++++++++++++++--------------
  gyro-calibration.c |  138 ++++++++++++----------
  transform.c        |   67 ++++++-----
  8 files changed, 498 insertions(+), 220 deletions(-)

Change-Id: I182f02ee05a281cfb009f6d4fc42107f5d39647e

9 years agoGMIN-2992: Revisit gyroscope calibration
Patrick Porlan [Tue, 26 Aug 2014 09:57:01 +0000 (11:57 +0200)]
GMIN-2992: Revisit gyroscope calibration

Modify the code so it provides valid uncalibrated gyro samples
while calibrating (we simply use bias 0 until we can determine
it), and compute bias iteratively (no need for long term sample
storage).

I can now pass the Cts Verifier gyroscope measurement test
effortlessly, and the delayed calibration is also visible in
applications such as Sensor Readout.

Issue: GMIN-2992

Change-Id: I7d86c529da0167e72ab93039d370f2df1c058ab3
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-2992: Don't be as heavy handed with gyro filtering as compass
Patrick Porlan [Tue, 26 Aug 2014 13:51:42 +0000 (15:51 +0200)]
GMIN-2992: Don't be as heavy handed with gyro filtering as compass

The gyroscope is not so noisy, so limit ourselves to a smaller
window size in the interest of better response time.

Issue: GMIN-2992

Change-Id: Ida74cae999007eca90c708ccf35cd3f6c706f04c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-2992: Use much larger set for gyro calibration
Patrick Porlan [Tue, 26 Aug 2014 09:00:52 +0000 (11:00 +0200)]
GMIN-2992: Use much larger set for gyro calibration

We need to be strict about the criteria for gyro calibration, as
it's a very rapid firing sensor (100 Hz is common) and the effect
of a miscalibrated gyro sensor is serious. Better err on the safe
side, as we simply don't know if the device is still or not.

Issue: GMIN-2992

Change-Id: I931b012be7771e27e81a80f5f5f9e0d64b126886
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-2992: Start with -dev trigger before switching to -any-motion
Patrick Porlan [Mon, 25 Aug 2014 16:51:55 +0000 (18:51 +0200)]
GMIN-2992: Start with -dev trigger before switching to -any-motion

Otherwise we're stuck waiting for a first sample (in order to engage
the periodic repeat-last-sample-if-nothing-arrived-for-a-while code)
which makes a variety of tests fail.

Issue: GMIN-2992

Change-Id: I13093f364455a566de80a5e185707590007d8235
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoReconciliate tree with SP version regarding uncalibrated gyro.
Patrick Porlan [Mon, 4 Aug 2014 18:01:38 +0000 (20:01 +0200)]
Reconciliate tree with SP version regarding uncalibrated gyro.

Looks like something was lost during integrations.

Change-Id: I756b24fe7a61142cde184f589f95f3bfd950ceb0
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-2992: Enable filtering on accelerometer and gyroscope
Patrick Porlan [Wed, 20 Aug 2014 17:30:30 +0000 (19:30 +0200)]
GMIN-2992: Enable filtering on accelerometer and gyroscope

Cts Verifier is frequently failing the gyro tests because it's very
sensitive to out of spec samples. Filtering the BMG160 output makes
it happy, so let's enable filtering on other sensor types than just
magnetometer. We may want to tune filter latency though.

Issue: GMIN-2992

Change-Id: I0cbea2195a616ffd922c67246d04d0af8619398c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-3044: Fix a few edge cases in filtering code
Patrick Porlan [Wed, 20 Aug 2014 14:31:19 +0000 (16:31 +0200)]
GMIN-3044: Fix a few edge cases in filtering code

- limit ourselves to a window size of 100 to limit CPU usage

- start filtering as soon as we have a few samples instead of
  waiting for a full history buffer

- drop out if we're operating with window size = 1

And restructure the code a little bit for improved clarity.

Issue: GMIN-3044

Change-Id: Ia4e6208bfb86bccda8473502f3f1d16ef61771ca
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-3044: Fix a problem were filtering would not reengage
Patrick Porlan [Wed, 20 Aug 2014 14:24:46 +0000 (16:24 +0200)]
GMIN-3044: Fix a problem were filtering would not reengage

We wouldn't reallocate the history buffer after a disable
enable cycle if the sampling rate was unchanged, and the
filtering code fails silently if the history buffer is nil.

This could cause filtering to simply don't work in several
scenarios.

Issue: GMIN-3044

Change-Id: I6f0d7428a6caebe903315d6f5a1141dd466e1957
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoPLD processing readibility tweaks
Patrick Porlan [Wed, 20 Aug 2014 09:28:57 +0000 (11:28 +0200)]
PLD processing readibility tweaks

Use symbols rather than direct numeric values, as suggested by Samuel.

Change-Id: I82ad7714946d4b46e9b396b3b04edccfe415e954
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoEnable .panel and .rotation specifiers in property files
Patrick Porlan [Tue, 19 Aug 2014 09:54:44 +0000 (11:54 +0200)]
Enable .panel and .rotation specifiers in property files

This is a convenient way to check or override PLD settings
during development. These are of course optional, per sensor,
and if found the BIOS values are ignored.

Change-Id: I03fadb70245476d49df5bd9167980e9fad9a662d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoDerive sensor orientation from PLD ACPI data if available.
Patrick Porlan [Mon, 18 Aug 2014 12:53:25 +0000 (14:53 +0200)]
Derive sensor orientation from PLD ACPI data if available.

We use the panel indicator (front or back side of the board) as
well as rotation indicator to generate suitable scaling and order
directives. Note that this is a default state, so expressing
ordering or scaling needs though properties will supersede these.

Change-Id: I1eeaffb838ee53d7e7f7216c07cae9211801d88a
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSmall changes intended at making the code more readable
Patrick Porlan [Mon, 18 Aug 2014 12:44:52 +0000 (14:44 +0200)]
Small changes intended at making the code more readable

Intermediate variables are nice.

Change-Id: Ia95169c724d2b7604d8967f88ccf669c85a31152
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, 14 Aug 2014 16:27:44 +0000 (19:27 +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:
  f3307d0 Thu Aug 14 16:08:25 2014 +0300 | Add multiple calibration levels (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  f876d44 Wed Aug 13 19:03:03 2014 +0300 | Change data sample size for calibration [Adriana Reus]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  calibration.h         |   22 +++++++++-------------
  common.h              |    2 +-
  compass-calibration.c |   35 +++++++++++++----------------------
  enumeration.c         |    2 +-
  gyro-calibration.c    |    6 +++---
  5 files changed, 27 insertions(+), 40 deletions(-)

Change-Id: Ia63d8752e62028b81289c9ed74992ada843f18ca

9 years agoAdd multiple calibration levels
Adriana Reus [Thu, 14 Aug 2014 13:08:25 +0000 (16:08 +0300)]
Add multiple calibration levels

In an attempt to provide an initial estimation faster.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: Ia8e0beaf2ad5424f96ebdf700d179ec0fa31c87c

9 years agoChange data sample size for calibration
Adriana Reus [Wed, 13 Aug 2014 16:03:03 +0000 (19:03 +0300)]
Change data sample size for calibration

ECS seems to take a lot of time to calibrate because of noisy
events. A smaller data sample size seems to somewhat help and
it doesn't affect calibration in any other way.

Change-Id: I706ced6408c0915162aafbcf2cfed7f3be9c0ff9
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, 13 Aug 2014 15:43:55 +0000 (18:43 +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:
  752fe0e Tue Aug 12 20:58:58 2014 +0200 | GMIN-3044: Implement a simple filtering routine for noisy sensors (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
  4c18969 Fri Aug 8 16:45:26 2014 +0200 | STPK-1429: Always wait for at least 1 ms before repeating samples [Patrick Porlan]
  06f5f6a Thu Aug 7 11:06:41 2014 +0200 | GMIN-2525: Ensure that we select a motion trigger if available [Patrick Porlan]
  e135a70 Mon Aug 11 16:13:22 2014 +0300 | Fix uncalibrated gyroscope trigger name [Adriana Reus]
  7cceddf Thu Aug 7 15:28:51 2014 +0300 | Populate maxDelay field [Adriana Reus]
  ce90973 Mon Aug 4 21:00:16 2014 +0200 | Delete a couple of unused variables. [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  common.h      |    9 ++++++
  control.c     |   18 +++++++++---
  description.c |   48 +++++++++++++++++++++++++++++++
  enumeration.c |   87 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
  transform.c   |   58 ++++++++++++++++++++++++++++++++++++++
  5 files changed, 209 insertions(+), 11 deletions(-)

Change-Id: I2fe75740013ad51747cded5fc337af8905b71706

9 years agoGMIN-3044: Implement a simple filtering routine for noisy sensors
Patrick Porlan [Tue, 12 Aug 2014 18:58:58 +0000 (20:58 +0200)]
GMIN-3044: Implement a simple filtering routine for noisy sensors

Keep a window of samples worth a second, and output the moving
average of the last recorded samples in order to smooth out
readings from extremely noisy sensors such as the BMM050 magneto.

We may want to use more advanced filters in the future.

Issue: GMIN-3044

Change-Id: I10bc0ddb960ed31e89228bc69fcf17f38fa85b97
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429: Always wait for at least 1 ms before repeating samples
Patrick Porlan [Fri, 8 Aug 2014 14:45:26 +0000 (16:45 +0200)]
STPK-1429: Always wait for at least 1 ms before repeating samples

Auto-repetition of events at very high sample rates can make the
device unresponsive.

Issue: STPK-1429

Change-Id: Id846f7a8e313b96099e78fbb0e53a93ca6d194f2
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-2525: Ensure that we select a motion trigger if available
Patrick Porlan [Thu, 7 Aug 2014 09:06:41 +0000 (11:06 +0200)]
GMIN-2525: Ensure that we select a motion trigger if available

Srinivas is adding alternate "any-motion" triggers to a variety
of iio drivers. Let's use these in priority, and engage the HAL
level event repetition machinery if we select such a trigger.

This is dependent on the trigger name being advertised through
/sys/bus/iio/devices/triggerX.

Issue: GMIN-2525

Change-Id: I5e8c717df9b2716ded175e3522ea505c70eaf8b9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoFix uncalibrated gyroscope trigger name
Adriana Reus [Mon, 11 Aug 2014 13:13:22 +0000 (16:13 +0300)]
Fix uncalibrated gyroscope trigger name

Change-Id: I193a273ae1e729b36c237ae76ae081c06b4635c8
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoPopulate maxDelay field
Adriana Reus [Thu, 7 Aug 2014 12:28:51 +0000 (15:28 +0300)]
Populate maxDelay field

L introduces the maxDelay field. It is the delay between two sensor events
corresponding to the lowest frequency that this sensor supports.

Issue: GMINL-43
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: I9df4d2b90e29acfd6aa697a9bb23ceb5c7732000

9 years agoDelete a couple of unused variables.
Patrick Porlan [Mon, 4 Aug 2014 19:00:16 +0000 (21:00 +0200)]
Delete a couple of unused variables.

Change-Id: I3437a3362b6f09eff3520aa0fa78fe46098f2c43
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, 11 Aug 2014 10:32:49 +0000 (13:32 +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:
  1de822e Fri Aug 8 12:34:50 2014 +0300 | Filter invalid points for compass calibration. (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
  283c4d8 Thu Jul 31 17:37:46 2014 +0300 | Add the ordering flag to the quirks array [Adriana Reus]
  c609651 Thu Jul 31 16:18:20 2014 +0300 | Populate L specific sensor_t fields [Adriana Reus]
  ec4ac4b Mon Aug 4 11:07:38 2014 +0200 | GMIN-2832: Accomodate high noise level on BMC150 magnetometer [Patrick Porlan]
  013086e Fri Aug 1 18:01:46 2014 +0200 | GMIN-675: Add the ability to repeatedly send samples to Android [Patrick Porlan]
  0d063b7 Mon Jul 28 15:53:19 2014 +0200 | STPK-1429: Fix trigger type for proximity sensor [Patrick Porlan]
  fba47f8 Mon Jul 28 14:25:48 2014 +0200 | Fix a signed vs unsigned GCC warning [Patrick Porlan]
  5d94de3 Wed Jul 23 11:36:24 2014 +0200 | Add support for signed 13 and 15 bits samples [Patrick Porlan]
  fee5195 Thu Jul 24 16:52:38 2014 +0200 | STPK-1429 Add support for custom trigger names [Patrick Porlan]

git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
  common.h              |   23 ++++++----
  compass-calibration.c |   19 ++++++++-
  control.c             |  113 ++++++++++++++++++++++++++++++++++++++++++++++---
  description.c         |  105 +++++++++++++++++++++++++++++++++++++++++++--
  description.h         |   10 ++++-
  entry.c               |    4 +-
  enumeration.c         |  102 +++++++++++++++++++++++++++++++++++++++++++-
  sens.c                |    4 +-
  transform.c           |   34 ++++++++++-----
  9 files changed, 377 insertions(+), 37 deletions(-)

Change-Id: I5d30856296ede2bd08a5b06a04584f378b446a3d

9 years agoFilter invalid points for compass calibration.
Adriana Reus [Fri, 8 Aug 2014 09:34:50 +0000 (12:34 +0300)]
Filter invalid points for compass calibration.

Apparently the magnetometer on ECS sends an invalid first event
[x,y,z]=[0,0,0]. This is confusing the calibration and makes the entire
data invalid. Therefore the first calibration attempt always fails thus
wasting a lot of time.

Change-Id: Ibad68b2d4b4740ab7da6f5400426ffee5c29d6c5
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoAdd the ordering flag to the quirks array
Adriana Reus [Thu, 31 Jul 2014 14:37:46 +0000 (17:37 +0300)]
Add the ordering flag to the quirks array

L introduces a "flags" field in sensor_t to express the
reporting mode for a sensor. To avoid confusion, remove the
"flags" field from sensor_info_t, that expressed the axes reordering
and add it to the quirks array.

Change-Id: Ie42f6ef9705572b6f6bf20663268dd56907b21c2
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoPopulate L specific sensor_t fields
Adriana Reus [Thu, 31 Jul 2014 13:18:20 +0000 (16:18 +0300)]
Populate L specific sensor_t fields

Add stringType, flags, and requiredPermission fields.

Change-Id: I1df67776e55fe85dfc06984459e6a1a795489ded
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoGMIN-2832: Accomodate high noise level on BMC150 magnetometer
Patrick Porlan [Mon, 4 Aug 2014 09:07:38 +0000 (11:07 +0200)]
GMIN-2832: Accomodate high noise level on BMC150 magnetometer

Adriana suggested that we use a quirk to allow for higher error
margins during BMC150 magnetometer calibration. This is supported
by a few code changes in the HAL. The associated "quirks = noisy"
property has to be set in suitable configuration files.

Issue: GMIN-2832

Change-Id: Id43145aeb916cec02e2fedfe32cb7b89a01c8bbb
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoGMIN-675: Add the ability to repeatedly send samples to Android
Patrick Porlan [Fri, 1 Aug 2014 16:01:46 +0000 (18:01 +0200)]
GMIN-675: Add the ability to repeatedly send samples to Android

This allows supporting sensors that are defined as continuously
firing by Android with underlying iio drivers that don't generate
events unless something has changed.

This will allow using Srinivas's latest gyro driver properly, as
well as fix issues with the XPS 12 sensors.

Issue: GMIN-675

Change-Id: I8c69b538646b915d3185ecef2d31939a2eb6aef4
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429: Fix trigger type for proximity sensor
Patrick Porlan [Mon, 28 Jul 2014 13:53:19 +0000 (15:53 +0200)]
STPK-1429: Fix trigger type for proximity sensor

The proximity sensor only sends an event if its state changes.

Note the statement at the end of sensor_activate about at least
one event being sent after a sensor is enabled. This will ensure
that whatever middleware components controls the proximity sensor,
it's not going to mistakenly believe that it's stuck in near state.

Change-Id: I56a8bd1ca171cd879d69c03fafab83dde9c42e1e
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoFix a signed vs unsigned GCC warning
Patrick Porlan [Mon, 28 Jul 2014 12:25:48 +0000 (14:25 +0200)]
Fix a signed vs unsigned GCC warning

Besides, the upper boundary of the tested range was incorrect.

Change-Id: Iab087f60717c2e1ee7fee32c1178b75ca4004279
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoAdd support for signed 13 and 15 bits samples
Patrick Porlan [Wed, 23 Jul 2014 09:36:24 +0000 (11:36 +0200)]
Add support for signed 13 and 15 bits samples

The BMC150 magnetometer declares its x and y samples
as le:s13/16>>3 and its z samples as le:s15/16>>1, so
generalize a little bit our handling of signed integers.

Change-Id: I308629ac84ce898da63c31b757da358391ee530c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Add support for custom trigger names
Patrick Porlan [Thu, 24 Jul 2014 14:52:38 +0000 (16:52 +0200)]
STPK-1429 Add support for custom trigger names

    The Bosch BMC150 magnetometer driver exposes a different
    trigger name than the usual sensor-name-devX. Add support for
    this, so the enable buffer operation succeeds. There seems to
    be remaining issues with channels not being enabled though,
    so this change is not enough to get the magnetometer working
    on the ECS board. Also, the driver does not expose a sampling
    rate control knob.

    Issue: STPK-1429

Change-Id: I2a145a597c0ba4f95beeb86d385d3c774889d9e8
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoFix pthread link failure on LPDK
suyyala [Thu, 24 Jul 2014 02:19:43 +0000 (19:19 -0700)]
Fix pthread link failure on LPDK

pthreds are supprted by libc.

Issue: GMINL-102

Change-Id: I3481115f569019a2aea5acc5a6f1ba075abdaef0
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
9 years agoAdd USE_INTEL_SENSOR_HAL flag
Qiming Shi [Wed, 4 Jun 2014 08:24:45 +0000 (16:24 +0800)]
Add USE_INTEL_SENSOR_HAL flag

Change-Id: I1cfcfb0768d5538a3de571c9e5c512933aa4fbc5
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
9 years agoUse LOCAL_MODULE_RELATIVE_PATH for multiarch build
Qiming Shi [Wed, 4 Jun 2014 06:32:27 +0000 (14:32 +0800)]
Use LOCAL_MODULE_RELATIVE_PATH for multiarch build

Change-Id: I710086eb7824ed630ed4f171e6c2e4dcc92ba05b
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat...
Adriana Reus [Fri, 25 Jul 2014 14:07:53 +0000 (17:07 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master

git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
  ce139d1 Wed Jul 23 16:13:05 2014 +0300 | Remove a few unused variables (origin/abt/topic/gmin/kitkat/sensors) [Octavian Purdila]
  206e7b3 Wed Jul 23 16:01:04 2014 +0300 | Fix timestamp type [Octavian Purdila]
  e242e18 Wed May 21 18:38:40 2014 +0200 | STPK-1821 Work around what seems to be an ISH firmware bug [Patrick Porlan]
  860fd4d Fri Jun 6 10:44:33 2014 +0200 | STPK-1429 Document usage of sensor properties [Patrick Porlan]
  db9ce46 Tue Jul 22 13:48:10 2014 +0300 | Add support for Linux build [Octavian Purdila]
  03fee75 Tue Jul 22 13:36:22 2014 +0300 | Add sensor HAL test program [Octavian Purdila]

git diff --stat origin/abt/topic/gmin/kitkat/master..HEAD:
  Android.mk                |   10 +
  Makefile                  |   18 ++
  common.h                  |    2 +
  compass-calibration.c     |    2 +-
  control.c                 |    9 +-
  description.c             |   67 ++++++
  description.h             |    3 +
  entry.c                   |   20 ++
  enumeration.c             |    4 -
  linux/cutils/properties.h |   16 ++
  linux/log.c               |   49 +++++
  linux/utils/Log.h         |   65 ++++++
  sens.c                    |  536 +++++++++++++++++++++++++++++++++++++++++++++
  transform.c               |    2 -
  14 files changed, 789 insertions(+), 14 deletions(-)

Change-Id: Iba58f1c168a18aa934e9dbf7fb9c1f6db94f24ef

9 years agoRemove a few unused variables
Octavian Purdila [Wed, 23 Jul 2014 13:13:05 +0000 (16:13 +0300)]
Remove a few unused variables

Change-Id: I30b7acde908317e6368d1004b49ff516a9837079
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agoFix timestamp type
Octavian Purdila [Wed, 23 Jul 2014 13:01:04 +0000 (16:01 +0300)]
Fix timestamp type

This fixes and issue where invalid timestamps are seen in event
reports.

Change-Id: Ia55b4d5065482a8e41e0702b6eb711c67981a447
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agoSTPK-1821 Work around what seems to be an ISH firmware bug
Patrick Porlan [Wed, 21 May 2014 16:38:40 +0000 (18:38 +0200)]
STPK-1821 Work around what seems to be an ISH firmware bug

The hardware sensors controlled through the Intel Sensor Hub
sometimes do not send events before an explicit disable/enable
cycle, with a link to the initial sampling rate.

The issue does not happen if the Intel Sensor Hub firmware is
flashed with an up to date version, but let's take this opportunity
to introduce a quirk property that we'll be able to control slightly
altered behaviors on a sensor basis.

Issue STPK-1821

Change-Id: I93dc36214b0a3f545e3ff5b87d2d4e7ff7daf7f0
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Document usage of sensor properties
Patrick Porlan [Fri, 6 Jun 2014 08:44:33 +0000 (10:44 +0200)]
STPK-1429 Document usage of sensor properties

Let's document the properties we support.

Issue: STPK-1429

Change-Id: I07704c2e17eacad29ea373bba96e9c78ebadd8f6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoAdd support for Linux build
Octavian Purdila [Tue, 22 Jul 2014 10:48:10 +0000 (13:48 +0300)]
Add support for Linux build

This patch adds support for building the sensor HAL and the test
program wihtin a Linux environment. It is usefull for faster sensor
HAL and driver development.

Change-Id: I13b6240899a4ed5351c5ae6660bb317cbcb3f793
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agoAdd sensor HAL test program
Octavian Purdila [Tue, 22 Jul 2014 10:36:22 +0000 (13:36 +0300)]
Add sensor HAL test program

This patch adds a HAL test program that can be used to test the sensor
HAL in a console Android environment (e.g. not framework
required). This is useful for faster development for sensor drivers
and HAL features as well as for faster enabling on new platforms.

The test program takes the following commands: start HAL, stop HAL,
list sensors, activate and deactivate sensors, and set delay.

The start command will fork, load the HAL shared object, initialize it
and keep it running in the background. One thread will be used for
polling sensor data and one for accepting commands from the
client. UNIX sockets are used for communication between the client and
server.

Change-Id: I837e1dd9cb48657d4a8fe52f67c751e619b5c244
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat...
Adriana Reus [Thu, 24 Jul 2014 15:37:52 +0000 (18:37 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master

git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
  a603a74 Sun Jun 22 11:06:26 2014 +0300 | Adding TYPE_GYROSCOPE_UNCALIBRATED (origin/abt/topic/gmin/kitkat/sensors) [Adriana Reus]
  f9635be Tue Jul 15 12:14:43 2014 +0200 | STPK-1429 Reduce worker thread exit latency [Patrick Porlan]
  345931b Fri Jul 18 16:00:58 2014 +0200 | STPK-1429: Add 'order' configuration property [Patrick Porlan]

git diff --stat origin/abt/topic/gmin/kitkat/master..HEAD:
  common.h           |   15 ++++++
  control.c          |  152 ++++++++++++++++++++++++++++++++++++++++++----------
  description.c      |   27 ++++++++++
  description.h      |    2 +
  enumeration.c      |  109 ++++++++++++++++++++++++++++++-------
  gyro-calibration.c |   29 +++++++---
  transform.c        |   22 ++++++++
  7 files changed, 302 insertions(+), 54 deletions(-)

Change-Id: I7031481550741bd06e94cca954aafd96d7a8635a

9 years agoAdding TYPE_GYROSCOPE_UNCALIBRATED
Adriana Reus [Sun, 22 Jun 2014 08:06:26 +0000 (11:06 +0300)]
Adding TYPE_GYROSCOPE_UNCALIBRATED

Add type TYPE_GYROSCOPE_UNCALIBRATED on the same device number as the base sensor.
When activated at the same time the uncalibrated will copy the data from the calibrated one.
When activated independently each will take data from the device.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: If7d8f801a418f8cb4ab561849949f65e0249f379

9 years agoSTPK-1429 Reduce worker thread exit latency
Patrick Porlan [Tue, 15 Jul 2014 10:14:43 +0000 (12:14 +0200)]
STPK-1429 Reduce worker thread exit latency

We use condition variables as a mean to interrupt
sleep for all worker threads so they can reevaluate
their exit condition, as well as react a bit quicker
to sampling rate updates.

Change-Id: I3f11b5b103594f0d0e4f04ec14a4cd2521804abf
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429: Add 'order' configuration property
Patrick Porlan [Fri, 18 Jul 2014 14:00:58 +0000 (16:00 +0200)]
STPK-1429: Add 'order' configuration property

This allows field reordering for sensors that are tilted
inside the chassis, as this appears to be the case for the
ECS Cruise 7 tablet. This field reordering is applied in
the finalization stage, thus after opt_scale has been applied.

Ex: ro.iio.accel.order = 102 would swap x and y fields for
the accelerometer. Only digits are tolerated, and we must have
as many of them as there are fields for this sensor.

Issue: STPK-1429

Change-Id: I1f5eb3de0413bfa786408c7d59235bd486d09200
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat...
Adriana Reus [Fri, 18 Jul 2014 16:00:52 +0000 (19:00 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master

git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
  eee1b23 Thu Jul 3 14:18:31 2014 +0200 | STPK-1429 Fix a problem with on change sensors being muted (origin/abt/topic/gmin/kitkat/sensors) [Patrick Porlan]
  35ac9c5 Thu Jul 3 14:11:35 2014 +0200 | STPK-1429 Fix start condition for acquisition threads [Patrick Porlan]
  c238ae8 Thu Jul 3 11:38:15 2014 +0200 | STPK-1429 Minor trace and comment cleanup [Patrick Porlan]
  4b3009a Thu Jul 3 11:36:45 2014 +0200 | STPK-1429 Adjust types of a couple of sampling rate variables [Patrick Porlan]
  0c6adc6 Thu Jul 3 11:34:29 2014 +0200 | STPK-1429 Remove unneeded variable [Patrick Porlan]
  033c147 Wed Jul 2 15:43:45 2014 +0200 | STPK-1429 Remove artificial cap on sensor update rate [Patrick Porlan]
  dbf1cc4 Wed Jul 2 14:18:11 2014 +0200 | STPK-1429 Minor tweak to compass calibration data save point [Patrick Porlan]
  f4a2bd0 Wed Jul 2 14:13:47 2014 +0200 | STPK-1429 Source code cleanup [Patrick Porlan]
  47aa36d Wed Jul 2 13:45:24 2014 +0200 | STPK-1429 Return as many available events as possible from sensor_poll [Patrick Porlan]
  74e77ce Tue Jul 1 13:46:23 2014 +0200 | STPK-1429 Offload poll mode sensors data acquisition to threads [Patrick Porlan]

git diff --stat origin/abt/topic/gmin/kitkat/master..HEAD:
  Android.mk    |    1 +
  common.h      |   13 +-
  control.c     |  456 +++++++++++++++++++++++++++++++++------------------------
  enumeration.c |    6 +
  4 files changed, 283 insertions(+), 193 deletions(-)

Change-Id: I469eb57b03f18c09ba9618c8ec752619771e1afc

9 years agoSTPK-1429 Fix a problem with on change sensors being muted
Patrick Porlan [Thu, 3 Jul 2014 12:18:31 +0000 (14:18 +0200)]
STPK-1429 Fix a problem with on change sensors being muted

We probably want on-change sensors to send an event following
a disable - enable cycle, even if the sensed value (such as
the ambient light level in lux) hasn't changed during this
time. That ensures that applications starting up have fresh
data to deal with.

Issue: STPK-1429

Change-Id: I58cf3baaeee8937d374fa7a087df01cbe968f898
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Fix start condition for acquisition threads
Patrick Porlan [Thu, 3 Jul 2014 12:11:35 +0000 (14:11 +0200)]
STPK-1429 Fix start condition for acquisition threads

It's perfectly possible that we have to open a poll mode sensor
living alongside regular sensors: hint: that's the case of the
temperature sensor on the MPU 6500, which lives on the same iio
device as the accelerometer and gyroscope.

Issue: STPK-1429

Change-Id: I5faf8d30280405bfb356a5a33f5c08646e971494
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Minor trace and comment cleanup
Patrick Porlan [Thu, 3 Jul 2014 09:38:15 +0000 (11:38 +0200)]
STPK-1429 Minor trace and comment cleanup

Striving for perfection...

Issue: STPK-1429

Change-Id: Ia3ab00f4e2ce5ba659fcdeb6fb985904ffbee88e
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Adjust types of a couple of sampling rate variables
Patrick Porlan [Thu, 3 Jul 2014 09:36:45 +0000 (11:36 +0200)]
STPK-1429 Adjust types of a couple of sampling rate variables

Those are not necessarily integers, so use a proper type.

Issue: STPK-1429

Change-Id: I66be97150afb31af0d9aa8b42f9ba8dbab35c0b4
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Remove unneeded variable
Patrick Porlan [Thu, 3 Jul 2014 09:34:29 +0000 (11:34 +0200)]
STPK-1429 Remove unneeded variable

The requested sampling rate was kept only for traces. Those traces
are kind of redundant, so remove them and the associated variable
for the sake of clarity.

Issue: STPK-1429

Change-Id: I82b5fd19164d72e10e4411cbb6adb521224bde66
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Remove artificial cap on sensor update rate
Patrick Porlan [Wed, 2 Jul 2014 13:43:45 +0000 (15:43 +0200)]
STPK-1429 Remove artificial cap on sensor update rate

The MRD 7 accelerometer advertises support for 1600 Hz.
We have no good reason to cap sampling rate to a lower value than
what the driver supports.

Issue: STPK-1429

Change-Id: I1408d4d699e133efe2016145d3c89284d3481e3c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Minor tweak to compass calibration data save point
Patrick Porlan [Wed, 2 Jul 2014 12:18:11 +0000 (14:18 +0200)]
STPK-1429 Minor tweak to compass calibration data save point

Was being saved each time the magnetometer reference count was
decremented. Doing it when it reaches zero is probably enough.

Issue: STPK-1429

Change-Id: Ia465821cbf1ec22c5645753b6289e368d7ef2bd8
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Source code cleanup
Patrick Porlan [Wed, 2 Jul 2014 12:13:47 +0000 (14:13 +0200)]
STPK-1429 Source code cleanup

Factorize a little, remove unused variables, etc.

Issue: STPK-1429

Change-Id: I531991ac04d5c7d3887773d9542124b08bd98fbc
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Return as many available events as possible from sensor_poll
Patrick Porlan [Wed, 2 Jul 2014 11:45:24 +0000 (13:45 +0200)]
STPK-1429 Return as many available events as possible from sensor_poll

No longer return a single event when returning from sensor_poll. This
should minimize the trips between the Android sensor framework layers
and the HAL module itself. We can actually return up to one event per
sensor type, which should fit nicely with the buffer size that we get.

Issue: STPK-1429

Change-Id: Ie5f9974bee92380de4b121e005ace8261b77801e
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Offload poll mode sensors data acquisition to threads
Patrick Porlan [Tue, 1 Jul 2014 11:46:23 +0000 (13:46 +0200)]
STPK-1429 Offload poll mode sensors data acquisition to threads

I have seen sysfs reads blocking for 200 ms on the MRD 7 ALS,
with proximity, temperature and combined magnetometer x,y,z
in the 100 ms ballpark. This ended up blocking the main sensor
poll loop for large windows, with the effect that high frequency
sensors events were not delivered for extended amounts of time.

This offloads these sysfs reads to dedicated threads: there is
is one of these per enabled poll-mode sensor, and they communicate
their data through a pollable fd (something we can't have directly
on sysfs files). As a result we get much smoother and timely
event delivery overall, while simplifying the code somewhat: the
poll call can always use an infinite timeout, thereby voiding
the need for a wakeup fd, as well as complex timeout calculations.

Issue: STPK-1429

Change-Id: I4a45ede2369bcca03b9da78e98abb83ff5879c73
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat...
Adriana Reus [Thu, 10 Jul 2014 12:44:10 +0000 (15:44 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master

git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
  af3f64a Fri Jun 27 17:00:20 2014 +0200 | STPK-1429 Minor stylistic changes (origin/abt/topic/gmin/kitkat/sensors) [Patrick Porlan]
  81f81d5 Thu Jun 26 17:26:49 2014 +0200 | Enable proximity sensor detection [Patrick Porlan]

git diff --stat origin/abt/topic/gmin/kitkat/master..HEAD:
  control.c     |   11 +++++++----
  enumeration.c |    1 +
  2 files changed, 8 insertions(+), 4 deletions(-)

Change-Id: I4c6ba4a9aba4752a15b37cdfbd79c4460de03c4f
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
9 years agoSTPK-1429 Minor stylistic changes
Patrick Porlan [Fri, 27 Jun 2014 15:00:20 +0000 (17:00 +0200)]
STPK-1429 Minor stylistic changes

I feel the code is a little more readable this way...

Issue: STPK-1429

Change-Id: If4671b243f2ff2d3ee2a80b6c6a71ac4340ec525
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoEnable proximity sensor detection
Patrick Porlan [Thu, 26 Jun 2014 15:26:49 +0000 (17:26 +0200)]
Enable proximity sensor detection

Note that the proximity permission file is not set at this point.
I don't expect Android to use the proximity sensor, but as the
MRD 7 exposes one - which consistenly reports 255 cm -, let's
enable it for use by sensor testing applications.

Change-Id: I9483189e1c9a6e048d88a73b60b5f006889794f9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat...
suyyala [Sat, 28 Jun 2014 02:12:41 +0000 (19:12 -0700)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master

git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
  86ec10d Thu Jun 26 15:17:09 2014 +0200 | STPK-1429 Add a trace warning of unusually high sysfs read times (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master) [Patrick Porlan]
  0d868f7 Thu Jun 26 10:28:55 2014 +0200 | STPK-1429 Clean up a few traces and obscure pieces of code [Patrick Porlan]
  dece0ae Wed Jun 25 14:34:43 2014 +0200 | STPK-1429 Support "on change" event firing [Patrick Porlan]
  5e58419 Thu Jun 19 15:08:12 2014 +0200 | STPK-1429 Support floating point sampling rates [Patrick Porlan]
  fe7a4ab Thu Jun 19 11:19:28 2014 +0200 | STPK-1429 Fix single channel opt_scale specifier [Patrick Porlan]
  5380d64 Tue Jun 17 15:01:15 2014 -0700 | Reset channel sampling on enumeration [suyyala]

git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
  common.h      |   7 ++--
  control.c     | 101 +++++++++++++++++++++++++++++++++++-----------------------
  enumeration.c |   2 +-
  transform.c   |  21 +++++++++---
  utils.c       |  36 ++++++++++++++++++++-
  utils.h       |  11 ++++---
  6 files changed, 126 insertions(+), 52 deletions(-)

Change-Id: I3c13ce408c0e80cdd98efc368e2daf9ce71590a9
Signed-off-by: sridhar.uyyala <sridhar.uyyala@intel.com>
9 years agoSTPK-1429 Add a trace warning of unusually high sysfs read times
Patrick Porlan [Thu, 26 Jun 2014 13:17:09 +0000 (15:17 +0200)]
STPK-1429 Add a trace warning of unusually high sysfs read times

It looks like some sensors (proximity on MRD 7 perhaps) have
acquisition times in the order of several hundred ms. Help
flag those with a trace warning of combined (all channels)
acquisition times larger than 100 ms. None of the T100 sensors
(magnetometer, temperature, ALS) have this problem though.

Issue: STPK-1429

Change-Id: I04ee59f63184c89eae26e46460f4dcb675b91131
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Clean up a few traces and obscure pieces of code
Patrick Porlan [Thu, 26 Jun 2014 08:28:55 +0000 (10:28 +0200)]
STPK-1429 Clean up a few traces and obscure pieces of code

We're not supposed to get data for sensor types we don't
recognize, but we can get there while adding support for
new sensors (type added to enumeration table, but not yet
to sample reporting routines), so handle this case a little
bit better.

Issue: STPK-1429

Change-Id: I256374e6b661a28a19db9f7791c226543766c4ad
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Support "on change" event firing
Patrick Porlan [Wed, 25 Jun 2014 12:34:43 +0000 (14:34 +0200)]
STPK-1429 Support "on change" event firing

The Android documentation states that ALS and temperature
sensors are "on change" rather than continuously firing
sensors. So, for these types, make note of the last returned
lux or temperature reading, and drop the event that we're
about to generate if it is identical to the last returned one.

Issue: STPK-1429

Change-Id: I4c07da6555727f905e25e2e3bb7cef975af4e4c7
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Support floating point sampling rates
Patrick Porlan [Thu, 19 Jun 2014 13:08:12 +0000 (15:08 +0200)]
STPK-1429 Support floating point sampling rates

The Kionix accelerometer found on the MRD 7 advertises
support for 6.25 and 12.5 Hz, so open up a little the
scope of what we consider a valid sampling rate.

Some %f specifications were replaced by %g because %f
shows zero digits in the style of 3.140000, and some
sysfs writes would not be accepted because of this format.

Issue: STPK-1429

Change-Id: I35379aec4d3f03bfdf27a17d192ebc0dfbef3441
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoSTPK-1429 Fix single channel opt_scale specifier
Patrick Porlan [Thu, 19 Jun 2014 09:19:28 +0000 (11:19 +0200)]
STPK-1429 Fix single channel opt_scale specifier

This (unused as of today) line was forgotten when the
optional scaling specified was renamed from scale to
opt_scale. It's intended for single channel sensors,
such as the temperature or ALS.

Issue: STPK-1429

Change-Id: Idcc69f8113636ff95e84140bbf4ec21d45ad811c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
9 years agoReset channel sampling on enumeration
suyyala [Tue, 17 Jun 2014 22:01:15 +0000 (15:01 -0700)]
Reset channel sampling on enumeration

If HAL is restarted due to service crash or adb stop
command  the sensor device may be left in enable state.
Make sure to trun off iio buffer/enable and trigger channels
in next enumeration during re-intialization of HAL.

Change-Id: I6cac99ebc3cda4ff629864c09132fa062127f470
Signed-off-by: sridhar.uyyala <sridhar.uyyala@intel.com>