summaryrefslogtreecommitdiff
path: root/zephyr/test
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: emul: ln9310Aaron Massey2021-09-281-0/+2
| | | | | | | | | | | | | | | Add INT1_MSK registor to ln9310 emulator. BRANCH=none BUG=b:184856083 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Change-Id: I864d355767f0c2d091f830329e511be8d293fac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3179310 Commit-Queue: Aaron Massey <aaronmassey@google.com> Tested-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: drivers: thermistors are device tree nodesAaron Massey2021-09-243-280/+141
| | | | | | | | | | | | | | | | | | | Thermistor drivers now query the device tree for configuration. Thermistor tests have been updated to be parameterized on all thermistors enabled in the device tree. BRANCH=none BUG=b:184374937 TEST= 1) zmake testall 2) make runhosttests Cq-Depend: chromium:3161332 Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Change-Id: Ic5330cd5c33e79e192428ca857651de9a225856e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133812 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Aaron Massey <aaronmassey@google.com>
* zephyr: test: remove unused functionYuval Peress2021-09-221-11/+0
| | | | | | | | | | | | | | | | Function was left over from a different approach to a test. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I1fd3a1cf7da6725672cc35165e83bd60197358f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3176386 Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: test: fix setup useYuval Peress2021-09-221-1/+1
| | | | | | | | | | | | | | BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Iae8c1a044b07849a2829fb43999621225824a2e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3175621 Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: test: Add test for st_raw_read_nYuval Peress2021-09-214-0/+79
| | | | | | | | | | | | | | | | | Enable mocking and add a test using the I2C mock emulator for the st_raw_read_n function. BRANCH=none BUG=b:200589041 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I2554f1eab898942bc6d68860beba2e1eb02b5aa0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3171695 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: test: lis2dw12 fail setting bdu on initYuval Peress2021-09-211-0/+30
| | | | | | | | | | | | | | BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/projects/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I5e109001cf19010c2a4edc68be9b043a14070480 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170539 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com>
* zephyr: test: test lis2dw12_init timeoutYuval Peress2021-09-211-0/+16
| | | | | | | | | | | | | BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/projects/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Icae6ca1a5b5a222893380975880979e68c3d941b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170537 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: test: Test failed write on soft reset register (lis2dw12)Yuval Peress2021-09-211-0/+15
| | | | | | | | | | | | | | | Test the init code path that fails writing the soft reset register. BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ic395c7dd749c4203800b72afbb024919a71d0eae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170535 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: test: Test failed read on who-am-i register (lis2dw12)Yuval Peress2021-09-211-3/+20
| | | | | | | | | | | | | | | Test the init code path that fails reading who-am-i register. BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I66c17d1d0f2e889c22ccecca8ecedd467174b764 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170534 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: i2c: Translate zephyr error to ecos errorsYuval Peress2021-09-215-148/+209
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I80f53103b3bb873da5627dec116386741b496a94 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3171693 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* usbpd: implement new api to access PD discovery dataDeepti Deshatty2021-09-201-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API pd_get_am_discovery() sets the lock (task access bit) to keep track of EC tasks accessing the pd port discovery data. If any of the task access bits are set,EC host task typec discovery handler will return EC_RES_BUSY to host, indicating discovery data is modified while copying port discovery data to the host. Hence the lock/task access bit should be set only when the port discovery data is modified by any tasks. Setting of lock/task access is removed from pd_get_am_discovery() and implemented new api pd_get_am_discovery_and_notify_access() for this. pd_get_am_discovery() proto type is changed to return 'constant pointer' which forces developers to use pd_get_am_discovery_and_notify_access() when they intend to access and modify discovery data. summary of changes implemented. - Remove setting of task access bit from pd_get_am_discovery(). - modify pd_get_am_discovery() prototype to return constant pointer. - implement new api pd_get_am_discovery_and_notify_access() - Replace calls to pd_get_am_discovery() with new api wherever discovery data is accessed and modified. BRANCH=none BUG=b:197466819 b:190390784 TEST=Verified 50 cold boot cycling with TBT device attached. Device detected in every cycle. Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Change-Id: I5b6f1f2b91d92ddbe58f3bf994f684abee948c02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139858 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* zephyr: test: Add tests for lis2dw12 driverYuval Peress2021-09-172-0/+43
| | | | | | | | | | | | | | | | Add a single test for the lis2dw12 driver that checks the who-am-i register. BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I8dba62f941d74cca025645b81512b4e0c9e04908 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168035 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: emul: lis2dw12: Add stubs for LIS2DW12 emulatorYuval Peress2021-09-171-0/+30
| | | | | | | | | | | | | BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: If425d9760b8db9024478fb9a664ffa71e7c25eb7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168034 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: test: Add convinience debug config for I2CYuval Peress2021-09-171-0/+4
| | | | | | | | | | | | | | | | | Add the configuration log level needed to show I2C traffic. This will make it easier for others to enable when debugging tests. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I238a2f101777a5651ddde537a0359d9c15377587 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168033 Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* BB Retimer: Add new HPD callback to boardsDiana Z2021-09-161-0/+1
| | | | | | | | | | | | | | | Now that the BB retimer has its own HPD interface, add this interface to every board using the bb_usb_retimer driver. BRANCH=None BUG=b:195773400 TEST=on voxel, pass tast typec.Mode*.manual Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ia70d139431739e8f2c0577359cb3aaa7fb906d0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163930 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: Test SYV682 5V_OC interrupt handlingAbe Levkoy2021-09-152-6/+41
| | | | | | | | | | | | | | | | | Simulate a 5V OC condition and verify that the driver turns VBUS off. Support status interrupt conditions and clear-on-read registers in SYV682x emulator. Increase line coverage of syv682x.c from 37.9% to 52.8%. BUG=b:190519131 TEST=zmake -l DEBUG configure --test zephyr/test/drivers BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I9c5b419057cf4ccb1531527a71760533240d1f47 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3059218 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Conform BC1.2 test to device treeAbe Levkoy2021-09-152-10/+5
| | | | | | | | | | | | | | | | Do not override the number of USB-C ports. Enable the port 1 PD task, so that port 1 behaves as expected during the test. BUG=b:197747859 TEST=zmake configure --test zephyr/test/drivers BRANCH=none Cq-Depend: chromium:3159528 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I3e170c4fd295de7812b1678185a0cd892faf4203 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3138216 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: test: drivers: Use the LN9310 emulatorYuval Peress2021-09-144-0/+63
| | | | | | | | | | | | | | | Test the LN9310 init function for both 2S and 3S battery types. BRANCH=none BUG=b:184856083 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I6c6804657377cab615f7af6661839b019ab88a8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3159648 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: shim/system: fix APIs of call BBRAM read and writestabilize-14217.B-mainTim Lin2021-09-131-11/+4
| | | | | | | | | | | | | | | | | | | | The APIs of BBRAM read and write have been renamed and moved to drivers/bbram. The related call routines of shim/system.c need to be fixed. BUG=b:195843756 BRANCH=none TEST=the board of asurada and it8xxx2_evb can boot EC and access bbram successfully after adding this CL. zmake testall --> pass Change-Id: I98e51a278a24eeb4bbc92343fe6fc97e3e758e8a Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153117 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: hooks: use k_work_reschedule to schedule deferred tasksJack Rosenthal2021-09-081-6/+0
| | | | | | | | | | | | | | | | k_work_reschedule will reschedule a work item if it's already been scheduled. Switching from k_work_schedule to k_work_reschedule fixes us the hooks test snag we saw during the v2.6 uprev. BUG=b:195971523 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I66f6bbad1cd39847e68a178165c9c59922abbb7c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144378 Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: emul: i2c: Add device label for better debugYuval Peress2021-09-071-0/+1
| | | | | | | | | | | | | | | | Improve the debug output by including the device label in the common configs. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ic331e7842efdfae70d3f994a694c7723fdcd9640 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144313 Reviewed-by: Tomasz Michalec <tm@semihalf.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Replace DT_ENUM_TOKEN with DT_STRING_TOKENJack Rosenthal2021-09-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Zephyr v2.7, DT_ENUM_TOKEN is deprecated in favor of DT_STRING_TOKEN. Additionally, DT_ENUM_UPPER_TOKEN is deprecated in favor of DT_STRING_UPPER_TOKEN. See the v2.7 release notes for details: https://docs.zephyrproject.org/latest/releases/release-notes-2.7.html Since we backported the DT_STRING_* macros to our v2.6 branch, let's switch to them ahead of time to prepare for the v2.7 uprev. Note: the DT_STRING_* macros are compatible with Zephyr's device tree enums, but also allow non-enum properties to be used in the same fashion. This commit does the bare minimum for compatibility with v2.7, i.e., just swap the macros without dropping enum properties anywhere. We should investigate whether we want to continue using the enum properties or abandon some of them for any string in the future. BUG=b:198824039 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I1efd8f99bc7d93504c0ab94510406cd36ad24cd3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144536 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: drivers: add BB retimer init testTomasz Michalec2021-09-035-3/+139
| | | | | | | | | | | | | | | | | | | | bb_retimier init function is tested with I2C communication errors and wrong values of BB retimer vendor/device ID. Init function checks state of AP, so CONFIG_PLATFORM_EC_POWERSEQ is enabled. CONFIG_PLATFORM_EC_POWERSEQ_INTEL and CONFIG_PLATFORM_EC_POWERSEQ_PP5000_CONTROL are disabled to reduce code that needs to be mocked. BUG=b:184856919 BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ibaed931f54a797d70fa86297b3eb0181ab2a689d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140205 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: Use common I2C code in emulatorsTomasz Michalec2021-09-036-254/+241
| | | | | | | | | | | | | | | | | | | Align following emulators to use common I2C code: - bb_retimer - bma255 - bmi (both 160 and 260) - smart_battery - tcs3400 BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I7515407b867487574a29dcae3456d96920a24979 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140202 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: drivers: add BB retimer test suiteTomasz Michalec2021-09-025-3/+472
| | | | | | | | | | | | | | | | bb_retimer driver is tested using BB retimer emulator. Set mode function is tested with different usb mux mode and cable configuration. BUG=b:184856919 BRANCH=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I106435262ccd9123c4fe3cb9063cce68d777cb84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110087 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: zmake: implement multiple toolchain support/probingJack Rosenthal2021-09-0110-10/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our GitLab builder uses different toolchains than the supported ones we use for development. At present, this means that the GitLab CI needs to call -t for each build with the desired toolchain, preventing us from using the more general commands "zmake coverage" or "zmake testall". Extend the idea of toolchain in our config files to be "supported toolchains" instead (i.e., multiple toolchains can be supported instead of one. We do this by refactoring our toolchain support code to consist of two related methods: - "probe" returns True if the toolchain is detected on the system, or False otherwise - "get_toolchain_config" returns the BuildConfig associated with the toolchain for the system, mirroring the functionality previously implemented in lambda functions. Also dropped support for arm-none-eabi, as I believe this was only used early on during scarlet development, and am not aware of any current users. BUG=b:178731498 BRANCH=none TEST=./run_tests.sh TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9b2ad508ae6703f0c3b56518fc32606c0ff1777c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3134668 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Removing unused varsJeremy Bettis2021-08-314-10/+2
| | | | | | | | | | | | | | | | | | | zephyr toolchain doesn't allow unused vars, so this is preventing running tests on gitlab. Add -Werror=unused-variable to clang args so that this doesn't backslide. BUG=None TEST=zmake coverage on docker BRANCH=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I7749041fd0f09e5cf35e6a6c1d4555af805469c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3131880 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: test: drivers: add eSPI test using host commandYuval Peress2021-08-314-1/+60
| | | | | | | | | | | | | | | | | | | | Verify that we can call host commands from driver tests by adding a test that calls the EC_CMD_GET_PROTOCOL_INFO host command. Add a few convenience functions to host_command.h when building with CONFIG_ZTEST enabled. Also, add eSPI emulator to support the test. Coverage: - lines 17.4% -> 17.8% - functions 21.4% -> 22.0% BRANCH=none BUG=b:189954415 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ib9e750eeab555ea629a560cbf3beed28e346c460 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3031842 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: rename kconfig PLATFORM_EC_VBOOTJack Rosenthal2021-08-111-1/+1
| | | | | | | | | | | | | | | | | | | Rename CONFIG_PLATFORM_EC_VBOOT to CONFIG_PLATFORM_EC_VBOOT_EFS2, since this is what is actually toggled by the config. EFS2 is only a small component of verified boot, and we have many boards which don't actually use it (e.g., trogdor family) for verified boot, making the existing name very confusing. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I68ea5815b4a001c680fc78196bb7a02815799b52 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088164 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: switch posix-ec and host tests to v2.6Jack Rosenthal2021-08-1010-9/+15
| | | | | | | | | | | | | | | | Switch the host tests and posix-ec build to Zephyr v2.6. Note: need to disable one assert in the hooks test until b/195971523 is resolved. BUG=b:195571108,b:195971523 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I01b386b2f54cf5b752bede707ff9fbda0faad80a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3072414 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: hooks test: bump DEFERRED_DELAY_USJack Rosenthal2021-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently 250ms is too sensitive for Zephyr v2.6 and the test fails: *** Booting Zephyr OS build zephyr-v2.6.0-77-g656dcdda8d73 *** Running test suite hooks_tests =================================================================== START - test_hook_list_multiple PASS - test_hook_list_multiple in 0.0 seconds =================================================================== START - test_hook_list_single PASS - test_hook_list_single in 0.0 seconds =================================================================== START - test_hook_list_empty PASS - test_hook_list_empty in 0.0 seconds =================================================================== START - test_deferred_func PASS - test_deferred_func in 0.510 seconds =================================================================== START - test_deferred_func_push_out Assertion failed at CMAKE_SOURCE_DIR/hooks.c:116: test_deferred_func_push_out: (deferred_func_2_called is true) The deferred function was called, but should not have been FAIL - test_deferred_func_push_out in 0.510 seconds =================================================================== START - test_deferred_func_cancel PASS - test_deferred_func_cancel in 0.510 seconds =================================================================== Test suite hooks_tests failed. =================================================================== PROJECT EXECUTION FAILED Bump to 500ms so we can support Zephyr v2.6. BUG=b:195571108 BRANCH=none TEST=passes on both v2.5 and v2.6 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id090fe9e678c9f168e3a1c3f90f048089a638fff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3072416 Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: Move BBRAM access functions to common system.cWealian Liao2021-08-041-0/+8
| | | | | | | | | | | | | | | | | | NPCX & IT8xxx2 series are both use BBRAM for scratchpad/reset_flags access. cros_bbram API already handles the chip-specific code. This CL moves scratchpad/reset_flags access functions to the common system.c to avoid duplicate those functions. BUG=none BRANCH=none TEST=zmake testall TEST=check reset cause on lazor & npcx_evb Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I0a394e5fbf784ec2e3caea77f194c88ae9d5542e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3067156 Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
* zephyr: drivers: set ADC value in temp_sensor testTomasz Michalec2021-07-271-0/+7
| | | | | | | | | | | | | | | | | | | Set correct emulated ADC value at the end of the temp_sensor test. There is task that periodically check temperature sensor value. If ADC is left in incorrect state then it will generate following error message: E: failed to read channel 0 (err -22) This message shuldn't appear after temp_sensor test suite. BUG=none BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I6d0148714c82f380ec1ec3dd86bc1ecd20642ba5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3055494 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: drivers: add als_tcs3400 test suiteTomasz Michalec2021-07-274-0/+731
| | | | | | | | | | | | | | | Functions exposed in public API by TCS3400 driver are tested using TCS emulator. Driver's irq handler is tested in calibration and normal mode. BUG=b:184856080 BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I80fa87accc43c9fd41ab057a2b1026577847275a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3048095 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: test: drivers: Move headers to include/ directoryYuval Peress2021-07-213-1/+1
| | | | | | | | | | | | | | Declutter the test directory and follow existing established pattern of src/ and include/ directories. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I5daf54a950d6fb830414da0b55a8d85732cffa4f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3043364 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: test: drivers: tick to zephyr v2.6Yuval Peress2021-07-201-1/+1
| | | | | | | | | | | | BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Cq-Depend: chromium:3039315 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ie5b10db6ab29c746bada8f5a8c062eae859a56fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3039389 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: drivers: add accelgyro_bmi160 test suiteTomasz Michalec2021-07-144-0/+1915
| | | | | | | | | | | | | | | BMI160 driver is tested using BMI emulator. All functions exposed in accelgyro_drv are tested for both accelerometer and gyroscope sensors. BUG=b:184856157 BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ica0e40a904c35adbd9a46e70423137e064a75059 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3017985 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: drivers: add accelgyro_bmi260 test suiteTomasz Michalec2021-07-144-1/+1919
| | | | | | | | | | | | | | | BMI260 driver is tested using BMI emulator. All functions exposed in accelgyro_drv are tested for both accelerometer and gyroscope sensors. BUG=b:184856157 BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Id911a161bcbb2fcb87ccdadf266a683859db25d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2997365 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add SYV682x emulator and testAbe Levkoy2021-07-025-2/+63
| | | | | | | | | | | | | | Just test enabling VBUS for now. BUG=b:190519131 TEST=zmake configure --test zephyr/test/drivers BRANCH=none Change-Id: I9759e709539ed041dd92c80ab1e49f896f8d6e65 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2994648 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add pi3usb9201 emulator and testEdward Hill2021-06-305-1/+299
| | | | | | | | | | | | BUG=b:184852906 BRANCH=none TEST=zmake configure --test zephyr/test/drivers Change-Id: Ie554b6957269c638357d82d6f5dcc2ceda08caab Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2961272 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: drivers: add accele_bma2x2 test suiteTomasz Michalec2021-06-304-0/+934
| | | | | | | | | | | | | | BMA2x2 driver is tested using BMA255 emulator. All functions exposed in accelgyro_drv are tested. BUG=b:184855546 BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I20a2849b7b11b2a2c152bd07d748cb073cfd86b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2933303 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: tasks: fix task id for deferred callsTomasz Michalec2021-06-301-0/+1
| | | | | | | | | | | | | | | In Zephyr deferred calls are run in k_sys_work_queue context instead of thread running hook_task(). Because of that shimmed task_get_current() is modfied to return TASK_ID_HOOKS if run from k_sys_work_queue context. BUG=b:190727776 TEST=make hosttest BRANCH=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I9e15627df8dce6b0829ad872150cbe2318330f28 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2953225 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: test: convert tests to DEVICE_DT_GETstabilize-RUST-14057.B-mainstabilize-14057.B-mainFabio Baltieri2021-06-283-14/+14
| | | | | | | | | | | | | Convert Zephyr tests from device_get_binding to DEVICE_DT_GET. BRANCH=none BUG=none TEST=cq dry drun Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I0da71b58d70c66bf68503b7c80e57051aace60c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2985465 Reviewed-by: Yuval Peress <peress@chromium.org>
* config: Rename CONFIG_CROS_BOARD_INFOPhilip Chen2021-06-161-1/+1
| | | | | | | | | | | | | | | | | | Rename CONFIG_CROS_BOARD_INFO to CONFIG_CBI_EEPROM to make it clear that the information comes from on-board EEPROM. It sets up the groundwork for adding more options of CBI sources later. BRANCH=None BUG=b:186264627 TEST=make buildall -j Signed-off-by: Philip Chen <philipchen@google.com> Change-Id: I9a6feee0a8b35bbf29e445544243485507767ad8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2945792 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* zephyr: drivers: add temp_sensor test suiteTomasz Michalec2021-05-272-0/+134
| | | | | | | | | | | | | | | | | | Temperature sensors are accessed through temp_sensor_read() for which this test suite is created. Tested functionalities are: - Error code from underlying driver is returned. - Unknown temperature sensor id is rejected. - Temperature from underlying driver is returned. Value is not extensively tested, because it is done in thermistor test suite. BUG=b:184857072 BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I6c2df39a70e8ac57325aa9e1f49e7a9bd2340fae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2886889 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: drivers: add thermistor test suiteTomasz Michalec2021-05-205-1/+565
| | | | | | | | | | | | | | | | Thermistor driver uses ADC to read temperature. Because of that ADC emulator is added to overlay dts. Thermistor test suite check behaviour in case of ADC error and test if conversion from ADC output to temperature is precise. BUG=b:184857072 BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Icc6c779ce590d2768a382bccfb04acec657a140c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2886888 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: drivers: add smart battery test suiteTomasz Michalec2021-05-184-0/+321
| | | | | | | | | | | | | | | | Add tests for functions from driver/battery/smart.c To test them, Smart Battery emulator is used. BUG=b:184855975 BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I51bdcc2a18c7f30f037b0273ca1ae584312a574b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2903207 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* zephyr: drivers: add CBI test suiteTomasz Michalec2021-04-204-1/+35
| | | | | | | | | | | | | | | CBI test suite uses EC code. It is required to use I2C and eeprom emulators for storage and GPIO emulator for write protect pin. The overlay.dts is extended with required devices. BUG=b:185205123 BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I2dc743b97aac0efa11624ebba4ac2e1b6811b847 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821699 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add external power gpioJeremy Bettis2021-04-124-6/+10
| | | | | | | | | | | | | | | | | Enable CONFIG_PLATFORM_EC_EXTPOWER_GPIO and add the necessary emulated gpio pin. Remove the stub from stubs.c. BUG=b:185118990 TEST=zmake testall BRANCH=none Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ibfd455f6be4efecd3b686a293ea7a2da8f7ca518 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821358 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Allow ztests to use shimmed tasksJeremy Bettis2021-04-123-21/+5
| | | | | | | | | | | | | | | | There is no reason to prevent CONFIG_SHIMMED_TASKS and CONFIG_ZTEST from being used together. BUG=b:185118990 TEST=zmake testall BRANCH=none Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I024ef0faea14fa9ddc38c5ca688e8fa4448691c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821357 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>