summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* board: strago: Adapt to new sensor stack.Gwendal Grignou2016-11-1416-523/+342
| | | | | | | | | | | | | | | | Remove sensor stack on devices that do not have sensors: umaro wizpig kunimitsu [last one is not used anyway] Add FIFO on strago, kefka, ultima and setzer only. Remove code included by #ifdef CONFIG_GYRO_L3GD20H, unused. BUG=b:27849483 TEST=Check on Kefka BRANCH=strago Change-Id: I634ec16ad5df91fe002dc126a4d5b592ff0cc10c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409508 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: kionix: Add reading whoami to be sure device has booted.Gwendal Grignou2016-11-122-1/+28
| | | | | | | | | | | | | | | | | | | From the specs, "KX022-1020 Specifications Rev4.0", the power up time can be as long as 10ms. Add a loop to be sure the device is responsive before initalizing it. BRANCH=reef,glados,oak,veyron,cyan BUG=none TEST=After putting a KX022 accel as first in the list, it would not initialize properly. After adding the loop, it initializes properly. Change-Id: I3194a5d1deb0c2eb2a04a459aab3b4269e479af3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/394750 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 09f90a3b8f0f48d11b3653ad2af1d61c29691a48) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409507
* driver: kionix: Add set_valueGwendal Grignou2016-11-121-74/+45
| | | | | | | | | | | | | | | Put the common code for set_[data_rate|range|resolution] in the same function BUG=b:27849483 TEST=tested on Cyan, save 128 bytes on minnie. BRANCH=veyron,cyan Change-Id: Ie66f64a478ad73c2a46129a664f2a6c60c5157bc Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/379099 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409506
* driver: kionix: No need to set static field to NULLGwendal Grignou2016-11-121-1/+0
| | | | | | | | | | | | | | Redundant, already set by the compiler. BRANCH=none BUG=none TEST=compile. Change-Id: I4d1c7263034c0cef1a6484a516edb3893c11945f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/379098 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409505
* motion: Remove redundant set_range.Gwendal Grignou2016-11-121-6/+0
| | | | | | | | | | | | | | | No need to do set_range in motion_sense_shutdown(), already done at init. Besides, this is an error if the sensor is not powered in S5. BUG=b:27849483 BRANCH=cyan, minnie, samus TEST=Check sensor range is set correctly. Change-Id: Id0b9c2e4988ffc8b55b21258f60b1efa26156dbb Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/379097 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409504
* driver: kionix: Remove variant field.Gwendal Grignou2016-11-123-45/+39
| | | | | | | | | | | | | | Field is not required: sensor->chip already has that information. BRANCH=veyron BUG=none TEST=compile Change-Id: I6c0bc2e71d7c848968caa78c749dd3fb916f6263 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/379096 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409503
* cyan: Enable Force mode for accelerometerGwendal Grignou2016-11-122-9/+25
| | | | | | | | | | | | | | | | | Given we do not enble FIFO on these, we must ask the EC to collect samples as soon as they are available. Reduce sampling rate when measuring lid angle, EC will collect when needed. BRANCH=cyan BUG=b:27849483 TEST=Pass CTS, check lid angle with ectool motionsense lid_angle Change-Id: Icb703f8e5a63c27b704d907804838edd287e0226 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/372404 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409502
* cyan: Add support for new motion sensor stackGwendal Grignou2016-11-122-9/+63
| | | | | | | | | | | | BRANCH=cyan BUG=b:27849483 TEST=buidall Change-Id: I43e2e6c1dc7d0b15a6f69095328d090d354e9132 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359413 Reviewed-on: https://chromium-review.googlesource.com/409501 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: Fix comparison between signed and unsigned integerKoro Chen2016-11-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | If wait_us < 0, comparison against motion_min_interval actually fails, and this negative wait_us causes task_wait_event() never returns if we are not using any motion task event except the timer. The motion task will then stop running and sensor data stay unchanged. BRANCH=none BUG=chrome-os-partner:54092 TEST=hardcode wait_us to a negative value before motion_min_interval check, and see motion task is still running by EC console cmd timerinfo Change-Id: Ic1e7ffeeb9d2ec1f5c5beb4387294014298123af Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/358332 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/364930 Tested-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409500 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: Add CONFIG_HOSTCMD_DEBUG_MODE to set default hcdebug modeNicolas Boichat2016-11-122-1/+4
| | | | | | | | | | | | | | | | | | | | elm EC console output is very spammy, as EC_CMD_MOTION_SENSE_CMD is called every 100ms, so we want to set "hcdebug" to "off" as the default (which still includes errors, but no "normal" commands). BRANCH=cyan BUG=chrome-os-partner:55001 TEST=make buildall -j TEST=Flash cyan EC, see that output is fairly quiet. Change-Id: I70d91c291d934b4f032e5c57f3c333e2c10b93bc Reviewed-on: https://chromium-review.googlesource.com/359412 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409499 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: host: mock i2c_xferGwendal Grignou2016-11-128-225/+77
| | | | | | | | | | | | | | | | | | | | Instead of mocking i2c_read8/16/32, mock i2c_xfer. We can now test code that call i2c_xfer directly and test common/i2c.c BRANCH=samus, ryu, cyan BUG=chrome-os-partner:45223 TEST=Unit tests pass. Change-Id: Iaa772515c40cf55d2050d0019e2062d63278adc0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/299768 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit c2c02249a01ec56857a51e1645060325f7558b59) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359411 Reviewed-on: https://chromium-review.googlesource.com/409498 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: Add ability to stop ring interrupts.Gwendal Grignou2016-11-123-17/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, it is assumed the host will sooner or later retrieve the events from the sensor ring: It is only used by Android and the sensor HAL is enabling the ring buffer at boot. But if nobody processes the ring, and the ring is almost full, the EC will generate interrupt for every new events. This can happen with ARC, where events generated for ChromeOS will be in the ring but nobody will process them until Android is started. Add a command to allow sending ring MKBP events. It will be used when the IIO ring buffer is enabled / disabled. It also can be used for preventing raising interrupt when the device is about to go to sleep. BRANCH=ryu, cyan BUG=b:25425420,b:2784948, b:27849483 TEST=Check with fiforead that no events are queued when IIO ring buffer is disabled. Check with ectool and androsensor that interrupt generation stops. Change-Id: Ibc85eed2e0eae3a9ec07d191e692118bc2fd0dab Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356689 (cherry picked from commit f6b26dee24f4a4006e1a5509031972f8c0b5e9fc) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359410 Reviewed-on: https://chromium-review.googlesource.com/409497 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: ectool: provide lid angle infoKevin K Wong2016-11-124-4/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new host command to support returning lid angle. New output from ectool: System with lid angle support: ------------------------------------------ localhost ~ # ectool motionsense lid_angle Lid angle: 72 System without lid angle support: ------------------------------------------ localhost ~ # ectool motionsense lid_angle EC result 3 (INVALID_PARAM) BUG=b:27849483 BRANCH=cyan TEST=run "ectool motionsense lid_angle" verify the value matches the physical lid angle position Change-Id: I4179172c778f643640561e819216f7adfee679d2 Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/313345 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit e24ac972e21d60a65d15e957605e8b78bd25e039) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359409 Reviewed-on: https://chromium-review.googlesource.com/409496 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: mkpb: Add MKBP support over ACPIGwendal Grignou2016-11-124-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Add a host event to support MKPB: When sent, the ACPI code will send a notification to the kernel cros-ec-lpcs driver that will issue EC_CMD_GET_NEXT_EVENT. We can allow code (sensor stack for instance) that uses MKBP to work on ACPI based architecture. Obviously, host event over MKPB is not supported. BRANCH=cyan BUG=b:27849483 TEST=Check we get sensor events on Cyan through the sensor ring. (cyan branch) Change-Id: Iadc9c852b410cf69ef15bcbbb1b086c36687c687 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/353634 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 00aef53a7b4c1a302b8f1448f2c634712c7b77eb) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359408 Reviewed-on: https://chromium-review.googlesource.com/409495 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: kionix: Initialize rv in all casesStefan Reinauer2016-11-121-3/+3
| | | | | | | | | | | | | | | | | | Signed-off-by: Stefan Reinauer <reinauer@chromium.org> BRANCH=cyan BUG=b:27849483 TEST=compile tested for Samus Change-Id: Ib7a0a75a2d63cf8f55d0b59f4a3225da2cb4e70b Reviewed-on: https://chromium-review.googlesource.com/343282 Commit-Ready: Stefan Reinauer <reinauer@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> (cherry picked from commit 65bca9b9fdd797c1a659718f08b4eaa3d7de41ce) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359407 Reviewed-on: https://chromium-review.googlesource.com/409494 Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* BACKPORT: elm: kionix: allow dynamic selection of SPI or I2C transportKoro Chen2016-11-122-6/+66
| | | | | | | | | | | | | | | | | | | This CL ports c9832e04f1528 to Kionix accel driver. And also enables SPI access of Elm's base kx022. BUG=b:27849483 BRANCH=cyan TEST=manual Change-Id: I0c1de028c82fc62a124bb5b930a3882c4b368d71 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/331851 Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org> (cherry picked from commit f00d4621a480f12293214f14716ac33a90281ce7) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359406 Reviewed-on: https://chromium-review.googlesource.com/409493 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: sensor: update sensor driver to use I2C port from motion_sensor_tKevin K Wong2016-11-124-36/+45
| | | | | | | | | | | | | | | | | | this allow motion sensor devices to be locate on different I2C port BUG=b:27849483 BRANCH=cyan TEST=make buildall Change-Id: Ia7ba2f5729ebb19561768ec87fdb267e79aafb6a Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/334269 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit 6711629163f23a98099d8c6d37f6cdb1ef56ca52) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359405 Reviewed-on: https://chromium-review.googlesource.com/409492 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: Set interrupt interval properly for sensor in force modeGwendal Grignou2016-11-121-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | cl/301134 has a bug. If the AP wants a forced sensor (i.e. light) at 100Hz but a sampling frequency at 1s, we would still wake it up every .1s instead of 1s. Take in account force mode only when calculating the sampling frequency not the interrupt interval. BRANCH=smau, cyan BUG=b:2542542, b:27849483 TEST=Check the device goes to suspend even with 40Hz light sampling rate: echo 0 > /sys/bus/iio/devices/iio:device0/frequency echo 40000 > /sys/bus/iio/devices/iio:device3/frequency echo mem >/sys/power/state Before it would resume just after suspend/while suspending. Change-Id: Ie4fe36268cb1b04bc8f01ec885af84fad9e8b282 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/314315 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 70915b501249017e4e962316bf178fd00d09e696) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359404 Reviewed-on: https://chromium-review.googlesource.com/409491 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: At shutdown, access sensors only if initialized.Gwendal Grignou2016-11-121-2/+9
| | | | | | | | | | | | | | | | | | | | | When sensor_shutdown() is called, the sensors may already been powered off, or will be soon. In that case, do not attempts to access them. Check their state before setting range or disabling activities. BRANCH=smau, cyan BUG=chromium:55796, b:27849483 TEST=compile Change-Id: I60640b120a23f9aab393a93c4c67ef17222ced4e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/314382 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit cef0fdb90e17fae3fd9f035bb6ada17e2833369e) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359403 Reviewed-on: https://chromium-review.googlesource.com/409490 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: fix ec_rate to be more accurateGwendal Grignou2016-11-121-3/+3
| | | | | | | | | | | | | | | | | | | | In case the actual ODR rate is way higher that the AP asked for, we don't have to settle to a slower EC rate if EC rate == AP requested ODR rate. BRANCH=smau, cyan BUG=b:27849483 TEST=Run android.hardware.cts.SingleSensorTests Change-Id: I437f47bd942a16694c7efcdbc00201352f0480a6 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/313641 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 68502864c7db47b0dae250600dec5531c5f35619) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359402 Reviewed-on: https://chromium-review.googlesource.com/409489 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: Fix the number of sample to collect in motion taskGwendal Grignou2016-11-121-1/+10
| | | | | | | | | | | | | | | | | | | | | | AP could collect samples while motion task was still adding timestamp. A data stream not ending with a timestamp can lead to timestamp error in the kernel. This is espcially true if the motion task interrupt the AP back to back, when sensor ODR changes for instance. BRANCH=smau, cyan BUG=b:2436762, b:27849483 TEST=Run android.hardware.cts.SingleSensorTests Change-Id: I5820216a2cfc0a869db7dc5ef75d4be126a53b4f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/313640 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 708f81e3d1d222270c697b5643760b1ca361b9f9) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359401 Reviewed-on: https://chromium-review.googlesource.com/409488 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: improve readability by adding units to variable names.Gwendal Grignou2016-11-122-22/+23
| | | | | | | | | | | | | | | | | | | | Throughout the code, there are comparison between frequency (in mHz) and period (in us). To improve readability, append units (_mhz, _us) after variable names. BRANCH=smau, cyan BUG=b:27849483 TEST=compile. Change-Id: Icc9c66d9f06c526fc3b74fd85ca9759b702ee416 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/313221 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 87a60df71f24aca95a485662e30a94076c75b0e0) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359400 Reviewed-on: https://chromium-review.googlesource.com/409487 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: wake up main task for all changes in EC parameter.Gwendal Grignou2016-11-122-11/+16
| | | | | | | | | | | | | | | | | | | | | | We need to wake up the main task, even if we disable a sensor. It will force sending the sensors samples in the FIFO and put a timestamp behind them. Also, reduce the interrupt period by 10us to be sure we fire interrupt to the AP even if there are some variation in the timing calculation. BUG=b:2436762, b:27849483 BRANCH=smau, cyan TEST=Run ts.SingleSensorTests overnight. Change-Id: I6d966d52b5cbb72ba5eb936bc2fad6c06c7d8605 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/312986 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 9d7f1674460ce8e1a9c2fab79909cfd3bc856807) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359399 Reviewed-on: https://chromium-review.googlesource.com/409486 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: Alter ec_rate to prevent samples without dataGwendal Grignou2016-11-121-11/+40
| | | | | | | | | | | | | | | | | | | | | If EC sampling rate is close to sensor rate, decrease sampling frequency by 5% to prevent samples by the EC without data. It can happen when the clocks are slightly different and get unsynchronized. BRANCH=smau, cyan BUG=b:2436762, b:27849483 TEST=Ran cts.SingleSensorTests overnight without error. Change-Id: Iab5e578763171411eb474e1e717167c8e1ef7ecf Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/312985 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit d98999f3685ddbd27af86e1d96f2af030af9beab) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359398 Reviewed-on: https://chromium-review.googlesource.com/409485 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: motion: Change units of ec_rate from us to ms.Gwendal Grignou2016-11-123-19/+19
| | | | | | | | | | | | | | | | | | To ease finer calculation of ec rate change units from ms to us. BRANCH=smaug, cyan BUG=b:24367625, b:27849483 TEST=compile Change-Id: I52057c8ca1b1180a64b58d1ba0af9ec53f40b026 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/312984 (cherry picked from commit 420099f74976b3af1f4b24dc24b9fec461b1037b) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359397 Reviewed-on: https://chromium-review.googlesource.com/409484 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: fix oversampling formulaGwendal Grignou2016-11-122-42/+33
| | | | | | | | | | | | | | | | | | | | | | Overly complex previous formula could lead the EC to throw all samples between 2 timestamps and put 2 event within one timestamp. That would confuse the kernel. If the motion sense task is delayed while this happen, the delta between the 2 samples could be so long that CTS test cts.SingleSensorTests would fail. BRANCH=smau, cyan BUG=b:2436762, b:27849483 TEST=Loops of cts.SingleSensorTests pass. Change-Id: I29e6bf354ccb7ecf741a91116854d6abe07558dc Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/312364 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 96b65354878587df434becfbc5d707a687c85fa4) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359396 Reviewed-on: https://chromium-review.googlesource.com/409483 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: motion: minium interval between motion task now a variableGwendal Grignou2016-11-123-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Ryu EVT2, where sensors share a 100kb i2c bus with other device, when the sensors set to their maximal frequency and sampling interval set to 5ms, the power management task would wait forever for the i2c lock. Increase the minimal amount of time the task can wait from 3ms to 8ms in that case. This is not an issue for Ryu PVT where the sensors are on a separate SPI bus. However, on EVT, when setting the accelerometer/gyro over 125Hz, EC won't be able to deliver the data in non-batched mode. BRANCH=smaug, cyan BUG=b:25510300, b:27849483 TEST=Without this change, an evt2 board would crash when plugging/unplugging the charger while the sensors are set with: echo 200000 > iio:device0/frequency # Accel echo 5 > iio:device0/sampling_frequency echo 200000 > iio:device1/frequency # Gyro echo 25000 > iio:device2/frequency # Mag Change-Id: Idb30da9ab8da61284388db73365c37be3a250dec Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311755 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 66a72f0b6e379edc3a2a52fa2e9b0f66c557a447) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359395 Reviewed-on: https://chromium-review.googlesource.com/409482 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: cleanup include fileGwendal Grignou2016-11-123-7/+5
| | | | | | | | | | | | | | | | | | | Use test_export_static for static variable/function that needs to by used by tests/motion_lid.c BRANCH=smau, cyan BUG=b:27849483 TEST=Compile, make buildall -j Change-Id: I2f3eb72ce319622842885be9125b91e58f47133a Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311754 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 0922cc81ce22204264a2b96cec4bf2195939e516) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359394 Reviewed-on: https://chromium-review.googlesource.com/409481 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: motion: Remove duplicate shutdown codeGwendal Grignou2016-11-123-12/+8
| | | | | | | | | | | | | | | | | | | | | | Call shutdown() entry point at init() and remove duplicate code. shutdown would init the sensor so they would be ready if needed. Set S5 flag to include G3 (hard off) state, not only S5 (soft off). BUG=chrome-os-partner:45722, b:27849483 BRANCH=smaug, cyan TEST=When doing a RO->RW transition while AP is in G3, check the sensors are initialized properly. This issue was found while testng the magic sequence code. Change-Id: I647f83580240bf5ba0c340fca3184220abe4c12e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/308561 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 21c46e7b1300022fcee1e5997b3e9293c47c27ea) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359393 Reviewed-on: https://chromium-review.googlesource.com/409480 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: common: lightbar: Add histeresis to prevent flickeringGwendal Grignou2016-11-125-20/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When ALS is enabled, if light is around one threshold (say 40 lux), the lightbar will flicker between readings. Add a histeresis to prevent the flickering. The current setting is: setting ^ (dim) 2 | ------+---->---+ 1 | +----<---+--->---+ (bright) 0 | +---<---+--------- +-------+--------+-------+--------> lux 20 40 60 BRANCH=smaug, cyan BUG=chrome-os-partner:44400, b:27849483 TEST=check in a dark room (30~40 lux) there is no flickering. Add unit test. Change-Id: I4018e2c2ed764abf9c9ed28e2d50a3e94a7d5f75 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/308205 (cherry picked from commit 81d269dc004b6c7334e4e8eafbb2872e5b6fdcf1) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359392 Reviewed-on: https://chromium-review.googlesource.com/409479 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: common: Add lightbar dimming based on outside light.Gwendal Grignou2016-11-124-0/+60
| | | | | | | | | | | | | | | | | | | | | Unless the lid is closed, the ALS is used for lightbar dimming. Change the google colors depending on the light sensor result. BUG=chrome-os-partner:44400, b:27849483 BRANCH=smaug, cyan TEST=Check all 3 levels of brightness of the lightbar. Check value using "adb shell ectool lightbar" Check double tap color are not affected and is using full brightness. Change-Id: I7b5e2890c3557f1dd3ae719f5f82ffb5fe7b24fb Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/301216 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 7340e804a1e3ffba2f1ffb9bf826a33b8b5fb19c) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359391 Reviewed-on: https://chromium-review.googlesource.com/409478 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: reenable double tap in S5.Gwendal Grignou2016-11-121-0/+3
| | | | | | | | | | | | | | | | | | | | Double TAP must be enabled in S5, even if it has been disabled by the AP, otherwise we would not be able to check the battery level if the AP did not shutdown properly or does not reenable double tap on shutdown. BRANCH=cyan BUG=chrome-os-partner:4657, b:27849483 TEST=Check double tap is working after unit has been powered down. Change-Id: Ic798399a3e4ae4d87c6e80eab4cf1fd680f99585 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/306697 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 0686445847dac456e867f96968b2ee29d7cce74a) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359390 Reviewed-on: https://chromium-review.googlesource.com/409477 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: motion: fix manage_activity interfaceGwendal Grignou2016-11-122-2/+2
| | | | | | | | | | | | | | | | | | | Declare optional parameters are const structure. These parameters, when used, are just read by the sensor driver. BRANCH=smaug, cyan BUG=b:27849483 TEST=compile Change-Id: I8f2a9291e1908922831fb5e2a524bb6edd0e0f65 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/306696 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit fcfd32f04a58e1baf54b39d97c7b37eabb0770db) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359389 Reviewed-on: https://chromium-review.googlesource.com/409476 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: common: motion: Fix forced mode computationGwendal Grignou2016-11-121-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the sensor is defined to be used in forced mode, ec rate was not calculated properly: if the AP rate was rounded up, ec_rate requested by the AP would always be 0. If the EC rate is 0, the sensor may potientally never be queried. Also, when the sensor was disable for a long time, the last timestamp of collection may appear to be in the future, so collection was not initiated. (long time more than 35 minutes, less than 71 minutes). We still see instance where the sensor seems locked up. accelinit would not help because the state machine was not reseted, fix that. BRANCH=smaug, cyan BUG=chrome-os-partner:45627, b:27849483 TEST=With accelerate 3/4, check the value is now correct. Check proximity sensor is not stuck 45 minutes after last collection. Change-Id: Ia6805b75f67b048cb0b42c0f91a73dfaf94a254f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/305823 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 917effebbf4f64607a94b10490c143817bf10801) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359388 Reviewed-on: https://chromium-review.googlesource.com/409475 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: Add timestamp in ODRGwendal Grignou2016-11-121-9/+17
| | | | | | | | | | | | | | | | | | | | Before setting a new frequency, put a timestamp in the FIFO. In case there was a long silence, the sample timestamp will be anchored on that timestamp instead of the last timestamp the AP collected. BRANCH=smau, cyan BUG=chrome-os-partner:4381, b:27849483 TEST=Check SingleSensorTests pass. Change-Id: Ie40ebd9d856abdeeeccf4b636351560bb8a6305c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/305571 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 0174b9a21d0764bf32243cf23a3f138bf44e5938) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359387 Reviewed-on: https://chromium-review.googlesource.com/409474 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: motion: fix spellingGwendal Grignou2016-11-122-16/+16
| | | | | | | | | | | | | | | | | | | | | | | Fix various spelling errors. Command used: spell include/motion_sense.h | sort | uniq -c | \ grep -v -f ~/tmp/known_words | sort -n > /tmp/checking_spell Appended /tmp/checking_spell to ~/tmp/known_words to avoid C code. BRANCH=smaug, cyan TEST=compile BUG=b:27849483 Change-Id: I39acfeaefef51d142a587940bccb02db86e87068 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/305570 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit c8844123923f8b65f38a7d16aaac3e9ce774ce2c) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359386 Reviewed-on: https://chromium-review.googlesource.com/409473 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: fix sensor interrupt interval computationVincent Palatin2016-11-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | When a sensor has a null rate, do not reset the interrupt interval as we need the minimum for all used sensors. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smau, cyan BUG=b:2467859, b:27849483 TEST=Rotate a Ryu at the Home Screen and see a proper auto-rotation. Change-Id: Ia4cbb1e8bc425c076af245f45a72b1beb356f686 Reviewed-on: https://chromium-review.googlesource.com/304132 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 1c73c7958e5db4024e05d5e691918238107654d3) Reviewed-on: https://chromium-review.googlesource.com/304196 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit f7022544bffac0964300405eb878b114d14128ae) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359385 Reviewed-on: https://chromium-review.googlesource.com/409472 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: common: motion: Fix for calculating oversampling fix.Gwendal Grignou2016-11-121-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | cl:302176 did not fully fix the issue: - sampling rate would be unnecessary truncated to integer. - Because the sensor can slightly oversample (15Hz -> 25Hz, 10Hz -> 12.5Hz), we would skip samples for long period of time. In both cases we skip samples in low speed tests, noticed by CTS tests. BUG=b:2436762, b:27849483 BRANCH=smau, cyan TEST=Before we would fail some android.hardware.cts.SingleSensorTests#testMagneticField_X, Now pass. Change-Id: Ic555e2add47ba89a0a0657f5eb492a5e7ca441d5 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/303010 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit f236658ff7f5c98e60db05dca49a90d8795867c7) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359384 Reviewed-on: https://chromium-review.googlesource.com/409471 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: common: motion: Separate motion task interval from AP configurationGwendal Grignou2016-11-124-30/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some sensors are in forced mode, motion sense must be scheduled at their ODR. However the host may not want the data right away, so motion task may not wake up the host that often. Add a new variable motion_int_interval that defines the maximum interval between FIFO host event. BRANCH=smaug, cyan BUG=chrome-os-partner:43800, b:27849483 TEST=Check that light sensor is polled at ODR frequency. Check that when AP does not want any event, no FIFO host event are requested. Check CTS tests work as before. Reenable motion_lid unit test. Change-Id: Ie25e6cbe28fed899073856057855ffa03c0cd9fd Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/301134 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit d0e1c2394c641afdbd633e9393131fe03fdefa9f) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359383 Reviewed-on: https://chromium-review.googlesource.com/409470 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: common: motion: Add timestamp before wakeup event.Gwendal Grignou2016-11-121-1/+9
| | | | | | | | | | | | | | | | | | | | | Sandwich wake up event between timestamp. Otherwise HAL will think the event came from a long time ago. With two timestamp, the wake event timestamp will be - more - accurantly set at the time it occurs. BRANCH=smau, cyan BUG=chrome-os-partner:4570, b:27849483 TEST=Pass com.android.cts.verifier.sensors.SignificantMotionTestActivity Change-Id: I6be76820d71d2571d069542564f569a623001190 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/302642 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit fec7aea0bf11912fae03dc6c9f9292395c141294) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359382 Reviewed-on: https://chromium-review.googlesource.com/409469 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: common: motion: Fix setting of Significant motion.Gwendal Grignou2016-11-121-1/+2
| | | | | | | | | | | | | | | | | | | | cl/296213 had another bug that prevent Significant motion gesture to be set: In set_activity, activity is a number, not a bitfield. BRANCH=smau, cyan BUG=chrome-os-partner:4570, b:27849483 TEST=With ectool motionsense set_activity and list_activity, check we can set/reset the significant motion activity. Change-Id: Iff921f3f5edcee74ed3540139f13da301f149173 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/302641 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit cf25d26c2740cb86adf235ee33dd15653c7c522b) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359381 Reviewed-on: https://chromium-review.googlesource.com/409468 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: common: motion: Fix error calculating oversampling.Gwendal Grignou2016-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | cl:298688 was wrong and oversampling calculation, used to drop events that AP does not want was incorrect. We were comparing mHz with Hz. BUG=b:2436762, b:27849483 BRANCH=smau, cyan TEST=Before, we would fail all android.hardware.cts.SingleSensorTests#testAccelerometer tests where frequency was lower than 100Hz. After, we pass thoses tests. Change-Id: I487feb4e235a21f78d367397b5890ebcc5864b22 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/302176 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit a0a1d18e06053b3cf2f390d31cd032560b184544) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359380 Reviewed-on: https://chromium-review.googlesource.com/409467 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion_sense: Fix issues in SET_ACTIVITY / LIST_ACTIVITIESFurquan Shaikh2016-11-121-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. ret always evaluated to INVALID_PARAM and so SET_ACTIVITY bailed out early and returned an error to host command. 2. No need to verify sensor id since SET_ACTIVITY / LIST_ACTIVITIES identify the correct sensor to operate on. BUG=chrome-os-partner:4571, b:27849483 BRANCH=cyan TEST=Compiles successfully. Disable double-tap works as expected. Change-Id: I58ae9cd5009fadedb3ea78a4eec0452124747707 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/301990 Trybot-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> (cherry picked from commit 2a3a120c8f7cca1e032f4be2a198748f0e8b5fb1) Reviewed-on: https://chromium-review.googlesource.com/302409 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit f4ef486fc21a655b75c928ed719d366c6e95a2d4) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359379 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409466 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: common: motion: Add double tap gesture host interfaceGwendal Grignou2016-11-123-9/+25
| | | | | | | | | | | | | | | | | | | Allow the host to enable/disable double tap. Send event when double tap is present. Also fix a bug when scanning for gestures. BRANCH=smau, cyan BUG=chrome-os-partner:4475, b:27849483 TEST=compile. Check on Ryu. Change-Id: I50d008cd3823072ab1c1e2d21f1276cd2185d797 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/298683 (cherry picked from commit 4e8120a3641d5ed8de5a53e08f2bb711e5516167) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359378 Reviewed-on: https://chromium-review.googlesource.com/409465 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: common: motion: Fix oversampling calculation.Gwendal Grignou2016-11-121-4/+6
| | | | | | | | | | | | | | | | | | | | | | | Was setting frequency radix at 1 mHz. That would limit frequency to 32Hz, which is not enough for accelerometor. Set radix as a fixed point or float variable, to calculate the rate properly. BRANCH=smau, cyan BUG=b:27849483 TEST=Check that when Ryu set accelerometer to 100Hz internally (for double tap), that AP gets data when requested frequency is 15Hz. Change-Id: I84e0ea784f8bd04566aa91bc4300cf4ff30b350c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/298688 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit b98e33c95000976d689a9e5537402eafadad6507) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359377 Reviewed-on: https://chromium-review.googlesource.com/409464 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: common: accel: Add error code for irq handlerGwendal Grignou2016-11-123-3/+9
| | | | | | | | | | | | | | | | | | | | | | | When IRQ handler is not processing any event raised, return NOT_HANDLED. Without this change, any event would set the light sensor process timestamp and, if the light sensor frequency was lower than BM160 fifo interrupt frequency, we would never read from the light sensor. BRANCH=smaug, cyan BUG=chrome-os-partner:43800, b:27849483 TEST=Compile. Check that light sensor data get updated. Change-Id: I302f80c5cd9b4f3c926362fdafdc8b5074cabb60 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/298686 (cherry picked from commit 33046e7d51af5d521235c79dcddc3308c71189db) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359376 Reviewed-on: https://chromium-review.googlesource.com/409463 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: motion: Add Gesture InterfaceGwendal Grignou2016-11-126-25/+295
| | | | | | | | | | | | | | | | | | | | Add an interface with the host to set up gesture recognition. Today, only significant motion is supported. Add a virtual sensor for concentrating gesture support from host. BRANCH=smaug, cyan BUG=b:23570481, b:27849483 TEST=On ryu, enable significant motion from host. Change-Id: I906fa2d2d7b4ca2771ea2f58b91de8d97bf4e2e3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296213 (cherry picked from commit 6b5a49ef15354c5b31be51f32006dbb4d7dc7c62) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359375 Reviewed-on: https://chromium-review.googlesource.com/409462 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: Add wake up sensor support.Gwendal Grignou2016-11-122-11/+23
| | | | | | | | | | | | | | | | | | | | | | Add a flag in the FIFO event to tell that the sensor want to wake up the AP. Use this flag in the EC and let it reach the AP for debugging. Move fifo_flush as well, use only when FIFO present. BRANCH=smau, cyan TEST=compile. BUG=b:2357048, b:27849483 Change-Id: I5ff567b0f9f1e37a3dae16bfa7859c341f1a9b17 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296212 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 13a7ae7b6fe5c67446adeb95256271547a0c777b) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359374 Reviewed-on: https://chromium-review.googlesource.com/409461 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: common: motion: move gesture actions in motion task.Gwendal Grignou2016-11-125-18/+24
| | | | | | | | | | | | | | | | | | | Change the IRQ interface to allow adding events. Move code to send the lightbar sequence from gesture.c to motion task. TEST=compile, works on Ryu. BRANCH=smaug, cyan BUG=chrome-os-partner:44754, b:27849483 Change-Id: I981ea123ebef0e8e3d6aa320eade89f10e83b6fc Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296822 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit bde89ebc203d9d15ede2cefb3eea8511d1fc3b65) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359373 Reviewed-on: https://chromium-review.googlesource.com/409460 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: common: motion: print return of drv->init()Gwendal Grignou2016-11-121-8/+15
| | | | | | | | | | | | | | | | | In motion_sense_init, gather the result of the sensor init routine. BUG=b:27849483 BRANCH=smau, cyan TEST=Get the result of init() when calling accelinit. Change-Id: I8d0219a2b81fdf6d512976db5a28646ee5f6b994 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/299946 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit a2ef386ee745f2c34585d50a850afb5087c6325c) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359372 Reviewed-on: https://chromium-review.googlesource.com/409459