OSDN Git Service
summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
suyyala [Tue, 17 Jun 2014 15:16:37 +0000 (08:16 -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:
eccfac9 Mon Jun 16 16:33:32 2014 -0700 | Consolidate Axis inversion operations (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master) [suyyala]
64c8e6b Mon Jun 2 11:13:23 2014 +0300 | Change Magnetometer calibration to support multiple sensors [Adriana Reus]
37c99cb Thu Jun 12 19:56:29 2014 -0700 | Fix sampling frequency cap [suyyala]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
calibration.h | 13 +--
common.h | 1 +
compass-calibration.c | 213 +++++++++++++++++++++++++++-----------------------
control.c | 23 +++---
enumeration.c | 6 ++
transform.c | 32 +-------
6 files changed, 140 insertions(+), 148 deletions(-)
Change-Id: I46164c9651d4ee3163e8a5a79cfc52fbcc57c220
Signed-off-by: sridhar.uyyala <sridhar.uyyala@intel.com>
suyyala [Mon, 16 Jun 2014 23:33:32 +0000 (16:33 -0700)]
Consolidate Axis inversion operations
Axis inversions are applied in transform using opt_scale.
This fix removes the axis inverse operations from
finalize operation
Issue: GMIN-1493
Change-Id: I8c15712c576dd0c1002c88168e95a98aff1c1375
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Adriana Reus [Mon, 2 Jun 2014 08:13:23 +0000 (11:13 +0300)]
Change Magnetometer calibration to support multiple sensors
Added calibration information in sensor_info_t.
Also keeping in sync with the gyro calibration interface.
Change-Id: I5fbd6dd18480d2ed8b1b22f28a4070c9bb2a66ed
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
suyyala [Fri, 13 Jun 2014 02:56:29 +0000 (19:56 -0700)]
Fix sampling frequency cap
With intent of capping sampling frequency to 1000, code
incorrectly lowers requested frequency to 1000 even
when sensor doesn't support 1000 value in available
sampling frequency.
Fix is to impose cap and use lower available sampling
frequency
Issue: GMIN-1178
Change-Id: Ibf5001d1c5afc26fa3198d54585917281e639039
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
suyyala [Thu, 12 Jun 2014 21:45:04 +0000 (14:45 -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:
088195d Thu Jun 12 13:12:52 2014 -0700 | Rename opt_scale property name (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master) [suyyala]
96575ae Thu May 29 14:29:51 2014 -0700 | Do not update calibsense if prop read fails [arun]
05610d9 Thu May 29 16:29:16 2014 +0300 | Gyro Calibration [Adriana Reus]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
Android.mk | 1 +
calibration.h | 16 ++++++++++
common.h | 2 ++
control.c | 3 ++
enumeration.c | 32 ++++++++++++++++---
gyro-calibration.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
transform.c | 6 ++--
7 files changed, 141 insertions(+), 9 deletions(-)
Change-Id: I3f544c65cf85fab54b5df233cf3b85ebd568309d
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
suyyala [Thu, 12 Jun 2014 20:12:52 +0000 (13:12 -0700)]
Rename opt_scale property name
rename optional scale property to reflect
the options use and not to confus with scale.
old: iio.accel.y.scale
new: iio.accel.y.opt_scale
Change-Id: I2fdf792b1d7db86e7273cbd473cf724c3a91cfda
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
arun [Thu, 29 May 2014 21:29:51 +0000 (14:29 -0700)]
Do not update calibsense if prop read fails
It was observed that in case the android prop read fails,
we write a 0 value(typically happens in case the property variable
not present)into the sysfs variable. This caused the resulting ALS
output to be 0, added a check to filter that condition. Now in case
the read from the android property fails, we just keep the default
value for the calibsense variable.
Issue:GMIN-671
Change-Id: Ifd65f0268dfa345ecf8cd6d40255c1a1fd52a03c
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Adriana Reus [Thu, 29 May 2014 13:29:16 +0000 (16:29 +0300)]
Gyro Calibration
Tries to detect steady state and computes bias based
on that detection.
Steadyness is detected by monitoring the gyro data for a fixed
number of events. If the data is extremely close it gathers the bias.
Theoretically, applying a constant rotation on all axes could also
provide very close data and that would provide a wrong bias but this is
not possible by human interaction with a mobile device (perhaps only
with an automated robotic solution).
Issue: GMIN-1185
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: If1db69dcbda9c9c3b4434ac27ab500a199023f73
Conflicts:
enumeration.c
suyyala [Wed, 11 Jun 2014 02:24:48 +0000 (19:24 -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:
20482a9 Sat Jun 7 09:44:55 2014 -0700 | merge sp/private/topic/sp/sp-autodetect to gmin/kitkat/sensors (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master) [suyyala]
71c0448 Wed Jun 4 11:55:27 2014 +0200 | STPK-1429 Add copyright headers to a few files [Patrick Porlan]
3ee3f20 Wed Jun 4 11:00:06 2014 +0200 | STPK-1429 Remove superfluous initialization [Patrick Porlan]
635a483 Mon May 26 14:54:54 2014 +0300 | Tweaked parameters for faster magnetometer calibration [Adriana Reus]
e32477b Tue Jun 3 11:16:26 2014 +0200 | STPK-1677 Fix Klocwork issue #94943 [Patrick Porlan]
eb4a8cf Fri May 30 11:34:43 2014 -0400 | iio_sensors: Add Light sensor sysfs interface and transformation [Archana Patni]
2c628fe Fri May 30 11:29:42 2014 -0400 | iio_sensors: Remove hard coded exponent and data bytes [Archana Patni]
54d3349 Fri May 30 14:46:35 2014 +0200 | STPK-1429 Fix erroneous buffer size [Patrick Porlan]
f052d7d Fri May 30 11:57:11 2014 +0200 | STPK-1429 Slight improvement to timestamp accuracy [Patrick Porlan]
d93e8b6 Wed May 28 10:29:44 2014 +0200 | STPK-1429 Enable known channels once at boot time [Patrick Porlan]
65c4798 Tue May 27 17:17:52 2014 +0200 | STPK-1429 Revisit sensor enabling code [Patrick Porlan]
0545bfb Tue May 27 17:14:17 2014 +0200 | STPK-1429 Ignore _en status when building report maps [Patrick Porlan]
6f2016f Tue May 27 17:09:19 2014 +0200 | STPK-1429 Move channel analysis to enumeration stage [Patrick Porlan]
dedb01b Tue May 27 17:01:11 2014 +0200 | STPK-1429 Don't add trailing zero to sysfs write buffer [Patrick Porlan]
a2e82c2 Mon May 26 15:59:04 2014 +0200 | STPK-1429 Cosmetic changes in code dealing with scales [Patrick Porlan]
0332aa6 Mon May 26 10:39:07 2014 +0200 | STPK-1429 Remove articifial delay between poll exits [Patrick Porlan]
ffff8c1 Fri May 23 17:07:24 2014 +0200 | STPK-1429 Remove a compilation warning [Patrick Porlan]
0357b87 Fri May 23 15:26:01 2014 +0200 | STPK-1429 Add optional per-channel scaling factor [Patrick Porlan]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
calibration.h | 8 ++--
common.h | 15 +++++++
compass-calibration.c | 4 ++
control.c | 114 ++++++++++++++++----------------------------------
control.h | 2 +
description.c | 3 +-
description.h | 2 +
enumeration.c | 59 ++++++++++++++++++++++----
enumeration.h | 1 +
matrix-ops.c | 4 ++
matrix-ops.h | 4 ++
transform.c | 83 ++++++++++++++++++++++--------------
utils.c | 7 ++--
13 files changed, 181 insertions(+), 125 deletions(-)
Change-Id: I3b3428cc4de05035c24d20e52963dbf7c8c4a507
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
suyyala [Sat, 7 Jun 2014 16:44:55 +0000 (09:44 -0700)]
merge sp/private/topic/sp/sp-autodetect to gmin/kitkat/sensors
9390b29 Wed Jun 4 11:55:27 2014 +0200 | STPK-1429 Add copyright headers to a few files [Patrick Porlan]
bcfe0bd Wed Jun 4 11:00:06 2014 +0200 | STPK-1429 Remove superfluous initialization [Patrick Porlan]
2d74046 Mon May 26 14:54:54 2014 +0300 | Tweaked parameters for faster magnetometer calibration [Adriana Reus]
41511bf Tue Jun 3 11:16:26 2014 +0200 | STPK-1677 Fix Klocwork issue #94943 [Patrick Porlan]
e674776 Fri May 30 11:34:43 2014 -0400 | iio_sensors: Add Light sensor sysfs interface and transformation [Archana Patni]
43a3504 Fri May 30 11:29:42 2014 -0400 | iio_sensors: Remove hard coded exponent and data bytes [Archana Patni]
29df85f Fri May 30 14:46:35 2014 +0200 | STPK-1429 Fix erroneous buffer size [Patrick Porlan]
d252a28 Fri May 30 11:57:11 2014 +0200 | STPK-1429 Slight improvement to timestamp accuracy [Patrick Porlan]
e5742f8 Wed May 28 16:12:43 2014 +0200 | Merge remote-tracking branch 'sp/private/topic/sp/sp-autodetect' into merge-sp-autodetect-to-mas
db990b1 Wed May 28 10:29:44 2014 +0200 | STPK-1429 Enable known channels once at boot time [Patrick Porlan]
9707c1f Tue May 27 17:17:52 2014 +0200 | STPK-1429 Revisit sensor enabling code [Patrick Porlan]
e674576 Tue May 27 17:14:17 2014 +0200 | STPK-1429 Ignore _en status when building report maps [Patrick Porlan]
2a372db Tue May 27 17:09:19 2014 +0200 | STPK-1429 Move channel analysis to enumeration stage [Patrick Porlan]
4df30de Tue May 27 17:01:11 2014 +0200 | STPK-1429 Don't add trailing zero to sysfs write buffer [Patrick Porlan]
450e414 Mon May 26 15:59:04 2014 +0200 | STPK-1429 Cosmetic changes in code dealing with scales [Patrick Porlan]
8e43961 Mon May 26 10:39:07 2014 +0200 | STPK-1429 Remove articifial delay between poll exits [Patrick Porlan]
13b78ec Fri May 23 17:07:24 2014 +0200 | STPK-1429 Remove a compilation warning [Patrick Porlan]
7a933b3 Fri May 23 15:26:01 2014 +0200 | STPK-1429 Add optional per-channel scaling factor [Patrick Porlan]
Issue: GMIN-1370
Change-Id: I8309e2246c2c0966e80a72cc834e3cbe3de34849
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Patrick Porlan [Wed, 4 Jun 2014 09:55:27 +0000 (11:55 +0200)]
STPK-1429 Add copyright headers to a few files
This code is still Intel proprietary.
Issue: STPK-1429
Change-Id: I29a17b66b38a403a275d5e7003c11fa8c8b35a50
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 4 Jun 2014 09:00:06 +0000 (11:00 +0200)]
STPK-1429 Remove superfluous initialization
I thought that snprintf does not guarantees a final NUL,
but it turns out that my mind was polluted by the semantics
of the MS _snprintf. Remove the forced NUL write.
Issue: STPK-1429
Change-Id: Ib16870a2f0ec0f0c8dd22a4b91a51055172ed406
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Mon, 26 May 2014 11:54:54 +0000 (14:54 +0300)]
Tweaked parameters for faster magnetometer calibration
These parameters are taken into consideration when
collecting the data samples (the points that we are
going to fit on an ellipsoid).
MIN_DIFF
Minimum difference between collected points (there
is no point in collecting events that are similar
or very close because we won't get a sphere or an
ellipsoid that way, however a big value doesn't make
much sense either because the time of collecting a
certain number of "good" events would increase,
many would be rejected)
MAX_SQR_ERR
Maximum allowed error for a calibration, if a
calibration has an error bigger than this we won't
allow it.
LOOKBACK_COUNT
The number of previous events that we consider that
should be different enough from the current event
(tightly coupled to the MIN_DIFF parameter).
The smaller the MIN_DIFF and the LOOPBACK_COUNT the faster
a collection is gathered.
The bigger the MAX_SQR_ERR the faster a calibration is accepted.
Testing shows that this new set of parameters leads to a faster
first calibration with no visible user impact on its quality.
Change-Id: Ibe09c02c00975321459d599039d7e4767a880e96
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 3 Jun 2014 09:16:26 +0000 (11:16 +0200)]
STPK-1677 Fix Klocwork issue #94943
The issue was with sprintf possibly returning a negative
value, which would really be unexpected, but handle it
anyway.
Issue: STPK-1677
Change-Id: I28b4251cff63c5f1704786025eab2121e8fa101b
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Archana Patni [Fri, 30 May 2014 15:34:43 +0000 (11:34 -0400)]
iio_sensors: Add Light sensor sysfs interface and transformation
The IIO/HID sensor hub driver publishes the light sensor data using the
IIO_INTENSITY defined in iio industrial-core. This patch adds this
sensor type to the sensor catalogue and adds a corresponding transformation
in transform_sample_ISH function.
This was tested on BDW Wilson Beach (running Intel FW) and on BDW RVP Y
(running STM FW).
Change-Id: Ib0629dca03f8ec645fcd4d5816ee7131e1764e39
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Archana Patni [Fri, 30 May 2014 15:29:42 +0000 (11:29 -0400)]
iio_sensors: Remove hard coded exponent and data bytes
The current implementation used hard coded exponent and
data bytes for the data transformation macros inside
transform_sample_ISH function. These values were not
correct for all implementations and were resulting in
large invalid values.
These can be calculated from the SysFs attributes exported
by the driver. This patch changes the calculation to use these
and was tested on BDW Wilson Beach (running Intel FW) and
BDW RVP Y (running STM FW).
Change-Id: Ie66ee5a5b9692cee3a48d4027f795b16c6b5e8d0
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Patrick Porlan [Fri, 30 May 2014 12:46:35 +0000 (14:46 +0200)]
STPK-1429 Fix erroneous buffer size
Not sure what I had in mind with that multiplication. Anyway, the
buffer is zero-initialized, so keep it at a reasonable size, which
is to say... 32. That's plenty enough for now, as the maximum we
encountered is 20 (accel x,y,z 16 bits + gyro x,y,z + 64 bits ts).
We don't need the expected data size calculation, because the
values are set to zero by default, and because that sum would not
be correct anyway in the case where fields such as the timestamp
are shared between sensors. Plus, we were not even verifying that
the computed sum did really fit our buffer.
Issue: STPK-1429
Change-Id: Ie001ceeb634866a1460444bb839918045b72de31
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 30 May 2014 09:57:11 +0000 (11:57 +0200)]
STPK-1429 Slight improvement to timestamp accuracy
Use date immediately before the iio device read operation instead
of sensor report propagation time as the event timestamp. That's
only an intermediate step towards higher precision timestamps
though, as some drivers expose a timestamp channel we can read at
the same time as associated sample data.
Issue: STPK-1429
Change-Id: Iad5e1dc35fcbd422d3d1390cab202e3c36de8504
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 28 May 2014 08:29:44 +0000 (10:29 +0200)]
STPK-1429 Enable known channels once at boot time
That solves the problem with gyro not working on T100 if the
accelerometer hasn't been enabled. We have a combination of
two factors at play: data for disabled channels is not
reported through the character device, but it also seems that
once a channel has been enabled, we can't disable it anymore.
As sampling is not active before a trigger is selected and
the buffer is enabled (with an additional open on the iio
character device being necessary for this data to be read)
that should not do any harm.
If we could reliably disable channels then we could go back
to dynamic maps updated when a sensor gets enabled or disabled,
but this comes with additional complexity such as synchronization
between reads and enable/disable operations... better have a
static structure for iio device reports.
Issue: STPK-1429
Change-Id: Ic3b5a0e6e39c09e9533b35b1f6dac279a41b96a5
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 27 May 2014 15:17:52 +0000 (17:17 +0200)]
STPK-1429 Revisit sensor enabling code
Refine trigger usage, particularly ordering vs buffer ops.
Documentation on this is somewhat scarce, so let's try to follow
the ordering described in Free Electron's "iio a new subsystem"
presentation.
Change-Id: I545ac76d96870a10fa5aedc2a57907cf5e1b45a0
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 27 May 2014 15:14:17 +0000 (17:14 +0200)]
STPK-1429 Ignore _en status when building report maps
Whether a sensor is enabled or not is irrelevant to the mapping
between device report slots and individual sensors reports.
Again this is a remnant of a very dynamic, but false, understanding
of the structure of the buffers read from a iio character device.
Issue: STPK-1429
Change-Id: Idf1727153c6786c449da2df029906e040906a319
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 27 May 2014 15:09:19 +0000 (17:09 +0200)]
STPK-1429 Move channel analysis to enumeration stage
It was previously done at sensor enabling time, which is overkill
as the indices don't change when sensors get enabled or disabled.
That wasn't clear to me initially.
Change-Id: Ie19005b3d2448031a78eb4fa5e6085355eafcd61
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 27 May 2014 15:01:11 +0000 (17:01 +0200)]
STPK-1429 Don't add trailing zero to sysfs write buffer
The final NUL is not required, so don't write one.
Issue: STPK-1429
Change-Id: I8df959f7f205c818211e938da36a46581bb6e7d9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 26 May 2014 13:59:04 +0000 (15:59 +0200)]
STPK-1429 Cosmetic changes in code dealing with scales
Minor cosmetic adjustments, the most important being that we
don't emit a channel scale trace anymore if there is no sysfs
file expressing a scale, channel specific or otherwise. That's
the case with the dummy orientation sensor we're inserting as
a placeholder for replacement by the AOSP orientation sensor.
Issue: STPK-1429
Change-Id: I994e6049b42fd2e3963705f6fb99990ff2ffb4a6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 26 May 2014 08:39:07 +0000 (10:39 +0200)]
STPK-1429 Remove articifial delay between poll exits
I introduced a minimum 1 ms delay between poll operations
early in development as a way to limit CPU usage in case
of problems with a sensor. That has become a significant
source of jitter now that we control a bunch of sensors
from that loop, and never was a good way to handle
misbehaving sensors anyway (we yet have to devise one).
This commits removes this forced gap between the last
poll exit and the next poll entry.
Issue: STPK-1429
Change-Id: I1b59ffbd71cad608456b98a336089c9057874aee
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 23 May 2014 15:07:24 +0000 (17:07 +0200)]
STPK-1429 Remove a compilation warning
GCC is weird sometimes. It warns about comparing an unsigned to
a signed int, and casting does not make that go away, but using
an intermediate variable and affectation is fine.
The value was always known at compile time and could fit in a
single byte anyway.
Issue: STPK-1429
Change-Id: I4373c84d55a906cdbbeef1a7be6ffcf316189893
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 23 May 2014 13:26:01 +0000 (15:26 +0200)]
STPK-1429 Add optional per-channel scaling factor
This adds support for a scaling factor that can be expressed
using properties, for all sensors, on a channel basis. That
scaling factor is applied after all other transforms have been
applied, and is intended as a way to compensate for problems
such as an incorrect axis polarity for a given sensor.
The syntax is <usual property prefix>.<channel>.scale, e.g.
ro.iio.accel.y.scale = -1 to negate the sign of the y readings
for the accelerometer.
For sensors using a single channel - and only those - the channel
name is implicitly void and a syntax such as ro.iio.illuminance.
scale = 3 has to be used.
Issue: STPK-1429
Change-Id: I240a614c0dd22ddfd036116cd4d1cf30be46003e
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Andrew Boie [Wed, 4 Jun 2014 21:20:05 +0000 (14:20 -0700)]
merge build into master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/build/master:
b4295dd Wed Jun 4 13:08:49 2014 -0700 | don't hardcode 'gmin', use $(TARGET_BOARD_PLATFORM) (origin/abt/topic/gmin/kitkat/build/master) [Andrew Boie]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/build/master:
Android.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Change-Id: I16a3a42dc34e203c46f30a61e8996f7dea9cefdf
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Andrew Boie [Wed, 4 Jun 2014 20:08:49 +0000 (13:08 -0700)]
don't hardcode 'gmin', use $(TARGET_BOARD_PLATFORM)
libhardware uses ro.board.platform to search for HAL libs.
Change-Id: Ic1dec2aae872b6bfd0f06c9f435f926af8e561ee
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
suyyala [Thu, 22 May 2014 22:15:39 +0000 (15:15 -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:
4a088e6 Wed May 14 15:59:45 2014 +0300 | Magnetometer calibration (origin/abt/topic/gmin/kitkat/sensors) [Adriana Reus]
11359b8 Fri May 16 18:03:53 2014 -0700 | Support for channel specific scale value [suyyala]
9111117 Fri May 16 16:36:11 2014 -0700 | Transform Magnetometer raw data [suyyala]
e9c0e86 Fri May 16 11:50:17 2014 -0700 | Fix wrong index in sample conversion to int64_t [suyyala]
d214a45 Wed May 14 18:54:36 2014 +0200 | STPK-1429 Fix coordinate system mapping for gyro and magn [Patrick Porlan]
5b1f6b7 Wed May 7 15:50:06 2014 +0200 | STPK-1429 Limit firing rate for poll-mode sensors [Patrick Porlan]
24f7742 Mon May 12 16:53:37 2014 +0200 | STPK-1429 Cut off temperature readings at two decimals [Patrick Porlan]
d3b18bb Fri May 16 08:55:01 2014 -0700 | Adding 12-bit sample size support [suyyala]
1b91fef Thu May 15 10:46:11 2014 -0700 | Updated with a variable to set the ALS calibration value in sysfs [arun]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
Android.mk | 2 +
calibration.h | 48 ++++++
common.h | 8 +-
compass-calibration.c | 458 ++++++++++++++++++++++++++++++++++++++++++++++++++
control.c | 28 ++-
description.c | 12 ++
description.h | 1 +
enumeration.c | 32 +++-
enumeration.h | 1 +
matrix-ops.c | 102 +++++++++++
matrix-ops.h | 11 ++
transform.c | 72 ++++++--
12 files changed, 754 insertions(+), 21 deletions(-)
Change-Id: Iaf75929c82ba4e253a4f40228f720508e927e4fd
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Adriana Reus [Wed, 14 May 2014 12:59:45 +0000 (15:59 +0300)]
Magnetometer calibration
Implementation ported from the MCG HAL.
Algorithm gathers a sample set and computes the hard iron bias offset
and the soft iron bias matrix inversion. Once the calibration data is
set it's used for the following events until a better calibration data
is generated. Samples are continuously gathered.
Change-Id: Ia170190713bca7d54acb385c005ef4394242f24f
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
suyyala [Sat, 17 May 2014 01:03:53 +0000 (18:03 -0700)]
Support for channel specific scale value
Sensor devices are exporting channel specific scale values as well.
example: in_magn_x_scale, in_magn_y_scale, in_magn_z_scale, etc.
Channel specific scales are enumerated when no common scale(example:
in_magn_scale) is provided.
Issue: GMIN-355
Change-Id: Ib49750228a2f0a44528470672be93dc3945c2bae
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
suyyala [Fri, 16 May 2014 23:36:11 +0000 (16:36 -0700)]
Transform Magnetometer raw data
iio driver is providing data in gauss units and converting
to MicroTesla as Android expectes.
Issue: GMIN-355
Change-Id: I2eeb3eb4fbae315d176c8a990129e1eb38003626
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
suyyala [Fri, 16 May 2014 18:50:17 +0000 (11:50 -0700)]
Fix wrong index in sample conversion to int64_t
Fixing for loop with wrong index when
converting sample to int64_t
Issue: GMIN-355
Change-Id: Ibb76baf724e487742d31bf6440589c0599db25b1
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Patrick Porlan [Wed, 14 May 2014 16:54:36 +0000 (18:54 +0200)]
STPK-1429 Fix coordinate system mapping for gyro and magn
It turns out they are consistent. Android uses a different
coordinate system, with axes based on the "natural orientation"
of the device, but the transfom is the same for these three
sensors as they are using the same convention.
Issue: STPK-1429
Change-Id: I5e9b819a30422ca8134c39e427c21178cdef68a0
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 7 May 2014 13:50:06 +0000 (15:50 +0200)]
STPK-1429 Limit firing rate for poll-mode sensors
Don't refresh values associated to poll-mode sensors, and don't
raise the flag that will cause an event to be propagated upwards,
until an amount of time consistent with the sensor sampling rate
has elapsed since an event was last reported in relation to this
sensor.
This takes care of scenarios such as a low refresh rate poll-mode
sensor and a high refresh rate device-driven sensor being both
enabled, and a lot of events (and sysfs reads) being generated
for the low refresh rate sensor without a good reason to do so.
Issue: STPK-1429
Change-Id: I2bac3a8efd8da79bc642945b085408c29072d8c2
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 12 May 2014 14:53:37 +0000 (16:53 +0200)]
STPK-1429 Cut off temperature readings at two decimals
Centigrades are enough and make temperature readings much
easier to read.
Issue: STPK-1429
Change-Id: Id15f7ecca38c191b00996569d70ad6caabebd8a5
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
suyyala [Fri, 16 May 2014 15:55:01 +0000 (08:55 -0700)]
Adding 12-bit sample size support
Change-Id: I0cf3579deb27e0e2141f068aa53198e0f9d74a94
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
arun [Thu, 15 May 2014 17:46:11 +0000 (10:46 -0700)]
Updated with a variable to set the ALS calibration value in sysfs
The values displayed by the ALS sensor were incorrect(GMIN-671),
this was fixed by updating the value of the calibsense sensor
variable within the sysfs, The HAL code was modified such that it
would read the 'illumincalib' variable that is set with the
Android property variables and set it accordingly within sysfs
Change-Id: Ida01fd4bba92c1a871fe01845e810d06c1895e62
suyyala [Sat, 10 May 2014 23:19:51 +0000 (16:19 -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:
2b71866 Tue Apr 22 11:46:29 2014 -0500 | STPK-966: Fix orientation of accelerometer z-axis (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master, fresh) [Ivan Gomez Castellanos]
f49a66d Tue May 6 14:53:39 2014 +0200 | STPK-1429 Enable the AOSP orientation sensor on T100 [Patrick Porlan]
6954b9a Tue May 6 14:51:37 2014 +0200 | STPK-1429 Use proper interface version macro [Patrick Porlan]
2b5a9b2 Fri Apr 25 14:24:19 2014 +0200 | STPK-1429 Ignore bits that should be masked out in iio sampling data [Patrick Porlan]
27d9195 Wed Apr 16 10:53:23 2014 +0200 | STPK-1429 Revisit handling of stale incoming data notifications [Patrick Porlan]
2e12ef2 Tue Apr 15 11:41:08 2014 +0200 | STPK-1429 Honor maximum rate if reported through sysfs [Patrick Porlan]
f860b17 Tue Apr 15 09:52:57 2014 +0200 | STPK-1429 Allow for delivery rates up to 1000/s [Patrick Porlan]
67575b9 Mon Apr 14 17:36:23 2014 +0200 | STPK-1429 Correct Android type for ALS sensor [Patrick Porlan]
01f6890 Mon Apr 14 17:17:35 2014 +0200 | STPK-1429 Remove an unused variable [Patrick Porlan]
8c75d50 Mon Apr 14 16:56:25 2014 +0200 | STPK-1429 Take into account poll-mode sensors in sampling rate code [Patrick Porlan]
8c92626 Mon Apr 14 15:31:54 2014 +0200 | STPK-1429 Adjust sampling rate according to to available rates set [Patrick Porlan]
4cd02d5 Mon Apr 14 15:22:55 2014 +0200 | STPK-1429 Support per-device sampling frequency sysfs entries [Patrick Porlan]
0a4bb8b Mon Apr 14 13:50:46 2014 +0200 | STPK-1429 Rename misleading macro definition [Patrick Porlan]
d766a84 Mon Apr 14 10:50:53 2014 +0200 | STPK-1429 Move immediate values acquisition to transform.c [Patrick Porlan]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
common.h | 8 ++-
control.c | 200 ++++++++++++++++++++++++++++++++++++++++------------------
entry.c | 2 +-
enumeration.c | 57 ++++++++++++++++-
transform.c | 91 ++++++++++++++++----------
transform.h | 3 +-
6 files changed, 257 insertions(+), 104 deletions(-)
Change-Id: I9a39bf705254f7a568b2fe06dda6225cf1614a3e
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Ivan Gomez Castellanos [Tue, 22 Apr 2014 16:46:29 +0000 (11:46 -0500)]
STPK-966: Fix orientation of accelerometer z-axis
This patch fixes the orientation of the accelerometer z coordinate.
It was inverted and it was causing two CTS Verifier tests to fail.
When the tablet was placed on a flat surface with the screen facing the
ceiling, the z-data of the accelerometer was negative and it should be
positive. This patch fixes this issue.
ISSUE: STPK-966
Change-Id: I4997e606aab10f65aa36a97b3fc2472b02e90be1
Signed-off-by: Ivan Gomez Castellanos <ivan.gomez.castellanos@intel.com>
Patrick Porlan [Tue, 6 May 2014 12:53:39 +0000 (14:53 +0200)]
STPK-1429 Enable the AOSP orientation sensor on T100
Google provides a software virtual sensor for orientation
but it is only created if we have hardware support for an
accelerometer, a gyroscope and a compass, if we don't
provide our own rotation vector sensor, and if we expose
an orientation sensor (which then gets replaced by the AOSP
virtual sensor). As we can't touch the shared SensorService
code, simply create a dummy orientation sensor if the right
conditions are satisfied, so Android can replace it with its
own implementation instead.
The sensor itself reacts strangely to certain movements, but
I believe that this is indicative of a problem in one of the
hardware sensors processing routines, which will be adressed
in a forthcoming commit.
Issue: STPK-1429
Change-Id: I97cf81685b0f9fd8c66153e806e9af6617efe0bd
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 6 May 2014 12:51:37 +0000 (14:51 +0200)]
STPK-1429 Use proper interface version macro
Version 1.0 and newer add batching related entry points
which are not supported yet.
Issue: STPK-1429
Change-Id: Ib34434b6cf494c61df55ccb37258c2565a511918
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 25 Apr 2014 12:24:19 +0000 (14:24 +0200)]
STPK-1429 Ignore bits that should be masked out in iio sampling data
Take into account the "real size" of data fields within their container
by applying suitable masking and shifting. The Intel Sensor Hub samples
typically come as signed 16 bits integers within 32 bits containers, so
mask out the two most significant bytes and sign-extend the real sample
data.
Issue: STPK-1429
Change-Id: Ifa9e72c523c58a773009806ea00d1e49dc1f18d3
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 16 Apr 2014 08:53:23 +0000 (10:53 +0200)]
STPK-1429 Revisit handling of stale incoming data notifications
It is possible to get notified of incoming data for a sensor
that just got disabled. That can happen because the polling loop
lives in a different thread than the rest of the sensor machinery.
Indicate this with a dedicated trace.
Change-Id: Idb30cddcee4ad5c013db70fb2ade6c398cf0a1ae
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 15 Apr 2014 09:41:08 +0000 (11:41 +0200)]
STPK-1429 Honor maximum rate if reported through sysfs
In case we have a list of supported rates, make sure that we
don't select a higher value than the maximum advertised one.
Issue: STPK-1429
Change-Id: I5fa008966d07b9e38b61dcda87799e510a35dfbf
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 15 Apr 2014 07:52:57 +0000 (09:52 +0200)]
STPK-1429 Allow for delivery rates up to 1000/s
Lower the forced gap between poll releases to 1/1000s, and
conversely limit the sampling rate we get from upper layers.
Not sure that all involved layers (drivers, HAL module, Android
middleware, applications) react correctly to such sampling rates,
so that could be an area of focus for testing.
Issue: STPK-1429
Change-Id: I431598d3e60123e8d2ad173a56a64eff1d8a0c0c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 14 Apr 2014 15:36:23 +0000 (17:36 +0200)]
STPK-1429 Correct Android type for ALS sensor
Thanks to Goran Roth for pointing out that TYPE_TEMPERATURE was
deprecated in favor to TYPE_AMBIENT_TEMPERATURE in API level 14.
Issue: STPK-1429
Change-Id: I4d67adaeda6e4b4f68a53a347d838770863ce923
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 14 Apr 2014 15:17:35 +0000 (17:17 +0200)]
STPK-1429 Remove an unused variable
One line saved :)
Issue: STPK-1429
Change-Id: Idcee40635e2f302ab209779e7e4386615213bb3a
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 14 Apr 2014 14:56:25 +0000 (16:56 +0200)]
STPK-1429 Take into account poll-mode sensors in sampling rate code
Poll-mode sensors firing rate is entirely controlled by software,
and more precisely by our own poll loop, so be careful when
handling the desired sampling rate for these. On the T100, we
have both poll mode sensors (such as the AK magnetometer) and
regular character-device sensors (accel, gyro) on iio device 0,
so also check for poll-mode devices when arbitrating the device
level sampling rate.
Issue: STPK-1429
Change-Id: I561d25b5afa83fd0360b9197b1dd8b6fd7dffca5
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 14 Apr 2014 13:31:54 +0000 (15:31 +0200)]
STPK-1429 Adjust sampling rate according to to available rates set
The MPU-6500 driver allows sampling frequency to be set in a
discrete set of ranges. Use this information if available, by
using the first available frequency that is equal or higher than
the desired rate.
Issue: STPK-1429
Change-Id: I8f8aeebbd057d8bebf06ede0eb2259afe6dfae42
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 14 Apr 2014 13:22:55 +0000 (15:22 +0200)]
STPK-1429 Support per-device sampling frequency sysfs entries
The Invensense MPU-1500 driver uses a single sampling rate sysfs
entry for all sensors associated to a given iio device. Support
this in addition to the per-sensor specification that the Intel
Sensor Hub driver uses.
Issue: STPK-1429
Change-Id: Ic92974312094ecb2352c7989c6ba70011159a3d6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 14 Apr 2014 11:50:46 +0000 (13:50 +0200)]
STPK-1429 Rename misleading macro definition
The "common" attributes are per sensor, but we may also have
per device attributes, so rename a few macros for the sake of
clarity.
The Intel Sensor Hub driver uses a per-sensor sampling rate,
whereas the Invensense MPU-6500 has a per-device sampling rate
which following commits will address.
Issue: STPK-1429
Change-Id: I6c455f04fdeec1638e1f81661e108c6201dbe581
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 14 Apr 2014 08:50:53 +0000 (10:50 +0200)]
STPK-1429 Move immediate values acquisition to transform.c
This routine is in charge of reading and processing sensor
values for poll-mode sensors. It makes more sense to have
it within transform.c than control.c, as it applies offsets
and scales. So far we don't need Intel Sensor Hub -style
processing for these, because none of the ISH sensors uses
a polling interface.
Issue: STPK-1429
Change-Id: Ib45b4f9d32452c965b5829d17d9a57a9c9680902
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
suyyala [Fri, 2 May 2014 19:52:26 +0000 (12:52 -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:
bbe3210 Mon Apr 14 13:05:30 2014 -0700 | Rename iio-sensor-hal to sensor.gmin (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/sensors, mystart1) [Sridhar Uyyala]
8fa2df3 Fri Apr 11 15:09:08 2014 +0200 | STPK-1429 Fix gyroscope drift elimination routine [Patrick Porlan]
7d903c6 Fri Apr 11 11:10:47 2014 +0200 | STPK-1429 Add Intel Sensor Hub conversion routines [Patrick Porlan]
034ffb3 Fri Apr 11 10:49:29 2014 +0200 | STPK-1429 Select sample transformation depending on a property [Patrick Porlan]
13ce8e3 Thu Apr 10 16:47:18 2014 +0200 | STPK-1429 Improve a couple of important traces [Patrick Porlan]
7f096e3 Thu Apr 10 16:46:03 2014 +0200 | STPK-1429 Remove obsolete comment [Patrick Porlan]
fac4cfd Thu Apr 10 16:44:21 2014 +0200 | STPK-1429 Remove timestamp sensor definition [Patrick Porlan]
6971262 Mon Apr 7 11:29:09 2014 +0200 | STPK-1429 Honor requested sample rate for poll-mode sensors [Patrick Porlan]
8e24984 Thu Apr 3 13:59:15 2014 +0200 | STPK-1429 Unblock poll loop when a sensor gets enabled [Patrick Porlan]
18273fd Wed Apr 9 14:03:42 2014 +0200 | STPK-1429 Use properties values for user-visible sensor description [Patrick Porlan]
733601b Tue Apr 8 14:16:14 2014 +0200 | STPK-1429 Groundwork for per sensor sampling rate [Patrick Porlan]
259d5cf Tue Apr 8 13:58:20 2014 +0200 | STPK-1429 Add flexibility to sample processing [Patrick Porlan]
93e42e5 Mon Apr 7 14:31:41 2014 +0200 | STPK-1429 Make the sensor enable/disable code path more robust [Patrick Porlan]
d6f3b77 Thu Apr 3 13:52:00 2014 +0200 | STPK-1429 Disable a sensor if its character device can't be opened [Patrick Porlan]
9c1b08a Thu Apr 3 15:18:45 2014 +0200 | STPK-1429 Minor optimization to poll-mode sensor handling [Patrick Porlan]
94791b2 Thu Apr 3 14:25:46 2014 +0200 | STPK-1429 Fix Klocwork issue #88846 [Patrick Porlan]
b7a44cc Thu Apr 3 14:12:47 2014 +0200 | STPK-1429 Fix Klocwork issue #88803 [Patrick Porlan]
1121320 Mon Apr 7 15:23:47 2014 +0200 | STPK-1429 Fix a major SNAFU in iio device report handling [Patrick Porlan]
816bba6 Fri Mar 28 14:25:18 2014 +0100 | STPK-1429 Fix temperature sensor readings [Patrick Porlan]
9587445 Thu Mar 27 16:40:25 2014 +0100 | STPK-1429 Delete a now unused variable [Patrick Porlan]
73e13a4 Fri Mar 21 17:50:01 2014 +0100 | STPK-1429 Initial version of iio-sensors-hal component [Patrick Porlan]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
Android.mk | 31 +++
common.h | 132 ++++++++++
control.c | 769 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
control.h | 15 ++
description.c | 143 +++++++++++
description.h | 17 ++
entry.c | 108 +++++++++
enumeration.c | 238 ++++++++++++++++++
enumeration.h | 82 +++++++
transform.c | 330 +++++++++++++++++++++++++
transform.h | 15 ++
utils.c | 230 ++++++++++++++++++
utils.h | 26 ++
13 files changed, 2136 insertions(+)
Change-Id: I30db9b6828f5e571ccfcb1044b765f82afca0706
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Sridhar Uyyala [Mon, 14 Apr 2014 20:05:30 +0000 (13:05 -0700)]
Rename iio-sensor-hal to sensor.gmin
-Using fixed name sensors.gmin to make HAL
binding easier
-Change LOCAL_MODULE_NAME to sensors.gmin
-set LOCAL_MODULE_OWNER as intel
Issue: GMIN-31
Change-Id: Ib49b42a1f35a8f65bc8e844810399359e3149033
Signed-off-by: Sridhar Uyyala <sridhar.uyyala@intel.com>
Patrick Porlan [Fri, 11 Apr 2014 13:09:08 +0000 (15:09 +0200)]
STPK-1429 Fix gyroscope drift elimination routine
abs was too heavy handed for these checks
Issue STPK-1429
Change-Id: Ia2d1a3d08f735d23e06d78672dc38e564ee157f2
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 11 Apr 2014 09:10:47 +0000 (11:10 +0200)]
STPK-1429 Add Intel Sensor Hub conversion routines
This will be used with several of the sensors we have on the XPS 12.
This code is derived from the Intel Sensor Hub (libsensors) HAL module.
Issue: STPK-1429
Change-Id: I44fafd68aa24b8ead615385ebee3569821235df4
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 11 Apr 2014 08:49:29 +0000 (10:49 +0200)]
STPK-1429 Select sample transformation depending on a property
This introduces a per-sensor "transform" property, with a single
recognized value: ISH for Intel Sensor Hub units and fields.
The per channel transform function is meant for units conversions
such as deg/s to rad/s, and the finalize function is for broader
changes, such as field reordering, which is also required for ISH.
Issue: STPK-1429
Change-Id: I5ed937267e58333a9658882b7c6c4a2636ec08d2
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 10 Apr 2014 14:47:18 +0000 (16:47 +0200)]
STPK-1429 Improve a couple of important traces
The user visible name is much nicer than the iio name string.
Issue: STPK-1429
Change-Id: I36fe67865909b9a47282617a9a82ac6251c9f6dd
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 10 Apr 2014 14:46:03 +0000 (16:46 +0200)]
STPK-1429 Remove obsolete comment
We do get sensor details from an external data file.
Issue: STPK-1429
Change-Id: I3b4e3d44808db9953634aca7e1bd5e72519bc066
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 10 Apr 2014 14:44:21 +0000 (16:44 +0200)]
STPK-1429 Remove timestamp sensor definition
That's not one of the types listed in the Android sensors.h
and it does not seem to hold any useful information anyway.
Issue: STPK-1429
Change-Id: I350057e90f61c5a156aa5f44f5cdfa8c870516b3
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 7 Apr 2014 09:29:09 +0000 (11:29 +0200)]
STPK-1429 Honor requested sample rate for poll-mode sensors
Dynamically compute the poll timeout value depending on the
sampling rate associated to active poll-mode sensors.
Issue: STPK-1429
Change-Id: I2d5ba614ceb9e093cf05222568d92d4dd82aaf9c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Apr 2014 11:59:15 +0000 (13:59 +0200)]
STPK-1429 Unblock poll loop when a sensor gets enabled
This solves an issue where we could be blocked in our
event processing loop with an infinite timeout, and a
poll-mode sensor gets enabled. In that scenario no
reading associated to this sensor gets reported up,
because the poll timeout does not get re-evaluated.
Also interrupt poll on enabling as the timeout currently
being used may now be stale.
Issue STPK-1429
Change-Id: I7913463d8580862e16d67113d58a7596afdb7dae
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 9 Apr 2014 12:03:42 +0000 (14:03 +0200)]
STPK-1429 Use properties values for user-visible sensor description
This expects properties named after sensor types, such as:
ro.iio.accel.name = "Invensense Accelerometer"
Issue: STPK-1429
Change-Id: Ia714fb55017f61e41828286e9d44c916318a2382
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 8 Apr 2014 12:16:14 +0000 (14:16 +0200)]
STPK-1429 Groundwork for per sensor sampling rate
This supports sampling rate as used by the Intel Sensor Hub.
That conveniently performs the syfs read and double enable
buffer operation that the ISH sensor seem to require.
Issue: STPK-1429
Change-Id: I6e5b6419bb3dc83563849a8d65d7688b6b264bf6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 8 Apr 2014 11:58:20 +0000 (13:58 +0200)]
STPK-1429 Add flexibility to sample processing
Move samples processing logic to a dedicated file in
preparation for more advanced transform operations,
both per channel and per sample.
Issue: STPK-1429
Change-Id: I4e4e2e5a0691a3413fd50f85034eb477a006352b
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 7 Apr 2014 12:31:41 +0000 (14:31 +0200)]
STPK-1429 Make the sensor enable/disable code path more robust
Tests on the number of enabled sensors can be replaced by a
check on the iio device fd status (having any sensor active
on a iio device implies that the associated device was open).
This simplifies the enable path somewhat. On the disable path
we still need to check whether a regular or poll-mode sensor
associated to the device remains in operation before actually
closing the fd and setting it back to -1.
Issue: STPK-1429
Change-Id: Ib3084d0075630d48ffb97bcdd01b880271b3192c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Apr 2014 11:52:00 +0000 (13:52 +0200)]
STPK-1429 Disable a sensor if its character device can't be opened
It's an abnormal situation to have a sensor operating while its
associated character device couldn't be opened (the underlying
hardware may not be powered on). Reconciliate the HAL level state
with the underlying driver state in this case by reverting to
disabled state.
Issue: STPK-1429
Change-Id: I16ce2889b7be644a33a79fe04ddba9cf574bfde9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Apr 2014 13:18:45 +0000 (15:18 +0200)]
STPK-1429 Minor optimization to poll-mode sensor handling
Let's not waste CPU cycles...
This change does not buy us much, but since we're already
maintaining a global active poll-mode sensors counter,
let's take advantage of it. This is a frequently run code
path after all.
Issue: STPK-1429
Change-Id: I66b7e9fbaf5c07942308dfb990cd76267b6d05b8
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Apr 2014 12:25:46 +0000 (14:25 +0200)]
STPK-1429 Fix Klocwork issue #88846
Possible buffer overflow indeed.
Issue STPK-1429
Change-Id: Ic238fc29b212593b1b2fb9385e19f960db817567
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Apr 2014 12:12:47 +0000 (14:12 +0200)]
STPK-1429 Fix Klocwork issue #88803
Wise is the one who knows his limits.
There's an assumption in the code that enumerated all
sensors though, and that their reported indices are
contiguous. That should not be a problem with platforms
we control (e.g. MAX_SENSORS can be adjusted accordingly
as well as recognized sensors types), but that may be
worth revisiting in the future.
Issue: STPK-1429
Change-Id: I25392d1c4bf4c4a308f3c3448262445522fbd3be
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 7 Apr 2014 13:23:47 +0000 (15:23 +0200)]
STPK-1429 Fix a major SNAFU in iio device report handling
The code computing the number of bytes to read from the
iio character device made the assumption that the location
of the sensor reports within the device report change when
a sensor gets enabled or disabled. That's incorrect.
It worked so far in most cases by luck: either we had one
device per sensor, as with the XPS, or the co-located
sensors were enabled/disabled in order, e.g. accelerometer
enabled whenever we used the gyroscope. Now the gyroscope
works whatever the status of the rotation lock is...
Issue: STPK-1429
Change-Id: I3ab69c49fe1df934ae25d589c8e17da03fa85c7d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 28 Mar 2014 13:25:18 +0000 (14:25 +0100)]
STPK-1429 Fix temperature sensor readings
Raw levels were not being converted to standard units,
for poll-mode sensors only. This fixes the temperature
readings on the T100.
Change-Id: I95832b748d707d3d517ff618415f53f6f6d1f859
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 27 Mar 2014 15:40:25 +0000 (16:40 +0100)]
STPK-1429 Delete a now unused variable
This array is now local to control.c and has been split.
Issue: STPK-1429
Change-Id: I0a36084f5349c1e579a7963dbfe981d9cf13e58d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 21 Mar 2014 16:50:01 +0000 (17:50 +0100)]
STPK-1429 Initial version of iio-sensors-hal component
This alternative sensors HAL should eventually be usable with all
sensors exposed using the iio interface. In the current form, it
has only been tested on a European T100 computer, which uses an
Invensense 6500 sensor complex, and only the accelerometer has
been taken care of.
The major reason for writing this new HAL module is the need for
flexibility to handle cases such as several sensors being exposed
through a single iio device. On the T100 the ALS and magnetometer
expose a polling interface (no buffer, no trigger, unreadable
character device). This kind of sensor is supported too.
Issue: STPK-1429
Change-Id: Ib4ebfec4d21559c929f3bbb7b4f2da452a50bd52
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Gumbel, Matthew K [Thu, 10 Apr 2014 18:22:14 +0000 (11:22 -0700)]
Initial empty repository