summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* UPSTREAM: common: motion: Fix for calculating oversampling fix.Gwendal Grignou2016-08-011-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
* BACKPORT: common: motion: Separate motion task interval from AP configurationGwendal Grignou2016-08-014-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
* UPSTREAM: common: motion: Add timestamp before wakeup event.Gwendal Grignou2016-08-011-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
* UPSTREAM: common: motion: Fix setting of Significant motion.Gwendal Grignou2016-08-011-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
* UPSTREAM: common: motion: Fix error calculating oversampling.Gwendal Grignou2016-08-011-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
* UPSTREAM: motion_sense: Fix issues in SET_ACTIVITY / LIST_ACTIVITIESFurquan Shaikh2016-08-011-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>
* UPSTREAM: common: motion: Add double tap gesture host interfaceGwendal Grignou2016-08-013-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
* UPSTREAM: common: motion: Fix oversampling calculation.Gwendal Grignou2016-08-011-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
* BACKPORT: common: accel: Add error code for irq handlerGwendal Grignou2016-08-013-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
* BACKPORT: motion: Add Gesture InterfaceGwendal Grignou2016-08-016-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
* UPSTREAM: motion: Add wake up sensor support.Gwendal Grignou2016-08-012-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
* BACKPORT: common: motion: move gesture actions in motion task.Gwendal Grignou2016-08-015-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
* UPSTREAM: common: motion: print return of drv->init()Gwendal Grignou2016-08-011-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
* BACKPORT: motion: add config option to use the old accelerometer ref frameAlec Berg2016-08-017-39/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add config option to use the old accelerometer reference frame, which is used on samus and products using 3.14 or earlier kernel. This fixes samus so that the lid angle calculation is correct again. This also moves the accel_orientation structure out of the board directory and into common code, since it purely is a function of the reference frame being used. BUG=chrome-os-partner:43494, b:27849483 BRANCH=cyan TEST=test on samus, verify lid angle calculation is correct once again. also, enable the motion_lid test and verify that it passes. Change-Id: I948a74a71964b54c68be66e828a030ddd0418947 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/300510 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 5717b3150c8a8d43e07ce2dc8065c3515d3651f7) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359371 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: motion: fix task to guarantee task never exitsAlec Berg2016-08-011-2/+3
| | | | | | | | | | | | | | | | | | | | | Fix motion_sense task to make sure the task never exits. Note, before this change a task_wake(TASK_ID_MOTIONSENSE) would end the task because task_wait_event() would return 0. BUG=b:27849483 BRANCH=smau, cyan TEST=with following CL, run motion_lid test and make sure it passes Change-Id: I67bd2e535d67215baa0cc1dfd0010b8199152dbd Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/300630 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 7a87dae5c7208f7f4264ea89fa10ba37322e838a) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359370
* BACKPORT: driver: Refactor Kionix Accelerometer drivers.Aseda Aboagye2016-08-0110-564/+713
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a new basic driver for the Kionix KX022 Accelerometer. Currently, the driver is capable of reading the sensor data and manipulating its ODR, resolution, and range. This sensor also has integrated support for Directional Tap/Double-Tap(TM), however that functionality is not yet implemented in the driver. Lastly, since this accelerometer is very similar to the previous KXCJ9, this commit tries to combine the drivers. Note, the variant of the Kionix accelerometer MUST be specified in the private data structure. BUG=chrome-os-partner:43494, b:27849483 BRANCH=cyan TEST=Build GLaDOS EC with driver enabled and verify that valid accelerometer data is read, and that range, resolution, and odr can all be modified. TEST=Build samus EC image and verify that the lid still works. Additionally, verify that I can change the odr, rate, and resolution. TEST=make buildall tests Change-Id: I238ff1dc13f5342a93f8f701a0da85c52f25d214 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/299013 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 16a18a5e0eeaeebff5f4ab5c9363481f8d1426aa) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359369 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* BACKPORT: common: Add variable to enable software gesture recognition.Gwendal Grignou2016-08-013-4/+14
| | | | | | | | | | | | | | | | | | Gesture recognition can be done in software (by the EC) or in hardware, by the sensor itself. Add variable to compile gesture.c only in the software case. BRANCH=smaug, cyan TEST=compile. BUG=b:23570481, b:27849483 Change-Id: I22bef0bf744516df267020d9458e0299a4da3d72 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296211 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 17296409d8eec57bd3f11c8835ad13f22d4f13fc) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359368
* UPSTREAM: motion: Fix a bug in accelrateGwendal Grignou2016-08-011-0/+2
| | | | | | | | | | | | | | | | | | Allow accelrate to suspend a sensor, even if the AP is using it. For debugging only. BRANCH=smau, cyan TEST=before accelrate 0 0 would not suspend the accelerometer in SO, the AP is using it. BUG=b:2357048, b:27849483 Change-Id: Iea4f616d0a0d1b4a0b0fa2bc942d05b2a2425926 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296210 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 3b1847d81053d211febc98604f4a3101c389f1ac) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359367
* BACKPORT: driver: bmi160: Prevent crash when FIFO is not validGwendal Grignou2016-08-012-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When all BMI160 sensors are suspended, FIFO is invalid. Put the test to check if all sensors are disable within the processing loop: otherwise, the FIFO can become invalid while we are processing it. Add printf to be sure we are not processing invalid FIFO. Add a macro around ODR to really check the ODR rate, excluding the roundup flag. BRANCH=smaug, cyan BUG=chrome-os-partner:44381, b:27849483 TEST=Using a special patch (see 44381#14) add delay to simulate a loaded EC (like at resume). Using a script flip-flop sensors frequency (to simulate suspend/resume). Check that: - we are not crashing anymore (we were before this patch) - the driver is not hitting invalid FIFO content. Change-Id: I7c9e86f5dcfc231ab89472a6ea03af22e2c2ac32 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/297178 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 84ed699ac98f7aab6556b806092bc6f8b501453f) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359366
* BACKPORT: samus: Use new config, fix gestureGwendal Grignou2016-08-013-22/+7
| | | | | | | | | | | | | | | | | Use new config table. Move ODR setting in motion sense, fix variable names. BRANCH=samus, ryu BUG=chromium:513458, b:27849483 TEST=Test accelerator and double tap on Samus Change-Id: I341add11a18de8e4cc97c57da29f9114bd2014cf Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295638 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 32867104da45ae38e37163ba6d04f847bc15e6bc) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359365
* BACKPORT: motion_sense: Add more complex EC/AP sensor rate support.Gwendal Grignou2016-08-017-180/+304
| | | | | | | | | | | | | | | | | | | | | | | | Add config settings for ODR and EC rate per requestor and per power state (1 for the AP, 3 for the EC). This way we can finely set ec rate and ODR depending on usage. On chromeos, AP is not setting frequency, so EC sets for different power state. On some platform, sensors can now be suspended in S3/S5. Allow EC oversampling when AP is only looking for a few samples. It is useful for double tap detection where high accelerator ODR is required. BRANCH=ryu, cyan TEST=Tested on Ryu BUG=chromium:513458, b:27849483 Change-Id: Ic3888a749699f07b10c5da3bc07204afd4de70da Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295637 (cherry picked from commit 4e7e1bb796190e658ea2de8d4e391efa59b0d643) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359364
* UPSTREAM: driver: kxcj9: Remove some printf to fit into kunimitsuGwendal Grignou2016-08-011-5/+0
| | | | | | | | | | | | | | | | Remove some printfs for the new sensor code to compile. BRANCH=kunimits, cyan BUG=b:27849483 TEST=compile Change-Id: Ia7b203a03866fd497cdfaf5fa91f651423279f61 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295856 Reviewed-by: Sheng-liang Song <ssl@chromium.org> (cherry picked from commit 398bd9a0178c0120a2dbf3f58419d6a5360dfb3d) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359363
* UPSTREAM: common: motion_sense: Fix Light sensor sequencingGwendal Grignou2016-08-011-5/+6
| | | | | | | | | | | | | | | | | | | Light was gathered too often: - missing timestamp when reading completes. - error when calculating next timestamp. BRANCH=ry, cyan BUG=chrome-os-partner:3282, b:27849483 TEST=check the light is sampled ~ every seconds, whatever the motion task frequency Change-Id: Id070af3c8d2e080780334822278dda267bea058c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295636 Reviewed-by: Sheng-liang Song <ssl@chromium.org> (cherry picked from commit e11637aed6b58085c13bcc4e88cef706a5184964) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359362
* BACKPORT: driver: change get_ interface.Gwendal Grignou2016-08-015-52/+32
| | | | | | | | | | | | | | | | | | Simplify sensor get_data_rate, get_range and get_resolution. Error code was not checked and these functions as currently implemented have no reason to fail. BRANCH=ryu,samus,cyan,strago BUG=chromium:513458, b:27849483 TEST=Check on ryu, compile Change-Id: I40dca41cee29a19f65b2f84d434b4c19eb6cbf3c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295635 Reviewed-by: Sheng-liang Song <ssl@chromium.org> (cherry picked from commit 7a2299163b7769b546db53c0dd225eee9e0a0df1) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359361
* UPSTREAM: driver: accel: Apply offsets after rotationGwendal Grignou2016-08-012-9/+14
| | | | | | | | | | | | | | | | | Offsets are in the axis of the device, not the sensor. Apply the offsets after rotiation BRANCH=cyan TEST=compile, test on cyan BUG=chromium:51767, b:27849483 Change-Id: Iae9282efcbb5889bb0f1f556b7e5ca9fabe31b22 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/294595 Reviewed-by: Sheng-liang Song <ssl@chromium.org> (cherry picked from commit f7fa6248bf170d2fffbf3fb067b6ed40f0a4d55f) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359360
* BACKPORT: motion_sense: calculate threshold properlyGwendal Grignou2016-08-013-12/+32
| | | | | | | | | | | | | | | | | | | Working on light sensor, sensor were read on every time, SENSOR_EC_THRES was not taken into account. Fix 64/32 conversions and add a function for dealing with rollover. TEST=Set light sensor probe at 1s. Set accel sensor at 100Hz to fill fifo often; verify that light sensor is queried every second only. BRANCH=smaug, cyan BUG=chrome-os-partner:39900, b:27849483 Change-Id: If1df53c1a9a304c992f8e517f5d516210118a437 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/291992 Reviewed-by: Sheng-liang Song <ssl@chromium.org> (cherry picked from commit de42bb285fa45a777ed7a27be9f4c99c8f606ed8) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359329
* BACKPORT: motion_sense: Force flush when sensor disabled.Gwendal Grignou2016-08-011-7/+1
| | | | | | | | | | | | | | | | | | | | | | When sensor is disabled, HAL will not send flush request to EC. However, when sensor is reenabled, only new events are expected. When we have a change in frequency, we have to request the host to query all the current events. Flush the FIFO when events are not needed because all sensors are disabled. BRANCH=smaug, cyan TEST=Pass more tests: tests like ..._fastest_batching after _50hz_flush have more change to pass. BUG=chrome-os-partner:39900, b:27849483 Change-Id: I1a8fc3784e3e6be260b23103b28e336e242f14cd Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/291991 Reviewed-by: Sheng-liang Song <ssl@chromium.org> (cherry picked from commit 5faadc6748d556375c1effd56dac226f2a773ad1) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359328
* BACKPORT: motion_sense: Allow multiple IRQ based sensorsGwendal Grignou2016-08-014-22/+46
| | | | | | | | | | | | | | | | | | Add a mask of custom events reserved for IRQ based sensors. Copy data from raw_xzy to xyz while filling the FIFO when FIFO is enabled. BRANCH=smaug, cyan TEST=Test with si1141 driver, check irq works for both driver. BUG=chrome-os-partner:32829, b:27849483 Change-Id: I5e106df0c121e3bf1385f635195717395235ccc3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/291334 Reviewed-by: Sheng-liang Song <ssl@chromium.org> (cherry picked from commit 59138ad0977bd7ddd47a2810446f458f91eaac7c) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359327
* UPSTREAM: motion_sense: Reduce condition for lid angle calc.Aseda Aboagye2016-08-011-8/+11
| | | | | | | | | | | | | | | | | | | | | | | The motion sense task was checking to see that every single motion sensor was ready (active, initialized, and reading), before performing the lid angle calculations. This amount of checking is unnecessary. This commit reduces the condition to only check if the sensors required for lid angle calculation are ready. BUG=chrome-os-partner:3613, b:27849483 BRANCH=cyan TEST=Build and flash on samus. Verify that the lid still works. TEST=make -j buildall tests Change-Id: Ibaa5cc8358cdcc6023a50aed247fce2e599fef58 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/291301 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 3a659c1fedb3536a6f04b80b65ff18df6ddb653f) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359326
* BACKPORT: driver: bmi160: Add SPI access supportGwendal Grignou2016-08-011-0/+3
| | | | | | | | | | | | | | | | | Add interface to access the sensor using SPI interface. Added for config.h variable. BRANCH=smaug, cyan TEST=compile and work on new Ryu board BUG=chrome-os-partner:42304 Change-Id: I987259a7e378de8ada3b3b55b3662e5028ea31b2 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/288515 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit e94152b7e895b973e1c90a9935d2d1e4a706b55f) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359325
* BACKPORT: accel: mechanical changes from i2c_addr to addrGwendal Grignou2016-08-015-37/+38
| | | | | | | | | | | | | | | | | | Encode both the I2C address and SPI GPIO CS in addr field. Mechanical change to rename i2c_addr into addr. BRANCH=smaug, cyan TEST=compile BUG=chrome-os-partner:42304, b:27849483 Change-Id: I1c7435398deacb27211445afa27a08716d224c06 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/288513 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: David James <davidjames@chromium.org> (cherry picked from commit a3a5c90b54670ddc865defc16757f1fef78ca322) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359324
* driver: bmi160: Remove, not needed on cyan branchGwendal Grignou2016-08-013-1374/+0
| | | | | | | | | | | | To ease portage of sensor hub stack for arc++, remove bmi160 driver. BRANCH=cyan BUG=b:27849483 TEST=compile Change-Id: I1ac787db3e5fe43dbb989386c6d3299213ef9c96 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359323
* board: Remove all boards with sensor but CyanGwendal Grignou2016-08-0174-9872/+0
| | | | | | | | | | | | | To ease portage of motion sensor stack to support ARC++, remove all other boards with sensors but Cyan BRANCH=cyan BUG=b:27849483 TEST=compile Change-Id: I3376e8347aed0f5ee20717a965f659b1e46fe3f1 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359322
* vboot_hash: Properly handle hash of zero-byte regionShawn Nematbakhsh2016-05-172-2/+17
| | | | | | | | | | | | | | | | | | | | | | If we're asked to compute a hash of an image on a region of storage, we may find that the region actually contains no image. In that case, we need to compute a hash of zero bytes. Properly handle this case from image size detection to hash computation to hash invalidation. BUG=chrome-os-partner:49529 TEST=Manual on chell. `dd conv=notrunc if=/dev/zero of=ec.bin bs=131072 count=1`, then write ec.bin and verify SW sync occurs, RW hash is computed correctly, and the system boots into dev mode. BRANCH=glados, strago Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ie5a023d13d2521f9c224615666950aea8fbc22bb Reviewed-on: https://chromium-review.googlesource.com/322750 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 17ffa6b1abdec63015054623226a09c60c38a1ee) Reviewed-on: https://chromium-review.googlesource.com/345441
* mec1322: lpc: Clear STATUS_PROCESSING LPC status bit on initShawn Nematbakhsh2016-01-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | When a sysjump host command is received, there is a (usually) small period of time when the EC has sent a reply packet back to the host, but interrupts are still enabled. If the host sends a new host command, STATUS_PROCESSING will be set by the EC ISR, but the host command will never be handled due to pending sysjump. In this case, STATUS_PROCESSING will still be set, so we need to clear it on LPC post-sysjump re-init. BUG=chrome-os-partner:49318 TEST=Add 200ms msleep before call to interrupt_disable() in jump_to_image(), boot to software sync, and verify host commands are handled successfully post-sysjump and system continues to boot. BRANCH=glados, cyan Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Id0878df738541f7d5d158821a68988a8e6dc6759 Reviewed-on: https://chromium-review.googlesource.com/322431 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> (cherry picked from commit e933d0b7b6984bc8abf40b3364695d9955a9a426) Reviewed-on: https://chromium-review.googlesource.com/322407 Tested-by: 志偉 黃 <David.Huang@quantatw.com> Commit-Queue: 志偉 黃 <David.Huang@quantatw.com>
* braswell: Monitor power button press and hold to do a force shutdown.Kevin K Wong2015-10-132-2/+33
| | | | | | | | | | | | | | | | | | This is to ensure the system will shut down and power up properly if a force shutdown is happened. BUG=chrome-os-partner:46250 BRANCH=firmware-cyan-7287.57.B TEST=1) "stop powerd" from OS 2) Run "dut-control pwr_button:press sleep:10 pwr_button:release" 3) Verified system is shutdown and able to power back to OS 4) Repeat and the sleep time from 10 to 5, 7.5, 8, 8.5, 10, 20, etc. Change-Id: Ic1631430c5b2f9b071bf353be64b7b1fd959f68a Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/305307 Reviewed-by: Bernie Thompson <bhthompson@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* Braswell: EC_ME_LOCK implementationShobhit Srivastava2015-09-291-1/+1
| | | | | | | | | | | | | | | | Set EC_KBD_ALERT Gpio LOW to enable Flash Descriptor Override Strap BRANCH=firmware-strago-7287.B,firmware-cyan-7287.57.B BUG=chrome-os-partner:45935 TEST=Build and boot cyan. Check ME lock status Change-Id: Ie811351e34ca195c7472d4f4ff58029e1fc3c439 Signed-off-by: Shobhit Srivastava <shobhit.srivastava@intel.com> Reviewed-on: https://chromium-review.googlesource.com/302841 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Ravishankar Sarawadi <ravishankar.sarawadi@intel.com> Tested-by: Ravishankar Sarawadi <ravishankar.sarawadi@intel.com>
* bq24773: Set charge inhibit bit only when it's changed.li feng2015-09-251-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | charger_set_mode() is called in each charger_task loop and sets charge inhibit bit. This reads and writes register option 0 no matter the requested value is same as before or not. Limit this activity to only when the bit is changed. Also if reading option 0 returns value with LEARN mode enabled, try to read one more time to make sure it's not bogus value. Otherwise, this could casue LEARN mode been enabled mistakenly and cause battery discharge with AC on. BUG=chrome-os-partner:45575 BRANCH=none TEST=Observed charger_set_mode() only writes charge inhibit bit when it's changed. If the value keeps then same, no set mode happens. Change-Id: Ia7f258d44e7cadd00f42f671d112eae17da3016e Signed-off-by: li feng <li1.feng@intel.com> Reviewed-on: https://chromium-review.googlesource.com/301185 Reviewed-by: Shawn N <shawnn@chromium.org> Tested-by: Divya Jyothi <divya.jyothi@intel.com> Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
* Strago: Enable power button as wake pin from EC HibernateShobhit Srivastava2015-09-251-1/+2
| | | | | | | | | | | | | | | | | | | When DUT reaches critical battery it shutdowns and EC enters hibernate state. To bring the DUT out of hibernate and boot the system we need to assign power button as wake source. BUG=None BRANCH=firmware-strago-7287.B TEST=Drain the battery and let DUT enter hibernate state. Press power button and check DUT boots. Insert charger and check that charging is happening. Change-Id: I0fe52eecada2b26c12b6bed72a065df0a558bf9e Signed-off-by: Shobhit Srivastava <shobhit.srivastava@intel.com> Reviewed-on: https://chromium-review.googlesource.com/302155 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Bernie Thompson <bhthompson@chromium.org> Tested-by: Bernie Thompson <bhthompson@chromium.org>
* Cyan/Strago: reduce VNN off/on time intervalKyoung Kim2015-09-241-1/+1
| | | | | | | | | | | | | | | | Previous 200msec delay of VNN_EN increases system boot time. Reduce it to 10 msec. BUG=chrome-os-partner:45184 TEST=use 'reboot' EC console command and check if SOC continues to boot to OS successfully. And check if system boot time is improved by 190 msec. BRANCH=firmware-cyan-7287.57.B Change-Id: Idbd5020560d5a7e31cd53bb4f7879f2b8449f0e5 Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com> Reviewed-on: https://chromium-review.googlesource.com/302172 Reviewed-by: Shawn N <shawnn@chromium.org>
* cyan: Remove CONFIG_SYSTEM_UNLOCKEDShawn Nematbakhsh2015-09-221-1/+0
| | | | | | | | | | | | | | Remove CONFIG_SYSTEM_UNLOCKED in preparation for FSI FW. BUG=chrome-os-partner:45672 TEST=None BRANCH=None Change-Id: I23163491bf00593fb01372ea07b63132c598a734 Reviewed-on: https://chromium-review.googlesource.com/301453 Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
* Fixed a failure of power button press while entering G3 state.Kaiyen Chang2015-09-211-5/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | If the power button is pressed while S5 inactivity timer is about to expire, EC need to give CPU a little time to start up before changing the state from S5 to G3 (the hard off state); otherwise the system will not start up. This issue can be reproduced on Rambi. BUG=chrome-os-partner:42728, chrome-os-partner:42811 BRANCH=None TEST=Implement an ec command to simulate power button press while S5 inactivity timer is about to expire, and then make sure that the patch did solve the issue. Change-Id: I022e8e14fd41447898760a4d57a4702e2c00a0d5 Signed-off-by: Kaiyen Chang <kaiyen.chang@intel.com> Reviewed-on: https://chromium-review.googlesource.com/290280 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit 8f6e54aca00ac2336aab636267824d5210942c17) Reviewed-on: https://chromium-review.googlesource.com/291700 Tested-by: Icarus W Sparry <icarus.w.sparry@intel.com> Commit-Queue: Icarus W Sparry <icarus.w.sparry@intel.com> (cherry picked from commit d532781727e031acf5f6a7a207807f4461be3b4f) Reviewed-on: https://chromium-review.googlesource.com/301422 Reviewed-by: Icarus W Sparry <icarus.w.sparry@intel.com> Tested-by: Divya Jyothi <divya.jyothi@intel.com>
* Cyan: Added WIFI power controlKyoung Kim2015-09-212-1/+7
| | | | | | | | | | | | | | | | Added WIFI module power down to minimize power leakage at G3. BRANCH=firmware-strago-7287.B BUG=none TEST=1. measure V3P3A_WIFI at G3 for leakage 2. 'gpioget WLAN_OFF_L' to probe GPIO control Change-Id: I2226df2f82071a8485cd75d9f9831cc6aa4055ea Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com> Reviewed-on: https://chromium-review.googlesource.com/299465 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit 7668ef2d7e0430fc5a2e901de13c29509189399c) Reviewed-on: https://chromium-review.googlesource.com/300647
* driver/temp_sensor: Add support for BD99992GWShawn Nematbakhsh2015-09-176-0/+408
| | | | | | | | | | | | | | | | | | Add support for ADC / thermistor reads on the BD99992GW PMIC. BUG=chrome-os-partner:42156 TEST=This is base code for ncp15wb thermistor on EC's ADC line 'make buildall -j' is ok for this branch BRANCH=firmware-strago-7287.B Change-Id: Ic15f41046130317a0e0c3bce4a923ba624328c0d Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/289935 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 2bb093151fe5b65948f40b0518dc9c5e86f7b434) Reviewed-on: https://chromium-review.googlesource.com/296842 Commit-Queue: Wonjoon Lee <woojoo.lee@samsung.com> Tested-by: Wonjoon Lee <woojoo.lee@samsung.com>
* Strago: BCRD2 FAB 1.1 GPIO Changes.Divagar Mohandass2015-09-163-21/+31
| | | | | | | | | | | | | | | | | | | | | This change contains following GPIO chanages: - Board id GPIO changes. - Sensor and USB TypeC I2C and GPIO changes. BUG=None BRANCH=firmware-strago-7287.B TEST=Build/flash EC FW and platform should boot. check board id from 'version' console command. check output of 'i2cscan' console command. CQ-DEPEND=CL:299685 Change-Id: Ie9117e382124a26ba26214c3cde2e969087f061f Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com> Reviewed-on: https://chromium-review.googlesource.com/299686 Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shobhit Srivastava <shobhit.srivastava@intel.com>
* i2c: Fix i2c_lock deadlock on sysjumpShawn Nematbakhsh2015-09-161-3/+3
| | | | | | | | | | | | | | | | | | | On sysjump we attempt to lock all i2c ports in use, but locking is by-controller. This leads to a deadlock if two ports from the same controller are in use. Fix this by directly locking all controllers present in the system. BUG=chrome-os-partner:44214 TEST=`sysjump rw` and then `sysjump ro` on Strago BRANCH=None Change-Id: I21d65cd4455769414216016a5c97ad118a712117 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/294959 Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit 9312676ab37de0be031d79629177c5590e83cc65) Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com> Reviewed-on: https://chromium-review.googlesource.com/299685
* Celes: Enable hash computation to facilitate EC software sync.Anson Tseng2015-09-162-2/+2
| | | | | | | | | | | | | | | | | | | This change includes: - Enabling hash computation. - Hooks task is overflowing and causing crash after enabling hash computation. - Increasing the stack size by 128 bytes. BUG=chrome-os-partner:45128 TEST=Build and boot Celes platform. TEST=Check for hash computation output in EC console. BRANCH=firmware-strago-7287.B Change-Id: Ia40332da71d9fa96c99e2f6ec7d0613a467fa2ce Signed-off-by: Anson Tseng <anson.tseng@intel.com> Reviewed-on: https://chromium-review.googlesource.com/299990 Reviewed-by: Ted Kuo <tedkuo@ami.com.tw> Reviewed-by: Shawn N <shawnn@chromium.org>
* strago: fix sensors matricesKevin Cheng2015-09-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Matches definitons set in chromium/chromeos/accelerometer/accelerometer_types.h. Using that standard, the coordinate frames of the lid and base DO NOT line up perfectly when the lid is fully closed or fully open. Therefore, rotate the lid vector 180 along the X axis before calculating the lid angle. BRANCH=strago BUG=none TEST=When the device is open 180 degrees, check the sensors agree with each other: Flat on the back (Z pointing to the sky): localhost devices # cat */*raw -1008 [keyboard : X] -112 [keyboard : Y] 16544 [kyeboard : Z] -256 [lid : X ] 2000 [lid : Y ] 16336 [lid : Z ] On the right side (X pointing to the ground) localhost devices # cat */*raw -16928 -48 -1040 -16176 432 80 On the bottom edge (Y pointing to the sky) localhost devices # cat */*raw -192 15872 1648 496 15936 752 Check the angle as calculated by the EC is correct using accelinfo. Change-Id: I620b0078863137bc244aeacb6d8a81a9c869211a Signed-off-by: Kevin Cheng <kevin.cheng@intel.com> Reviewed-on: https://chromium-review.googlesource.com/299577 Reviewed-by: Shawn N <shawnn@chromium.org>
* mec1322: Properly initialize the ALTERNATE GPIO level flagsKevin K Wong2015-09-161-4/+5
| | | | | | | | | | | | | | | | | | | | Initialise the ALTERNATE GPIO level flags along with rest of the flags to prevent GPIO toggling during I2C initialization. BUG=chrome-os-partner:44821 BRANCH=firmware-strago-7287.B TEST=Manually tested on Kunimitsu FAB3. I2C SDA & SCL lines do not toggle during I2C initialization. Soon after the I2C init is done, read/write to PMIC is success. Change-Id: I70f728017b00f407a0422fd4aa4dbfd8590d74de Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/298242 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/299970
* Celes: EC support GD25Q41B for external EC ROM.jongpil19.jung2015-09-164-3/+6
| | | | | | | | | | | | | | | | | | | MEC1322 use external spi rom. Now, we support W25X40 and W25Q64. Celes will use GD25Q41B for external EC ROM. So, we need to add define for GD25Q41B for Celes. BUG=chrome-os-partner:45246 BRANCH=firmware-strago-7287.B TEST=emerge-celes chromeos-ec flashrom -p ec --wp-range 0x00020000 0x00020000 flashrom -p ec --wp-eanble reboot flashrom -p ec --wp-status Change-Id: I24ce990ca579c12ff69f64932cb1b2b013f38824 Signed-off-by: jongpil19.jung <jongpil19.jung@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/299570 Reviewed-by: Shawn N <shawnn@chromium.org>