| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sort all includes in driver with the clang-format rules used by
the zephyr project.
BRANCH=None
BUG=b:247100970
TEST=zmake build -a
TEST=./twister --clobber -v -i
TEST=make -j72 buildall_only runtests
TEST=zmake compare-builds -a
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Change-Id: I675e0db416b6b7cbcfce031c97fd24ad97b66f4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4052767
Reviewed-by: Yuval Peress <peress@google.com>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Normally we don't do this, but enough changes have accumulated that
we're doing a tree-wide one-off update of the name & style.
BRANCH=none
BUG=chromium:1098010
TEST=`repo upload` works
Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b
Signed-off-by: Mike Frysinger <vapier@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Define a common function for setting the rms noise floor.
Use static function per sensor to set the proper floor.
BUG=b:236799854
BRANCH=dedede
TEST=Compile
Change-Id: I18e228fd98cb230a77d435f3865c8b249162a4bc
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3860188
Reviewed-by: Diana Z <dzigterman@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove these includes as they're not needed in this header. Instead,
the includes should go where they're actually being used.
BRANCH=none
BUG=b:240574048
TEST=make buildall -j
TEST=zmake build -a
Signed-off-by: Yuval Peress <peress@google.com>
Change-Id: I64b10af3216654b2a20caa1cabd267661a0bca39
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3791980
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Commit-Queue: Tristan Honscheid <honscheid@google.com>
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=b:236386294
BRANCH=none
TEST=none
Change-Id: I7e626f1f92e94f4b08a1106944b2db40c3aa7946
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729912
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use CONFIG_<driver>_INT_ENABLE to not include interrupt() and
irq_handler() when hardware interrupt are not used.
Disable call to motion_sense_fifo() with IS_ENABLED(CONFIG_ACCEL_FIFO).
Other use of CONFIG_ACCEL_FIFO are removed: only when a hardware
interrupt is configured we enable the sensor FIFO.
Otherwise we directly read into the sensor data registers.
BUG=b:230401133
BRANCH=asurada,dedede,brya
TEST=Build all. Check Zephyr with herobrine. Check on bugzzy.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: Ie33ad8dd34b5723ce9da4029effdae0755d81c03
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3609354
Reviewed-by: Yuval Peress <peress@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test the interrupt handler in the BMI160 driver. Also, correct an error
from an earlier CL (3229647) where I moved the BMI260 event flag in to
BMI160 driver's header.
BRANCH=None
BUG=b:184856157
TEST=zmake -D configure --test test-drivers
Signed-off-by: Tristan Honscheid <honscheid@google.com>
Change-Id: Icb08d9e1142066ba0ef22b9633895e60e6b40e90
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262878
Reviewed-by: Wai-Hong Tam <waihong@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We check twice that the sensor being passed in to
`config_accel_interrupt()` is an accelerometer. This is
unnecessary and creates unreachable code.
BRANCH=None
BUG=b:184856157
TEST=zmake -D configure --test test-drivers; make runhosttests
Signed-off-by: Tristan Honscheid <honscheid@google.com>
Change-Id: Ic07bfe76ae20e1615bcf52717a106cc622d32d84
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262106
Reviewed-by: Keith Short <keithshort@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Try running perform_calib() and set_offset() on sensor types that don't
support it.
BRANCH=None
BUG=b:184856157
TEST=zmake -D configure --test test-drivers; make runhosttests
Signed-off-by: Tristan Honscheid <honscheid@google.com>
Change-Id: I978dfc87bd2915c4da2ccd58d2da9f3f597164d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262105
Reviewed-by: Aaron Massey <aaronmassey@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Put list_activities in common code, as it is used by both BMI160 and
BMI260 driver.
Fixes cb3771973de ("Coachz: MotionSensor: Avoid redefine gesture function list_activites")
Fixes fc298a0ada0 ("driver: bmi260: integrate body detection")
BUG=b:195908820
BRANCH=trogdor
TEST=buildall
Change-Id: I05591954c825802502328c842b03e8934c497f08
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150056
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit is for motion sensor combine(BMI160 & BMI260),Avoid redefine
gesture function `list_activites`.
BUG=b:195908820
TEST=make -j BOARD=coachz
Verify build on SIT board
BRANCH=Trogdor
Signed-off-by: pengjunhao5 <pengjunhao5@huaqin.corp-partner.google.com>
Reviewed-by: tongjian <tongjian@huaqin.corp-partner.google.com>
Reviewed-by: yudengwu <yudengwu@huaqin.corp-partner.google.com>
Change-Id: If31442d0c00745d124b20188b4e5fad8a9a1d173
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133188
Reviewed-by: Jian Tong <tongjian@huaqin.corp-partner.google.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix three issues with BMI160 and BMI260 drivers:
- get/set acclerometer/gyroscope offset will return error on failed read
of offset register
- BMI160 calibration function returns error when setting range fail
- Invalid temperature is properly recognized by driver
BUG=none
BRANCH=none
TEST=run zmake drivers test
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: I545c0a931227ef7efc000ec97c1f6297a48e6d1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3027039
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the interrupt handler using the same model used in the bmi260.
BRANCH=none
BUG=b:185966444
TEST=zmake testall
Signed-off-by: Yuval Peress <peress@chromium.org>
Change-Id: I7aa3bcade8c3bc0fe526d44f8223bab8760cf279
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2842714
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Zephyr builds do not use the platform/ec root in the include path so
we need to remove the "driver/" prefix for these includes.
BRANCH=none
BUG=b:185966444
TEST=zmake testall
TEST=make buildall
Signed-off-by: Yuval Peress <peress@chromium.org>
Change-Id: Ic8682ad2b5c53621ea54984d6d7d711fc4e7173f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2842708
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is an option in the task_set_event function which force
the calling task to wait for an event. However, the option is never
used thus remove it.
This also will help in the Zephyr migration process.
BUG=b:172360521
BRANCH=none
TEST=make buildall
Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When AP changes range, unlike offset or ODR, it was not surviving init()
call. If the sensor is powered off in S3, at resume the range would be
back to the default.
To make it consistent with other attributes, remember range change until
EC powers down.
- remove get_range
- add current_range to store the range currently used.
This is modifiable by the AP
- when the AP shutdown, revert current_range to default_range
- Remove const attribute for sensor structure when init and set_range is
called.
BUG=chromium:1083791
BRANCH=none
TEST=One eve branch, check range is preserved even after 'shutdown -h 0'
Change-Id: Ia7126ac0cc9c3fef60b4464d95d6dd15e64b0fc4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2215751
Reviewed-by: Yuval Peress <peress@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use IS_ENABLED instead of #ifdef as much as possible.
To help refactoring the following awk script is used:
awk 'BEGIN { code=0 } \
/{/ { code += 1 } \
/}/ { code -= 1 } \
/#ifdef CONFIG/ { if ( code ) { gsub(/#ifdef CONFIG_/, "(IS_ENABLED(CONFIG_"); } } \
// { print }' < $F > /tmp/temp.txt; vimdiff $F /tmp/temp.txt
BUG=chromium:1140877
BRANCH=none
TEST=buildall
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I5e0d708ade28e750de0d65a2e32a747d282545ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2488938
Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enabling orientation sensor would not compile anymore.
Fix interface by replacing macros with functions.
BUG=chromium:718919
BRANCH=none
TEST=Compile when enabled on grunt and eve.
Change-Id: Ic5d6992d040cde79ef3f691db494804e160b7650
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2491266
Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new I2C_STRIP_FLAGS macro was added to avoid conflict with
Zephyr's macro. This CL performs the migration to that new API.
BRANCH=none
BUG=b:172067439
TEST=make runtests -j and built for various boards: eve, volteer,
arcada_ish, atlas, hatch, kohaku, nocturne, samus, and scarlet
Change-Id: I0583b647435db96ec268f186252b367bdc4118a6
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2511097
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We will need the amount of noise for body detection.
The amount of noise in accelometer will depends on several thing, e.g.,
output data rate.
Add get_rms_noise() function to get the root mean square
of noise in BMI.
BRANCH=None
BUG=b:123434029
TEST=buildall
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Change-Id: Ia56bbd2cdb36bee771beb9df32451d3e56f4f028
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2329112
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The remaining 2 are qualifier for single/double tap we are not
interested in. They are not reset to 0 even after we process the
interrupt, so when gesture is enabled, we are stuck in the interrupt
routine for a while.
BMI260 does not have this problem as the interrupt register is now
explicitly 16 bit.
Gesture is currently enabled on eve that does not have
the loop on interrupt, so no other branch than ToT is affected.
BUG=b:164974014
BRANCH=none
TEST=Without, we would be stuck in bmi160 irq_hanlder:
(timestamp of int) (interrupt mask)
...
[5064.237873 a hw int: 769270447 - 2 0x00C00000]
[5064.238989 a hw int: 769270447 - 2 0x00C04000]
[5064.241277 a hw int: 769270447 - 2 0x00C00000]
[5064.242397 a hw int: 769270447 - 2 0x00C00000]
[5064.243527 a hw int: 769270447 - 2 0x00C00000]
[5064.244647 a hw int: 769270447 - 2 0x00C00000]
[5064.246419 a hw int: 769270447 - 2 0x00C00000]
... /
Qualifier -----/
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I2c8fd354eddfa412f644555dcdcdb77708a9e3c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2370152
Reviewed-by: Patryk Duda <pdk@semihalf.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Patryk Duda <pdk@semihalf.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Current calibration timeout, 400ms, is not enough for gyro.
Accel has done calibration under 100ms, whereas gyro usually takes 300ms ~ 700ms. So we need to increase timeout to 800ms in case of gyro.
In addition, temporary set the least range during calibration to perform with full sensitivity.
BUG=b:159557101
BRANCH=none
TEST=check if gyro calibrated well without an error.
'echo 1 > /sys/bus/iio/devices/iio:device[gyro-index]/calibrate'
Change-Id: Ib8c190d2969f6295e70cadd990999dfddf7a1b53
Signed-off-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256967
Reviewed-by: Bob Moragues <moragues@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Bob Moragues <moragues@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|