summaryrefslogtreecommitdiff
path: root/common/motion_lid.c
Commit message (Collapse)AuthorAgeFilesLines
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* motion_lid: Rewrite lid angle calculation based on chromium codeGwendal Grignou2019-03-261-200/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use code from ash/wm/tablet_mode/tablet_mode_controller.cc, in particular TabletModeController::HandleHingeRotation() to calculate lid angle. Add unit tests based on ash/wm/tablet_mode/tablet_mode_controller_unittest.cc and the data file accelerometer_test_data_literals.cc. BUG=b:120346412 BRANCH=none TEST=Check unit tests pass, check it compile on FPU based EC, EC without FPU and no 64 bit support (ampton). Check lid calculation is correct on eve: - with "while true ; do ectool motionsense lid_angle ; sleep 1 ; done" Check when hinge is almost vertical lid angle is close to constant or marked are unrieliable. Check when shaking device, lid angle is also unreliable Check with evtest SW_TABLET_MODE event is trigger when lid angle is available and cross 180 region. Change-Id: I545f7333ed9b53accedb75f238f747f66bae1f5d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1388844 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* ec_commands: Fix more warnings from check_patch.plGwendal Grignou2019-02-081-18/+18
| | | | | | | | | | | | | | Rename lid_ang lid_angle, split long lines. BRANCH=none BUG=none TEST=Compile. Change-Id: Idab0877f77d69d8e0b099891834cb775535dd058 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1428759 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* motion_lid: Allow host to configure tablet mode detection thresholdFurquan Shaikh2018-11-291-6/+64
| | | | | | | | | | | | | | | | | | | | | | | This change adds support for host to configure the tablet mode threshold angle and hysteresis degree using a new motionsense command MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. Additionally, the EC sets a new feature bit to indicate support for this refined tablet mode detection. This feature bit can be used by kernel to expose an inclinometer device which can eventually help remove the redundant lid angle calculation in Chrome. BUG=b:120050761 BRANCH=octopus TEST=make -j buildall. Additionally, verified that tablet mode lid angle can be configured by host using ectool. Also, feature flag is correctly set to indicate support for this feature. Change-Id: I51bd160bbfae02d899bdf63096618c13eb5800e8 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1351518 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* motion_lid: Set tablet mode at 180 degreeFurquan Shaikh2018-11-291-10/+10
| | | | | | | | | | | | | | | | | | | | This change aligns tablet mode detection in EC to match the behavior of Chrome. When lid angle goes beyond 200 degree, tablet mode is set to 1. On the other hand, tablet mode is set to 0 when lid angle goes below 160 degree. BUG=b:120050761 BRANCH=None TEST=make -j buildall. Verified that EC reports tablet mode close to 180 degrees. Change-Id: If20a8e7545683b2a01f401f7db8d7973e70deb14 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1350472 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* motion_lid: Use CONFIG_TABLET_MODEFurquan Shaikh2018-11-291-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | This change updates motion_lid driver to use CONFIG_TABLET_MODE to decide if device requires reporting of tablet mode. This basically makes the config options CONFIG_LID_ANGLE_INVALID_CHECK and CONFIG_LID_ANGLE_TABLET_MODE obsolete. Now that EC will always report tablet mode aligned with Chrome (at 180 degree), any device that supports tablet mode and uses motion lid driver will require this by default and should not require boards to individually select any special config options. Thus, it also gets rid of unused CONFIG_LID_ANGLE_TABLET_MODE and CONFIG_LID_ANGLE_INVALID_CHECK. BUG=b:120050761 BRANCH=octopus TEST=make -j buildall Change-Id: Ib73af66ca1c17d4033cf54f0b4b86bf41793f3a3 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1350470 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* motion_lid: Get rid of return value for motion_lid_set_tablet_modeFurquan Shaikh2018-11-271-5/+4
| | | | | | | | | | | | | | | | | | motion_lid_set_tablet_mode accepts reliable as its input parameter and returns back the param value without any change. Effectively, the return value doesn't change anything. This change gets rid of the return value for motion_lid_set_tablet_mode. BUG=None BRANCH=None TEST=make -j buildall Change-Id: I0f379d9148131d9dcb1d3f53a1db08d3ef72831f Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1341161 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* motion_lid: Add support for setting DPTF profile based on lid angleFurquan Shaikh2018-11-151-1/+69
| | | | | | | | | | | | | | | | | | | | | | | This change adds support in motion_lid driver to set DPTF profile number based on the lid angle, only when: 1. CONFIG_DPTF_MULTI_PROFILE is selected by board 2. If board does not have a hall sensor to indicate completely flipped mode. This is done by adding another new config option CONFIG_DPTF_MOTION_LID_NO_HALL_SENSOR which will have to be selected by boards to indicate to motion_lid driver to set DPTF profile numbers. BUG=b:117844490 CQ-DEPEND=CL:1295851 BRANCH=None TEST=make -j buildall Change-Id: If695429240e0645e3d19eeb9073bd00bac580705 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1295852 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* type: Rename vector_3_t to intv3_t.Yilun Lin2018-09-131-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Naming of many vector types and matrix types are not clear enough. For example, we have: vector_3_t, which is a vector of three int. vec3_t, which is a vector of three float. size4_t, which is a vector of four size_t. mat33_t, which is a 3x3 matrix of float. matrix_3x3_t, which is a 3x3 matrix of fixed point. Besides, we have types like int8_t, uint16_t types. To clearly distinguished types, the CL propose to, For vector types, naming should be `$type + 'v' + $num + '_t'`: vector_3_t becomes intv3_t vec3_t becomes floatv3_t vector 4 of uint16_t becomes uint16v4_t (which doesn't exist yet) For matrix types, naming should be `mat$N$N_` + $type + '_t', where $N is the matrix size: matrix_3x3_t becomes mat33_fp_t # fp: fixed point mat33_t becomes mat33_float_t TEST=make buildall -j BUG=b:114662791 Change-Id: I865aa3ecbab6cb97f8585a081a679adf00febe1d Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1215442 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* grunt: Enable tablet mode for convertible SKUs.Jonathan Brandmeyer2018-06-181-1/+1
| | | | | | | | | | | | | BUG=b:79159777 BRANCH=none TEST=EC functional test 1.2.18 on grunt convertible. Verified that a grunt clamshell wthat does not have a populated lid accelerometer works as expected. Change-Id: Ic9059d7d8f4f353475517ad3b8ef049ed653e9e4 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1093255 Reviewed-by: Edward Hill <ecgh@chromium.org>
* Nami: Use lid angle to detect tablet mode for Vayne & NamiDaisuke Nojiri2018-05-091-79/+90
| | | | | | | | | | | | | | | | | | | | This patch refactors motion_lid so that EC can decide to use lid angles to set tablet mode at run time. Then, it implements board_is_lid_angle_tablet_mode to enable the feature for Nami and Vayne. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:77298177 BRANCH=none TEST=Verify on Nami. Change-Id: Ib717911a16fe031aa6c6ede731e6aa722d32d022 Reviewed-on: https://chromium-review.googlesource.com/1024914 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* motion_lid: Increase precision in noisy mag check.Aseda Aboagye2017-07-131-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit increases the precision used in the noisy magnitude deviation check by multiplying the scaled sensor data by 8 in the intermediate calculations. Prior to this, due to some bits being lost, certain devices would determine the lid angle as unreliable in specific angles, even though the device was at rest. BUG=b:63148973 BRANCH=eve,gru,reef TEST=Flash bob, set DUT on desk, run `while true; do ectool motionsense lid_angle; sleep 0.1; done`, slowly move the lid from 15 degrees until ~350. Verify that no particular angle results in a unreliable lid angle reading. TEST=Run `evtest` and examing cros-ec-buttons, fold screen all the way back to make tablet mode, shake device for at least 30s. Verify that there are no spurious transitions of the tablet mode switch. TEST=Repeat above tests on kevin. Change-Id: Iff06c1df2dd33c60e26a59183f62f29b71548729 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/567050 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* motion_lid: no angle correction when lid closephilipchen2017-03-171-2/+5
| | | | | | | | | | | | | | | | | | | | BUG=b:36107214 BRANCH=gru TEST=manually on kevin: (1) make DUT in tablet mode (2) swiftly close the lid (3) check ec log and confirm DUT can read small angle and turn into clamshell mode when lid is closed. TEST=make runtests Change-Id: I7ebf10d38a8b300960ebf46be717d48522c6fd0b Reviewed-on: https://chromium-review.googlesource.com/455458 Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 75ba9147c392367037c21e79899f463c32c1f92f) Reviewed-on: https://chromium-review.googlesource.com/457137 Commit-Ready: Philip Chen <philipchen@chromium.org>
* motion_lid: Fix merge of cl/430344Gwendal Grignou2017-02-101-3/+0
| | | | | | | | | | | | | | Fix merging that would send 2 hook_notify when tablet mode changes. BUG=none BRANCH=none TEST=buidall Change-Id: Ibf19cbbdf3ce28abe3314c0ce2c41a210c86d153 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/440404 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* CHERRY-PICK: motion_lid: Add more reliability measurements.Aseda Aboagye2017-01-201-19/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously in motion lid, we only considered the lid angle as unreliable when the hinge is too closely aligned with the direction of gravity. However, there are other cases where the lid angle can be unreliable. For example, when the device is being shaken and is under acceleration that's not solely due to gravity. This commit adds some more checks for a reliable lid angle measurement. - Checking if the device is significant motion by checking the deviation of the magnitudes of the base and lid vectors. - Making sure that the calculated angles agree with the current state of the lid switch. BUG=chrome-os-partner:59480 BUG=chrome-os-partner:59203 BRANCH=gru,cyan,glados,oak TEST=Flash kevin; use ectool motionsense lid_angle and monitor the instantaneous lid angle. Verify that unreliable is reported for cases where the device is under significant motion. TEST=Flash kevin; use evtest to monitor the tablet mode switch. Verify that tablet mode switch is much more robust. Change-Id: I4bd9e818e617b056364cce2e46385e743a7522d4 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/430344 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* motion: Disable tablet mode if one accel is brokenGwendal Grignou2017-01-041-1/+0
| | | | | | | | | | | | | | | | We need 2 accelerometer for tablet mode. If one of them is not working, disable tablet mode. We will stay in clamshell mode, lid angle will be always unreliable. BUG=chrome-os-partner:61141 TEST=On kevin with a single sensor. Check we are in clamshell mode when rebooting the EC. BRANCH=kevin Change-Id: I7bf6cdc9d85370fce20e5183622b4bc18f4f5f99 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424184 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* motion_lid: Make tablet mode great (again).Aseda Aboagye2016-11-151-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chrome seems to pay attention to the tablet mode switch reported by the EC. However, for some devices that don't actually have a switch and use the lid angle as a "virtual" switch, it's possible for invalid tablet mode change events to be reported. This is because a single reading could flip the switch. This commit adds some debouncing to the tablet mode event changes. Instead of having a single event be able to change the tablet mode switch, we will now perform TABLET_MODE_DEBOUNCE_COUNT number of calculations of the new tablet mode value. If those calculations all agree, then we'll flip the switch. This should help mitigate false tablet mode change events caused by spurious forces. BUG=chrome-os-partner:59203 BUG=chrome-os-partner:59480 BRANCH=gru TEST=flash kevin; open lid to pi/2 rad; rotate device counter-clockwise pi/2 rad; shake device and verify that tablet mode doesn't change easily. TEST=verify that tablet mode still works. Change-Id: Id020f7db28e93e53b276b3f0d28a40251f035f0b Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/410942 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* common: Add tablet_mode APIGwendal Grignou2016-11-081-11/+4
| | | | | | | | | | | | | | | | | | | Simple API to set/get the tablet mode. It can be set via lid angle calculation or if a board has a dedicated HAL sensor/GPIO. Merged from glados branch, add MKBP switch support. BUG=chromium:606718 BRANCH=gru TEST=Check with Cave that both mode works. Reviewed-on: https://chromium-review.googlesource.com/402089 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit c940f36ceabcf2425284001298f03ebdb4c3079e) Change-Id: I2ee5130f3e0a1307ec3ea543f7a32d66bc32b31d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/404915 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common: motion_lid: Add tablet mode detection using lid angle.Gwendal Grignou2016-09-091-0/+53
| | | | | | | | | | | | | | | | | | | | | | Using the lid angle, detect if we are in tablet mode or not. We are in tablet mode when the lid angle is large enough: tablet_mode: 1 | +-----<----+---------- | \/ /\ | | | 0 |------------------------>----+ +------------------+----------+----------+ lid angle 0 240 300 360 BRANCH=kevin BUG=chrome-os-partner:55702,b:27849483 TEST=Check on Kevin event are sent on tablet mode transition. Change-Id: Id9935ce4dd717e2c20fa6c9520defb504a1760d9 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/383073 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* motion_lid: prevent angle 0 <-> 360 transition.Gwendal Grignou2016-09-091-7/+35
| | | | | | | | | | | | | | When lid is closed, the lid angle can move to 358, 360, 0, 359 ... Prevent transition 0 from/to 360 by keeping the last calculated value. BRANCH=kevin BUG=chrome-os-partner:55702 TEST=Check transition does not happen anymore. Change-Id: Ifa8415470f425c893e2c3662c84c8fd0156e0524 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/373040 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* motion_lid: Add const around sensor vector.Gwendal Grignou2016-08-241-2/+2
| | | | | | | | | | | | | | Accelerometer data is read-only in motion_lid, add const to help the compiler. BRANCH=none BUG=none TEST=compile Change-Id: I487030318b63a2decd4a57cd8ee0d965628a344b Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/372311 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* ectool: provide lid angle infoKevin K Wong2015-11-251-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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=none BRANCH=none 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>
* motion: add config option to use the old accelerometer ref frameAlec Berg2015-09-171-2/+48
| | | | | | | | | | | | | | | | | | | | | | | 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 BRANCH=none 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>
* cyan: fix sensors matricesGwendal Grignou2015-08-221-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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=cyan BUG=chrome-os-partner:40177 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: Ib8ee42da8cf818213f892b1f024253f37a4da488 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/294716 Reviewed-by: Jonathan Ross <jonross@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
* Cyan: Added Clamshell/Tablet mode supportli feng2015-08-101-5/+5
| | | | | | | | | | | | | | | | | | | | | Enabled lid angle calculation. Clamshell/Tablet mode is decided by lid angle. Accelerometers are set to be active in S3 also. Trackpad is enabled/disabled by GPIO TP_INT_DISABLE. Keyboard scan and trackpad are enabled in clamshell mode and disabled in tablet mode. Removed enable_keyboard() since keyboard is enabled in clamshell S0 and S3. BUG=chrome-os-partner:41353 TEST=Verify in clamshell mode, system can be waken up from S3 by keyboard/trackpad; And not tablet mode. BRANCH=None Change-Id: Ic5fb5a562e8426288eae2fb9815a213fe5033955 Signed-off-by: li feng <li1.feng@intel.com> Signed-off-by: Shamile Khan <shamile.khan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/287341 Reviewed-by: Shawn N <shawnn@chromium.org>
* accel: move X,Y,Z definitionGwendal Grignou2015-06-091-5/+0
| | | | | | | | | | | | | | Move definition so that we can use it in accel driver. BUG=None TEST=Compile BRANCH=none Change-Id: I45d16a91d923cb0538b7fdf4110112566c87b6d0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/269837 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* cleanup: rename motion sensor CONFIG_ optionsBill Richardson2015-05-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This renames some motion sensor options to start with more consistent prefixes. For gesture (tap) detection: CONFIG_GESTURE_DETECTION: CONFIG_SENSOR_BATTERY_TAP => CONFIG_GESTURE_SENSOR_BATTERY_TAP For detecting lid angle: CONFIG_LID_ANGLE: CONFIG_SENSOR_BASE => CONFIG_LID_ANGLE_SENSOR_BASE CONFIG_SENSOR_LID => CONFIG_LID_ANGLE_SENSOR_LID BUG=none BRANCH=none TEST=make buildall Change-Id: Ib8f645902a5585346e1d8d2cbf73d825c896a521 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/268777 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Convert motion sense calculations to fixed point.Randall Spangler2015-02-051-30/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Motion sense calculations do not require huge amounts of precision, so fixed point is plenty accurate. And fixed point works on Cortex-M0, which lacks a FPU. BUG=chrome-os-partner:36126 BRANCH=minnie (samus already works with the FPU, but could grab this if we want additional testing) TEST=manual 1. Boot system 2. At EC console: accelinfo on 250 3. Move lid through several different angles (30 degrees to max open) and see that it updates correctly and relatively smoothly. A few degrees of angle jitter is normal. 4. At several angles, rotate the chromebook around and see that the lid angle remains relatively stable. 5. If the hinge is made normal to the ground (or within 15 degrees of vertical), the angle should read 500, since the acceleration vectors don't yield good results in that orientation (for either fixed or float math). And run 'make buildall -j', which tests arc_cos() and lid angle calculations Change-Id: I70a0d08b8914629a3e21ae5578cbe8e50f29ad68 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/244116 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Samus: Split motion sense and lid angleGwendal Grignou2014-10-291-0/+192
Split motion_sense.c. Translate the accel data in the Android coordinate right away. BUG=chrome-os-partner:32002 BRANCH=ToT TEST=On samus, check lid angle are still correct. Change-Id: If743e25245dc1ce4cdacb8a4d5af22616c4a79e4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225486 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>