summaryrefslogtreecommitdiff
path: root/zephyr/include/emul
Commit message (Collapse)AuthorAgeFilesLines
* zephyr test: Verify SYV682x busy bit checkAbe Levkoy2021-12-031-0/+11
| | | | | | | | | | | | | | | | Support setting CONTROL_3[BUSY] in the SYV682x emulator. Verify that writes fail if this bit stays set for too long but succeed if it clears quickly. BUG=b:190519131 TEST=zmake configure --test zephyr/test/drivers BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I58386f73c8df20239b3eaf13f8eab37be0b11bbf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3315225 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Strawman example of integration testJeremy Bettis2021-11-241-0/+8
| | | | | | | | | | | | | | | | | | | | This is an example of a simple integration test. This test is too simple, and needs to check more things, but it does verify that the battery emulator can detect a emulated charger being attached. BRANCH=None BUG=b:201314530 TEST=It passes Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I4c07f1587806c9ef0893f979bfd356e28bbdac69 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3245620 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: sn5s330: reorganize emul reg access funcsAaron Massey2021-11-231-2/+2
| | | | | | | | | | | | | | | | | | | There are two similar switch statements that check if a register being accessed has been implemented and subsequently map it to a data field. Fully implementing a peek_register function for unit tests would would require duplication of code in the sn5s330_emul_read_byte function. Adapt register implementation checking and mapping to a struct field as a single workhorse helper function. BRANCH=none BUG=b:203364783 TEST=zmake configure --test test-drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I414efbb92822259c13cb9d4a1e73cf8dfaa5f8e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3298882 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr test: Use interrupt GPIO for SYV682xAbe Levkoy2021-11-221-25/+20
| | | | | | | | | | | | | | | | | | Set and clear the ALERT_L signal in the SYV682x emulator based on the state of underlying conditions. Test the driver by just setting the underlying conditions instead of calling the ISR from within the test. Define the interrupt signal in the device tree and enable interrupts from it in the test. BUG=b:190519131 TEST=zmake configure --test zephyr/test/drivers BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Idc8b957fe53ce78bd8236e4af6b005636498ada2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3288914 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr: emul: Add sn5s330 emul resetAaron Massey2021-11-181-0/+7
| | | | | | | | | | | | | Add sn5s330 emulator reset for isolated unit testing. BRANCH=none BUG=b:203364783 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: Ideb77c295e0ec0808656881c020f1a18e7428d08 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3271366 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: add USB-C charger emulatorTomasz Michalec2021-11-181-0/+66
| | | | | | | | | | | | | | | | | | Add basic charger emulator that can be attached to TCPCI emulator. Charger is always presenting one source capability mode and is able to respond to some TCPM messages. BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ic8d2c4f1352324d47ff8659ea971beb3de5c2e9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3259926 Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
* zephyr: add functions for TCPCI emul port partnerTomasz Michalec2021-11-181-0/+68
| | | | | | | | | | | | | | | | | | | Add functions required to implement port partner emulator for TCPCI emulator. Some debug logs are added to TCPCI emulator. BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ia12ad2e903da1bd1fa2e9ff57d74957790bff3fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3259925 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
* zephyr: Add PS8xxx emulatorTomasz Michalec2021-10-282-0/+150
| | | | | | | | | | | | | | | | | Add PS8xxx emulator which is extension of TCPCI emulator. It has its own DTS node which should be sibling of TCPCI emulator that is used for tcpci-i2c phandle. PS8xxx register additional "hidden" I2C devices. BUG=b:184857030 BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ib88e5e78b52ab6a8a48efd165e8e7ac86b6d982f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3220595 Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* tree: Files should end with single newlineTom Hughes2021-10-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes all files by running the following: for f in $(find . -name '*.[ch]'); do printf '%s\n' "$(cat ${f})" > ${f}; done BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia3ece5b64b549d21ca11708791368002bb6e9b0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229797 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: ppc: sn5s330: Add test for func_set1 retry loopYuval Peress2021-10-181-0/+30
| | | | | | | | | | | | | | | Add a basic test that ensures that the func_set1 register write is attempted at least one more time on an initial failure. BRANCH=none BUG=b:203364783 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ib06794de0af29fb44e4cb550c7b1ef3c2667af0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229005 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr test: SYV682 VCONN_OC interruptAbe Levkoy2021-10-181-0/+11
| | | | | | | | | | | | | | Simulate VCONN OC and verify that the driver handles it as expected. Increase syv682x.c line coverage 65.4% -> 68.8%. BUG=b:190519131 TEST=zmake configure --test zephyr/test/drivers BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ifa9ff4129ef0f158e2f59314dbf62ee53b6180e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3219870 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: add TCPCI emulatorTomasz Michalec2021-10-121-0/+239
| | | | | | | | | | | | | | | | | | | | | Add TCPCI emulator. It follows TCPCI specification revision 2.0 version 1.2, but allows access to TX and RX buffer registers in revision 1.0 style if configured to do so. It can be extended by device specific operations (to implement specific TCPC device behaviour) and partner operations to emulate scenarios with different devices connected on other side of TCPC. BUG=b:184857030 BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I6305c437d820528de24439337211f32a015e83d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3181722 Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr test: ln9310 emulator exposes i2c_emul structAaron Massey2021-10-111-0/+10
| | | | | | | | | | | | | | | | In order to test driver failure paths, the ln9310 emulator now exposes its i2c_emul to be manipulated by unit tests. BRANCH=none BUG=b:184856083 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Change-Id: I2fadec0cd8e4c1d897b38f0d0024a49b50cbf5d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3205932 Commit-Queue: Aaron Massey <aaronmassey@google.com> Tested-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: test: add an emulated clock to drivers testYuval Peress2021-10-111-0/+9
| | | | | | | | | | | BRANCH=none BUG=b:180112248 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I4a6561c58c7fab33a66ec8fd4a34da38ace6a45c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3213364 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: test: isl923x::initYuval Peress2021-10-051-0/+7
| | | | | | | | | | | | | | | | Test the remaining (failure/uncommon) code paths in init(). This includes a mocking of the system_jumped_late function which was already stubbed to always return false. This mock will later need to be cleaned up with a better mock to avoid the custom struct added. BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I1be53b0a15850d8b97b7b5a96ccef764f0782816 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3201916 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: test: isl923x::get_vbus_voltageYuval Peress2021-10-051-0/+9
| | | | | | | | | | | | | | Verify all the code paths in get_vbus_voltage (including calculated mV value). BRANCH=none BUG=b:201819565 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I508880a8af30c2d546655424b289d521f3c22626 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3201915 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: test: isl923x AC prochotYuval Peress2021-10-051-1/+10
| | | | | | | | | | | | | Verify setting the prochot amps as well as edge conditions BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I306adf1d74eea65a8522c61e5ed71cf8deacfe2a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200054 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: test: isl923x::set_mode always turns off learn modeYuval Peress2021-10-051-0/+17
| | | | | | | | | | | | BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ic2481c0de52268cc65475de8e79f1db7834358d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198686 Reviewed-by: Sam Hurst <shurst@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: test: verify isl923x device ID code pathYuval Peress2021-10-021-0/+9
| | | | | | | | | | | BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I08b24d571e0b27fd7fc5f644efdba18c5a639128 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198237 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: test: verify isl923x manufacturer ID code pathYuval Peress2021-10-021-0/+9
| | | | | | | | | | | | BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I2000ea7ea73a311184c5f66c3aa16518261b065d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198236 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* zephyr: test: isl923x: Test input current get/setYuval Peress2021-10-021-0/+13
| | | | | | | | | | | | | | Test all the code paths for the get/set input current of the isl923x. BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I452690a4087c97b67e75bad23e1b82e5b3dc366a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198235 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* zephyr: test: Add stub isl923x emulatorYuval Peress2021-10-011-0/+9
| | | | | | | | | | | | | | Add the skeleton code needed to emulate the isl923x charger. BRANCH=none BUG=b:201602829 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ic9af555ccd7ff6a0be2e7a0818b5e566816a0c13 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195202 Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: test: Add a common i2c_emul_api instanceYuval Peress2021-10-011-0/+3
| | | | | | | | | | | | | | | | Refactor emulators that all set the same i2c_emul_api to use the same common API. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I6da6df23c77f0710a24bab8d9f0b7fb6fa14dff2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195201 Reviewed-by: Tomasz Michalec <tm@semihalf.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: ln9310Aaron Massey2021-09-281-0/+10
| | | | | | | | | | | | | | | 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: test: add a generic I2C mockYuval Peress2021-09-211-0/+35
| | | | | | | | | | | | | | | Add a simple mock with no state to test common i2c code. BRANCH=none BUG=b:200589041 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I99730361a298708278106deb58890a0ed2c9febf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3171694 Tested-by: Yuval Peress <peress@google.com> 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/+10
| | | | | | | | | | | | | | 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 failed read on who-am-i register (lis2dw12)Yuval Peress2021-09-211-0/+9
| | | | | | | | | | | | | | | 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: test: Add tests for lis2dw12 driverYuval Peress2021-09-171-0/+20
| | | | | | | | | | | | | | | | 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/+9
| | | | | | | | | | | | | 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 SYV682 5V_OC interrupt handlingAbe Levkoy2021-09-151-0/+10
| | | | | | | | | | | | | | | | | 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: emul: ln9310Yuval Peress2021-09-141-0/+63
| | | | | | | | | | | | | | | | | | Add an LN9310 emulator. The emulator is mostly a stub right now with some limited functionality to update the battery cell type and chip version number. BRANCH=none BUG=b:184856083 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I156393f4612bf69e31d4d28d88d74fa4dd1689fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3156846 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: i2c: Add device label for better debugYuval Peress2021-09-071-0/+2
| | | | | | | | | | | | | | | | 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: emul: Use common I2C code in emulatorsTomasz Michalec2021-09-035-484/+58
| | | | | | | | | | | | | | | | | | | 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: emul: Add common code for I2C emulatorsTomasz Michalec2021-09-031-0/+367
| | | | | | | | | | | | | | | | | | Emulators of I2C devices have similar handling of I2C messages, locking mechanism for multithread code, custom user functions and user triggered failing on specific register. These functionalities are exported to common code which will replace current functions in emulators of I2C devices. BUG=none BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ib2c1a6596127dad1250d0051a312a837fc03ce20 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140201 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add BB retimer emulatorTomasz Michalec2021-09-021-0/+188
| | | | | | | | | | | | | | | | | | Add BB retimer emulator on i2c bus. Emulator properties can be defined using device tree or runtime emulator API. Emulator checks if RO registers and reserved bits are accessed correctly. API allows to set custom read/write i2c messagess handlers to emulate complex behaviour. BUG=b:184856919 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I4b641a90e6fb55e89aaee388c0ac04ab7bf367ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110085 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: Add TCS3400 emulatorTomasz Michalec2021-07-271-0/+255
| | | | | | | | | | | | | | | | | | Add TCS3400 emulator which is emulated device on i2c bus. Emulator properties can be defined using device tree or runtime TCS emulator API. It allows to set custom handlers for write and read messages. Emulator is able to convert internal values to register values that can be obtained by driver through i2c interface. Conversion takes current state set by driver into account (gain and data acquisition time). BUG=b:184856080 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I16f25de43e047df39f84ce86044736d50c9a49c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3048094 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Add BMI260 emulatorTomasz Michalec2021-07-141-0/+7
| | | | | | | | | | | | | | Add extension to support BMI260 model. BUG=b:184856157 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Iaffebdb5279001d085fd56868e81318528380380 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2997364 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add BMI160 emulatorTomasz Michalec2021-07-141-0/+518
| | | | | | | | | | | | | | | | | | | | | Add BMI emulator which is emulated device on i2c bus. Emulated accelerometer and gyroscope properties are defined through device tree, but they can be changed in runtime through BMI emulator API. It allows to set custom handlers for write and read messages to emulate more complex scenarios or malfunctioning device. BMI emulator is designed to implement support for different BMI models as an extension to common emulator code. BUG=b:184856157 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I63e9d3aca98c8923372437f7a66257a4c82817f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2977559 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add SYV682x emulator and testAbe Levkoy2021-07-021-0/+133
| | | | | | | | | | | | | | 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-301-0/+55
| | | | | | | | | | | | 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: Add BMA255 emulatorTomasz Michalec2021-06-301-0/+275
| | | | | | | | | | | | | | | | | Add BMA255 emulator which is emulated device on i2c bus. Emulated accelerometer properties are defined through device tree, but they can be changed in runtime through BMA255 emulator API. It allows to set custom handlers for write and read messages to emulate more complex scenarios or malfunctioning device. BUG=b:184855546 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I4def7fcc54edbf9cb346fda0f21f647a5ad5f8d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2933301 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add Smart Battery emulatorTomasz Michalec2021-05-181-0/+243
Add Smart Battery emulator which is emulated device on i2c bus. Emulated battery properties are defined through device tree, but they can be changed in runtime through Smart Battery emulator API. It allows to set custom handlers for write and read messages to emulate more complex scenarios or malfunctioning device. BUG=b:184855975 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ia94a0a122123e3259882dfdc80d067c61c98379b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2903206 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>