OSDN Git Service

android-x86/hardware-intel-libsensors.git
10 years agoMerge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat...
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>
10 years agoRename iio-sensor-hal to sensor.gmin
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>
10 years agoSTPK-1429 Fix gyroscope drift elimination routine
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>
10 years agoSTPK-1429 Add Intel Sensor Hub conversion routines
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>
10 years agoSTPK-1429 Select sample transformation depending on a property
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>
10 years agoSTPK-1429 Improve a couple of important traces
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>
10 years agoSTPK-1429 Remove obsolete comment
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>
10 years agoSTPK-1429 Remove timestamp sensor definition
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>
10 years agoSTPK-1429 Honor requested sample rate for poll-mode sensors
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>
10 years agoSTPK-1429 Unblock poll loop when a sensor gets enabled
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>
10 years agoSTPK-1429 Use properties values for user-visible sensor description
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>
10 years agoSTPK-1429 Groundwork for per sensor sampling rate
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>
10 years agoSTPK-1429 Add flexibility to sample processing
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>
10 years agoSTPK-1429 Make the sensor enable/disable code path more robust
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>
10 years agoSTPK-1429 Disable a sensor if its character device can't be opened
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>
10 years agoSTPK-1429 Minor optimization to poll-mode sensor handling
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>
10 years agoSTPK-1429 Fix Klocwork issue #88846
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>
10 years agoSTPK-1429 Fix Klocwork issue #88803
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>
10 years agoSTPK-1429 Fix a major SNAFU in iio device report handling
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>
10 years agoSTPK-1429 Fix temperature sensor readings
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>
10 years agoSTPK-1429 Delete a now unused variable
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>
10 years agoSTPK-1429 Initial version of iio-sensors-hal component
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>
10 years agoInitial empty repository
Gumbel, Matthew K [Thu, 10 Apr 2014 18:22:14 +0000 (11:22 -0700)]
Initial empty repository