| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The upstream change
https://github.com/zephyrproject-rtos/zephyr/pull/51217 modified the
function signature for the SYS_INIT call, eliminating the unused device
pointer.
Run the Zephyr provided script
./zephyr/scripts/utils/migrate_sys_init.py to update all callers.
BUG=b:278595739
BRANCH=none
TEST=zmake build -a
Cq-Depend: chromium:4422804
Change-Id: I881bc536cef43a7c3ac4bc5eb3ce1893237bbd1f
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4437049
Reviewed-by: Tristan Honscheid <honscheid@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add GESTURE_DETECTION to enable/disable body detection on zephyr.
Also define LID_ACCEL and format the string literal to avoid
build failed after enable GESTURE_DETECTION.
BRANCH=corsola
BUG=b:272655176
TEST=zmake build steelix
TEST=check cros-ec-activity loaded
Change-Id: Id77f0baeee3b7e710746991a653a77497984402b
Signed-off-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4405803
Reviewed-by: Mike Lee <mike5@huaqin.corp-partner.google.com>
Reviewed-by: Eric Yilun Lin <yllin@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The global |sensor_active| which duplicates the power state is changed
in the CHIPSET_TASK.
It is used in lower priority tasks (MOTION_SENSE and HOOK), so can
change in a middle of a call.
It is usually fine, except when configuring activities, where we could
end up calling manage_activity() on a sensor that does not support it.
BUG=b:269225196
BRANCH=bugzzy,kukui (any branch where on body/off body is used).
TEST=Compile
Check buggzy ec.RW.dis to check the call to manage_activity() function
pointer is gone:
228c movs r2, #140 ; 0x8c
fb02 7005 mla r0, r2, r5, r7
2102 movs r1, #2 <<< MOTIONSENSE_ACTIVITY_DOUBLE_TAP
6c02 ldr r2, [r0, #64] ; 0x40 << sensor->driver
4620 mov r0, r4 <<< sensor
6c15 ldr r5, [r2, #64] ; 0x40 << ..drive->manage_activity
2201 movs r2, #1 <<< 1
47a8 blx r5
Change-Id: I0060cfcb7b815cde54982e3e310b745cabed2306
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4316725
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If motion sense stops working it's very mysterious. Add some stats at
key points in time to help figure out what could be going wrong.
Prints look like:
[58.816888 Motion pre-resume; loops 1280; last 12067 ms ago; a=0x7, s=0x111]
BUG=b:267680317
TEST=See printouts at key times
BRANCH=trogdor
Change-Id: I4daa2d2a51ca8c3d560e13e4ad7fdc467c691913
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4265366
Reviewed-by: Wai-Hong Tam <waihong@google.com>
(cherry picked from commit daa98348b2d8d02dc2e9c67c2368e68631661e69)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4266201
Commit-Queue: Wai-Hong Tam <waihong@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To validate the sensors are not responsive on coming back from S5 on
Lazor, print ODR setting information, even on error.
BUG=b:267680317
TEST=compile
BRANCH=trogdor
Change-Id: If5c9e87cfc0f4ee49f6276b6ffd78cd9168ed6f0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4255277
Reviewed-by: Douglas Anderson <dianders@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sort all includes in common 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: I70c2ed7bb2ce50c968f3e2dbdc274de3a455129a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4049889
Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Tomasz Michalec <tmichalec@google.com>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Returning SENSOR_CONFIG_MAX will cause out of bound read.
Return one of the legal values.
BUG=b:64477774
BRANCH=none
TEST=make -j buildall
Signed-off-by: Boris Mittelberg <bmbm@google.com>
Change-Id: I1d2b407cb42da8b6fa78fb61be39d05ea1d64401
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4032916
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Ricardo Quesada <ricardoq@chromium.org>
Reviewed-by: caveh jalali <caveh@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, the body detection needs to be activated by host command.
Add a new configuration to always enable the body detection function
without host command.
BRANCH=none
BUG=b:236668095;b:232946420
LOW_COVERAGE_REASON=no unit test for body_detection yet: b/259754018
TEST=zmake build winterhold
Signed-off-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com>
Change-Id: I9cd9e984cd302898ff2960c9c197a6eef0393f6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3928568
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow board to prevent enumerating the lid angle device and
calculate a lid angle, even if it looks like there are 2 accelerometers
present in the device.
BUG=b:254328661
BRANCH=brya
TEST=compile
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: Iaa2d54d1afb31a229ada4259c63f954606636657
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3967457
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Tested-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When building with clang, and CONFIG_USB_PD_TBT_COMPAT_MODE or
CONFIG_ACCEL_FIFO enabled I found that the __fallthrough fails since
it's being added in unreachable code. Replace the use of IS_ENABLED
with standard #if so that the line is only added in the preprocessor
and not relying on LTO.
BRANCH=none
BUG=b:255967867
TEST=Build using clang via twister
LOW_COVERAGE_REASON=This change doesn't affect the final binary
Signed-off-by: Yuval Peress <peress@google.com>
Change-Id: I890b32ad1846d3916751805b03b709d9ea8c7c09
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3987169
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, interrupt trigering is based on the time when the motion
sensor task is scheduled. If the task is delayed for processing a
first sample but not a second one, the second sample will be delayed
until the third sample arrive:
/ sensor interrupt / sensor interrupt / sensor int
| / task scheduling| / task scheduling | / task
+-delay-+----------------+-+--------------------+-+
<--------- 10 ms --------X------------ 10 ms ----->
<------- < 10 ms ----> event delayed until the
next sample.
To address the issue:
1 - add more leeway to schedule the interrupt. Instead of 3us, allow to
trigger an interrupt if the delta between samples is more than the
expect delta minus 1ms.
2 - Use the sensor timestamp provided to the FIFO, keep sensor timestamp
for every sensor.
When the timestamp difference is larger than the requested rate, we
schedule an interrupt.
Fixes: 0c71c474869 ("motion sense: Calculate loop time based on sensor needs")
BUG=b:242263033
BRANCH=none
TEST=Ran "tast run localhost:22552 hardware.SensorIioserviceHard"
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I9ccf08c1180820e699cf84069df3e4541768988d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3966709
Reviewed-by: Yuval Peress <peress@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The EC code has generally been good about adding comments about
intentional fallthrough in switch statements, but there were a few cases
without comments (e.g., https://crrev.com/c/3949622). Enabling
-Wimplicit-fallthrough generates a compiler warning if the fallthrough
is not annotated with __attribute__((fallthrough)). For convenience, we
add a "__fallthrough" macro for this attribute.
See https://clang.llvm.org/docs/AttributeReference.html#fallthrough and
https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html.
BRANCH=none
BUG=b:253644823
TEST=make buildall
LOW_COVERAGE_REASON=legacy code
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I9f4d6049f4507a25ce706675d159b70e28b4b825
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3957420
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This updates the API for console commands
from "int cmd(int argc, char **argv)"
to "int cmd(int argc, const char **argv)"
which is more accurate and in line with common convention.
BRANCH=none
BUG=b:244387210
TEST="make buildall" passes
TEST="zmake build -a" passes
TEST="util/compare_build.sh -b all" passes
TEST="./twister -v -T zephyr/test" passes
Cq-Depend: chrome-internal:4960125
Cq-Depend: chrome-internal:4959932
Change-Id: I57de9f35b85b8f3c7119df36aefb2abf25d2625f
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3863941
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-by: Keith Short <keithshort@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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Timestamp spreading is reset after each fifo commit.
It prevents the fifo logic to operate when the EC takes
more than a period to collect the samples.
Reset timestamp spreading only when ODR changes.
Move needed fields inside motion_sense_fifo to handle
virtual sensors.
Fixes commit bc9660a4b3e8 ("common: motionsense fifo: Reset the initialized bits after commit")
BUG=b:168335284,b:237305991,b:217580259
BRANCH=all
TEST=make run-motion_sense_fifo
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: If7265079f7fc7f4e7e22dd80865305f4553df020
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3754212
Reviewed-by: Yuval Peress <peress@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move lost field from the sensor object to inside motion_sense_fifo:
It is not used anywhere else.
BUG=b:237305991
BRANCH=brya
TEST=make -j BOARD=crota
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: Idfb159ed9025e859e86bb494cf5da98df9cf4a36
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3754211
Reviewed-by: Yuval Peress <peress@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using standard format specifiers makes it easier to switch between the
"builtin" EC standard library and the C standard library provided by the
toolchain (or Zephyr).
BRANCH=none
BUG=b:238433667, b:234181908
TEST=On icetower v0.1 with servo_micro and J-Trace attached:
> reboot
observe console shows timestamps
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I6660ff22ebc6ba74f1245ff83026f5919b356a02
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3756178
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=b:236386294
BRANCH=none
TEST=none
Change-Id: I5c926ba079e9e0eacca41e0bed9f8de1203a3073
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729680
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When no sensors have interrupt enabled, not event will be generated
within TASK_EVENT_MOTION_INTERRUPT_MASK mask, so
IS_ENABLED(CONFIG_ACCEL_INTERRUPTS) is redundant.
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: I0ce5d4b152092756cfa50352d378a9130b171090
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3609125
Reviewed-by: Yuval Peress <peress@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It will be used when ACCEL_FIFO is not used in sensor drivers:
Instead of calling functions in motion_sense_fifo, we will call
motion_sense_push_raw_xyz() to just update sensor->xyz under lock.
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: I4189896be208d6877b6a85765c2bde983532dd3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3609124
Reviewed-by: Yuval Peress <peress@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
BRANCH=none
BUG=b:224614211
TEST=zmake test test-drivers
Signed-off-by: Yuval Peress <peress@google.com>
Change-Id: Ia183e576e71d8c4c7d6c9d0e9793b9b82a247f83
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3602215
Reviewed-by: Sam Hurst <shurst@google.com>
Commit-Queue: Sam Hurst <shurst@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While adding the tests and code coverage I also removed the
undocumented option to pass -1 to the command for 'n' which causes
it to print infinitely in a loop.
BRANCH=none
BUG=b:224614211
TEST=zmake test test-drivers
Signed-off-by: Yuval Peress <peress@google.com>
Change-Id: Ie065111c89011f76b1d98ceeac0fc252abc19346
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3602214
Reviewed-by: Tristan Honscheid <honscheid@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
BRANCH=none
BUG=b:224614211
TEST=zmake test test-drivers
Signed-off-by: Yuval Peress <peress@google.com>
Change-Id: I043bca8a20fb8dd50c5f66a1f9416bfa9cc61378
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3594484
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Commit-Queue: Al Semjonovs <asemjonovs@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add tests for the various code paths of the ec_rate subcommand:
- Invalid sensor number
- Get the current ec_rate
- Set the AP configured ec_rate
BRANCH=none
BUG=b:224614211
TEST=zmake test --coverage test-drivers
Signed-off-by: Yuval Peress <peress@google.com>
Change-Id: Ib49019b2a8e61f863aa0d27107dc9b204ea24bb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579627
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Zephyr has enabled warnings about pointers to members of packed
structs. This resulted in failing compilation process.
This commit supresses some warnings by using void* intermediate
pointers and by using temporary variables if possible.
BUG=b:210501420
BRANCH=main
TEST=zmake testall && make buildall
Change-Id: Ia03322e80ae2b4ba42731b066066cc466bd92baf
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3405041
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Sam Hurst <shurst@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are several places where atomic_t can be a type variables that
are use with atomic_* operation, so use it.
It sometimes has an impact on the asm code, but it is not significant.
The change will be useful for incoming commits related to modifying
atomic_t caused by a change in Zephyr upstream (atomic_t from int to
long).
BUG=b:207082842
TEST=make buildall && zmake testall
BRANCH=main
Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
Change-Id: I5c7fa6b74b84454b22074a2a00b5f10003ee9843
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3306358
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Code will currently check whether it's running in a deferred context by
directly checking against TASK_ID_HOOKS. However, this should be
checked in a function which can be set based on the OS running to
account for OS differences.
BRANCH=None
BUG=b:195137794
TEST=make -j buildall
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I54c266bb3a36ee3aa3fe6f8a09fcbfafe2fb43e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3265285
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve precision of the new_rate_us calculation.
Fixes: motion_sense: Fix ap_event_interval calculation ("5155d9c7bfc42aa3f53572e0389a8180d7f3a366")
BUG=b:195264765,b:129159505,b:73557414
BRANCH=many.
TEST=compile
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I4b3d54dedceca5652004da14f32dac6ae98747fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200808
Reviewed-by: Rob Barnes <robbarnes@google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang fails to compile due to the following:
common/motion_sense.c:1123:34: error: result of comparison of constant -1
with expression of type 'const uint8_t' (aka 'const unsigned char') is
always false [-Werror,-Wtautological-constant-out-of-range-compare]
(in->sensor_odr.sensor_num ==
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
common/motion_sense.c:1454:27: error: result of comparison of constant -1
with expression of type 'const uint8_t' (aka 'const unsigned char') is
always false [-Werror,-Wtautological-constant-out-of-range-compare]
in->spoof.sensor_id == MOTION_SENSE_ACTIVITY_SENSOR_ID) {
~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As indicated by the TEST line, the output is identical before and after
this change.
BRANCH=none
BUG=b:172020503
TEST=./util/compare_build.sh -b all -j 90
=> MATCH
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: Ieb55b385dfe9e07a8a7098ac3b456a0504215d94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3197753
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[CONFIG_AP].ec_rate, populated with sysfs entry |hwfifo_timeout|, is used
to calculate |ap_event_interval| the delay before sending a new event to
the AP.
When load_fifo() still existed (CL:938146), it was critical that a
sample was available before gathering the data. When ODR and
|hwfifo_timeout| are closed, |ap_event_interval| is increased by 5%.
Now, since samples are collected after an interrupt triggers due to at
least one element in the sensor FIFO or are scheduled based on the
sensor data rate (forced mode), we are guaranteed to have an event.
We should actually decreate |ap_event_interval| by 5% to be sure an
event is triggered.
When both an interrupt based sensor and a force sensor are at running at
the same ODR, they will probably not be in phase, but there will be
opportunity to send event to the host. One sensor will have a fix delay,
guaranteed to be less than its ODR.
BUG=b:195264765,b:129159505,b:73557414
BRANCH=many.
TEST=Without the change, on gaybrush, we can see that events are sent 2
by 2, event when the AP asks for them immediately.
Using 'iioservice_simpleclient --device_id=3 --channels="timestamp"
--frequency=49 --samples=40' (50Hz ODR):
: Before : After
Latency tolerance: 0.070408 s : 0.070408 s
Max latency : 0.024089 s : 0.004047 s
Min latency : 0.003339 s : 0.003167 s
Median latency : 0.02319 s : 0.003565 s
Mean latency : 0.013644 s : 0.003567 s
Change-Id: I9035dd535ff2895be5011335c5f44bd069c9421e
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172269
Reviewed-by: Rob Barnes <robbarnes@google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are 2 tablet mode triggers:
* Lid: when the lid angle close to 360 degree, either detected by
a GMR sensor or by the angle computed by 2 motion sensors.
* Base: when the detachable base is detached.
These 2 triggers set the tablet mode status, which as a boolean,
resulting a race condition.
This CL fixes the race condition. Each trigger updates its own bit. The
final tablet mode status is the OR of all bits.
BRANCH=Trogdor
BUG=b:193873098
TEST=Attached the base, checked tablet_mode enabled;
detached the base, checked tablet_mode disabled;
flip base to 360 degree, checked tablet_mode disabled;
move the base out of the lid, checked tablet_mode disabled.
Change-Id: Ia9d9d2d66c194796c1039cc8b746c8d1f28a4496
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044414
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
motion_sense_init() checks if it was called in hooks task or console task
context. In Zephyr console task is not available so TASK_ID_CONSOLE is
not defined. Because of that HAS_TASK_CONSOLE is used to choose if check
for hooks and console task or only for hooks task.
BUG=none
TEST=makeall
BRANCH=none
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: Ie51b043209d5228c074bbc9a693bf7b98cf2a598
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2933302
Reviewed-by: Keith Short <keithshort@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The powerd will enable the body_detection once after rebooting, but not
after resuming. Because we disable the body_detection in S3, we should
re-enable the body_detection in S0.
BRANCH=trogdor
BUG=b:123434029
TEST=powerd_dbus_suspend; ectool motionsense list_activities;
see if body_detection is enabled.
TEST=make buildall;
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Change-Id: Idb06888d9b4ec0eca994201f7fbd646f37c2c371
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2752573
Commit-Queue: Ching-Kang Yen <chingkang@chromium.org>
Tested-by: Ching-Kang Yen <chingkang@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a new flag: BYPASS_FIFO to raise an interrupt to the AP
when an event is sent.
It is not as strong as WAKEUP, as it does not wake up the AP.
BYPASS_FIFO must be set when WAKEUP is set.
It is applied to sync sensor as well as gesture/activity sensor.
BUG=b:123434029
BRANCH=trogdor
TEST=Compile
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: Id5aba71e6d11ef31f7fa2c67ba2e07178d088b1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2780834
Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
Tested-by: Ching-Kang Yen <chingkang@chromium.org>
Commit-Queue: Ching-Kang Yen <chingkang@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Do not use collection_rate blindly after a function may have slept:
the HOOK task could have run suspend() or suspend() call and set it to
0.
Fixes 104f5257 ("motion: Control on which task sensor setting functions are running on")
[CL:2553347]
BUG=b:176918310, b:170703322
BRANCH=kukui
TEST=unit test.
Change-Id: I9ef13ceca195db4b48866f1e53f9408fb2bbf595
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2616137
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move command in _fifo.c, as the fifo data structure is a static in
this file.
BUG=none
BRANCH=none
TEST=Add CONFIG_CMD_ACCEL_FIFO to baseboard volteer, check it compiles.
Change-Id: I6f9efafeaf450309ce48182396f3398fa4276d46
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2485909
Reviewed-by: Yuval Peress <peress@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for motion sense in zephyr. This change adds basic functions
for motion sense task to do meaningful work.
sensor_map.h included by board.h will be used to get board specific sensor
configuration.
BUG=b:173507858
BRANCH=none
TEST=make buildall -j8
build volteer on zephyr
Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com>
Change-Id: I906316d2e97428cf46b9a15071666c8e3b039b18
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638909
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: Jack Rosenthal <jrosenth@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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add struct ec_response_activity_data to handle activity data in
include/ec_commands.h.
BRANCH=None
BUG=b:169374265
TEST=make buildall
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Change-Id: I5f40d45d656ae91acc6e9364261c548f302383ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2581708
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Analysis of motionsense shutdown revealed a race condition,
as function that change sensor state can run on parallel tasks, namely
CHIPSET and HOOK:
motion_sense_shutdown (CHIPSET) ---> (motion_sense_switch_sensor_rate)
suspend/resume (HOOK) ----> (motion_sense_switch_sensor_rate)
motion_sense_process (MOTIONSENSE) ---> motion_sense_set_data_rate (ACTIVE)
\-> motion_sense_set_motion_intervals
/----------- motion_sense_init --\
| |
motion_sense_switch_sensor_rate ---> motion_sense_set_data_rate (ACTIVE)
| \----------- sensor->collection_rate = odr...; (ACTIVE)
\------------> sensor->collection_rate = 0; (INACTIVE)
\-----------> motion_sense_set_motion_intervals
Running motion_sense_switch_sensor_rate() on HOOK task is necessary because
on some platform, the power line may be already off, when the device is going to S5.
- Always run motion_sense_switch_sensor_rate() on hook.
- When changing ODR is needed (sensor active), schedule MOTIONSENSE task.
The new sequencing is simplified:
suspend/resume/shutdown (HOOK) ----> (motion_sense_switch_sensor_rate)
/----------- motion_sense_init --\
| |
motion_sense_switch_sensor_rate ---> schedule MOTIONSENSE.
\------------> sensor->collection_rate = 0; (INACTIVE)
motion_sense_process (MOTIONSENSE) ---> motion_sense_set_data_rate (ACTIVE)
\-> motion_sense_set_motion_intervals
BUG=b:170703322
BRANCH=kukui
TEST=Check on Volteer the sequence at suspend/resume/shutdown.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I0238cae9b4720e487a1e70788296a4db1b1e186b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2553347
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Set collection_rate to 0 when sensor is not in initialized state anymore.
It will prevent the motion_sense task to be neededlessly scheduled.
Export wait_us to be tested.
BUG=b:170703322
BRANCH=kukui
TEST=unit test
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I1dc4c7a07ff30fa10997ef87784114c725f100d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2520297
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Reviewed-by: Yuval Peress <peress@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
make spoof command able to spoof activity state:
ectool motionsense spoof -- NUM activity ACT [EN] [0/1]
This commit also remove unused parameter |sensor_num| from
list_activities, set_activity, get_activity in ectool.
BRANCH=None
BUG=b:123434029
TEST=buildall
TEST=ectool motionsense spoof 4 activity 4 1 0
ectool motionsense spoof 4 activity 4
ectool motionsense get_activity 4
ectool motionsense spoof 4 activity 4 1 1
ectool motionsense get_activity 4
ectool motionsense spoof 4 activity 4 0
ectool motionsense get_activity 4
ectool motionsense spoof 4 activity 4 1
ectool motionsense get_activity 4
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Change-Id: I819c156ae7fe50c5cf6216d0f44012d192fb528e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2477393
Reviewed-by: Gwendal Grignou <gwendal@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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
powered off"
We can not change the ODR when the sensors are marked as not active.
They may not be powered on and can not be touched.
This reverts commit 89b87b5004252bd6f6fa6c019a63a4a1dd157600.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> motion_sense: set sensor data rate to 0, when sensors are being powered off
>
> when sensors are being powered off, we should set sensor data rate to 0,
> to prevent the motion sense task from being unable to enter the idle
> state because the collect rate is not equal to 0.
>
> BUG=b:170703322
> BRANCH=master
> TEST=make buildall pass, and test cerise power consumption meet spec in
> DC S5 state
>
> Signed-off-by: Mike Lee <mike5@huaqin.corp-partner.google.com>
> Change-Id: Iae66f87aee1889b460fd598b1962be658c74ddab
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505392
> Reviewed-by: Cheng-Hao Yang <chenghaoyang@chromium.org>
> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
BRANCH=master
BUG=b:170703322
TEST=compile
Change-Id: Ieb8566614249fc2efdce5993291ceb98bab429f8
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2519428
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Split some defines when necessary, add IF_ENABLED to
common/motion_sense.c.
Find small setting errors in some boards along the way.
BUG=chromium:1140877
BRANCH=none
TEST=buildall
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I77ff528a16809088a986a2cc707aff8ae7df3906
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2488939
Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Split information in a boolean variable and another
variable that contains a property.
For instance, CONFIG_GESTURE_SENSOR_DOUBLE_TAP becomes:
CONFIG_GESTURE_SENSOR_DOUBLE_TAP : boolean variable
CONFIG_GESTURE_TAP_SENSOR : property that contains the sensor number.
BUG=chromium:1140877
BRANCH=none
TEST=buildall
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I27ba462f8a12b14882104b9f983f2dc17f917314
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2488937
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
when sensors are being powered off, we should set sensor data rate to 0,
to prevent the motion sense task from being unable to enter the idle
state because the collect rate is not equal to 0.
BUG=b:170703322
BRANCH=master
TEST=make buildall pass, and test cerise power consumption meet spec in
DC S5 state
Signed-off-by: Mike Lee <mike5@huaqin.corp-partner.google.com>
Change-Id: Iae66f87aee1889b460fd598b1962be658c74ddab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505392
Reviewed-by: Cheng-Hao Yang <chenghaoyang@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@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>
|