| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add accelgyro_bmi_common.(c/h) for the code shared among the BMI.
BRANCH=None
BUG=b:146144827
TEST=make -j4 BOARD=ampton
Then, flash the ec.bin into DUT, check sensor data is available on DUT
by "ectool motionsense".
TEST=make buildall -j
Change-Id: Ia56ffb0896943b08640b3d6ca96324ac5e7d93a0
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130146
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The original set_offset() and get_offset() codes in the
driver/accelgyro_bmi160 use simple divisions to write the data.
The more times the set_offset() and get_offset() is used, the
data will get closer to 0.
Fixing it by replacing simple division to round_divide(), division
that round to nearest, in the common/math_util.c.
BRANCH=octopus
BUG=b:146823505
TEST=Testing on octopus:ampton on branch [firmware-octopus-11297.B].
Checking the data did not rounding to 0.
Change-Id: Ide9df9e32fc501e63d6f952cb8254df7662afd23
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2002998
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=b:138303429,chromium:1023858
BRANCH=None
TEST=buildall
Change-Id: I1a1fd0f0cf9fd4d4d85d537ecf0e1ace76d3e196
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1867224
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes: commit 2f2a81079191ca "Add double tap and make motion sense wake up ap"
CONFIG_GESTURE_DETECTION_MASK includes significant motion in activity
list. We cannot use it for double tap.
Add more flags to distinguish it.
BUG=b:135575671
BRANCH=kukui
TEST=AP can receive mkbp event when double tap is triggered
Change-Id: I13776a01b14dc251396a615c8c97353f2d0477d4
Signed-off-by: Heng-Ruey Hsu <henryhsu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1911263
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change to use CONFIG_GESTURE_DETECTION_MASK since
CONFIG_GESTURE_SENSOR_BATTERY_TAP and CONFIG_GESTURE_SENSOR_DOUBLE_TAP
both define it.
BUG=b:135575671
BRANCH=none
TEST=build pass. EC can receive double tap interrupt.
Change-Id: I6eec40ef7405ec0653ff62dbce98f975cb19e332
Signed-off-by: Heng-Ruey Hsu <henryhsu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1710210
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change moves the motion_sense_fifo_commit_data call
outside of the do...while loop in irq_handler. This is
needed to allow for 1 commit per last_interrupt_timestamp
which makes the commit more efficient and accurate.
BUG=b:137758297,b:140157960
TEST=Ran CTS on Kohaku (this doesn't fix all the issues but
improves the state)
BRANCH=None
Change-Id: Ifd680fb8d6eb47383928e25858898ac828fe4e92
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1856829
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The BIT() macro was recently introduced to make things more
comfortable to upstream Linux. However, there's no need for it to
be a long.
Change the macro back to being an int (int and long are the same on
32-bit platforms, which all of our ECs are), so that we can reduce
the number of %l specifiers. The semantics of %l have changed, we
are deprecating its use on master to reduce the risk that we
accidentally cherry-pick one of those printfs to an old firmware
branch.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=None
Change-Id: I95b9cd49895cc67998dcb1de9bab5b5591d93243
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834601
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: caveh jalali <caveh@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change fixes the printf formatting errors found by the
compile-time prinf format checker. The errors fall into a few
categories:
1. Incorrect size specifier (missing or extra l).
2. Missing or extra arguments.
3. Bad line splitting.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=none
Change-Id: I5618097a581210b9fcbfc81560dec050ae30b61c
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819653
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When printing size_t sized integers, utilize the standard %z
modifier so that the specifier format is correct. This will enable us
to turn on compile-time printf format verification.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=none
Cq-Depend:chrome-internal:1860160
Change-Id: I2c95df5c0d87677cb9fcbde33ab8846708a774a1
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819651
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change allows us to use the IS_ENABLED condition to replace
the various ifdef guards around the CONFIG_ACCEL_FIFO
BUG=b:137758297,chromium:981990
BRANCH=None
TEST=buildall and CTS tests on Arcada
Change-Id: I65d36bac19855e51c830a33e6f3812575e8d15d9
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704164
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change is needed to allow better testing of the fifo
behavior. Additionally, motion_sense_fifo.c will only be compiled
if CONFIG_ACCEL_FIFO is defined. This behaviour requires a few
small changes to several boards and baseboards to make
sure that we only define CONFIG_ACCEL_FIFO when the MOTIONSENSE
task is present (some times that may be only in one section RW or
RO).
BUG=b:137758297
BRANCH=None
TEST=buildall and ran CTS on arcada
Change-Id: I2f7e4e436ba9568a35b7a0b2c8d53a73f198ba73
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704163
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Commit-Queue: Alexandru M Stan <amstan@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For TCS3400, performing calibration is not just a one-shot event:
The RBG sensor stays in calibration mode: returns raw value in R, G, B
space.
When out of calibration, it returns light information in X, Y and Z
space.
BUG=b:124512628
BRANCH=hatch,flapjack
TEST=unit test
Change-Id: I6766907054c8e79a3cbcb629ef91a0967ea0780a
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1702543
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The extentions were added to make the compiler perform most
of the verification that the conversion was being done correctly
to remove 8bit addressing as the standard I2C/SPI address type.
Now that the compiler has verified the code, the extra
extentions are being removed
BUG=chromium:971296
BRANCH=none
TEST=make buildall -j
TEST=verify sensor functionality on arcada_ish
Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Opt for 7bit slave addresses in EC code. If 8bit is
expected by a driver, make it local and show this in
the naming.
Use __7b, __7bf and __8b as name extensions for i2c/spi
addresses used in the EC codebase. __7b indicates a
7bit address by itself. __7bf indicates a 7bit address
with optional flags attached. __8b indicates a 8bit
address by itself.
Allow space for 10bit addresses, even though this is
not currently being used by any of our attached
devices.
These extensions are for verification purposes only and
will be removed in the last pass of this ticket. I want
to make sure the variable names reflect the type to help
eliminate future 7/8/7-flags confusion.
BUG=chromium:971296
BRANCH=none
TEST=make buildall -j
Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes moves the specialized logic for timestamp spreading
away from the accelgyro_lsm6dsm and into the main motion_sense
loop. The motion_sense_fifo_add_data function was replaced by a
stage equivalent, and a commit function was added. Similarly,
internal static functions for motion_sense.c were renamed to
use the stage terminology. The idea is:
When a sensor is read, it might provide more than one measurement
though the only known timestamp is the one that caused the interrupt.
Staging this data allows us to use the same fifo queue space that the
entries would consume eventually anyway without making the entries
readable. Upon commit, the timestamp entries are spread if needed.
Note that if tight timestamps are disabled, the commit becomes a
simple tail move.
BUG=chromium:966506
BRANCH=None
TEST=Ran CTS on arcada.
Change-Id: Ib7d0a75c9c56fc4e275aed794058a5eca58ff47f
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1637416
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=b:129159505
BRANCH=arcada
TEST=I ran `make buildall` since this change isn't used yet it doesn't
affect run-time behavior.
Change-Id: I01857d679b800f9b53762c659ebd9a018cbf16db
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1612251
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If there is an interrupt pending after we suspend the BMI160, we will
try to collect length from the FIFO, but the FIFO is suspended.
Bring back enable_fifo flags check before processing the FIFO.
It has been move after gathering the length in CL:1128555
BUG=b:127321764,b:131272795
BRANCH=master
TEST=Using flip_flop.sh script at b/131272795#comment2
Check the messages "unexpected empty FIFO" disappear.
Change-Id: Iaab1a7f3607b902acd92b75c926365d7eb09fd5e
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1585420
Reviewed-by: Enrico Granata <egranata@chromium.org>
(cherry picked from commit d17cd2add14f1f1e32bd58d51d60a2c93f17f055)
Reviewed-on: https://chromium-review.googlesource.com/1585471
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mechanical replacement of bit operation where operand is a constant.
More bit operation exist, but prone to errors.
Reveal a bug in npcx:
chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow]
BUG=None
BRANCH=None
TEST=None
Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1518660
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Define macros to define custom events used by sensor interrupt handlers.
Remove CONFIG_ for activity events.
BUG=none
BRANCH=none
TEST=compile, sensors work on eve.
Change-Id: I08ef6ed2a004466ebc5f7650d6952a150b9de713
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1272189
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without it, accelinit 3 lock the FIFO.
BUG=chromium:917868
BRANCH=eve
TEST=Check with ./mems_start_collection.sh fifo samples of the
accelerometer are printed out after initalizing the magnetometer with
accel_init 3.
Change-Id: Iadab1b3ae506b3360ee8fe7663ee2c74e9f5bc18
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1390941
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use a single variable instead of (s+i) to point to the sensor we are
working on.
BUG=chromium:917868
BRANCH=eve
TEST=With ./mems_start_collection.sh, check samples are collected.
Change-Id: Ib05059bea776aec978a8feb350f2dacb8aae7311
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1390940
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Enrico Granata <egranata@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove unnecessary code, sensor maximal ODR is guaranteed to be
smaller than EC support maximial ODR.
BUG=b:118205424,b:118851581,chromium:615059
BRANCH=none
TEST=Check the limits have not change and an error is reported when
frequency is set to high in sysfs.
Change-Id: Ia10bf2cc58c5609c4fded16a0bff3018916a2346
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1390937
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement get_scale, set_scale and apply the scale when normalizing.
BUG=b:112957338
BRANCH=nocturne
TEST=Check calibscale is taken into account on bmi160.
Change-Id: I2c72053b026fe09798cd1009e77cc36c3c4fdac2
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1279186
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Enrico Granata <egranata@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=b:110143516,b:115587004
BRANCH=none
TEST=compile
Change-Id: I72953d1c279f739e15e5d14dab2d016e0900a532
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/1444094
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Tested-by: Justin TerAvest <teravest@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add all possible supported or soon-to-be supported configuration of
magnetometer behind accelerometers.
Use a more generic variable to indicate the i2c address of the secondary
device.
BUG=b:110143516,b:115587004
BRANCH=none
TEST=compile
Change-Id: Ic00c413f2ec5fa0e6bf1c98861daa02f00769a65
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1361989
Commit-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Tested-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The IRQ handler for bmi160 continues to loop until all of the interrupt
reasons are handled; however, if the read fails the interrupt variable
will be in an unknown state. We can either return early if there was an
error or we can set the interrupt variable to 0 before the read call.
Either way the loop exits.
BRANCH=none
BUG=b:119093572
TEST=On Bobba360 with a solid repro case of the watchdog reset, this
change avoids the watchdog reset.
Change-Id: I482f074b6e9e7c183def8ce17157ed28ca96b1c9
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1378908
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Enrico Granata <egranata@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes a race condition in the BMI160 driver w.r.t. reading
from the FIFO.
The previous code was reading the FIFO length, adding 1 byte to it and
then reading that much data into a static buffer. This works well if no
new samples are added to the FIFO between reading the length and reading
the payload. But, if the BMI pushes a new sample in the FIFO, the read will
not return an empty frame header, but instead fill in the first byte of the
new sample, which is - however - incomplete and will be retransmitted.
However, because the buffer we process is static, if things align just
right, it is possible for that header to be parsed as a valid sample,
since we do not clear the buffer and we assume the entire 64 bytes of
it are valid and processable.
Fix this issue by maintaining a pointer to the end of the read-in FIFO
buffer and using that - instead of the static bp + sizeof - to calculate
how much data we can actually process from the FIFO.
BUG=b:120508077
BRANCH=poppy,octopus
TEST=Starting from CL:1367013 and CL:1370689, adding an
`msleep(2)` between reading last_interrupt_timestamp
and calling load_fifo(), observe that the kernel sees
more sensor events than should be present given the
sample rate selected. Observe that some of those have
repeated payload values.
With this change, the number of samples seen at the kernel
side is compatible with the chosen sample rate and no samples
have incorrectly repeating payloads. It is possible to also
make this more obvious by setting the buffer to contain an
incorrect value before reading from the FIFO, and observing
that no samples contain that incorrect value.
Change-Id: I57124756d51b8acf04630020c1ffb934f471735f
Signed-off-by: Enrico Granata <egranata@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1372027
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The BMI160 will clear the FIFO watermark/full interrupt when the FIFO
crosses the threshold condition - which happens upon reading from it
in load_fifo(). As a result of this, and the fact that the soft IRQ
handler for the BMI160 tries to loop until it has finished serving all
interrupt causes, there are possibilities for a race condition such as
the following to occur:
read timestamp, value is t0
read interrupt cause: it's a watermark interrupt
load fifo(t0): this clears the interrupt, allowing a new one to happen
read timestamp, value is still t0
a watermark interrupt happens at t1
read interrupt cause: watermark
load fifo(t0)
At this point, the fifo will process events at t1 as-if they had happened
at t0, which is bad and causes incorrect timestamps on the AP side.
This changes moves reading the timestamp value as close as possible
to load_fifo, and in a relative order where a new watermark interrupt
cannot happen, which ensures the timestamp and the FIFO data for it
are synchronized
BUG=b:120508077
TEST=on Bobba and Nocturne, observe that no events happen
where an identical "a" time matches two distinct (b,c) times
BRANCH=nocturne,bobba
Change-Id: I454b257366bccf2b9e4d78df5dc005a8ad7313a0
Signed-off-by: Enrico Granata <egranata@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1367013
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of blindy reading 64 bytes, even when only one sample is
available, first read the amount of data in the FIFO:
- if less than the buffer, just read that amount, and return when
processed.
- if more, read what the buffer can hold, return to be called again.
by the interrupt routine.
Return an error when we have to flush the FIFO when it looks incorrect.
BUG=b:73557414,b:80284952
BRANCH=scarlet,poppy
TEST=Check BMI160 is not stuck, run CtsHardwareTestCases suite.
Check remaining failures are related to timestamp only.
Change-Id: Ic2f48978f73f7aaf9996ec20d219a75dca5e5112
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1128555
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Actually 5ms is needed to reset interrupt of activity like significant
motion.
When processing FIFO, the interrupt will go down once the FIFO is
processed, but for activity, there is no easy way for the bit to go
down.
See
https://electronics.stackexchange.com/questions/299188/how-to-program-bmi160-inertial-measuremen-unit-to-latch-detection-flags
BUG=b:73557414,b:80284952
BRANCH=scarlet,poppy,nocturne
TEST=Without this change, the interrupt bitfield in the the interrupt
routine never goes back to 0.
Check the sensor is not getting stuck.
Change-Id: I986547787183377938ab08afe52fb2871d5c7c71
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1205203
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 61b1806c0db895487ee9e687f365d844f5931732)
Reviewed-on: https://chromium-review.googlesource.com/1252449
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For accelerometers which are interrupt driven, setting ODR too high may
exhaust the EC and trigger the watchdog timer.
Use config variable to verify the ODR requested is not too big.
Return an error when setting unsupported parameters.
BUG=b:112672627
BRANCH=nocturne,eve
TEST=Without this change, ectool motionsense odr 0 500000 crashes the EC
Now, it returns EC result 3 (INVALID_PARAM)
Change-Id: I64a4e522dcad450d619a7fc48a1330479f1cf81f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1200068
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's possible for the interrupt to be triggered and then when the bottom
half of the interrupt handler gets a chance to run, the sensor isn't
powered anymore. This commit simply has the loop terminate early if the
board indicates that the bus the sensor is on is no longer powered.
BUG=b:111683988
BRANCH=nocturne
TEST=Verify if IRQ handler is called when sensor is not powered, the
irq_handler loop terminates.
Change-Id: Iaf395902bb4b46a5b6d750c99767c4c36b1e7a99
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1182879
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using the high-level APIs for block transfers eliminates some code
duplication and error-prone manual locking sequences.
- common/cbi: Block transfers
- driver/accel_bma2x2: Block transfers
- driver/accel_kionix: Block transfers
- driver/accelgyro_bmi160: Block transfers
- driver/accelgyro_lsm6ds0: Block transfers
- driver/baro_bmp280: Block and byte transfers
- driver/charger/rt946x: Block transfers
- driver/gyro_l3gd20h: Block transfers
- driver/stm_mems_common: Block transfers
- driver/tcpm: Block transfers
TEST=buildall; motionsense and PD testing on Grunt convertible which
exercises the bma160, kionix and tcpcm drivers.
BRANCH=none
BUG=chromium:871851
Change-Id: I1732253a244c3343459265ce1e1e54488cee65b8
Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1167958
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Collect timestamp before resetting the interrupt line:
After reading, it is possible for the timestamp to change,
before we can process the FIFO.
BUG=b:67743747
BRANCH=scarlet
TEST=CtsHardwareTestCases
Change-Id: I283f8efb1098a38c76caf326b6416a386ab221cd
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1137438
Commit-Ready: Alexandru M Stan <amstan@chromium.org>
Tested-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During cts test with CL:938146, the BMI160 would not send any interrupts
and FIFO got un processed.
- Latch IRQ events forever: the motion_sense task will kick in and read
the interrupt source sometimes, even after 5ms.
- Retest irq bits in irq_handler. If more events are posted, we will
collect them right away, avoiding a task wake up round trip.
We assume the BMI160 adds events too fast and force the motion task into
a infinite loop.
BUG=b:73557414,b:80284952
BRANCH=scarlet,poppy
TEST=Without that code, BMI160 would get unprocessed:
android.hardware.cts.SensorIntegrationTests#testSensorsWithSeveralClients
fail: ... Iteration 0 failed: "WaitForEvents |i
sensor='CrosEC Accelerometer', samplingPeriod=0us, maxReportLatency=0us |
requested=100, received=0,
With it, the 25 iterations pass.
Change-Id: I0f94b811ac0dbf60dcfa24c899682a2b5eb69de7
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1128554
Commit-Ready: Alexandru M Stan <amstan@chromium.org>
Tested-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make it more generic to support sensor other than BMI159.
BUG=b:110143516
BRANCH=none
TEST=compile
Change-Id: I954df2e9301e05968930add396cd724ca0dfa262
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1101550
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make it more generic, to support other magnetometer.
BUG=b:110143516
BRANCH=none
TEST=Compile
Change-Id: I94cbbe6daf598680a2decde12d703650dfb7c04c
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1101548
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The BMI160 driver's init function generates a divide by 0 error
by calling config_interrupt before initializing the range defined
in struct accelgyro_saved_data_t. The explicit error is
generated by macro BMI160_TAP_TH that's called in config_interrupt.
BUG=b:80237518
BRANCH=None
TEST=`make -j buildall`
EVE boots from TOT
Signed-off-by: Sam Hurst <shurst@chromium.org>
Change-Id: I8b7a4a7c63c973bcc639779ee54958f3702f1b36
Reviewed-on: https://chromium-review.googlesource.com/1071847
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CL:957872 introduced "get_time().val + 400" as the deadline to perform
compensation and the comment in bma2x2.c mentioned the deadline should be
400ms. But the unit of val in timestamp_t is microsecond not milisecond
so only 400us is defined not 400ms.
BRANCH=none
BUG=b:76234078
BUG=b:76202592
TEST=test manually on the dut by performing calibrate.
Change-Id: I7a834ef6dcb0772569d2c8d6c507803deb5d2fc1
Signed-off-by: Marco Chen <marcochen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/979512
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add fast compensation automatic calibration, like bmi160.
Use timestamp_expired for timeout measurement for both perform_calib
functions.
Remove driver offset field, remove private bma2x2 structure.
BUG=b:73205042
BRANCH=master
TEST=echo 1 > calibrate perform calibration.
Reading in_accel_*_calibbias is within range.
Check on Lami for both bma2x2 and bmi160.
Change-Id: I3472865287fa4769a05e6f872b92d7c3f933cb4e
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/957872
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
set_resolution is only used for few sensors and is not exposed to the AP.
Remove definition when sensors have a fixed resolution.
BUG=none
BRANCH=master
TEST=compile, kevin has enough space for perform_calib.
Change-Id: I8482387e135356467edaee44da3a0e47cf1db524
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/961222
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead getting the time for each sample in the task code, we should be
getting it as soon as the sensor reported it added it to its fifo (so
sensor just finished integration).
Because of that each sensor should provide the time when it provides a
sample, ideally from an accurate spot like an interrupt.
Deprecate motion_sense_fifo_add_unit (without a timestamp) in favour of
motion_sense_fifo_add_data (which adds the timestamps). Update all
relevant sensors to use the new api.
Note: for now I focused on the BMI160, where I actually made it get the
time in the interrupt. The other sensors were made to use the new api,
but still don't record the time in the right place (though it's not any
worse than before).
BUG=b:67743747
TEST=In the kernel, fifo_info->info.timestamp still has sane values.
TEST=CTS should still pass
BRANCH=master
Change-Id: I9829343f8702e00cc19f9c88134fa1f258c9e1e9
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/807331
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To prevent invalid timestamping, call load_fifo only when we get a FIFO
interrupt.
In consequence, remove load_fifo entry point and only process fifo
inside the IRQ.
Add helper function to know when we are in forced mode (the EC needs to
periodically read sensor data or interrupt driven).
BUG=b:73557414
BRANCH=master
TEST=compile
Change-Id: I959e476f3f7215be95424c07223f7421e8b13da1
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/938146
Commit-Ready: Alexandru M Stan <amstan@chromium.org>
Tested-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Set the sensor side fifo watermark to interrupt the EC as soon as
there's any data in there, that way we get more frequent accelerometer
interrupts (which is handy when you want to mark down the time of each
sample accuratelly).
BUG=b:67743747
TEST=Sensor should still be working normally, the ec will probably start
recieving sensor interrupts (before this was probably not the case).
BRANCH=master
Change-Id: I726550e68447a74bbfed88b703d2f68b6967ac93
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/956626
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
At the end of the sensor initialization, all _init sensor routines set
the range to the default value from board.c file.
Put all the code in a single place, move it from sensor_common.c to
motion_sense.c.
BUG=none
BRANCH=none
TEST=compile
Change-Id: If89cf27c6438e0f215c193d68a480e027110174c
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/767610
Reviewed-by: Shawn N <shawnn@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BRANCH=none
BUG=chromium:718919
TEST=make buildall -j works, orientation works when enabled on gru
and scarlet.
Change-Id: I16dcfa5d9dea39c082d98190fa1bb6e496168b17
Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/540124
Tested-by: Nick Vaccaro <nvaccaro@google.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The line to convert the desired double tap window time to its
register value was using the incorrect macro. Have corrected this to
use the intended one.
BUG=b:62202895
BRANCH=none
TEST=On Eve verified that double tap events are properly detected.
Change-Id: I70d810c93a8e27a3f61f3175e1ea95d0e59554ac
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/518522
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Shorten certain long prints and reduce the precision of timestamp prints
when CONFIG_CONSOLE_VERBOSE is undef'd.
BUG=chromium:688743
BRANCH=gru
TEST=On kevin, cold reset the EC, boot to OS, and verify cros_ec.log
contains all data since sysjump and is < 2K bytes (~1500 bytes).
Change-Id: Ia9390867788d0ab3087f827b0296107b4e9d4bca
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/438932
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When we switch to a state where the sensor is not powered,
we don't call set_data_rate(0), because we may trigger an i2c/spi access
to a sensor already powered off. It has the side effect to leave
data->odr to the last set sensor frequency.
When we init the BMI160, it starts in suspend mode. We will set it to
normal mode only if data->odr is 0. Therefore, we must set odr to 0 in
the init routine.
BUG=chrome-os-partner:61502
BRANCH=reef,kevin
TEST=On reef, without this change. When going to S5 (shutdown -h 0) and
power back up, sensor is stuck (on EC, accelread 1 reads old value).
With this fix, sensor is active and working.
This fix a regression due to CL:411964.
Check others driver do not check odr for setting suspend/normal mode.
Change-Id: Ibc7519d49e55a0b43b4c12ed545bd75ab0260766
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/426766
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
|