summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfirmware-setzer-7287.360.BBrian Norris2021-09-102-10/+1
| | | | | | | | | | | | BUG=none TEST=none Change-Id: I0f03f432ada1064ffba9595be78ca7ab4d25ecd1 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155245 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* UPSTREAM: driver: kionix: Add checking whoami value at initialization.Yidi Lin2017-04-231-1/+1
| | | | | | | | | | | | | | | | | | | spi_transaction() always returns success even without the sensor. Check whoami value to make sure that the sensor is existed. BUG=none BRANCH=strago TEST=remove LID accel sensor from elm and see init failed log. [1.258973 Lid Accel: 1: init failed: 4] Signed-off-by: Yidi Lin <yidi.lin@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/453579 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 1d8fcd4fabfed67d8304b3c5ad418cf6f5ae1878) Change-Id: I55aa35bc9790e5dec61e22aa2f51243e29368a86 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/484586 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: kionix: Add WHO_AM_I values.Gwendal Grignou2017-04-232-0/+2
| | | | | | | | | | | | | | Values were added as part of i2ctest console command. Add them to check the sensors are alive. BUG=chrome-os-partner:39269,chrome-os-partner:63146 TEST=make -j buildall BRANCH=strago Change-Id: I2e9d9e57c9bbec33f77fba6b68cc29f8aa244d7d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/484585 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UPSTREAM: driver: kionix: Forgive i2c read failures while the acc is resettingGwendal Grignou2017-04-231-5/+0
| | | | | | | | | | | | | | | | | | | | | | | Port changes cl/288874 to generic kionix driver. From cl/288874: After we write SRST in CTRL2, there seems to be a period of time where the accelerometer doesn't respond to i2c commmands. Instead of failing the init just consider it as part of the timeout period. BUG=chrome-os-partner:39269,chrome-os-partner:63146 TEST=make -j buildall BRANCH=veyron,cave,strago Reviewed-on: https://chromium-review.googlesource.com/445973 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 4a34b0d88f6b0075ee66a18f4aa22325dc766eb6) Reviewed-on: https://chromium-review.googlesource.com/446417 (cherry picked from commit 9af60bb7955a8bba0710798d1dcf2a4d2c2aae6b) Change-Id: I2197aa7741d1482b76c7c07b0cb0c171aab86a59 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/484584
* UPSTREAM: driver: kionix: Increase init delay to 20msGwendal Grignou2017-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | Port changes cl/289037 to generic kionix driver. Form cl/289037 Sometimes the accelerometer doesn't initialize nicely. Increase the timeout to 20ms. BUG=chrome-os-partner:39269,chrome-os-partner:63146 TEST=buildall BRANCH=veyron,cave,strago Reviewed-on: https://chromium-review.googlesource.com/446132 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 11c00e1a4116bb0ac387c0264053e66e41a5ec92) Reviewed-on: https://chromium-review.googlesource.com/446699 (cherry picked from commit eb85cc2101ffccce6f54168782afac797f764202) Change-Id: I4e4d8951fc821b8b33daa53e6c3b8da5ffa7acde Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/484583
* Wizpig: Disable Touch Screen and motion sensor for clamshell SKUChris Wang2017-02-222-7/+44
| | | | | | | | | | | | | | | | | | For support clamsehll sku (board id 101) Disable touch screen and motion sensor by board id detecting. BUG=chrome-os-partner:62214;chrome-os-partner:62907 BRANCH=firmware-strago-7287.B TEST=make buildall -j/Check motion sensor and touch screen function on clamshell SKU and covertiable SKU Signed-off-by: Chris Wang <chriswang@ami.com.tw> Change-Id: I92114558b1dcb0cc09561de78faace502d2e213d Reviewed-on: https://chromium-review.googlesource.com/444587 Tested-by: Chris Wang <chriswang@ami.com.tw> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Chris Wang <chriswang@ami.com.tw>
* Wizpig: Adapt to new sensor stackPeggy Chuang2017-02-083-4/+156
| | | | | | | | | | | | | | | | | | | Given wizpig overlay is used for convertible as well as clamshell, re-add sensor stack. It was remove in cl/409508 BUG=chrome-os-partner:62184, chrome-os-partner:62214 CQ-DEPEND=CL:435710 TEST=Test tablet mode and normal mode, switch both mode is working normal. Test ARC++ sees the sensors with app AIDA64. BRANCH=strago Signed-off-by: Peggy Chuang <peggychuang@ami.com.tw> Change-Id: I7c731fbdaceb5a95feff556c8ee74fa80b5a9654 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/429770 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Peggy Chuang <PeggyChuang@ami.com.tw> Tested-by: Peggy Chuang <PeggyChuang@ami.com.tw>
* Kefka: Enable motion sensor when system in S3Chris Wang2017-01-031-6/+6
| | | | | | | | | | | | | | | | | | | Enable base/lid motion sensor when system in S3. BUG=chrome-os-partner:61201 BRANCH=firmware-strago-7287.B TEST=Manual on Sabin sku. Boot system with lid open in clamshell mode. Open a shell window and type powerd_dbus_suspend to bring the system to suspend state. Now fold the system to tablet mode. Verify that pressing a key or trackpad does not cause system to wake up Signed-off-by: Chris Wang <chriswang@ami.com.tw> Change-Id: Ie3e7ccc99d0cf6e0bcfbfe591c68a46c8c381660 Reviewed-on: https://chromium-review.googlesource.com/422828 Reviewed-by: YH Lin <yueherngl@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Chris Wang <chriswang@ami.com.tw> Tested-by: Chris Wang <chriswang@ami.com.tw>
* Umaro: Adapt to new sensor stackGuohua Zhong2016-12-153-1/+117
| | | | | | | | | | | | | | | | As the sesnsor stack is update. But the sensor stack has been removed for umaro which make the accel not work. So adapt to new sensor stack. BUG=None BRANCH=firmware-strago-7287.B TEST=Check accel sensor works with the new FW The orientation is correct. The tablet & normal mode transits OK. Change-Id: I94e336c8f6571bbe62ef699e81d4f183d22cd6cb Signed-off-by: Guohua Zhong <ghzhong@yifangdigital.com> Reviewed-on: https://chromium-review.googlesource.com/419729 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* task: Don't propagate TASK_EVENT_TIMER between between waitsShawn Nematbakhsh2016-11-184-5/+14
| | | | | | | | | | | | | | | | In __wait_evt(), if a timer expiration occurs after we read event status, before the timer is canceled, then TASK_EVENT_TIMER will be propagated to the next task wait, likely leading to premature timeout. Prevent this by clearing TASK_EVENT_TIMER after canceling our timer. BUG=chrome-os-partner:58658 BRANCH=gru TEST=Manual on gru, run 'pd # hard' for 12 hours with charger attached, verify no TCPC I2C read errors occur. Change-Id: Iac2f05a768b4ef29f82e7c3eb899f4c7dd5c3744 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/412390
* clock: Fix clock_wait_cycles() asmShawn Nematbakhsh2016-11-183-6/+6
| | | | | | | | | | | | | | | | | | The 'cycles' register will be clobbered by our macro, so it must be specified as an output operand that may also be used as input. BUG=chrome-os-partner:60000 BRANCH=gru,strago,glados TEST=Build + burn wheatley, verify alignment exception is not encountered on boot. Also verify produced assembly is still correct: 100a89a6: 2303 movs r3, #3 100a89a8: 3b01 subs r3, #1 100a89aa: d1fd bne.n 100a89a8 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I1be03a006967aed6970dbac5d98a19a31e0b7d49 Reviewed-on: https://chromium-review.googlesource.com/412350
* Fix: Use CONFIG_KEYBOARD_DEBUG for keyboard debug printfGwendal Grignou2016-11-171-0/+1
| | | | | | | | | | | | Removed line by mistake. BUG=chrome-os-partner:59967 BRANCH=strago TEST=compile. Check other cherry-pick does not have this issue. Change-Id: I85a65327764dd3c41f7a8e76e797316532c3dfa2 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/412032
* Kefka: update thermal tableChris Wang2016-11-161-5/+5
| | | | | | | | | | | | | | | | Update thermal table by referring to Thermal control table of BSW for Keyston and Corinth -V07 BUG=chrome-os-partner:59470 BRANCH=firmware-strago-7287.B TEST=`make buildall -j` and enter "thermalget" to get thermal information. Signed-off-by: Chris Wang <chriswang@ami.com.tw> Change-Id: Id942d4851a084754f9593254ec35e58ce10d366e Reviewed-on: https://chromium-review.googlesource.com/411680 Tested-by: JackJX Lin <jackjx_lin@compal.com> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Steven Houtchens <stevenh@google.com>
* Use CONFIG_KEYBOARD_DEBUG for keyboard debug printfGwendal Grignou2016-11-142-4/+14
| | | | | | | | | | | | | | | Remove keyboard printk like: KB wait/poll when not debugging keyboard. BUG=none BRANCH=none TEST=compile. Reviewed-on: https://chromium-review.googlesource.com/394068 (cherry picked from commit ce92dd27dfa2b60cf4443da5eb47c51d8c7170bf) Change-Id: I9743eab4597d2b661ae7b21c0aab4e1ffdcdb9a4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/410821 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common: host: Do no report sensor when motion_sensor_count set to 0.Gwendal Grignou2016-11-141-2/+5
| | | | | | | | | | | | | | | | | On some machine (kefka), the number of sensor is set at run time to 0. Be sure we do not report that sensors or sensor FIFO are available to the kernel. BRANCH=glados TEST=On kefka, check no iio devices are reported, even when sensor FIFO is in the firmware. On Sabin, check all expected IIO devices are present. BUG=b:27849483 Change-Id: I6babefd175bcf6839ceb19b670fe178b609bc248 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/410280 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* 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>